Sphere

class sknano.core.geometric_regions.Sphere(center=None, r=1)[source] [edit on github][source]

Bases: sknano.core.geometric_regions.Geometric3DRegion

Geometric3DRegion for a sphere.

New in version 0.3.0.

Parameters:
  • center (array_like, optional) – Either a 3-tuple of floats or an instance of the Point class specifying the \((x,y,z)\) coordinates of the Sphere center.
  • r (float, optional) – Sphere radius \(r\)

Attributes

bounding_box Bounding Cuboid.
center Sphere center point \((h, k, l)\).
centroid Alias for center.
fmtstr Format string.
measure Alias for volume, which is the measure of a 3D geometric region.
ndim Return the dimensions.
pmax Point at maximum extent.
pmin Point at minimum extent.
r Sphere radius, \(r\).
volume Sphere volume, \(V=\frac{4}{3}\pi r^3\).

Methods

center_centroid() Center centroid on origin.
contains(point) Test region membership of point in Sphere.
get_points() Return list of points from GeometricRegion.points and GeometricRegion.vectors
rotate(**kwargs) Rotate GeometricRegion points and vectors.
todict() Returns a dict of the Sphere constructor parameters.
translate(t[, fix_anchor_points]) Translate GeometricRegion points and vectors by Vector t.

Attributes Summary

center Sphere center point \((h, k, l)\).
centroid Alias for center.
r Sphere radius, \(r\).
volume Sphere volume, \(V=\frac{4}{3}\pi r^3\).

Methods Summary

contains(point) Test region membership of point in Sphere.
todict() Returns a dict of the Sphere constructor parameters.

Attributes Documentation

center

Sphere center point \((h, k, l)\).

centroid

Alias for center.

r

Sphere radius, \(r\).

volume

Sphere volume, \(V=\frac{4}{3}\pi r^3\).

Methods Documentation

contains(point)[source] [edit on github][source]

Test region membership of point in Sphere.

Parameters:point (array_like) –
Returns:True if point is within Sphere, False otherwise.
Return type:bool

Notes

A point \((p_x, p_y, p_z)\) is within the bounded region of a sphere with center \((h, k, l)\) and radius \(r\) if the following is true:

\[(p_x - h)^2 + (p_y - k)^2 + (p_z - l)^2 \le r^2\]
todict()[source] [edit on github][source]

Returns a dict of the Sphere constructor parameters.