core.utils
Core utilities.
Classes
An |
Functions
|
Get the angle from v1 to v2 (in radians). |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Join angle ranges, assuming they overlap. |
|
Returns |
|
Returns a new list made from |
|
Normalize an angle to range [0, 2 * pi]. |
|
Returns |
|
Returns |
|
Given a numpy array of shape |
Module attributes
2 * pi. |
- angle_range_contains(range_: Tuple[float, float], angle: float) bool
Returns
True
ifangle
is contained inrange_
(modshapemachine.core.utils.tau
). Fuzzy withshapemachine.core.utils.tolerance
.
- angles_similar(angle1: float, angle2: float) bool
Returns
True
if two angles are equivalent (mod pi). Fuzzy withshapemachine.core.utils.tolerance
.
- are_points_collinear(v1: ArrayLike, v2: ArrayLike, v3: ArrayLike) bool
Returns
True
if pointsv1
,v2
, andv3
are collinear. Fuzzy withshapemachine.core.utils.tolerance
.
- are_points_counterclockwise(v1: ArrayLike, v2: ArrayLike, v3: ArrayLike) bool
Returns
True
if pointsv1
,v2
, andv3
are arranged in a counter-clockwise fashion.
- join_angle_ranges(range1: Tuple[float, float], range2: Tuple[float, float]) Tuple[float, float]
Join angle ranges, assuming they overlap. Fuzzy with
shapemachine.core.utils.tolerance
.
- list_fuzzy_subset(list1: List[float], list2: List[float]) bool
Returns
True
if every element inlist1
has a unique match inlist2
.
- list_fuzzy_union(list1: List[float], list2: List[float]) List[float]
Returns a new list made from
list1
and all elements inlist2
not already present in the new list. Note that this only keeps duplicates from the first list.
- points_close(p1: ndarray, p2: ndarray) bool
Returns
True
if the distance between two points is less thanshapemachine.core.utils.tolerance
.
- range_contains(range_: Tuple[float, float], x: float) bool
Returns
True
ifx
is contained inrange_
. Fuzzy withshapemachine.core.utils.tolerance
.
- reduce_points(points: ndarray) Iterator[Tuple[ndarray, Set[int]]]
Given a numpy array of shape
(n, 3)
, create clusters of rows such that each row in the cluster is close to another row in the group. Compute the center of each cluster, and yield that center along with the indices of the rows in the cluster.- Parameters:
points – An
(n, 3)
numpy array.- Returns:
An iterator that yields (center, cluster indices) pairs