IsZero() public method

public IsZero ( ) : bool
return bool
Example #1
0
        public bool ProjectPerspective()
        {
            Golden distance    = new Golden(new Fraction(-4), new Fraction(4));
            Golden denominator = distance - U;

            double magSquared =
                X.GetAsDouble() * X.GetAsDouble() +
                Y.GetAsDouble() * Y.GetAsDouble() +
                Z.GetAsDouble() * Z.GetAsDouble() +
                U.GetAsDouble() * U.GetAsDouble();

            // The projection.
            Golden scale  = new Golden(new Fraction(1), new Fraction(0));
            Golden factor = (scale * distance) / denominator;

            // Fake projecting to infinity.
            if (denominator.IsZero() || denominator.GetAsDouble() < 0)
            {
                factor = new Golden(new Fraction(1000), new Fraction(0));
            }

            X *= factor;
            Y *= factor;
            Z *= factor;
            U  = new Golden(new Fraction(0), new Fraction(0));
            return(true);
        }