在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
源代码 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 >= 0) { return douValue; } else { return douValue * -1; } }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论