/// <summary>
 /// Multiplies 2 Similarity transformations.
 /// This concatenates the two similarity transformations into a single one, first b is applied, then a.
 /// Attention: Multiplication is NOT commutative!
 /// </summary>
 public static Similarity3f Multiply(Similarity3f a, Similarity3f b)
 {
     //a.Scale * b.Scale, a.Rot * b.Rot, a.Trans + a.Rot * a.Scale * b.Trans
     return(new Similarity3f(a.Scale * b.Scale, new Euclidean3f(
                                 Rot3f.Multiply(a.Rot, b.Rot),
                                 a.Trans + a.Rot.TransformDir(a.Scale * b.Trans))
                             ));
 }
 public static bool ApproxEqual(Similarity3f t0, Similarity3f t1, float angleTol, float posTol, float scaleTol)
 {
     return(t0.Scale.ApproximateEquals(t1.Scale, scaleTol) && Euclidean3f.ApproxEqual(t0.EuclideanTransformation, t1.EuclideanTransformation, angleTol, posTol));
 }
 public static Similarity3f operator *(Similarity3f a, Euclidean3f b)
 {
     return(Similarity3f.Multiply(a, b));
 }
 /// <summary>
 /// Transforms point p (p.w is presumed 1.0) by the inverse of the similarity transformation t.
 /// </summary>
 public static V3f InvTransformPos(Similarity3f t, V3f p)
 {
     return(t.EuclideanTransformation.InvTransformPos(p) / t.Scale);
 }
 public static bool ApproxEqual(Similarity3f t0, Similarity3f t1)
 {
     return(ApproxEqual(t0, t1, Constant <float> .PositiveTinyValue, Constant <float> .PositiveTinyValue, Constant <float> .PositiveTinyValue));
 }
 /// <summary>
 /// Transforms point p (p.w is presumed 1.0) by similarity transformation t.
 /// </summary>
 public static V3f TransformPos(Similarity3f t, V3f p)
 {
     return(t.EuclideanTransformation.TransformPos(t.Scale * p));
 }
 /// <summary>
 /// Transforms direction vector v (v.w is presumed 0.0) by the inverse of the similarity transformation t.
 /// Actually, only the rotation and scale is used.
 /// </summary>
 public static V3f InvTransformDir(Similarity3f t, V3f v)
 {
     return(t.EuclideanTransformation.InvTransformDir(v) / t.Scale);
 }
 /// <summary>
 /// Transforms direction vector v (v.w is presumed 0.0) by similarity transformation t.
 /// Actually, only the rotation and scale is used.
 /// </summary>
 public static V3f TransformDir(Similarity3f t, V3f v)
 {
     return(t.EuclideanTransformation.TransformDir(t.Scale * v));
 }
 /// <summary>
 /// Multiplies an Euclidean transformation by a Similarity transformation.
 /// This concatenates the two transformations into a single one, first b is applied, then a.
 /// Attention: Multiplication is NOT commutative!
 /// </summary>
 public static Similarity3f Multiply(Euclidean3f a, Similarity3f b)
 {
     return(Multiply((Similarity3f)a, b));
 }
Beispiel #10
0
 /// <summary>
 /// Multiplies a Similarity transformation by an Euclidean transformation.
 /// This concatenates the two transformations into a single one, first b is applied, then a.
 /// Attention: Multiplication is NOT commutative!
 /// </summary>
 public static Similarity3f Multiply(Similarity3f a, Euclidean3f b)
 {
     return(Multiply(a, (Similarity3f)b));
 }
Beispiel #11
0
 /// <summary>
 /// Returns a new Euclidean transformation by transforming this by a t.
 /// Note: This is not a concatenation.
 /// t is fully applied to the Translation and Rotation,
 /// but the scale is not reflected in the resulting Euclidean transformation.
 /// </summary>
 public Euclidean3f Transformed(Similarity3f t)
 {
     return(Transformed(this, t));
 }
Beispiel #12
0
        /*
         * public static M34f operator *(M33f m, Euclidean3f r)
         * {
         *  return (M34f)m * (M34f)r;
         * }
         */
        #endregion

        #region Transformations yielding a Euclidean transformation

        /// <summary>
        /// Returns a new Euclidean transformation by transforming self by a Trafo t.
        /// Note: This is not a concatenation.
        /// t is fully applied to the Translation and Rotation,
        /// but the scale is not reflected in the resulting Euclidean transformation.
        /// </summary>
        // [todo ISSUE 20090810 andi : andi] Rethink this notation. Maybe write Transformed methods for all transformations.
        public static Euclidean3f Transformed(Euclidean3f self, Similarity3f t)
        {
            return(new Euclidean3f(t.Rot * self.Rot, t.TransformPos(self.Trans)));
        }