Accord.Math.Geometry.CoplanarPosit.CoplanarPosit C# (CSharp) Method

CoplanarPosit() public method

Initializes a new instance of the Posit class.
The model must have 4 points.
public CoplanarPosit ( Vector3 model, float focalLength ) : System
model Vector3 Array of vectors containing coordinates of four real model's point.
focalLength float Effective focal length of the camera used to capture the model.
return System
        public CoplanarPosit( Vector3[] model, float focalLength )
        {
            if ( model.Length != 4 )
            {
                throw new ArgumentException( "The model must have 4 points." );
            }

            this.focalLength = focalLength;
            modelPoints = (Vector3[]) model.Clone( );

            // compute model vectors
            modelVectors = Matrix3x3.CreateFromRows(
                model[1] - model[0],
                model[2] - model[0],
                model[3] - model[0] );

            // compute pseudo inverse of the model matrix
            Matrix3x3 u, v;
            Vector3 e;

            modelVectors.SVD( out u, out e, out v );
            modelPseudoInverse = v * Matrix3x3.CreateDiagonal( e.Inverse( ) ) * u.Transpose( );

            // computer unit vector normal to the model
            modelNormal = v.GetColumn( e.MinIndex );
        }