/usr/include/geos/geom/Coordinate.inl is in libgeos-dev 3.2.2-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | /**********************************************************************
* $Id: Coordinate.inl 2554 2009-06-06 21:14:51Z strk $
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
* Copyright (C) 2005-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************/
#ifndef GEOS_GEOM_COORDINATE_INL
#define GEOS_GEOM_COORDINATE_INL
#include <geos/geom/Coordinate.h>
//#include <geos/geom/PrecisionModel.h> // we need it for makePrecise, possibly to be obsoleted
#include <geos/platform.h> // for DoubleNotANumber
#include <cassert>
#include <cmath>
namespace geos {
namespace geom { // geos::geom
INLINE void
Coordinate::setNull()
{
x=DoubleNotANumber;
y=DoubleNotANumber;
z=DoubleNotANumber;
}
INLINE Coordinate&
Coordinate::getNull()
{
return nullCoord;
}
INLINE bool
Coordinate::isNull() const
{
return (ISNAN(x) && ISNAN(y) && ISNAN(z));
}
INLINE
Coordinate::~Coordinate()
{
}
INLINE
Coordinate::Coordinate(double xNew, double yNew, double zNew)
:
x(xNew),
y(yNew),
z(zNew)
{}
#if 0
INLINE
Coordinate::Coordinate(const Coordinate& c)
:
x(c.x),
y(c.y),
z(c.z)
{
}
INLINE Coordinate&
Coordinate::operator=(const Coordinate &c)
{
if ( this == &c ) return *this;
x=c.x;
y=c.y;
z=c.z;
return *this;
}
#endif
INLINE bool
Coordinate::equals2D(const Coordinate& other) const
{
if (x != other.x) return false;
if (y != other.y) return false;
return true;
}
INLINE bool
Coordinate::equals(const Coordinate& other) const
{
return equals2D(other);
}
INLINE int
Coordinate::compareTo(const Coordinate& other) const
{
if (x < other.x) return -1;
if (x > other.x) return 1;
if (y < other.y) return -1;
if (y > other.y) return 1;
return 0;
}
INLINE bool
Coordinate::equals3D(const Coordinate& other) const
{
return (x == other.x) && ( y == other.y) &&
((z == other.z)||(ISNAN(z) && ISNAN(other.z)));
}
#if 0
INLINE void
Coordinate::makePrecise(const PrecisionModel *pm)
{
x = pm->makePrecise(x);
y = pm->makePrecise(y);
}
#endif
INLINE double
Coordinate::distance(const Coordinate& p) const
{
double dx = x - p.x;
double dy = y - p.y;
return std::sqrt(dx * dx + dy * dy);
}
INLINE int
Coordinate::hashCode() const
{
//Algorithm from Effective Java by Joshua Bloch [Jon Aquino]
int result = 17;
result = 37 * result + hashCode(x);
result = 37 * result + hashCode(y);
return result;
}
/*static*/
INLINE int
Coordinate::hashCode(double d)
{
int64 f = (int64)(d);
return (int)(f^(f>>32));
}
INLINE bool
CoordinateLessThen::operator()(const Coordinate* a, const Coordinate* b) const
{
if (a->compareTo(*b)<0) return true;
else return false;
}
INLINE bool
CoordinateLessThen::operator()(const Coordinate& a, const Coordinate& b) const
{
if (a.compareTo(b)<0) return true;
else return false;
}
INLINE bool
operator==(const Coordinate& a, const Coordinate& b)
{
return a.equals2D(b);
}
INLINE bool
operator!=(const Coordinate& a, const Coordinate& b)
{
return ! a.equals2D(b);
}
} // namespace geos::geom
} // namespace geos
#endif // GEOS_GEOM_COORDINATE_INL
|