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)); }
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)); }
/// <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; }
/// <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; }
/// <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; }
/// <summary> /// Inverts this rigid transformation (multiplicative inverse). /// this = [Rot^T,-Rot^T Trans] /// </summary> public void Invert() { Rot.Invert(); Trans = -Rot.TransformDir(Trans); }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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); }
/// <summary> /// Transforms a position vector. /// </summary> public __v2t__ InvTransformPos(__v2t__ v) { return(__rot2t__.InvTransformPos(this, v)); }
/// <summary> /// Transforms a position vector. /// </summary> public static __v2t__ InvTransformPos(__rot2t__ rot, __v2t__ v) { return((__m22t__)__rot2t__.Negate(rot) * v); }
/// <summary> /// Transforms a position vector. /// </summary> public static __v2t__ TransformPos(__rot2t__ rot, __v2t__ v) { return((__m22t__)rot * v); }
public static __v2t__ Transform(this __type__ rot, __v2t__ v) { return(rot * v); }