citam.engine.map.utils
¶
Module Contents¶
Functions¶
|
For a given wall, find other walls in same space that are |
|
Check if a wall is valid to be apart of an aisle. |
|
Given the svg path of the boundaries of a space, find all pairs of 2 walls |
|
Verify if a wall already belongs to an aisle. |
Find the center point and the width of an aisle. |
|
|
Verify that 2 walls form an aisle. Works by verifying that the center point |
|
Computes the bounding box of the floorplan given by all its walls and |
|
Given an aisle (tuple of two walls), add new walls to create a closed |
|
Verify if two walls overlap. |
|
Extract the end points of a wall returned as integer coordinates. |
|
Verify that two walls are collinear by making sure all end points are or |
- citam.engine.map.utils.find_closest_parallel_wall(space_boundaries: List[svgpathtools.Line], ref_wall: svgpathtools.Line) svgpathtools.Line [source]¶
For a given wall, find other walls in same space that are parallel to this (with some x or y overlap) and return the closest wall.
- Parameters:
space_boundaries (List[Line]) – The hallway object under consideration.
ref_wall (Line) – Reference wall for which to find closest parallel wall.
- Returns:
The closest parallel wall
- Return type:
Line
- citam.engine.map.utils.is_wall_valid_for_aisle(no_repeat: bool, wall: Optional[svgpathtools.Line], aisles: List[Tuple[svgpathtools.Line, svgpathtools.Line]]) bool [source]¶
Check if a wall is valid to be apart of an aisle.
- Parameters:
no_repeat (bool) – Whether to consider walls that are already part of an aisle or not.
wall (Optional[Line]) – the wall of interst
aisles (List[Tuple[Line, Line]]) – the list of all currently identified aisles.
- Returns:
whether this is a valid wall or not.
- Return type:
bool
- citam.engine.map.utils.find_aisles(space: citam.engine.map.space.Space, valid_boundaries: List[svgpathtools.Line], no_repeat=True) List[Tuple[svgpathtools.Line, svgpathtools.Line]] [source]¶
- Given the svg path of the boundaries of a space, find all pairs of 2 walls
that define an aisle (parallel walls with navigable space between them).
- Parameters:
space (Space) – The space of interest.
valid_boundaries (List[Line]) – List of valid boundaries to consider.
no_repeat (bool, optional) – A wall cannot belong to two different aisles, defaults to True
- Returns:
[description]
- Return type:
List[Tuple[Line, Line]]
- citam.engine.map.utils.is_this_wall_part_of_an_aisle(wall: svgpathtools.Line, aisles: List[Tuple[svgpathtools.Line, svgpathtools.Line]]) bool [source]¶
Verify if a wall already belongs to an aisle.
- Parameters:
wall (Line) – The wall of interest.
aisles (List[Tuple[Line, Line]]) – List of aisles to check.
- Returns:
Whether this wall is part of an aisle or not.
- Return type:
bool
- citam.engine.map.utils.get_aisle_center_point_and_width(aisle: Tuple[svgpathtools.Line, svgpathtools.Line]) Tuple[citam.engine.map.point.Point, float] [source]¶
Find the center point and the width of an aisle.
- Parameters:
aisle (Tuple[Line, Line]) – The aisle of interest.
- Returns:
The center point and width of the aisle.
- Return type:
Tuple[Point, float]
- citam.engine.map.utils.is_this_an_aisle(wall1: svgpathtools.Line, wall2: svgpathtools.Line, space: citam.engine.map.space.Space) bool [source]¶
- Verify that 2 walls form an aisle. Works by verifying that the center point
of this aisle is part of the same space. Note that this is a rather weak definition. Use accordingly.
- Parameters:
wall1 (Line) – The first wall.
wall2 (Line) – The second wall.
space (Space) – The space where this aisle would presumably fall.
- Returns:
Whether the two walls form an aisle or not.
- Return type:
bool
- citam.engine.map.utils.compute_bounding_box(walls: List[svgpathtools.Line]) Tuple[float, float, float, float] [source]¶
Computes the bounding box of the floorplan given by all its walls and return the min and max x and y values.
- Parameters:
walls (List[Line]) – List of all the walls to consider.
- Returns:
The minimum and the maximum x and y values
- Return type:
Tuple[float, float, float, float]
- citam.engine.map.utils.generate_closed_path_for_aisle(aisle: Tuple[svgpathtools.Line, svgpathtools.Line]) svgpathtools.Path [source]¶
Given an aisle (tuple of two walls), add new walls to create a closed path for this aisle.
- Parameters:
aisle (Tuple[Line, Line]) – Aisle of interest.
- Returns:
Closed path for this aisle
- Return type:
Path
- citam.engine.map.utils.do_walls_overlap(wall1: svgpathtools.Line, wall2: svgpathtools.Line, max_distance: float = 1.0) bool [source]¶
Verify if two walls overlap.
Uses the start and end points of each line and verifies if either one of them falls on the other segment. If so, it checks if all 4 points are collinear and returns True if the dot product and the distance between the 2 walls are respectively ~1.0 and ~0.0.
- Parameters:
wall1 (Line) – line object corresponding to wall 1
wall2 (Line) – line object corresponding to wall 2
max_distance (float, optional) – the max distance beyond which the walls are not considered overlapping, defaults to 1.0
- Returns:
Whether the walls overlap or not
- Return type:
bool
- citam.engine.map.utils.extract_end_points(wall: svgpathtools.Line) Tuple[citam.engine.map.point.Point, citam.engine.map.point.Point] [source]¶
Extract the end points of a wall returned as integer coordinates.
- citam.engine.map.utils.check_for_collinearity(wall1: svgpathtools.Line, wall2: svgpathtools.Line, max_distance: float) bool [source]¶
Verify that two walls are collinear by making sure all end points are or by measuring the distance and angle between the walls.
- Parameters:
wall1 (Line) – The first wall
wall2 (Line) – The second wall
max_distance (float) – The max distance to consider them to be collinear
- Returns:
Whether they are collinear or not
- Return type:
bool