R3.Math.Isometry.operator C# (CSharp) Method

operator() public static method

Composition operator.
public static operator ( ) : Isometry
return Isometry
        public static Isometry operator *( Isometry i1, Isometry i2 )
        {
            // ZZZ - Probably a better way.
            // We'll just apply both isometries to a canonical set of points,
            // Then calc which isometry makes that.

            Complex p1 = new Complex( 1, 0 );
            Complex p2 = new Complex( -1, 0 );
            Complex p3 = new Complex( 0, 1 );
            Complex w1 = p1, w2 = p2, w3 = p3;

            // Compose (apply in reverse order).
            w1 = i2.Apply( w1 );
            w2 = i2.Apply( w2 );
            w3 = i2.Apply( w3 );
            w1 = i1.Apply( w1 );
            w2 = i1.Apply( w2 );
            w3 = i1.Apply( w3 );

            Mobius m = new Mobius();
            m.MapPoints( p1, p2, p3, w1, w2, w3 );

            Isometry result = new Isometry();
            result.Mobius = m;

            // Need to reflect at end?
            bool r1 = i1.Reflection != null;
            bool r2 = i2.Reflection != null;
            if( r1 ^ r2 )	// One and only one reflection.
            {
                result.Reflection = new Circle(
                    Vector3D.FromComplex( w1 ),
                    Vector3D.FromComplex( w2 ),
                    Vector3D.FromComplex( w3 ) );
            }

            return result;
        }