Sphere
- class compas.geometry.Sphere(point, radius, **kwargs)[source]
Bases:
Shape
A sphere is defined by a point and a radius.
- Parameters
point ([float, float, float] |
compas.geometry.Point
) – The center of the sphere.radius (float) – The radius of the sphere.
- Attributes
point (
compas.geometry.Point
) – The center of the sphere.radius (float) – The radius of the sphere.
center (
compas.geometry.Point
, read-only) – The center of the sphere.area (float, read-only) – The surface area of the sphere.
volume (float, read-only) – The volume of the sphere.
Examples
>>> from compas.geometry import Point >>> from compas.geometry import Sphere >>> sphere1 = Sphere(Point(1, 1, 1), 5) >>> sphere2 = Sphere((2, 4, 1), 2) >>> sphere3 = Sphere([2, 4, 1], 2)
>>> from compas.geometry import Point >>> from compas.geometry import Sphere >>> sphere = Sphere(Point(1, 1, 1), 5) >>> sdict = {'point': [1., 1., 1.], 'radius': 5.} >>> sdict == sphere.data True
Methods
Construct a sphere from its data representation.
Returns a list of vertices and faces
Transform the sphere.
Inherited Methods
Make an independent copy of the data object.
Construct an object from serialized data contained in a JSON file.
Construct an object from serialized data contained in a JSON string.
Convert an object to its native data representation.
Serialize the data representation of an object to a JSON file.
Serialize the data representation of an object to a JSON string.
Returns a transformed copy of this geometry.
Validate the object's data against its data schema.
Validate the object's data against its json schema.