The Cylinder class#

class rockverse.region.Cylinder(p, v, r, l=inf, region='inside')[source]#

Defines cylindrical region of interest.

Note

For performance, region methods are dynamically created at class instantiation, and therefore the region parameters cannot be changed after the object is created.

Parameters:
  • p (3-element tuple, list, or Numpy array) – Point defining the spatial coordinates (in voxel units) for center of the sphere.

  • r (int or float) – Cylinder radius in voxel units. Must be non-negative.

  • v (3-element tuple, list, Numpy array) – Vector components for the axis direction vector.

  • l (int, float) – Cylinder length (must be non negative).

  • region ({'inside', 'outside'}, optional) – Whether to consider the region inside or outside the cylinder surface. Defaults to ‘inside’.

Attributes

p#

Point defining the center of the cylinder.

v#

Vector components for the axis direction vector.

r#

Cylinder radius.

l#

Cylinder length.

region#

Whether to consider the region inside or outside the cylinder surface.

Methods

contains_point(x, y, z)#

Check if a point (x, y, z) belongs to the region.

Parameters:
  • x (float) – Point x-coordinate in voxel units.

  • y (float) – Point y-coordinate in voxel units.

  • z (float) – Point z-coordinate in voxel units.

Returns:

b – True if point inside region, False otherwise.

Return type:

bool