aspsim.room.region.Cylinder
- class aspsim.room.region.Cylinder(radius, height, center=(0, 0, 0), point_spacing=(1, 1, 1), rng=None)
Bases:
Region
Constructs a cylinder region
- Parameters:
radius (float) – Radius of the cylinder.
height (float) – Height of the cylinder.
center (array_like of shape (3,), optional) – Center of the cylinder. The default is (0,0,0).
point_spacing (array_like of shape (3,), optional) – Spacing between points in each direction, affects the selection of points for the equally_spaced_points method. The default is (1,1,1).
rng (np.random.Generator, optional) – Random number generator. The default is None, in which case a new generator with a random seed will be created. The generator affects the sampling of points in the sample_points method, and so should be supplied for a reproducible result.
- Returns:
cylinder
- Return type:
- __init__(radius, height, center=(0, 0, 0), point_spacing=(1, 1, 1), rng=None)
Constructs a cylinder region
- Parameters:
radius (float) – Radius of the cylinder.
height (float) – Height of the cylinder.
center (array_like of shape (3,), optional) – Center of the cylinder. The default is (0,0,0).
point_spacing (array_like of shape (3,), optional) – Spacing between points in each direction, affects the selection of points for the equally_spaced_points method. The default is (1,1,1).
rng (np.random.Generator, optional) – Random number generator. The default is None, in which case a new generator with a random seed will be created. The generator affects the sampling of points in the sample_points method, and so should be supplied for a reproducible result.
- Returns:
cylinder
- Return type:
Methods
__init__
(radius, height[, center, ...])Constructs a cylinder region
Returns a grid of points within the cylinder
is_in_region
(coordinates)Checks whether the coordinate is within the cylinder or not.
plot
(ax[, label])sample_points
(num_points)Returns a set of points sampled uniformly within the cylinder
- equally_spaced_points()
Returns a grid of points within the cylinder
- Returns:
all_points – The number of points returned is determined by the radius, height and point_spacing. Each row is a coordinate in 3D space.
- Return type:
np.ndarray of shape (num_points, 3)
- is_in_region(coordinates)
Checks whether the coordinate is within the cylinder or not.
- Parameters:
coordinates (np.ndarray) – Shape (N,3) where N is the number of coordinates to check. Each row is a coordinate in 3D space. If only one coordinate is to be checked, it can be supplied as a (3,) array
- Returns:
is_in – True if the coordinate is within the cylinder, False otherwise.
- Return type:
boolan np.ndarray of shape (N,)
- sample_points(num_points)
Returns a set of points sampled uniformly within the cylinder
- Parameters:
num_points (int) – Number of points to sample.
- Returns:
points – Each row is a coordinate in 3D space.
- Return type:
np.ndarray of shape (num_points, 3)