kumiki.footprint¶
Flat import path
kumiki/__init__.py re-exports everything on this page via from kumiki import *, so every name below is also available directly as kumiki.Footprint -- you do not need to import from the submodule path shown in the heading above.
kumiki.footprint
¶
Footprint class for Kumiki - Represents the 2D footprint of a structure
Footprint
dataclass
¶
A support class representing the footprint of the structure in the XY plane
__post_init__
¶
Validate corners. Args: corners: Tuple of points defining the corners, last point connects to first
Source code in kumiki/footprint.py
sides
¶
Returns a list of sides (line segments) connecting consecutive corners.
Returns:
| Type | Description |
|---|---|
List[Tuple[V2, V2]]
|
List of tuples, each containing two points (start, end) representing a side |
Source code in kumiki/footprint.py
is_valid
¶
Checks if the footprint is valid. A valid footprint has at least 3 corners and no intersecting sides.
Returns:
| Type | Description |
|---|---|
bool
|
True if valid, False otherwise |
Source code in kumiki/footprint.py
contains_point
¶
contains_point(point: V2) -> bool
Check if a point is contained within the footprint boundary using ray casting algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
V2
|
2D point to check |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if point is inside or on the boundary, False otherwise |
Source code in kumiki/footprint.py
nearest_corner
¶
Find the nearest corner to a given point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
V2
|
2D point to measure from |
required |
Returns:
| Type | Description |
|---|---|
Tuple[int, V2]
|
Tuple of (index, corner) where index is the corner index and corner is the V2 point |
Source code in kumiki/footprint.py
nearest_boundary
¶
Find the nearest side (line segment) to a given point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
V2
|
2D point to measure from |
required |
Returns:
| Type | Description |
|---|---|
Tuple[int, Tuple[V2, V2], Numeric]
|
Tuple of (index, side, distance) where: - index is the side index - side is a tuple (start_corner, end_corner) - distance is the perpendicular distance to the side |
Source code in kumiki/footprint.py
get_inward_normal
¶
get_inward_normal(side_index: int) -> Direction3D
Get the inward-pointing normal vector for a boundary side.
The inward normal is perpendicular to the boundary side and points toward the interior of the footprint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
side_index
|
int
|
Index of the boundary side |
required |
Returns:
| Type | Description |
|---|---|
Direction3D
|
Direction3D representing the normalized 3D inward normal vector |
Source code in kumiki/footprint.py
nearest_boundary_from_line
¶
Find the nearest boundary side to a given line segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line_start
|
V2
|
Start point of the line segment (2D) |
required |
line_end
|
V2
|
End point of the line segment (2D) |
required |
Returns:
| Type | Description |
|---|---|
Tuple[int, Tuple[V2, V2], Numeric]
|
Tuple of (index, side, distance) where: - index is the side index - side is a tuple (start_corner, end_corner) - distance is the minimum distance between the line segment and the boundary |