/// <summary>
            /// Creates a list of ColladaRotate elements describing a rotation defined by three floats (YPR)
            /// </summary>
            /// <param name="y">Yaw</param>
            /// <param name="p">Pitch</param>
            /// <param name="r">Roll</param>
            /// <returns></returns>
            public static List <ColladaElement> CreateRotationSet(float y, float p, float r, LowLevel.Math.real_vector3d vector_y,
                                                                  LowLevel.Math.real_vector3d vector_p, LowLevel.Math.real_vector3d vector_r)
            {
                List <ColladaElement> return_array = new List <ColladaElement>();

                return_array.Add(new Core.ColladaRotate(vector_y.I, vector_y.J, vector_y.K, y));
                return_array.Add(new Core.ColladaRotate(vector_p.I, vector_p.J, vector_p.K, p));
                return_array.Add(new Core.ColladaRotate(vector_r.I, vector_r.J, vector_r.K, r));

                (return_array[0] as Core.ColladaRotate).sID = "rotateY";
                (return_array[1] as Core.ColladaRotate).sID = "rotateP";
                (return_array[2] as Core.ColladaRotate).sID = "rotateR";

                return(return_array);
            }
Exemplo n.º 2
0
            ////////////////////////////////////////////////////////////////////////////////////////////////////
            /// <summary>
            ///     Creates a list of ColladaRotate elements describing a rotation defined by three floats
            ///     (XYZ)
            /// </summary>
            ///
            /// <param name="x">				The x angle. </param>
            /// <param name="y">				The y angle. </param>
            /// <param name="z">				The z angle. </param>
            /// <param name="xColumnVector">	The x column vector. </param>
            /// <param name="yColumnVector">	The y column vector. </param>
            /// <param name="zColumnVector">	The z column vector. </param>
            /// <param name="order">			The rotation order. </param>
            ///
            /// <returns>	The new rotation set. </returns>
            public static List <ColladaElement> CreateRotationSet(float x,
                                                                  float y,
                                                                  float z,
                                                                  LowLevel.Math.real_vector3d xColumnVector,
                                                                  LowLevel.Math.real_vector3d yColumnVector,
                                                                  LowLevel.Math.real_vector3d zColumnVector,
                                                                  ColladaRotationOrder order)
            {
                List <ColladaElement> return_array = new List <ColladaElement>();

                Dictionary <ColladaRotationOrder, byte[]> rotation_indices = new Dictionary <ColladaRotationOrder, byte[]>()
                {
                    { ColladaRotationOrder.XYZ, new byte[] { 0, 1, 2 } },
                    { ColladaRotationOrder.YZX, new byte[] { 1, 2, 0 } },
                    { ColladaRotationOrder.ZXY, new byte[] { 2, 0, 1 } },
                    { ColladaRotationOrder.XZY, new byte[] { 0, 2, 1 } },
                    { ColladaRotationOrder.ZYX, new byte[] { 2, 1, 0 } },
                    { ColladaRotationOrder.YXZ, new byte[] { 1, 0, 2 } },
                    { ColladaRotationOrder.ZXZ, new byte[] { 2, 0, 2 } },
                    { ColladaRotationOrder.XYX, new byte[] { 0, 1, 0 } },
                    { ColladaRotationOrder.YZY, new byte[] { 1, 2, 1 } },
                    { ColladaRotationOrder.ZYZ, new byte[] { 2, 1, 2 } },
                    { ColladaRotationOrder.XZX, new byte[] { 0, 2, 0 } },
                    { ColladaRotationOrder.YXY, new byte[] { 1, 0, 1 } }
                };

                var values = new[] {
                    new { SID = "rotateX", Column = xColumnVector, Value = x },
                    new { SID = "rotateY", Column = yColumnVector, Value = y },
                    new { SID = "rotateZ", Column = zColumnVector, Value = z }
                };

                foreach (var index in rotation_indices[order])
                {
                    var axis = values[index];

                    return_array.Add(
                        new Core.ColladaRotate(axis.Column.I, axis.Column.J, axis.Column.K, axis.Value)
                    {
                        sID = axis.SID
                    }
                        );
                }

                return(return_array);
            }
 public static void Add(this ColladaValueArray <float> array, LowLevel.Math.real_vector3d v)
 {
     array.Add(v.I, v.J, v.K);
 }
 /// <summary>
 /// Creates a list of ColladaRotate elements describing a rotation defined a RealEulerAngles3D field
 /// </summary>
 /// <param name="rotation">A RealEulerAngles3D field</param>
 /// <returns></returns>
 public static List <ColladaElement> CreateRotationSet(LowLevel.Math.real_euler_angles3d rotation, LowLevel.Math.real_vector3d vector_y,
                                                       LowLevel.Math.real_vector3d vector_p, LowLevel.Math.real_vector3d vector_r)
 {
     return(CreateRotationSet(rotation.Yaw, rotation.Pitch, rotation.Roll, vector_y, vector_p, vector_r));
 }
Exemplo n.º 5
0
		public LowLevel.Math.real_vector3d ToVector3D()
		{
			var v = new LowLevel.Math.real_vector3d();

			v.I = I;
			v.J = J;
			v.K = K;

			return v;
		}