Tolerance.geometric_key_xy
- Tolerance.geometric_key_xy(xy, precision=None, sanitize=True)[source]
Compute the geometric key of a point in the XY plane.
- Parameters:
- xylist of float
The XY coordinates of the point.
- precisionint, optional
The precision used when converting numbers to strings. Default is
None
, in which caseself.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 in XY.
- Raises:
- ValueError
If the precision is zero.
Examples
>>> tol = Tolerance() >>> tol.geometric_key_xy([1.0, 2.0]) '1.000,2.000'
>>> tol = Tolerance() >>> tol.geometric_key_xy([1.05725, 2.0195], precision=3) '1.057,2.019'
>>> tol = Tolerance() >>> tol.geometric_key_xy([1.0, 2.0], precision=-1) '1,2'
>>> tol = Tolerance() >>> tol.geometric_key_xy([1.0, 2.0], precision=-3) '0,0'
>>> tol = Tolerance() >>> tol.geometric_key_xy([1103, 205], precision=-3) '1100,200'