Vector.Gpu.ViewPort.Project C# (CSharp) Method

Project() public method

public Project ( System.Vector3 source, System.Matrix projection, System.Matrix view, System.Matrix world ) : System.Vector3
source System.Vector3
projection System.Matrix
view System.Matrix
world System.Matrix
return System.Vector3
        public Vector3 Project(Vector3 source, Matrix projection, Matrix view, Matrix world)
        {
            Matrix matrix = Matrix.Multiply(Matrix.Multiply(world, view), projection);
            Vector3 vector = Vector3.Transform(source, matrix);
            float a = (((source.X * matrix.M14) + (source.Y * matrix.M24)) + (source.Z * matrix.M34)) + matrix.M44;
            if (!WithinEpsilon(a, 1f))
            {
                vector = (Vector3)(vector / a);
            }
            vector.X = (((vector.X + 1f) * 0.5f) * this.Width) + this.X;
            vector.Y = (((-vector.Y + 1f) * 0.5f) * this.Height) + this.Y;
            vector.Z = (vector.Z * (this.MaxDepth - this.MinDepth)) + this.MinDepth;
            return vector;
        }