Exemple #1
0
        public static bool IsPlaneInsectAABB2(Vector3 normal, float d, Vector3 min, Vector3 max, GeoPlane plane, ref GeoInsectPointArrayInfo insect)
        {
            float dot = Vector3.Dot(normal, plane.mNormal);

            if (1 - Mathf.Abs(dot) < 1e-5f)
            {
                return(false);
            }
            GeoInsectPointArrayInfo tmp = new GeoInsectPointArrayInfo();
            bool isInsect = GeoPlaneUtils.IsPlaneInsectPlane(normal, d, plane.mNormal, plane.mD, ref tmp);

            if (isInsect)
            {
                Vector3 l1 = tmp.mHitGlobalPoint.mPointArray[0];
                Vector3 l2 = l1 + tmp.mHitGlobalPoint.mPointArray[1];
                isInsect = GeoLineUtils.IsLineInsectAABBPlane2(l1, l2, min, max, plane, ref insect);
            }
            return(insect.mIsIntersect);
        }