The Sphere class#

class rockverse.region.Sphere(p, r, region='inside')[source]#

Defines spherical 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) – Sphere radius in voxel units. Must be non-negative.

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

Attributes

p#

Point defining the center of the sphere.

r#

Sphere radius.

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