GEOS 3.14.0dev
Namespaces | Functions | Variables
geos Namespace Reference

Basic namespace for all GEOS functionalities. More...

Namespaces

namespace  algorithm
 Contains classes and interfaces implementing fundamental computational geometry algorithms.
 
namespace  geom
 
namespace  geomgraph
 Contains classes that implement topology graphs.
 
namespace  index
 Provides classes for various kinds of spatial indexes.
 
namespace  io
 Contains the interfaces for converting JTS objects to and from other formats.
 
namespace  linearref
 Contains classes and interfaces implementing linear referencing on linear geometries.
 
namespace  noding
 Classes to compute nodings for arrangements of line segments and line segment sequences.
 
namespace  operation
 Provides classes for implementing operations on geometries.
 
namespace  planargraph
 Contains classes to implement a planar graph data structure.
 
namespace  precision
 Provides classes for manipulating the precision model of Geometries.
 
namespace  simplify
 Classes which implement algorithms for simplifying or generalizing geometries.
 
namespace  triangulate
 Classes to compute Delaunay triangulations.
 
namespace  util
 Utility classes for GEOS.
 

Functions

template<class T >
void ignore_unused_variable_warning (T const &)
 

Variables

constexpr double MATH_PI = 3.14159265358979323846
 
constexpr double DoubleNotANumber = std::numeric_limits<double>::quiet_NaN()
 
constexpr double DoubleMax = (std::numeric_limits<double>::max)()
 
constexpr double DoubleInfinity = (std::numeric_limits<double>::infinity)()
 
constexpr double DoubleNegInfinity = (-(std::numeric_limits<double>::infinity)())
 
constexpr double DoubleEpsilon = std::numeric_limits<double>::epsilon()
 
constexpr std::size_t NO_COORD_INDEX = std::numeric_limits<std::size_t>::max()
 
constexpr std::size_t INDEX_UNKNOWN = std::numeric_limits<std::size_t>::max()
 

Detailed Description

Basic namespace for all GEOS functionalities.

Implements extended-precision floating-point numbers which maintain 106 bits (approximately 30 decimal digits) of precision.

A DoubleDouble uses a representation containing two double-precision values. A number x is represented as a pair of doubles, x.hi and x.lo, such that the number represented by x is x.hi + x.lo, where

   |x.lo| <= 0.5*ulp(x.hi)

and ulp(y) means "unit in the last place of y". The basic arithmetic operations are implemented using convenient properties of IEEE-754 floating-point arithmetic.

The range of values which can be represented is the same as in IEEE-754. The precision of the representable numbers is twice as great as IEEE-754 double precision.

The correctness of the arithmetic algorithms relies on operations being performed with standard IEEE-754 double precision and rounding. This is the Java standard arithmetic model, but for performance reasons Java implementations are not constrained to using this standard by default. Some processors (notably the Intel Pentium architecture) perform floating point operations in (non-IEEE-754-standard) extended-precision. A JVM implementation may choose to use the non-standard extended-precision as its default arithmetic mode. To prevent this from happening, this code uses the Java strictfp modifier, which forces all operations to take place in the standard IEEE-754 rounding model.

The API provides both a set of value-oriented operations and a set of mutating operations. Value-oriented operations treat DoubleDouble values as immutable; operations on them return new objects carrying the result of the operation. This provides a simple and safe semantics for writing DoubleDouble expressions. However, there is a performance penalty for the object allocations required. The mutable interface updates object values in-place. It provides optimum memory performance, but requires care to ensure that aliasing errors are not created and constant values are not changed.

For example, the following code example constructs three DD instances: two to hold the input values and one to hold the result of the addition.

    DD a = new DD(2.0);
    DD b = new DD(3.0);
    DD c = a.add(b);

In contrast, the following approach uses only one object:

    DD a = new DD(2.0);
    a.selfAdd(3.0);

<p<blockquote>‍

This implementation uses algorithms originally designed variously by Knuth, Kahan, Dekker, and Linnainmaa. Douglas Priest developed the first C implementation of these techniques. Other more recent C++ implementation are due to Keith M. Briggs and David Bailey et al.

References

Author
Martin Davis