locan.data.region.AxisOrientedHypercuboid#
- class locan.data.region.AxisOrientedHypercuboid(corner=(0, 0, 0), lengths=(1, 1, 1))[source]#
Bases:
locan.data.region.RegionND
Region class to define an axis-oriented n-dimensional hypercuboid.
This is a n-dimensional convex region with rectangular faces and edges that are parallel to coordinate axes. Extension in x-, y-, z-coordinates correspond to length, width, height.
- Parameters
corner (npt.ArrayLike) – A point with shape (dimension,) that defines the lower left corner.
lengths (npt.ArrayLike) – Array of shape(dimension,) of length values for the 1-dimensional edge vectors.
Methods
__init__
([corner, lengths])buffer
(distance, **kwargs)Extend the region perpendicular by a distance.
contains
(points)Return list of indices for all points that are inside the region of interest.
from_intervals
(intervals)Constructor for instantiating Region from list of (min, max) bounds.
intersection
(other)Returns a region representing the intersection of this region with
other
.symmetric_difference
(other)Returns the union of the two regions minus any areas contained in the intersection of the two regions.
union
(other)Returns a region representing the union of this region with
other
.Attributes
A region describing the minimum axis-aligned bounding box that encloses the original region.
Region bounds min_x, min_y, ..., max_x, max_y, .
Point coordinates for region centroid.
A point that defines the lower left corner.
The region dimension.
The extent (max_x - min_x), (max_y - min_y), .
Provide bounds in a tuple (min, max) arrangement.
Array of length values for the 1-dimensional edge vectors.
The maximum distance between any two points within the region.
Point coordinates.
Region measure, i.e. area (for 2d) or volume (for 3d).
Measure of the sub-dimensional region, i.e. circumference (for 2d) or surface (for 3d).
- property bounding_box: typing_extensions.Self#
A region describing the minimum axis-aligned bounding box that encloses the original region.
- Return type
- property bounds: numpy.ndarray[Any, numpy.dtype[numpy.float64]]#
Region bounds min_x, min_y, …, max_x, max_y, … for each dimension.
- Returns
of shape (2 * dimension,)
- Return type
npt.NDArray[np.float_] | None
- buffer(distance, **kwargs)[source]#
Extend the region perpendicular by a distance.
- Parameters
distance (
float
) – Distance by which the region is extended.- Returns
The extended region.
- Return type
- property centroid: numpy.ndarray[Any, numpy.dtype[numpy.float64]]#
Point coordinates for region centroid.
- Returns
of shape (dimension,)
- Return type
npt.NDArray[np.float_] | None
- contains(points)[source]#
Return list of indices for all points that are inside the region of interest.
- Parameters
points (
Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]]) – Coordinates of points that are tested for being inside the specified region.- Returns
Array with indices for all points in original point array that are within the region.
- Return type
npt.NDArray[np.int_]
- property corner: numpy.ndarray[Any, numpy.dtype[numpy.float64]]#
A point that defines the lower left corner.
- Returns
with shape (dimension,)
- Return type
npt.NDArray[np.float_]
- property dimension: int#
The region dimension.
- Return type
int | None
- property extent: numpy.ndarray[Any, numpy.dtype[numpy.float64]]#
The extent (max_x - min_x), (max_y - min_y), … for each dimension.
- Returns
of shape (dimension,)
- Return type
npt.NDArray[np.float_] | None
- classmethod from_intervals(intervals)[source]#
Constructor for instantiating Region from list of (min, max) bounds.
- Parameters
intervals (npt.ArrayLike) – The region bounds for each dimension of shape (dimension, 2)
- Return type
- property intervals: numpy.ndarray[Any, numpy.dtype[numpy.float64]]#
Provide bounds in a tuple (min, max) arrangement.
- Returns
((min_x, max_x), …) of shape(dimension, 2).
- Return type
tuple[tuple[float, float], …]
- property lengths: numpy.ndarray[Any, numpy.dtype[numpy.float64]]#
Array of length values for the 1-dimensional edge vectors.
- Returns
of shape(dimension,)
- Return type
npt.NDArray[np.float_]
- property max_distance: float#
The maximum distance between any two points within the region.
- Return type
float
- property points: numpy.ndarray[Any, numpy.dtype[numpy.float64]]#
Point coordinates.
- property region_measure: float#
Region measure, i.e. area (for 2d) or volume (for 3d).
- Return type
float
- property subregion_measure: float#
Measure of the sub-dimensional region, i.e. circumference (for 2d) or surface (for 3d).
- Return type
float