Exemple #1
0
        public static __v2t__ InvTransform(this __type__ rot, __v2t__ v)
        {
            __ftype__ a = Fun.Cos(-rot.Angle);
            __ftype__ b = Fun.Sin(-rot.Angle);

            return(new __v2t__(a * v.X + -b * v.Y, b * v.X + a * v.Y));
        }
Exemple #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));
        }
Exemple #3
0
 /// <summary>
 /// Creates a rigid transformation from a trafo <paramref name="trafo"/>.
 /// </summary>
 public __e2t__(Trafo2d trafo)
 {
     Rot   = __r2t__.FromM2__s2f__((M2__s2f__)trafo.Forward);
     Trans = (__v2t__)trafo.Forward.C2.XY;
 }
Exemple #4
0
 /// <summary>
 /// Creates a rigid transformation from a rotation matrix <paramref name="rot"/> and a (subsequent) translation <paramref name="trans"/>.
 /// </summary>
 public __e2t__(M2__s2f__ rot, __v2t__ trans)
 {
     Rot   = __r2t__.FromM2__s2f__(rot);
     Trans = trans;
 }
Exemple #5
0
 /// <summary>
 /// Creates a rigid transformation from a rotation <paramref name="rot"/> and a (subsequent) translation <paramref name="trans"/>.
 /// </summary>
 public __e2t__(__r2t__ rot, __v2t__ trans)
 {
     Rot   = rot;
     Trans = trans;
 }
Exemple #6
0
 /// <summary>
 /// Inverts this rigid transformation (multiplicative inverse).
 /// this = [Rot^T,-Rot^T Trans]
 /// </summary>
 public void Invert()
 {
     Rot.Invert();
     Trans = -Rot.TransformDir(Trans);
 }
Exemple #7
0
 /// <summary>
 /// Transforms point p (p.w is presumed 1.0) by the inverse of this rigid transformation.
 /// </summary>
 public __v2t__ InvTransformPos(__v2t__ p)
 {
     return(InvTransformPos(this, p));
 }
Exemple #8
0
 /// <summary>
 /// Transforms direction vector v (v.w is presumed 0.0) by the inverse of this rigid transformation.
 /// Actually, only the rotation is used.
 /// </summary>
 public __v2t__ InvTransformDir(__v2t__ v)
 {
     return(InvTransformDir(this, v));
 }
Exemple #9
0
 /// <summary>
 /// Transforms direction vector v (v.w is presumed 0.0) by this rigid transformation.
 /// Actually, only the rotation is used.
 /// </summary>
 public __v2t__ TransformDir(__v2t__ v)
 {
     return(TransformDir(this, v));
 }
Exemple #10
0
 /// <summary>
 /// Transforms point p (p.w is presumed 1.0) by the inverse of the rigid transformation r.
 /// </summary>
 public static __v2t__ InvTransformPos(__e2t__ r, __v2t__ p)
 {
     return(r.Rot.InvTransformPos(p - r.Trans));
 }
Exemple #11
0
 /// <summary>
 /// Transforms direction vector v (v.w is presumed 0.0) by the inverse of the rigid transformation r.
 /// Actually, only the rotation is used.
 /// </summary>
 public static __v2t__ InvTransformDir(__e2t__ r, __v2t__ v)
 {
     return(r.Rot.InvTransformDir(v));
 }
Exemple #12
0
 /// <summary>
 /// Transforms point p (p.w is presumed 1.0) by rigid transformation r.
 /// </summary>
 public static __v2t__ TransformPos(__e2t__ r, __v2t__ p)
 {
     return(r.Rot.TransformPos(p) + r.Trans);
 }
Exemple #13
0
 /// <summary>
 /// Transforms a position vector.
 /// </summary>
 public __v2t__ InvTransformPos(__v2t__ v)
 {
     return(__rot2t__.InvTransformPos(this, v));
 }
Exemple #14
0
 /// <summary>
 /// Transforms a position vector.
 /// </summary>
 public static __v2t__ InvTransformPos(__rot2t__ rot, __v2t__ v)
 {
     return((__m22t__)__rot2t__.Negate(rot) * v);
 }
Exemple #15
0
 /// <summary>
 /// Transforms a position vector.
 /// </summary>
 public static __v2t__ TransformPos(__rot2t__ rot, __v2t__ v)
 {
     return((__m22t__)rot * v);
 }
Exemple #16
0
 public static __v2t__ Transform(this __type__ rot, __v2t__ v)
 {
     return(rot * v);
 }