ladybug_geometry.util module¶
Utility functions used by several different geometry methods.
- ladybug_geometry.util.coordinates_hash(point, tolerance)[source]¶
Convert XY coordinates of a Point2D into a string useful for hashing.
Points that are co-located within the tolerance will receive the same string value from this function, which helps convert line segments that contain duplicated vertex references them into a singular network object where co-located vertices are referenced only once.
- Parameters:
point – A Point2D object.
tolerance – A number for the smallest difference in coordinate values considered meaningful.
- Returns:
A string of rounded coordinates.
- ladybug_geometry.util.coordinates_hash_3d(point, tolerance)[source]¶
Convert XY coordinates of a Point3D into a string useful for hashing.
Points that are co-located within the tolerance will receive the same string value from this function, which helps convert line segments that contain duplicated vertex references them into a singular network object where co-located vertices are referenced only once.
- Parameters:
point – A Point3D object.
tolerance – A number for the smallest difference in coordinate values considered meaningful.
- Returns:
A string of rounded coordinates.
- ladybug_geometry.util.rounding_tolerance(tolerance)[source]¶
Get the number of digits to round coordinate value to given a tolerance.
To get coordinate values that are perfectly equal to one another within floating point tolerance using this method, the outputs should be used in the following way.
rounded_coordinate_value = base * round(coordinate_value / base, rtol)
- Parameters:
tolerance – A number for the smallest difference in coordinate values considered meaningful.
- Returns:
A tuple with two elements
rtol: An integer for the number of digits to round values to.
base: A number to account for cases where the input tolerance is not base 10.