System.Drawing.SizeF.GetUnitVector()

Here are the examples of the csharp api class System.Drawing.SizeF.GetUnitVector() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: NohBoard
Source File: Geom.cs
public static SizeF ProjectOn(this SizeF toProject, SizeF projectOn)
        {
            /* Projecting is easiest on a unit matrix. Therefore we call u the unit matrix of projectOn.
               The projection matrix is then:

               |  ux^2    ux * uy |
               | ux * uy   uy^2   |
          */

            var unitVector = projectOn.GetUnitVector();
            var projectionMatrix = new Matrix(
                unitVector.Width * unitVector.Width, unitVector.Width * unitVector.Height,
                unitVector.Width * unitVector.Height, unitVector.Height * unitVector.Height,
                0, 0);

            var inputList = new[] { new PointF(toProject.Width, toProject.Height) };
            projectionMatrix.TransformVectors(inputList);
            return new SizeF(inputList[0].X, inputList[0].Y);
        }