Beispiel #1
0
        internal static SizeF ProjectionVector(SizeF project, SizeF ontoDirection)
        {
            // calculates the projection of the first parameter in the direction given by the second parameter as a vector
            // i.e. the vector would be in direction szOntoDirection, and the magnitude is the projection of szProject in this direction
            float multiply = project.DotProduct(ontoDirection) / ontoDirection.DotProduct(ontoDirection);

            // this is actually ProjectionScalar (szProject, szOnto)/Scalar (szOnto) - but it is faster written this way
            return(ontoDirection.MultiplyBy(multiply));
        }
Beispiel #2
0
 internal static float ProjectionScalar(SizeF project, SizeF ontoDirection)
 {
     // calculates the projection of the first parameter in the direction given by the second parameter. (i.e. length of first parameter in the direction of the second)
     //The length of the second parameter does not affect the result
     return(project.DotProduct(ontoDirection) / ontoDirection.Length());
 }