Class: PrecisionModel

jsts.geom.PrecisionModel

new PrecisionModel()

Specifies the precision model of the Coordinates in a Geometry. In other words, specifies the grid of allowable points for all Geometrys.

The makePrecise method allows rounding a coordinate to a "precise" value; that is, one whose precision is known exactly.

Coordinates are assumed to be precise in geometries. That is, the coordinates are assumed to be rounded to the precision model given for the geometry. JTS input routines automatically round coordinates to the precision model before creating Geometries. All internal operations assume that coordinates are rounded to the precision model. Constructive methods (such as boolean operations) always round computed coordinates to the appropriate precision model.

Currently one type of precision model are supported:

  • FLOATING - represents full double precision floating point.

    Coordinates are represented internally as Java double-precision values. Since Java uses the IEEE-754 floating point standard, this provides 53 bits of precision.

    JSTS methods currently do not handle inputs with different precision models.

Source:

Members

(static) FIXED :string

Type:
  • string
Source:

(static) FLOATING :string

Type:
  • string
Source:

(static) FLOATING_SINGLE :string

Type:
  • string
Source:

Methods

compareTo(o)

Compares this PrecisionModel object with the specified object for order. A PrecisionModel is greater than another if it provides greater precision. The comparison is based on the value returned by the #getMaximumSignificantDigits method. This comparison is not strictly accurate when comparing floating precision models to fixed models; however, it is correct when both models are either floating or fixed.
Parameters:
Name Type Description
o the PrecisionModel with which this PrecisionModel is being compared.
Source:
Returns:
a negative integer, zero, or a positive integer as this PrecisionModel is less than, equal to, or greater than the specified PrecisionModel.

getScale()

Returns the scale factor used to specify a fixed precision model. The number of decimal places of precision is equal to the base-10 logarithm of the scale factor. Non-integral and negative scale factors are supported. Negative scale factors indicate that the places of precision is to the left of the decimal point.
Source:
Returns:
the scale factor for the fixed precision model.

getType() → {string}

Source:
Returns:
always jsts.geom.PrecisionModel.FLOATING.
Type
string

isFloating() → {boolean}

Tests whether the precision model supports floating point
Source:
Returns:
if the precision model supports floating point.
Type
boolean

makePrecise()

Rounds a numeric value to the PrecisionModel grid. Asymmetric Arithmetic Rounding is used, to provide uniform rounding behaviour no matter where the number is on the number line.

This method has no effect on NaN values.

Note: Java's Math#rint uses the "Banker's Rounding" algorithm, which is not suitable for precision operations elsewhere in JTS.

Source:

makePrecise2()

Rounds a Coordinate to the PrecisionModel grid.
Source: