Beispiel #1
0
/*public*/
double
HCoordinate::getY() const
{
	double a = y/w;
	if ( !FINITE(a) ) {
		throw  NotRepresentableException();
	}
	return a;
}
Beispiel #2
0
/*public*/
double
HCoordinate::getY() const
{
    double a = y / w;
    if(!std::isfinite(a)) {
        throw  NotRepresentableException();
    }
    return a;
}
Beispiel #3
0
/*public static*/
void
HCoordinate::intersection(const Coordinate &p1, const Coordinate &p2,
	const Coordinate &q1, const Coordinate &q2, Coordinate &ret)
{

#if GEOS_DEBUG
	cerr << __FUNCTION__ << ":" << endl
	     << setprecision(20)
	     << " p1: " << p1 << endl
	     << " p2: " << p2 << endl
	     << " q1: " << q1 << endl
	     << " q2: " << q2 << endl;
#endif

	// unrolled computation

	double px = p1.y - p2.y;
	double py = p2.x - p1.x;
	double pw = p1.x * p2.y - p2.x * p1.y;

	double qx = q1.y - q2.y;
	double qy = q2.x - q1.x;
	double qw = q1.x * q2.y - q2.x * q1.y;

	double x = py * qw - qy * pw;
	double y = qx * pw - px * qw;
	double w = px * qy - qx * py;

	double xInt = x/w;
	double yInt = y/w;

	if ( (!FINITE(xInt)) || (!FINITE(yInt)) )
	{
		throw NotRepresentableException();
	}

	ret = Coordinate(xInt, yInt);
}