コード例 #1
0
        public static __m33t__ Multiply(__rot2t__ rot, __m33t__ mat)
        {
            __ft__ a = (__ft__)System.Math.Cos(rot.Angle);
            __ft__ b = (__ft__)System.Math.Sin(rot.Angle);

            return(new __m33t__(a * mat.M00 +
                                b * mat.M10,

                                a * mat.M01 +
                                b * mat.M11,

                                a * mat.M02 +
                                b * mat.M12,

                                -b * mat.M00 +
                                a * mat.M10,

                                -b * mat.M01 +
                                a * mat.M11,

                                -b * mat.M02 +
                                a * mat.M12,

                                mat.M20,

                                mat.M21,

                                mat.M22));
        }
コード例 #2
0
        public static __v2t__ Multiply(__rot2t__ rot, __v2t__ vec)
        {
            __ft__ a = (__ft__)System.Math.Cos(rot.Angle);
            __ft__ b = (__ft__)System.Math.Sin(rot.Angle);

            return(new __v2t__(a * vec.X + b * vec.Y,
                               -b * vec.X + a * vec.Y));
        }
コード例 #3
0
        public static __m34t__ Multiply(__rot2t__ rot, __shift3t__ shift)
        {
            __ft__ a = (__ft__)System.Math.Cos(rot.Angle);
            __ft__ b = (__ft__)System.Math.Sin(rot.Angle);

            return(new __m34t__(a, b, 0, a * shift.X + b * shift.Y,
                                -b, a, 0, -b * shift.X + a * shift.Y,
                                0, 0, 1, shift.Z));
        }
コード例 #4
0
        public static __v3t__ Multiply(__rot2t__ rot, __v3t__ vec)
        {
            __ft__ ca = (__ft__)System.Math.Cos(rot.Angle);
            __ft__ sa = (__ft__)System.Math.Sin(rot.Angle);

            return(new __v3t__(ca * vec.X + sa * vec.Y,
                               -sa * vec.X + ca * vec.Y,
                               vec.Z));
        }
コード例 #5
0
 /// <summary>
 /// Checks if 2 objects are equal.
 /// </summary>
 /// <returns>True if equal.</returns>
 public override bool Equals(object obj)
 {
     if (obj is __rot2t__)
     {
         __rot2t__ rotation = (__rot2t__)obj;
         return(Angle == rotation.Angle);
     }
     return(false);
 }
コード例 #6
0
        public static __m33t__ Multiply(__rot2t__ rot, __scale3t__ scale)
        {
            __ft__ a = (__ft__)System.Math.Cos(rot.Angle);
            __ft__ b = (__ft__)System.Math.Sin(rot.Angle);

            return(new __m33t__(a * scale.X,
                                b * scale.Y,
                                0,

                                -b * scale.X,
                                a * scale.Y,
                                0,

                                0,
                                0,
                                scale.Z));
        }
コード例 #7
0
 /// <summary>
 /// Adds 2 rotations.
 /// </summary>
 public static __rot2t__ Add(__rot2t__ r0, __rot2t__ r1)
 {
     return(new __rot2t__(r0.Angle + r1.Angle));
 }
コード例 #8
0
 // [todo ISSUE 20090225 andi : andi] Wir sollten auch folgendes ber�cksichtigen -q == q, weil es die selbe rotation definiert.
 // [todo ISSUE 20090427 andi : andi] use an angle-tolerance
 // [todo ISSUE 20090427 andi : andi] add __rot3t__.ApproxEqual(__rot3t__ other);
 public static bool ApproxEqual(__rot2t__ r0, __rot2t__ r1, __ft__ tolerance)
 {
     return((r0.Angle - r1.Angle).Abs() <= tolerance);
 }
コード例 #9
0
 public static bool ApproxEqual(__rot2t__ r0, __rot2t__ r1)
 {
     return(ApproxEqual(r0, r1, Constant <__ft__> .PositiveTinyValue));
 }
コード例 #10
0
 /// <summary>
 /// Transforms a position vector.
 /// </summary>
 public static __v2t__ InvTransformPos(__rot2t__ rot, __v2t__ v)
 {
     return((__m22t__)__rot2t__.Negate(rot) * v);
 }
コード例 #11
0
 /// <summary>
 /// Transforms a position vector.
 /// </summary>
 public static __v2t__ TransformPos(__rot2t__ rot, __v2t__ v)
 {
     return((__m22t__)rot * v);
 }
コード例 #12
0
 /// <summary>
 /// Subtracts 2 rotations.
 /// </summary>
 public static __rot2t__ Subtract(__rot2t__ r0, __rot2t__ r1)
 {
     return(new __rot2t__(r0.Angle - r1.Angle));
 }
コード例 #13
0
 /// <summary>
 /// Multiplies 2 rotations.
 /// </summary>
 public static __rot2t__ Multiply(__rot2t__ r0, __rot2t__ r2)
 {
     return(new __rot2t__(r0.Angle * r2.Angle));
 }
コード例 #14
0
 public static __m33t__ Multiply(__rot2t__ rot2, __rot3t__ rot3)
 {
     return(__rot2t__.Multiply(rot2, (__m33t__)rot3));
 }
コード例 #15
0
 public static __m22t__ Multiply(__rot2t__ rot, __m22t__ mat)
 {
     return((__m22t__)rot * mat);
 }
コード例 #16
0
 /// <summary>
 /// Divides scalar by a rotation.
 /// </summary>
 public static __rot2t__ Divide(__rot2t__ rot, __ft__ val)
 {
     return(new __rot2t__(rot.Angle / val));
 }
コード例 #17
0
 /// <summary>
 /// Adds scalar to a rotation.
 /// </summary>
 public static __rot2t__ Add(__rot2t__ rot, __ft__ val)
 {
     return(new __rot2t__(rot.Angle + val));
 }
コード例 #18
0
 /// <summary>
 /// Negates rotation.
 /// </summary>
 public static __rot2t__ Negate(__rot2t__ rot)
 {
     return(new __rot2t__(-rot.Angle));
 }
コード例 #19
0
 /// <summary>
 /// Subtracts rotation from a scalar.
 /// </summary>
 public static __rot2t__ Subtract(__ft__ angle, __rot2t__ rot)
 {
     return(new __rot2t__(angle - rot.Angle));
 }
コード例 #20
0
 /// <summary>
 /// Multiplies scalar with a rotation.
 /// </summary>
 public static __rot2t__ Multiply(__rot2t__ rot, __ft__ val)
 {
     return(new __rot2t__(rot.Angle * val));
 }