GEOS  3.9.0dev
Namespaces | Functions | Variables
geos Namespace Reference

Basic namespace for all GEOS functionalities. More...

Namespaces

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

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);

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