Points#
- class gbox.Points(points: ndarray | None = None)#
Collection of ordered points
- append(new_points: ndarray, end=True)#
Append object to the end of the list.
- transform(angle=0.0, dx=0.0, dy=0.0)#
Transforms the points cluster by rotation and translation
>>> from numpy import array, pi >>> p = Points(array([[0.0, 0.0], [2.0, 2.0], [3.0, 5.0]])) >>> p.points array([[0., 0.], [2., 2.], [3., 5.]]) >>> q = p.transform(angle=0.2 * pi, dx=2.0, dy=2.0) >>> q.points array([[ 2.44246348, 4.79360449], [ 1.15838444, 7.31375151], [-1.38576811, 9.19185901]])
- reverse()#
Reverses the order of points in-place
>>> from numpy import array, pi >>> p = Points(array([[0.0, 0.0], [2.0, 2.0], [3.0, 5.0]])) >>> p.points array([[0., 0.], [2., 2.], [3., 5.]]) >>> p.reverse() >>> p.points array([[3., 5.], [2., 2.], [0., 0.]])
- reflect(p1: tuple[float, float], p2: tuple[float, float])#
Reflects the current points about a line connecting p1 and p2
>>> from numpy import array, pi >>> p = Points(array([[0.0, 0.0], [2.0, 2.0], [3.0, 5.0]])) >>> p.points array([[0., 0.], [2., 2.], [3., 5.]]) >>> q = p.reflect((0.0, 0.0), (1.0, 2.0)) >>> q.points ... array([[2.2, 5.4], [0.4, 2.8], [0., 0.0],])
- copy()#
Return a shallow copy of the list.
- make_periodic_tiles(bounds: list | None = None, order: int = 1)#
It tiles the points about the current position, in the space by the specified number of times on each side.
- Parameters:
bounds – The bounds of the points cluster
order – int, The number of times points are tiled in each direction.
- Returns:
Points object containing the tiled points.
- Return type:
- plot(axs=None, file_path=None, show_fig=False, hide_axis=True, b_box=False, **sct_opt)#
Plots the points
- Parameters:
axs – The axs on which points are plotted. If not specified, it will create a new axs with default options.
file_path – The path of the image (with appropriate extension) to save the figure.
hide_axis – Enable/disable the plot
show_fig – Should the figure be displayed using
matplotlib.pyplot.show()b_box – Whether to plot the bounding box around the points
sct_opt – All the key-word arguments that can be taken by
matplotlib.pyplot.scatter()function.
- Returns:
None,
- Return type:
None