Sphere
- class compas.geometry.Sphere[source]
Bases:
Shape
A sphere is defined by a point and a radius.
- Parameters:
- radius: float
The radius of the sphere.
- frame: :class:`compas.geometry.Frame`, optional
The local coordinates system, or “frame”, of the sphere. Default is
None
, in which case the sphere is constructed in world coordinates.- point: :class:`compas.geometry.Point`, optional
The center of the sphere. When provided, this point overwrites the location of the origin of the local coordinate system.
- namestr, optional
The name of the shape.
Examples
>>> from compas.geometry import Frame >>> from compas.geometry import Sphere >>> sphere1 = Sphere(frame=Frame.worldXY(), radius=5) >>> sphere1 = Sphere(radius=5)
- Attributes:
- areafloat, read-only
The surface area of the sphere.
- axis
compas.geometry.Line
, read-only The central axis of the sphere.
- base
compas.geometry.Point
, read-only The base point of the sphere. The base point is at the origin of the local coordinate system.
- circle
compas.geometry.Circle
, read-only The base circle of the sphere. The center of the circle is at the origin of the local coordinate system.
- diameterfloat, read-only
The diameter of the sphere.
- frame
compas.geometry.Frame
The coordinate system of the sphere.
- plane
compas.geometry.Plane
, read-only The plane of the sphere. The base point of the plane is at the origin of the local coordinate system. The normal of the plane is in the direction of the z-axis of the local coordinate system.
- radiusfloat
The radius of the sphere.
- transformation
compas.geometry.Transformation
The transformation of the sphere to global coordinates.
- volumefloat, read-only
The volume of the sphere.
Methods
Verify if a point is inside the sphere.
Verify if a list of points are inside the sphere.
Construct a sphere from a point and a radius.
Scale the sphere.
Returns a BRep representation of the sphere.
Returns a list of vertices and faces
Inherited Methods
Converts the instance to a string.
Compute the axis-aligned bounding box of the geometry.
Compute the oriented bounding box of the geometry.
Make an independent copy of the data object.
Construct an object of this type from a JSON file.
Construct an object of this type from a JSON string.
Rotate the shape.
Returns a rotated copy of this geometry.
Returns a scaled copy of this geometry.
Compute a hash of the data for comparison during version control using the sha256 algorithm.
Convert an object to its native data representation and save it to a JSON file.
Convert an object to its native data representation and save it to a JSON string.
Convert the shape to a polyhedron.
Transform the shape.
Returns a transformed copy of this geometry.
Translate the shape.
Returns a translated copy of this geometry.
Validate the data against the object's data schema.