Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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);
 }
Exemplo n.º 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));
        }
Exemplo n.º 7
0
 /// <summary>
 /// Adds 2 rotations.
 /// </summary>
 public static __rot2t__ Add(__rot2t__ r0, __rot2t__ r1)
 {
     return(new __rot2t__(r0.Angle + r1.Angle));
 }
Exemplo n.º 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);
 }
Exemplo n.º 9
0
 public static bool ApproxEqual(__rot2t__ r0, __rot2t__ r1)
 {
     return(ApproxEqual(r0, r1, Constant <__ft__> .PositiveTinyValue));
 }
Exemplo n.º 10
0
 /// <summary>
 /// Transforms a position vector.
 /// </summary>
 public static __v2t__ InvTransformPos(__rot2t__ rot, __v2t__ v)
 {
     return((__m22t__)__rot2t__.Negate(rot) * v);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Transforms a position vector.
 /// </summary>
 public static __v2t__ TransformPos(__rot2t__ rot, __v2t__ v)
 {
     return((__m22t__)rot * v);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Subtracts 2 rotations.
 /// </summary>
 public static __rot2t__ Subtract(__rot2t__ r0, __rot2t__ r1)
 {
     return(new __rot2t__(r0.Angle - r1.Angle));
 }
Exemplo n.º 13
0
 /// <summary>
 /// Multiplies 2 rotations.
 /// </summary>
 public static __rot2t__ Multiply(__rot2t__ r0, __rot2t__ r2)
 {
     return(new __rot2t__(r0.Angle * r2.Angle));
 }
Exemplo n.º 14
0
 public static __m33t__ Multiply(__rot2t__ rot2, __rot3t__ rot3)
 {
     return(__rot2t__.Multiply(rot2, (__m33t__)rot3));
 }
Exemplo n.º 15
0
 public static __m22t__ Multiply(__rot2t__ rot, __m22t__ mat)
 {
     return((__m22t__)rot * mat);
 }
Exemplo n.º 16
0
 /// <summary>
 /// Divides scalar by a rotation.
 /// </summary>
 public static __rot2t__ Divide(__rot2t__ rot, __ft__ val)
 {
     return(new __rot2t__(rot.Angle / val));
 }
Exemplo n.º 17
0
 /// <summary>
 /// Adds scalar to a rotation.
 /// </summary>
 public static __rot2t__ Add(__rot2t__ rot, __ft__ val)
 {
     return(new __rot2t__(rot.Angle + val));
 }
Exemplo n.º 18
0
 /// <summary>
 /// Negates rotation.
 /// </summary>
 public static __rot2t__ Negate(__rot2t__ rot)
 {
     return(new __rot2t__(-rot.Angle));
 }
Exemplo n.º 19
0
 /// <summary>
 /// Subtracts rotation from a scalar.
 /// </summary>
 public static __rot2t__ Subtract(__ft__ angle, __rot2t__ rot)
 {
     return(new __rot2t__(angle - rot.Angle));
 }
Exemplo n.º 20
0
 /// <summary>
 /// Multiplies scalar with a rotation.
 /// </summary>
 public static __rot2t__ Multiply(__rot2t__ rot, __ft__ val)
 {
     return(new __rot2t__(rot.Angle * val));
 }