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] |
Point
) – The center of the sphere.radius (float) – The radius of the sphere.
- Attributes
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
Converts the instance to a string.
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.
Compute a hash of the data for comparison during version control using the sha256 algorithm.
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.