Ejemplo n.º 1
0
 /// <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 Similarity3d Multiply(Similarity3d a, Similarity3d b)
 {
     //a.Scale * b.Scale, a.Rot * b.Rot, a.Trans + a.Rot * a.Scale * b.Trans
     return(new Similarity3d(a.Scale * b.Scale, new Euclidean3d(
                                 Rot3d.Multiply(a.Rot, b.Rot),
                                 a.Trans + a.Rot.TransformDir(a.Scale * b.Trans))
                             ));
 }
Ejemplo n.º 2
0
 public Trafo3d(Similarity3d trafo)
 {
     Forward  = (M44d)trafo;
     Backward = (M44d)trafo.Inverse;
 }
Ejemplo n.º 3
0
 public static Similarity3d operator *(Similarity3d a, Euclidean3d b)
 {
     return(Similarity3d.Multiply(a, b));
 }
Ejemplo n.º 4
0
 public static bool ApproxEqual(Similarity3d t0, Similarity3d t1, double angleTol, double posTol, double scaleTol)
 {
     return(t0.Scale.ApproximateEquals(t1.Scale, scaleTol) && Euclidean3d.ApproxEqual(t0.EuclideanTransformation, t1.EuclideanTransformation, angleTol, posTol));
 }
Ejemplo n.º 5
0
 public static bool ApproxEqual(Similarity3d t0, Similarity3d t1)
 {
     return(ApproxEqual(t0, t1, Constant <double> .PositiveTinyValue, Constant <double> .PositiveTinyValue, Constant <double> .PositiveTinyValue));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Transforms point p (p.w is presumed 1.0) by the inverse of the similarity transformation t.
 /// </summary>
 public static V3d InvTransformPos(Similarity3d t, V3d p)
 {
     return(t.EuclideanTransformation.InvTransformPos(p) / t.Scale);
 }
Ejemplo n.º 7
0
 /// <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 V3d InvTransformDir(Similarity3d t, V3d v)
 {
     return(t.EuclideanTransformation.InvTransformDir(v) / t.Scale);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Transforms point p (p.w is presumed 1.0) by similarity transformation t.
 /// </summary>
 public static V3d TransformPos(Similarity3d t, V3d p)
 {
     return(t.EuclideanTransformation.TransformPos(t.Scale * p));
 }
Ejemplo n.º 9
0
 /// <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 V3d TransformDir(Similarity3d t, V3d v)
 {
     return(t.EuclideanTransformation.TransformDir(t.Scale * v));
 }
Ejemplo n.º 10
0
 /// <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 Similarity3d Multiply(Euclidean3d a, Similarity3d b)
 {
     return(Multiply((Similarity3d)a, b));
 }
Ejemplo n.º 11
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 Similarity3d Multiply(Similarity3d a, Euclidean3d b)
 {
     return(Multiply(a, (Similarity3d)b));
 }
Ejemplo n.º 12
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 Euclidean3d Transformed(Similarity3d t)
 {
     return(Transformed(this, t));
 }
Ejemplo n.º 13
0
        /*
         * public static M34d operator *(M33d m, Euclidean3d r)
         * {
         *  return (M34d)m * (M34d)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 Euclidean3d Transformed(Euclidean3d self, Similarity3d t)
        {
            return(new Euclidean3d(t.Rot * self.Rot, t.TransformPos(self.Trans)));
        }