Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 126490
Collapse All | Expand All

(-)geos-2.2.1/source/headers/geos/geom.h (-15 / +15 lines)
Lines 358-409 Link Here
358
	//double distance(Coordinate& p);
358
	//double distance(Coordinate& p);
359
	static Coordinate nullCoord;
359
	static Coordinate nullCoord;
360
360
361
	void Coordinate::setNull() {
361
	void setNull() {
362
		x=DoubleNotANumber;
362
		x=DoubleNotANumber;
363
		y=DoubleNotANumber;
363
		y=DoubleNotANumber;
364
		z=DoubleNotANumber;
364
		z=DoubleNotANumber;
365
	}
365
	}
366
366
367
	static Coordinate& Coordinate::getNull() {
367
	static Coordinate& getNull() {
368
		return nullCoord;
368
		return nullCoord;
369
	}
369
	}
370
370
371
	Coordinate::Coordinate() {
371
	Coordinate() {
372
		x=0.0;
372
		x=0.0;
373
		y=0.0;
373
		y=0.0;
374
		z=DoubleNotANumber;
374
		z=DoubleNotANumber;
375
	}
375
	}
376
376
377
	Coordinate::Coordinate(double xNew, double yNew, double zNew) {
377
	Coordinate(double xNew, double yNew, double zNew) {
378
		x=xNew;
378
		x=xNew;
379
		y=yNew;
379
		y=yNew;
380
		z=zNew;
380
		z=zNew;
381
	}
381
	}
382
382
383
#ifndef PROFILE_COORDINATE_COPIES
383
#ifndef PROFILE_COORDINATE_COPIES
384
	Coordinate::Coordinate(const Coordinate& c){
384
	Coordinate(const Coordinate& c){
385
		x=c.x;
385
		x=c.x;
386
		y=c.y;
386
		y=c.y;
387
		z=c.z;
387
		z=c.z;
388
	}
388
	}
389
#else
389
#else
390
	Coordinate::Coordinate(const Coordinate& c);
390
	Coordinate(const Coordinate& c);
391
	Coordinate &operator=(const Coordinate &c);
391
	Coordinate &operator=(const Coordinate &c);
392
#endif
392
#endif
393
393
394
	Coordinate::Coordinate(double xNew, double yNew){
394
	Coordinate(double xNew, double yNew){
395
		x=xNew;
395
		x=xNew;
396
		y=yNew;
396
		y=yNew;
397
		z=DoubleNotANumber;
397
		z=DoubleNotANumber;
398
	}
398
	}
399
399
400
	void Coordinate::setCoordinate(const Coordinate& other) {
400
	void setCoordinate(const Coordinate& other) {
401
		x = other.x;
401
		x = other.x;
402
		y = other.y;
402
		y = other.y;
403
		z = other.z;
403
		z = other.z;
404
	}
404
	}
405
405
406
	bool Coordinate::equals2D(const Coordinate& other) const {
406
	bool equals2D(const Coordinate& other) const {
407
		if (x != other.x) {
407
		if (x != other.x) {
408
		return false;
408
		return false;
409
		}
409
		}
Lines 413-419 Link Here
413
		return true;
413
		return true;
414
	}
414
	}
415
415
416
	int Coordinate::compareTo(const Coordinate& other) const {
416
	int compareTo(const Coordinate& other) const {
417
		if (x < other.x) {
417
		if (x < other.x) {
418
		return -1;
418
		return -1;
419
		}
419
		}
Lines 429-450 Link Here
429
		return 0;
429
		return 0;
430
	}
430
	}
431
431
432
	bool Coordinate::equals3D(const Coordinate& other) const {
432
	bool equals3D(const Coordinate& other) const {
433
		return (x == other.x) && ( y == other.y) && ((z == other.z)||(ISNAN(z) && ISNAN(other.z)));
433
		return (x == other.x) && ( y == other.y) && ((z == other.z)||(ISNAN(z) && ISNAN(other.z)));
434
	}
434
	}
435
435
436
	void Coordinate::makePrecise(const PrecisionModel *precisionModel) {
436
	void makePrecise(const PrecisionModel *precisionModel) {
437
		x = precisionModel->makePrecise(x);
437
		x = precisionModel->makePrecise(x);
438
		y = precisionModel->makePrecise(y);
438
		y = precisionModel->makePrecise(y);
439
	}
439
	}
440
440
441
	double Coordinate::distance(const Coordinate& p) const {
441
	double distance(const Coordinate& p) const {
442
		double dx = x - p.x;
442
		double dx = x - p.x;
443
		double dy = y - p.y;
443
		double dy = y - p.y;
444
		return sqrt(dx * dx + dy * dy);
444
		return sqrt(dx * dx + dy * dy);
445
	}
445
	}
446
446
447
	int Coordinate::hashCode() {
447
	int hashCode() {
448
		//Algorithm from Effective Java by Joshua Bloch [Jon Aquino]
448
		//Algorithm from Effective Java by Joshua Bloch [Jon Aquino]
449
		int result = 17;
449
		int result = 17;
450
		result = 37 * result + hashCode(x);
450
		result = 37 * result + hashCode(x);
Lines 456-462 Link Here
456
	* Returns a hash code for a double value, using the algorithm from
456
	* Returns a hash code for a double value, using the algorithm from
457
	* Joshua Bloch's book <i>Effective Java</i>
457
	* Joshua Bloch's book <i>Effective Java</i>
458
	*/
458
	*/
459
	static int Coordinate::hashCode(double x) {
459
	static int hashCode(double x) {
460
		int64 f = (int64)(x);
460
		int64 f = (int64)(x);
461
		return (int)(f^(f>>32));
461
		return (int)(f^(f>>32));
462
	}
462
	}

Return to bug 126490