ArcCarrier

class ArcCarrier(center: ndarray[3], radius: float, attributes_set: Set[ElementAttributes] | None = None, filled: bool = False)

An ArcCarrier represents the equation of a circle.

Parameters:
  • center – The center of the circle.

  • radius – The radius of the circle.

  • attributes_set – The set of ElementAttributes present in elements on this carrier.

  • filled – Whether or not this is the carrier of a Circle.

Methods

contains_point

Return True if point is coincident to this carrier.

equivalent_to

Return True if this carrier is equivalent to another.

find_intersections

Find all intersection points between this carrier and another.

from_points

Create an ArcCarrier from the points used to define an Arc.

get_point_at_angle

Get the point at a specific angle from 0 on this carrier.

group_elements_by_attribute

Group elements by ElementAttributes.

group_elements_by_coequality

Group elements by coequality.

maximize

Maximize a group of elements.

contains_point(point: ArrayLike) bool

Return True if point is coincident to this carrier. Fuzzy with tolerance.

equivalent_to(other: ArcCarrier) bool

Return True if this carrier is equivalent to another. Fuzzy with tolerance.

find_intersections(other: Carrier) ndarray

Find all intersection points between this carrier and another. The output should be a numpy array of shape (n, 3) where each row is an intersection point. If there are no intersections, return np.zeros((0, 3)).

classmethod from_points(center: ndarray, start: ndarray[3], midpoint: ndarray[3], end: ndarray[3]) ArcCarrier

Create an ArcCarrier from the points used to define an Arc.

get_point_at_angle(angle: float) ndarray[3]

Get the point at a specific angle from 0 on this carrier.

classmethod group_elements_by_attribute(elements: Iterable[E_co]) Dict[ElementAttributes, List[E_co]]

Group elements by ElementAttributes.

Parameters:

elements – Elements to group.

Returns:

A mapping of ElementAttributes to lists of ShapeElement instances that have the attributes used as the key in the map.

classmethod group_elements_by_coequality(elements: Iterable[E_co]) List[List[E_co]]

Group elements by coequality. Two ShapeElement instances are considered coequal if they have spatially equivalent carriers ( checked with equivalent_to() with match_attributes=False).

Parameters:

elements – Elements to group.

Returns:

A list of elements grouped by coequality. Each entry in this list is a list of coequal elements.

classmethod maximize(elements: Sequence[E_co]) List[E_co]

Maximize a group of elements. Elements are considered maximal if there are no two elements such that coincident_with() returns True.

Specifically, if two elements visually appear to be one, replace the two with the one element they appear to be.

Maximization also performs calibration, which involves finding the “average” carrier of each set of coequal elements and projecting the resulting maximal elements onto this average carrier. This helps account for floating point error in the long run.