geometric_key_xy

compas.utilities.geometric_key_xy(xy, precision=None, sanitize=True)[source]

Convert XY coordinates to a string that can be used as a dict key.

Parameters
  • xy (list[float]) – The XY(Z) coordinates.

  • precision (str, optional) – A formatting option that specifies the precision of the individual numbers in the string. Supported values are any float precision (e.g. '3f'), or decimal integer ('d'). Default is None, inwhich case the global precision setting will be used (compas.PRECISION).

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

Returns

str – The string representation of the given coordinates.

See also

geometric_key

Examples

>>> from math import pi
>>> geometric_key_xy([pi, pi, pi])
'3.142,3.142'