Exemplo n.º 1
0
        public static bool IsRayInsectAABB2(Vector2 rayOrigin, Vector2 rayDirection, Vector2 min, Vector2 max, ref GeoInsectPointArrayInfo insect)
        {
            bool isInsect = GeoLineUtils.IsLineInsectAABB2(rayOrigin, rayDirection + rayOrigin, min, max, ref insect);

            if (isInsect)
            {
                List <Vector3> tmp = new List <Vector3>();
                foreach (Vector3 v in insect.mHitGlobalPoint.mPointArray)
                {
                    Vector2 v2 = new Vector2(v.x, v.y);
                    if (GeoRayUtils.IsPointInRay2(rayOrigin, rayDirection, ref v2))
                    {
                        tmp.Add(v);
                    }
                }
                if (tmp.Count > 0)
                {
                    insect.mHitGlobalPoint.mPointArray = tmp;
                }
                else
                {
                    insect.mIsIntersect = false;
                }
            }
            return(insect.mIsIntersect);
        }
Exemplo n.º 2
0
        public static bool IsSegmentInsectAABB2(Vector2 seg1, Vector2 seg2, Vector2 min, Vector2 max, ref GeoInsectPointArrayInfo insect)
        {
            bool isInsect = GeoLineUtils.IsLineInsectAABB2(seg1, seg2, min, max, ref insect);

            if (isInsect)
            {
                List <Vector3> tmp = new List <Vector3>();
                foreach (Vector3 v in insect.mHitGlobalPoint.mPointArray)
                {
                    Vector2 v2 = new Vector2(v.x, v.y);
                    if (GeoSegmentUtils.IsPointInSegment2(seg1, seg2, ref v2))
                    {
                        tmp.Add(v);
                    }
                }
                insect.mHitGlobalPoint.mPointArray = tmp;
            }
            return(insect.mIsIntersect);
        }
Exemplo n.º 3
0
 public static bool IsAABBInsectLine2(Vector2 min, Vector2 max, Vector2 line1, Vector2 line2, ref GeoInsectPointArrayInfo insect)
 {
     return(GeoLineUtils.IsLineInsectAABB2(line1, line2, min, max, ref insect));
 }