smarts.core.shape module

smarts.core.shape.distance_point_to_line(point: Point, line_start: Point, line_end: Point, perpendicular: bool = False) float | int[source]

Return the minimum distance between point and the line (line_start, line_end)

smarts.core.shape.distance_point_to_polygon(point: Point, polygon: List[Point], perpendicular: bool = False) float | int[source]

Return the minimum distance between point and polygon

smarts.core.shape.euclidean_distance(p1: Point, p2: Point) float[source]

The distance taking measuring a direct line between p1 and p2.

smarts.core.shape.line_offset_with_minimum_distance_to_point(point: Point, line_start: Point, line_end: Point, perpendicular: bool = False) float | int[source]

Return the offset from line (line_start, line_end) where the distance to point is minimal

smarts.core.shape.offset_along_shape(point: Point, shape: List[Point]) float | int[source]

An offset on a shape defined as a vector path determined by the closest location on the path to the point.

smarts.core.shape.polygon_offset_with_minimum_distance_to_point(point: Point, polygon: List[Point]) float | int[source]

Return the offset and the distance from the polygon start where the distance to the point is minimal

smarts.core.shape.position_at_offset(p1: Point, p2: Point, offset: float) Point | None[source]

A point between p1 and p2 given an offset less than the distance between p1 and p2.

smarts.core.shape.position_at_shape_offset(shape: List[Point], offset: float) Point | None[source]

A point defined as the offset into a shape defined as vector path.