예제 #1
0
        /// <summary>
        /// Creates a transformation from the specified coordinate system
        /// to the aardvark coordinate system (Meters, Right-Handed, Z-Up).
        /// </summary>
        public static Trafo3d ToAardvark(double scale, Handedness hand, Axis up)
        {
            var t = scale != 1 ? Trafo3d.Scale(scale) : Trafo3d.Identity;

            if (hand != Handedness.Right)
            {
                t *= SwapHand;
            }

            if (up != Axis.Z)
            {
                t *= FromToRH(up, Axis.Z);
            }

            return(t);
        }
예제 #2
0
        /// <summary>
        /// Builds transformation from one coordinate system to another.
        /// </summary>
        public static Trafo3d FromTo(Info from, Info to)
        {
            var t = Trafo3d.Identity;

            if (from.UnitScale != to.UnitScale)
            {
                t = Trafo3d.Scale(to.UnitScale / from.UnitScale);
            }

            if (from.Handedness != to.Handedness)
            {
                t *= SwapHand;
            }

            if (from.UpVector != to.UpVector)
            {
                t *= FromToRH(from.UpVector, to.UpVector);
            }

            return(t);
        }
예제 #3
0
 /// <summary>
 /// Builds a transformation matrix using the scale, rotation and translation componets.
 /// NOTE: Uses the Scale * Rotation * Translation notion.
 ///       The rotation is in Euler-Angles (yaw, pitch, roll).
 /// </summary>
 public static Trafo3d FromComponents(V3d scale, V3d rotation, V3d translation)
 {
     return(Trafo3d.Scale(scale) * Trafo3d.Rotation(rotation) * Trafo3d.Translation(translation));
 }