示例#1
0
 public static float PlaneAngleD(Vector3f a, Vector3f b, int nPlaneNormalIdx = 1)
 {
     a[nPlaneNormalIdx] = b[nPlaneNormalIdx] = 0.0f;
     a.Normalize();
     b.Normalize();
     return(Vector3f.AngleD(a, b));
 }
示例#2
0
        public static float PlaneAngleSignedD(Vector3f vFrom, Vector3f vTo, int nPlaneNormalIdx = 1)
        {
            vFrom[nPlaneNormalIdx] = vTo[nPlaneNormalIdx] = 0.0f;
            vFrom.Normalize();
            vTo.Normalize();
            float fSign  = Math.Sign(vFrom.Cross(vTo)[nPlaneNormalIdx]);
            float fAngle = fSign * Vector3f.AngleD(vFrom, vTo);

            return(fAngle);
        }
示例#3
0
        public static float PlaneAngleSignedD(Vector3f vFrom, Vector3f vTo, Vector3f planeN)
        {
            vFrom = vFrom - Vector3f.Dot(vFrom, planeN) * planeN;
            vTo   = vTo - Vector3f.Dot(vTo, planeN) * planeN;
            vFrom.Normalize();
            vTo.Normalize();
            Vector3f c      = Vector3f.Cross(vFrom, vTo);
            float    fSign  = Math.Sign(Vector3f.Dot(c, planeN));
            float    fAngle = fSign * Vector3f.AngleD(vFrom, vTo);

            return(fAngle);
        }
示例#4
0
        public static float PlaneAngleSignedD(Vector3f vFrom, Vector3f vTo, int nPlaneNormalIdx = 1)
        {
            vFrom[nPlaneNormalIdx] = vTo[nPlaneNormalIdx] = 0.0f;
            vFrom.Normalize();
            vTo.Normalize();
            Vector3f c = vFrom.Cross(vTo);

            if (c.LengthSquared < MathUtil.ZeroTolerancef)
            {                    // vectors are parallel
                return(vFrom.Dot(vTo) < 0 ? 180.0f : 0);
            }
            float fSign  = Math.Sign(c[nPlaneNormalIdx]);
            float fAngle = fSign * Vector3f.AngleD(vFrom, vTo);

            return(fAngle);
        }
示例#5
0
        public static float PlaneAngleSignedD(Vector3f vFrom, Vector3f vTo, Vector3f planeN)
        {
            vFrom = vFrom - Vector3f.Dot(vFrom, planeN) * planeN;
            vTo   = vTo - Vector3f.Dot(vTo, planeN) * planeN;
            vFrom.Normalize();
            vTo.Normalize();
            var c = Vector3f.Cross(vFrom, vTo);

            if (c.LengthSquared < MathUtil.ZeroTolerancef)
            {                    // vectors are parallel
                return(vFrom.Dot(vTo) < 0 ? 180.0f : 0);
            }
            float fSign  = Math.Sign(Vector3f.Dot(c, planeN));
            float fAngle = fSign * Vector3f.AngleD(vFrom, vTo);

            return(fAngle);
        }