Tolerance.geometric_key

Tolerance.geometric_key(xyz, precision=None, sanitize=True)[source]

Compute the geometric key of a point.

Parameters:
xyzlist of float

The XYZ coordinates of the point.

precisionint, optional

The precision used when converting numbers to strings. Default is None, in which case self.precision is used.

sanitizebool, optional

If True, minus signs (“-”) will be removed from values that are equal to zero up to the given precision.

Returns:
str

The geometric key.

Raises:
ValueError

If the precision is zero.

Examples

>>> tol = Tolerance()
>>> tol.geometric_key([1.0, 2.0, 3.0])
'1.000,2.000,3.000'
>>> tol = Tolerance()
>>> tol.geometric_key([1.05725, 2.0195, 3.001], precision=3)
'1.057,2.019,3.001'
>>> tol = Tolerance()
>>> tol.geometric_key([1.0, 2.0, 3.0], precision=-1)
'1,2,3'
>>> tol = Tolerance()
>>> tol.geometric_key([1.0, 2.0, 3.0], precision=-3)
'0,0,0'
>>> tol = Tolerance()
>>> tol.geometric_key([1103, 205, 30145], precision=-3)
'1100,200,30100'