NetTopologySuite
|
Specifies the precision model of the Coordinate
s in a Geometry
. In other words, specifies the grid of allowable points for all Geometry
s.
More...
Public Member Functions | |
PrecisionModel () | |
Creates a PrecisionModel with a default precision of Floating. More... | |
PrecisionModel (PrecisionModels modelType) | |
Creates a PrecisionModel that specifies an explicit precision model type. If the model type is Fixed the scale factor will default to 1. More... | |
PrecisionModel (double scale, double offsetX, double offsetY) | |
Creates a PrecisionModel that specifies Fixed precision. Fixed-precision coordinates are represented as precise internal coordinates, which are rounded to the grid defined by the scale factor. More... | |
PrecisionModel (double scale) | |
Creates a PrecisionModel that specifies Fixed precision. Fixed-precision coordinates are represented as precise internal coordinates, which are rounded to the grid defined by the scale factor. More... | |
PrecisionModel (PrecisionModel pm) | |
Copy constructor to create a new PrecisionModel from an existing one. More... | |
override int | GetHashCode () |
Return HashCode. More... | |
void | ToInternal (Coordinate cexternal, Coordinate cinternal) |
Sets internal to the precise representation of external . More... | |
Coordinate | ToInternal (Coordinate cexternal) |
Returns the precise representation of external . More... | |
Coordinate | ToExternal (Coordinate cinternal) |
Returns the external representation of internal . More... | |
void | ToExternal (Coordinate cinternal, Coordinate cexternal) |
Sets external to the external representation of internal . More... | |
double | MakePrecise (double val) |
Rounds a numeric value to the PrecisionModel grid. Symmetric Arithmetic Rounding is used, to provide uniform rounding behaviour no matter where the number is on the number line. More... | |
void | MakePrecise (Coordinate coord) |
Rounds a Coordinate to the PrecisionModel grid. More... | |
override string | ToString () |
override bool | Equals (object other) |
bool | Equals (IPrecisionModel otherPrecisionModel) |
int | CompareTo (object 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. More... | |
int | CompareTo (IPrecisionModel other) |
Static Public Member Functions | |||||
static IPrecisionModel | MostPrecise (IPrecisionModel pm1, IPrecisionModel pm2) | ||||
Determines which of two IPrecisionModels is the most precise /summary>
| |||||
static bool | operator== (PrecisionModel obj1, PrecisionModel obj2) | ||||
static bool | operator!= (PrecisionModel obj1, PrecisionModel obj2) | ||||
Public Attributes | |
const double | MaximumPreciseValue = 9007199254740992.0 |
The maximum precise value representable in a double. Since IEE754 double-precision numbers allow 53 bits of mantissa, the value is equal to 2^53 - 1. This provides almost 16 decimal digits of precision. More... | |
Properties | |
bool | IsFloating [get] |
Tests whether the precision model supports floating point. More... | |
int | MaximumSignificantDigits [get] |
Returns the maximum number of significant digits provided by this precision model. Intended for use by routines which need to print out precise values. More... | |
double | Scale [get, set] |
Returns the scale factor used to specify a fixed precision model. More... | |
PrecisionModels | PrecisionModelType [get] |
Gets the type of this PrecisionModel. More... | |
double | OffsetX [get] |
Returns the x-offset used to obtain a precise coordinate. More... | |
double | OffsetY [get] |
Returns the y-offset used to obtain a precise coordinate. More... | |
Specifies the precision model of the Coordinate
s in a Geometry
. In other words, specifies the grid of allowable points for all Geometry
s.
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 point. NTS 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 bool operations) always round computed coordinates to the appropriate precision model. Currently three types of precision model are supported:
Floating: represents full double precision floating point. This is the default precision model used in NTS FloatingSingle: represents single precision floating point. Fixed: represents a model with a fixed number of decimal places.
A Fixed Precision Model is specified by a scale factor. The scale factor specifies the size of the grid which numbers are rounded to. Input coordinates are mapped to fixed coordinates according to the following equations:
For example, to specify 3 decimal places of precision, use a scale factor of 1000. To specify -3 decimal places of precision (i.e. rounding to the nearest 1000), use a scale factor of 0.001.
Coordinates are represented internally as Java double-precision values. Since .NET uses the IEEE-394 floating point standard, this provides 53 bits of precision. (Thus the maximum precisely representable integer is 9,007,199,254,740,992 - or almost 16 decimal digits of precision).
NTS binary methods currently do not handle inputs which have different precision models. The precision model of any constructed geometric value is undefined.
NetTopologySuite.Geometries.PrecisionModel.PrecisionModel | ( | ) |
Creates a PrecisionModel
with a default precision of Floating.
NetTopologySuite.Geometries.PrecisionModel.PrecisionModel | ( | PrecisionModels | modelType | ) |
Creates a PrecisionModel
that specifies an explicit precision model type. If the model type is Fixed the scale factor will default to 1.
modelType | The type of the precision model. |
NetTopologySuite.Geometries.PrecisionModel.PrecisionModel | ( | double | scale, |
double | offsetX, | ||
double | offsetY | ||
) |
Creates a PrecisionModel
that specifies Fixed precision. Fixed-precision coordinates are represented as precise internal coordinates, which are rounded to the grid defined by the scale factor.
scale | Amount by which to multiply a coordinate after subtracting the offset, to obtain a precise coordinate |
offsetX | Not used. |
offsetY | Not used. |
NetTopologySuite.Geometries.PrecisionModel.PrecisionModel | ( | double | scale | ) |
Creates a PrecisionModel
that specifies Fixed precision. Fixed-precision coordinates are represented as precise internal coordinates, which are rounded to the grid defined by the scale factor.
scale | Amount by which to multiply a coordinate after subtracting the offset, to obtain a precise coordinate. |
NetTopologySuite.Geometries.PrecisionModel.PrecisionModel | ( | PrecisionModel | pm | ) |
Copy constructor to create a new PrecisionModel
from an existing one.
pm |
int NetTopologySuite.Geometries.PrecisionModel.CompareTo | ( | object | 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.
o | The PrecisionModel with which this PrecisionModel is being compared. |
PrecisionModel
is less than, equal to, or greater than the specified PrecisionModel
. int NetTopologySuite.Geometries.PrecisionModel.CompareTo | ( | IPrecisionModel | other | ) |
other |
override bool NetTopologySuite.Geometries.PrecisionModel.Equals | ( | object | other | ) |
other |
bool NetTopologySuite.Geometries.PrecisionModel.Equals | ( | IPrecisionModel | otherPrecisionModel | ) |
otherPrecisionModel |
override int NetTopologySuite.Geometries.PrecisionModel.GetHashCode | ( | ) |
Return HashCode.
double NetTopologySuite.Geometries.PrecisionModel.MakePrecise | ( | double | val | ) |
Rounds a numeric value to the PrecisionModel grid. Symmetric 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
val |
void NetTopologySuite.Geometries.PrecisionModel.MakePrecise | ( | Coordinate | coord | ) |
Rounds a Coordinate to the PrecisionModel grid.
coord |
|
static |
obj1 | |
obj2 |
|
static |
obj1 | |
obj2 |
Coordinate NetTopologySuite.Geometries.PrecisionModel.ToExternal | ( | Coordinate | cinternal | ) |
Returns the external representation of internal
.
cinternal | The original coordinate. |
internal
. void NetTopologySuite.Geometries.PrecisionModel.ToExternal | ( | Coordinate | cinternal, |
Coordinate | cexternal | ||
) |
Sets external
to the external representation of internal
.
cinternal | The original coordinate. |
cexternal | The coordinate whose values will be changed to the external representation of internal . |
void NetTopologySuite.Geometries.PrecisionModel.ToInternal | ( | Coordinate | cexternal, |
Coordinate | cinternal | ||
) |
Sets internal
to the precise representation of external
.
cexternal | The original coordinate. |
cinternal | The coordinate whose values will be changed to the precise representation of external . |
Coordinate NetTopologySuite.Geometries.PrecisionModel.ToInternal | ( | Coordinate | cexternal | ) |
Returns the precise representation of external
.
cexternal | The original coordinate. |
external
override string NetTopologySuite.Geometries.PrecisionModel.ToString | ( | ) |
const double NetTopologySuite.Geometries.PrecisionModel.MaximumPreciseValue = 9007199254740992.0 |
The maximum precise value representable in a double. Since IEE754 double-precision numbers allow 53 bits of mantissa, the value is equal to 2^53 - 1. This provides almost 16 decimal digits of precision.
|
get |
Tests whether the precision model supports floating point.
true
if the precision model supports floating point.
|
get |
Returns the maximum number of significant digits provided by this precision model. Intended for use by routines which need to print out precise values.
|
get |
Returns the x-offset used to obtain a precise coordinate.
|
get |
Returns the y-offset used to obtain a precise coordinate.
|
get |
Gets the type of this PrecisionModel.
|
getset |
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.