Class: QgsSphere

A spherical geometry object.

Represents a simple 3-dimensional sphere.

Added in version 3.34.

class qgis.core.QgsSphere[source]

Bases: object

__init__()

Constructor for an invalid QgsSphere.

__init__(x: float, y: float, z: float, radius: float)

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

Parameters:
  • x (float)

  • y (float)

  • z (float)

  • radius (float)

__init__(a0: QgsSphere)
Parameters:

a0 (QgsSphere)

boundingBox(self) QgsBox3D[source]

Returns the 3-dimensional bounding box containing the sphere.

Return type:

QgsBox3D

center(self) QgsPoint[source]

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[source]

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[source]

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[source]

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[source]

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[source]

Returns the diameter of the sphere.

See also

radius()

Return type:

float

isEmpty(self) bool[source]

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

Return type:

bool

isNull(self) bool[source]

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

Return type:

bool

radius(self) float[source]

Returns the radius of the sphere.

See also

setRadius()

See also

diameter()

Return type:

float

setCenter(self, center: QgsPoint)[source]

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)[source]

Sets the radius of the sphere.

See also

radius()

Parameters:

radius (float)

surfaceArea(self) float[source]

Returns the surface area of the sphere.

Return type:

float

toCircle(self) QgsCircle[source]

Converts the sphere to a 2-dimensional circle.

Return type:

QgsCircle

volume(self) float[source]

Returns the volume of the sphere.

Return type:

float