示例#1
0
        public IMathTransform GetTransformBetweenVectorsAroundPoint(
            double[] vec1, double[] vec2, double[] pt)
        {
            IMathVector mathVec1 = m_MathUtils.CreateVector(vec1) as IMathVector;
            IMathVector mathVec2 = m_MathUtils.CreateVector(vec2) as IMathVector;
            IMathVector crossVec = mathVec1.Cross(mathVec2) as IMathVector;

            double dot     = mathVec1.Dot(mathVec2);
            double vec1Len = mathVec1.GetLength();
            double vec2Len = mathVec2.GetLength();

            double angle = Math.Acos(dot / vec1Len * vec2Len);

            IMathPoint mathPt = m_MathUtils.CreatePoint(pt) as IMathPoint;

            return(m_MathUtils.CreateTransformRotateAxis(mathPt, crossVec, angle) as IMathTransform);
        }
示例#2
0
        private static IMathTransform GetTransformBetweenVectors(Vector firstVector, Vector secondVector, Point point)
        {
            var mathVec1 = (m_MathUtils.CreateVector(firstVector.ToArray()) as IMathVector).Normalise();
            var mathVec2 = (m_MathUtils.CreateVector(secondVector.ToArray()) as IMathVector).Normalise();
            var crossVec = (mathVec1.Cross(mathVec2) as IMathVector).Normalise();

            var dot     = mathVec1.Dot(mathVec2);
            var vec1Len = mathVec1.GetLength();
            var vec2Len = mathVec2.GetLength();

            var angle = Math.Acos(dot / vec1Len * vec2Len);

            var mathPt = m_MathUtils.CreatePoint(point.ToArray()) as IMathPoint;

            var mathTransform = m_MathUtils.CreateTransformRotateAxis(mathPt, crossVec, angle) as IMathTransform;

            return(mathTransform);
        }
        public TransformationMaxtrix GetTransformBetweenVectorsAroundPoint(
            Vector firstVector, Vector secondVector, Point point)
        {
            IMathVector mathVec1 = (m_MathUtils.CreateVector(firstVector.ToArray()) as IMathVector).Normalise();
            IMathVector mathVec2 = (m_MathUtils.CreateVector(secondVector.ToArray()) as IMathVector).Normalise();
            IMathVector crossVec = (mathVec1.Cross(mathVec2) as IMathVector).Normalise();

            double dot     = mathVec1.Dot(mathVec2);
            double vec1Len = mathVec1.GetLength();
            double vec2Len = mathVec2.GetLength();

            double angle = System.Math.Acos(dot / vec1Len * vec2Len);

            IMathPoint mathPt = m_MathUtils.CreatePoint(point.ToArray()) as IMathPoint;

            var mathTransform = m_MathUtils.CreateTransformRotateAxis(mathPt, crossVec, angle) as IMathTransform;

            return(mathTransform.ToTransformationMaxtrix());
        }
 public static MathTransform GetRotationFromAxisAndAngle(this IMathUtility m, IMathVector axis, double angle)
 {
     return((MathTransform)m.CreateTransformRotateAxis(m.Origin(), axis, angle));
 }