示例#1
0
文件: Geometry.cs 项目: stuart2w/SAW
        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));
        }
示例#2
0
文件: Geometry.cs 项目: stuart2w/SAW
 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());
 }