算法.积累20200411
2021-02-21 03:21
标签:ffffff https tail lbp code art col 四边形 turn 1、ZC:求某个点 是否在 (凸)4边形 内部 判断一个点是否在四边形内部_人工智能_San_Junipero的博客-CSDN博客.html(https://blog.csdn.net/San_Junipero/article/details/79172260) 已知四边形的四个点,求一个点是否在四边形之内的解决方法_人工智能_laukaka的专栏-CSDN博客.html(https://blog.csdn.net/laukaka/article/details/45168439) 2、 3、 4、 5、 算法.积累20200411 标签:ffffff https tail lbp code art col 四边形 turn 原文地址:https://www.cnblogs.com/csskill/p/12677644.html private boolean isPointInRect(int x, int y)
{
final Point A = mLBPoint;
final Point B = mLTPoint;
final Point C = mRTPoint;
final Point D = mRBPoint;
final int a = (B.x - A.x)*(y - A.y) - (B.y - A.y)*(x - A.x);
final int b = (C.x - B.x)*(y - B.y) - (C.y - B.y)*(x - B.x);
final int c = (D.x - C.x)*(y - C.y) - (D.y - C.y)*(x - C.x);
final int d = (A.x - D.x)*(y - D.y) - (A.y - D.y)*(x - D.x);
if((a > 0 && b > 0 && c > 0 && d > 0) || (a )) {
return true;
}
// AB X AP = (b.x - a.x, b.y - a.y) x (p.x - a.x, p.y - a.y) = (b.x - a.x) * (p.y - a.y) - (b.y - a.y) * (p.x - a.x);
// BC X BP = (c.x - b.x, c.y - b.y) x (p.x - b.x, p.y - b.y) = (c.x - b.x) * (p.y - b.y) - (c.y - b.y) * (p.x - b.x);
return false;
}
下一篇:完美解决jsp无法上传大文件方法