ed.volume¶
Classes¶
Represents a volume of an entity |
|
Represents a box shaped volume |
|
Represents a composite box shaped volume |
|
Represents a volume with a certain offset from the convex hull of the entity |
Functions¶
Creates a dict mapping strings to Volumes from the EntityInfo data dictionary |
|
Module Contents¶
- class ed.volume.Volume[source]¶
Bases:
ed.util.equal_hash_mixin.EqualHashMixin
Represents a volume of an entity
Points are defined relative to the object they belong to
Constructor
- property center_point: PyKDL.Vector¶
Get the center of the Volume
- Return type:
- abstract contains(point, padding=0)[source]¶
Checks if the point is inside this volume
- Parameters:
point (PyKDL.Vector) – kdl Vector w.r.t. the same frame as this volume
padding (float) – Padding to take into account. Positive values make the volume bigger, negative values smaller.
- Returns:
True if inside, False otherwise
- Return type:
- class ed.volume.BoxVolume(min_corner, max_corner)[source]¶
Bases:
Volume
Represents a box shaped volume
Constructor
Points are defined relative to the object they belong to
- Parameters:
min_corner (PyKDL.Vector) – Vector with the minimum bounding box corner
max_corner (PyKDL.Vector) – Vector with the maximum bounding box corner
- _min_corner¶
- _max_corner¶
- _calc_center_point()[source]¶
Calculate where the center of the box is located
>>> b = BoxVolume(kdl.Vector(0,0,0), kdl.Vector(1,1,1)) >>> b.center_point [ 0.5, 0.5, 0.5]
- Return type:
- _calc_size()[source]¶
Calculate the size of a volume
>>> BoxVolume(kdl.Vector(0, 0, 0), kdl.Vector(1, 1, 1)).size 1.0 >>> BoxVolume(kdl.Vector(0, 0, 0), kdl.Vector(10, 10, 0.1)).size 10.0 >>> BoxVolume(kdl.Vector(0, 0, 0), kdl.Vector(1, 1, 10)).size 10.0
- Return type:
- property min_corner: PyKDL.Vector¶
- Return type:
- property max_corner: PyKDL.Vector¶
- Return type:
- property bottom_area: List[PyKDL.Vector]¶
- Return type:
List[PyKDL.Vector]
- contains(point, padding=0)[source]¶
Checks if the point is inside this volume
>>> b = BoxVolume(kdl.Vector(0,0,0), kdl.Vector(1,1,1)) >>> b.contains(kdl.Vector(0.1, 0.1, 0.1)) True >>> b.contains(kdl.Vector(0.1, 0.1, 0.1), padding=0.2) True >>> b.contains(kdl.Vector(0.1, 0.1, 0.1), padding=-0.2) False >>> b.contains(kdl.Vector(-0.1, -0.1, -0.1)) False >>> b.contains(kdl.Vector(-0.1, -0.1, -0.1), padding=0.2) True >>> b.contains(kdl.Vector(-0.1, -0.1, -0.1), padding=-0.2) False
- Parameters:
point (PyKDL.Vector) – Vector w.r.t. the same frame as this volume
padding (float) – Padding to take into account. Positive values make the volume bigger, negative values smaller.
- Returns:
True if inside, False otherwise
- Return type:
- class ed.volume.CompositeBoxVolume(boxes)[source]¶
Bases:
Volume
Represents a composite box shaped volume
Constructor
Points are defined relative to the object they belong to.
- Parameters:
boxes (Iterable[Tuple[PyKDL.Vector, PyKDL.Vector]]) – list of tuples of two vectors. First one with the minimum bounding box corners, second one with the maximum bounding box corners
- _min_corners¶
- _max_corners¶
- _calc_center_point()[source]¶
Calculate where the center of the box is located
>>> b = CompositeBoxVolume([(kdl.Vector(0,0,0), kdl.Vector(1,1,1))]) >>> b.center_point [ 0.5, 0.5, 0.5]
- Return type:
- property min_corner: PyKDL.Vector¶
- Return type:
- property max_corner: PyKDL.Vector¶
- Return type:
- property bottom_area: List[PyKDL.Vector]¶
- Return type:
List[PyKDL.Vector]
- contains(point, padding=0)[source]¶
Checks if the point is inside this volume
>>> b = CompositeBoxVolume([(kdl.Vector(0,0,0), kdl.Vector(1,1,1))]) >>> b.contains(kdl.Vector(0.1, 0.1, 0.1)) True >>> b.contains(kdl.Vector(0.1, 0.1, 0.1), padding=0.2) True >>> b.contains(kdl.Vector(0.1, 0.1, 0.1), padding=-0.2) False >>> b.contains(kdl.Vector(-0.1, -0.1, -0.1)) False >>> b.contains(kdl.Vector(-0.1, -0.1, -0.1), padding=0.2) True >>> b.contains(kdl.Vector(-0.1, -0.1, -0.1), padding=-0.2) False
- Parameters:
point (PyKDL.Vector) – Vector w.r.t. the same frame as this volume
padding (float) – Padding to take into account. Positive values make the volume bigger, negative values smaller.
- Returns:
True if inside, False otherwise
- Return type:
- class ed.volume.OffsetVolume(offset)[source]¶
Bases:
Volume
Represents a volume with a certain offset from the convex hull of the entity
Constructor
- Parameters:
offset – Offset [m]
- _offset¶