FlatRedBall.Camera.GetZDistanceForPixelPerfect C# (CSharp) Method

GetZDistanceForPixelPerfect() public method

public GetZDistanceForPixelPerfect ( ) : float
return float
        public float GetZDistanceForPixelPerfect()
        {
            double sin = System.Math.Sin(FieldOfView / 2.0);
            double cos = System.Math.Cos(FieldOfView / 2.0f);


            double edgeToEdge = 2 * sin;
            float desiredHeight = this.DestinationRectangle.Height;

            double distance = cos * desiredHeight / edgeToEdge;
            return (float)distance;
        }