コード例 #1
0
ファイル: GeoLineUtils.cs プロジェクト: ByteKay/Nullspace
        public static bool IsLineInsectCircle3(Vector3 line1, Vector3 line2, Vector3 center, float r, GeoPlane plane, ref GeoInsectPointArrayInfo insect)
        {
            if (GeoPlaneUtils.IsPointOnPlane(plane.mNormal, plane.mD, line1) && GeoPlaneUtils.IsPointOnPlane(plane.mNormal, plane.mD, line2))
            {
                return(IsLineInsectCirclePlane2(line1, line2, center, r, plane, ref insect));
            }
            GeoInsectPointInfo info = new GeoInsectPointInfo();
            bool isInsect           = GeoPlaneUtils.IsPlaneInsectLine(plane.mNormal, plane.mD, line1, line2, ref info);

            if (isInsect)
            {
                if (GeoCircleUtils.IsInSphere(center, r, info.mHitGlobalPoint))
                {
                    insect.mIsIntersect = true;
                    insect.mHitGlobalPoint.mPointArray.Add(info.mHitGlobalPoint);
                    return(true);
                }
                insect.mIsIntersect = false;
            }
            return(false);
        }