源代码

public bool JudgeRectangleIntersect(double RecAleftX, double RecAleftY, double RecArightX, double RecArightY,
double RecBleftX, double RecBleftY, double RecBrightX, double RecBrightY)
{
bool isIntersect = false;
try
{
double zx = getAbsluteValue(RecAleftX + RecArightX - RecBleftX - RecBrightX);
double x = getAbsluteValue(RecAleftX - RecArightX) + getAbsluteValue(RecBleftX - RecBrightX);
double zy = getAbsluteValue(RecAleftY + RecArightY - RecBleftY - RecBrightY);
double y = getAbsluteValue(RecAleftY - RecArightY) + getAbsluteValue(RecBleftY - RecBrightY); if (zx <= x && zy <= y) //需要确认两矩形边线重合是否定义为相交 此处定义为相交。
{
isIntersect = true;
}
}
catch (Exception ex)
{
string str = ex.Message;
}
return isIntersect;
} private double getAbsluteValue(double douValue)
{
if (douValue >= )
{
return douValue;
}
else
{
return douValue * -;
}
}

C# 判断两个矩形是否相交的更多相关文章

  1. PHP判断两个矩形是否相交

    <?php $s = is_rect_intersect(1,2,1,2,4,5,0,3); var_dump($s); /* 如果两个矩形相交,那么矩形A B的中心点和矩形的边长是有一定关系的 ...

  2. 判断圆和矩形是否相交C - Rectangle and Circle

    Description Given a rectangle and a circle in the coordinate system(two edges of the rectangle are p ...

  3. poj1410(判断线段和矩形是否相交)

    题目链接:https://vjudge.net/problem/POJ-1410 题意:判断线段和矩形是否相交. 思路:注意这里的相交包括线段在矩形内,因此先判断线段与矩形的边是否相交,再判断线段的两 ...

  4. Oracle判断两个时间段是否相交

    SQL中常常要判断两个时间段是否相交,该如何判断呢?比如两个时间段(S1,E1)和(S2,E2).我最先想到的是下面的方法一.方法一:(S1 BETWEEN S2 AND E2) OR (S2 BET ...

  5. HDU 1221 Rectangle and Circle(判断圆和矩形是不是相交)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1221 Rectangle and Circle Time Limit: 2000/1000 MS (J ...

  6. Codeforces Round #587 (Div. 3) C题 【判断两个矩形是否完全覆盖一个矩形问题】 {补题 [差点上分系列]}

    C. White Sheet There is a white sheet of paper lying on a rectangle table. The sheet is a rectangle ...

  7. C# 判断两条直线是否相交

    直接上代码,过程不复杂 /// <summary> /// 判断两条线是否相交 /// </summary> /// <param name="a"& ...

  8. cocos2d-x 判断两条直线是否相交

    bool GraphicsUtil::linesCross(b2Vec2 v0, b2Vec2 v1, b2Vec2 t0, b2Vec2 t1, b2Vec2 &intersectionPo ...

  9. Overlapping rectangles判断两个矩形是否重叠的问题 C++

    Given two rectangles, find if the given two rectangles overlap or not. A rectangle is denoted by pro ...

随机推荐

  1. Windows系列原版系统镜像下载

    原版系统镜像下载 Windows 10 系统 Windows 10 企业版 1511版 (64位) Windows 10 Enterprise, Version 1511 (x64) – DVD (C ...

  2. 杭电 5053 the Sum of Cube(求区间内的立方和)打表法

    Description A range is given, the begin and the end are both integers. You should sum the cube of al ...

  3. 解决在使用Amoeba遇到的问题

    最近有同行在使用Amoeba 的过程中多少遇到了一些问题. 总结一下遇到问题的解决方法: 1.读写分离的时候设置的在queryRouter中设置无效? 读写分离配置的优先级别:        1)满足 ...

  4. 582. Kill Process

    Problem statement: Given n processes, each process has a unique PID (process id) and its PPID (paren ...

  5. linux 常见名词及命令(五)

    计划任务服务之一次性任务: at <时间> 安排一次性任务 atq 或at -l 查看任务列表 at -c 序号 预览任务与设置环境 atrm 序号 删除任务 安排任务示例: 在23:30 ...

  6. csu - 1537: Miscalculation (模拟题)

    http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1537 因为给出的式子是必定合法的,只要用两个栈分别保存符号和数字.算出答案后和从左至右算的答案比对 ...

  7. vue生成包报错error from UglifyJs

    mangle: { keep_fnames: true},

  8. Count the Colors-ZOJ1610(线段树区间求)

    Painting some colored segments on a line, some previously painted segments may be covered by some th ...

  9. Spring boot精要

    1.自动配置:针对很多Spring应用程序的常见应用功能,SpringBoot能自动提供相关配置: 2.起步依赖:告诉SpringBoot需要什么功能,他就能引入需要的库: 3.命令行界面:这是Spr ...

  10. 立面图 平面图 剖面图 CAD

    http://www.qinxue.com/88.html http://www.xsteach.com/course/2855 前后左右各个侧面的外部投影图——立面图:对建筑物各个侧面进行投影所得到 ...