Point Arrays#
- class gbox.base.PointArrayND(points: ndarray)#
Bases:
objectPointArrayND, a base class for representing a collection of points in N-dimensional space
- coor#
- classmethod from_points(points: Sequence[PointND] | Sequence[Sequence[float]]) PointArrayND#
Constructs a PointArray from a sequence of Point objects or sequences of sequences of coordinates
- classmethod from_dims(dims: Sequence[Sequence[float | float32]])#
Constructs a PointArray from a sequence of sequences of coordinates
- property dim#
- property dtype#
- property coordinates: ndarray#
Returns the coordinates of the point array
- property cycle: bool#
Returns True if the points are cyclic
- bounding_box() BoundingBox#
Returns the bounding box of the current PointArray
- transform(matrix: ndarray, in_place: bool = False) PointArrayND | None#
Transform using a transformation matrix
- reflection(p1: list[float] | PointND, p2: list[float] | PointND)#
Reflects the current points about a line connecting p1 and p2
- reverse(in_place: bool = False) PointArrayND | None#
Reverses the order of the points
- copy()#
Returns a copy of the current PointArray
- class gbox.base.PointArray1D(points: ndarray)#
Bases:
PointArrayNDPointArray1D, a subclass of PointArray, with one dimension
- property x: ndarray#
- transform(dx: float = 0.0, in_place: bool = False) PointArray1D | None#
Transformation of the points cluster by rotation and translation
- class gbox.base.PointArray2D(points: ndarray)#
Bases:
PointArrayNDPointArray2D, a subclass of PointArray, with two dimensions.
- Attributes:
coordinatesnp.ndarrayReturns the coordinates of the point array
- dimint
Dimension of the points
- dtypenp.dtype
Data type of the points
- xNDArray
Array of x coordinates
- yNDArray
Array of y coordinates
- property x: ndarray#
- property y: ndarray#
- transform(angle: float | float32 = 0.0, dx: float | float32 = 0.0, dy: float | float32 = 0.0, pivot: Point2D | Tuple[float | float32, float | float32] = (0.0, 0.0), in_place: bool = False, order: str = 'RT') PointArray2D | None#
Transformation of the points cluster by rotation and translation, either in-place or returning a new PointArray2D
- Parameters:
- anglefloat
Angle of rotation in radians, default: 0.0
- dxfloat
Translation along x axis, default: 0.0
- dyfloat
Translation along y axis, default: 0.0
- Returns:
- PointArray2D
- make_periodic_tiles(bounds: list | None = None, order: int = 1)#
Returns tiled copy of the points about the current position
- sort() PointArray2D#
- plot(axs, points_plt_opt: dict | None = None, b_box: bool = False, box_plt_opt: dict | None = None)#
Plots the points