Microsoft.Xna.Framework.Graphics.Viewport.WithinEpsilon C# (CSharp) Method

WithinEpsilon() private static method

private static WithinEpsilon ( float a, float b ) : bool
a float
b float
return bool
		private static bool WithinEpsilon(float a, float b)
		{
		    float num = a - b;
		    return ((-1.401298E-45f <= num) && (num <= float.Epsilon));
		}

Usage Example

Example #1
0
        public Vector3 Project(Vector3 source, Matrix projection, Matrix view, Matrix world)
        {
            Matrix  matrix  = Matrix.Multiply(Matrix.Multiply(world, view), projection);
            Vector3 vector3 = Vector3.Transform(source, matrix);
            float   a       = (float)((double)source.X * (double)matrix.M14 + (double)source.Y * (double)matrix.M24 + (double)source.Z * (double)matrix.M34) + matrix.M44;

            if (!Viewport.WithinEpsilon(a, 1f))
            {
                vector3 /= a;
            }
            vector3.X = (float)(((double)vector3.X + 1.0) * 0.5) * (float)this.Width + (float)this.X;
            vector3.Y = (float)((-(double)vector3.Y + 1.0) * 0.5) * (float)this.Height + (float)this.Y;
            vector3.Z = vector3.Z * (this.MaxDepth - this.MinDepth) + this.MinDepth;
            return(vector3);
        }
All Usage Examples Of Microsoft.Xna.Framework.Graphics.Viewport::WithinEpsilon