Class: QgsSphere

class qgis.core.QgsSphere

Bases: sip.wrapper

A spherical geometry object.

Represents a simple 3-dimensional sphere.

Added in version 3.34.

QgsSphere() Constructor for an invalid QgsSphere.

QgsSphere(x: float, y: float, z: float, radius: float) Constructor for QgsSphere with the specified center (x, y, z) and radius.

QgsSphere(QgsSphere)

Methods

boundingBox

Returns the 3-dimensional bounding box containing the sphere.

center

Returns the center point of the sphere.

centerVector

Returns the vector to the center of the sphere.

centerX

Returns the x-coordinate of the center of the sphere.

centerY

Returns the y-coordinate of the center of the sphere.

centerZ

Returns the z-coordinate of the center of the sphere.

diameter

Returns the diameter of the sphere.

isEmpty

Returns True if the sphere is considered empty, i.e. it has a radius of 0.

isNull

Returns True if the sphere is a null (default constructed) sphere.

radius

Returns the radius of the sphere.

setCenter

Sets the center point of the sphere.

setRadius

Sets the radius of the sphere.

surfaceArea

Returns the surface area of the sphere.

toCircle

Converts the sphere to a 2-dimensional circle.

volume

Returns the volume of the sphere.

boundingBox(self) QgsBox3D

Returns the 3-dimensional bounding box containing the sphere.

Return type:

QgsBox3D

center(self) QgsPoint

Returns the center point of the sphere.

See also

centerX()

See also

centerY()

See also

centerZ()

See also

setCenter()

Return type:

QgsPoint

centerVector(self) QgsVector3D

Returns the vector to the center of the sphere.

See also

centerX()

See also

centerY()

See also

centerZ()

See also

setCenter()

Return type:

QgsVector3D

centerX(self) float

Returns the x-coordinate of the center of the sphere.

See also

center()

See also

centerY()

See also

centerZ()

See also

setCenter()

Return type:

float

centerY(self) float

Returns the y-coordinate of the center of the sphere.

See also

center()

See also

centerX()

See also

centerZ()

See also

setCenter()

Return type:

float

centerZ(self) float

Returns the z-coordinate of the center of the sphere.

See also

center()

See also

centerX()

See also

centerY()

See also

setCenter()

Return type:

float

diameter(self) float

Returns the diameter of the sphere.

See also

radius()

Return type:

float

isEmpty(self) bool

Returns True if the sphere is considered empty, i.e. it has a radius of 0.

Return type:

bool

isNull(self) bool

Returns True if the sphere is a null (default constructed) sphere.

Return type:

bool

radius(self) float

Returns the radius of the sphere.

See also

setRadius()

See also

diameter()

Return type:

float

setCenter(self, center: QgsPoint)

Sets the center point of the sphere.

See also

center()

setCenter(self, x: float, y: float, z: float) Sets the center point of the sphere to (x, y, z).

See also

center()

Parameters:

center (QgsPoint)

setRadius(self, radius: float)

Sets the radius of the sphere.

See also

radius()

Parameters:

radius (float)

surfaceArea(self) float

Returns the surface area of the sphere.

Return type:

float

toCircle(self) QgsCircle

Converts the sphere to a 2-dimensional circle.

Return type:

QgsCircle

volume(self) float

Returns the volume of the sphere.

Return type:

float