예제 #1
0
        public static bool NearEqual(XMVector p1, XMVector p2, XMVector epsilon)
        {
            XMVector np1 = XMPlane.Normalize(p1);
            XMVector np2 = XMPlane.Normalize(p2);

            return(XMVector4.NearEqual(np1, np2, epsilon));
        }
예제 #2
0
        public static XMVector FromPoints(XMVector point1, XMVector point2, XMVector point3)
        {
            XMVector v21 = XMVector.Subtract(point1, point2);
            XMVector v31 = XMVector.Subtract(point1, point3);

            XMVector n = XMVector3.Cross(v21, v31);

            n = XMVector3.Normalize(n);

            XMVector d = XMPlane
                         .DotNormal(n, point1)
                         .Negate();

            return(XMVector.Select(d, n, XMGlobalConstants.Select1110));
        }
예제 #3
0
        public static XMVector IntersectLine(XMVector p, XMVector linePoint1, XMVector linePoint2)
        {
            XMVector v1 = XMVector3.Dot(p, linePoint1);
            XMVector v2 = XMVector3.Dot(p, linePoint2);
            XMVector d  = XMVector.Subtract(v1, v2);

            XMVector vt = XMPlane.DotCoord(p, linePoint1);

            vt = XMVector.Divide(vt, d);

            XMVector point = XMVector.Subtract(linePoint2, linePoint1);

            point = XMVector.MultiplyAdd(point, vt, linePoint1);

            XMVector control = XMVector.NearEqual(d, XMGlobalConstants.Zero, XMGlobalConstants.Epsilon);

            return(XMVector.Select(point, XMGlobalConstants.QNaN, control));
        }