Esempio n. 1
0
        /// <summary>
        /// Gets the rotation from matrix
        /// </summary>
        /// <param name="matrix">Rotation from matrix</param>
        /// <param name="axis">Around axis</param>
        /// <returns>Angle of rotation (0 - 2PI)</returns>
        public double GetRotation(IMatrix44 matrix, Axis axis)
        {
            double rot = 0.0;
            double y   = 0.0;

            switch (axis)
            {
            case Axis.XAxis:
                rot = GeomOperation.GetAngle(matrix.AxisZ, AxisZ);
                y   = AxisZ | (matrix.AxisX * matrix.AxisZ).Normalize;
                break;

            case Axis.YAxis:
                rot = GeomOperation.GetAngle(matrix.AxisX, AxisX);
                y   = AxisX | (matrix.AxisY * matrix.AxisX).Normalize;
                break;

            case Axis.ZAxis:
                rot = GeomOperation.GetAngle(matrix.AxisY, AxisY);
                y   = AxisY | (matrix.AxisZ * matrix.AxisY).Normalize;
                break;
            }

            if (y.IsLesser(0))
            {
                rot = 2 * Math.PI - rot;
            }

            return(rot);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets all angle change of parabola
        /// </summary>
        /// <returns>Angle change</returns>
        internal double GetAngleChange()
        {
            double angle = 0;

            if (Property.IsValid)
            {
                Vector3D vect1 = new Vector3D();
                Vector3D vect2 = new Vector3D();
                GeomOperation.GetTangentOnSegment(this, 0.0, ref vect1);
                GeomOperation.GetTangentOnSegment(this, 1.0, ref vect2);
                angle = GeomOperation.GetAngle(vect1, vect2);
            }
            else
            {
                var seg = new ArcSegment3D(StartPoint, IntermedPoint, EndPoint);
                angle = GeomOperation.GetArcAngle(seg);
            }

            return(angle);
        }