QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
QgsSphere Class Reference

A spherical geometry object. More...

#include <qgssphere.h>

Public Member Functions

 QgsSphere ()=default
 Constructor for an invalid QgsSphere.
 QgsSphere (double x, double y, double z, double radius)
 Constructor for QgsSphere with the specified center (x, y, z) and radius.
QgsBox3D boundingBox () const
 Returns the 3-dimensional bounding box containing the sphere.
QgsPoint center () const
 Returns the center point of the sphere.
QgsVector3D centerVector () const
 Returns the vector to the center of the sphere.
double centerX () const
 Returns the x-coordinate of the center of the sphere.
double centerY () const
 Returns the y-coordinate of the center of the sphere.
double centerZ () const
 Returns the z-coordinate of the center of the sphere.
double diameter () const
 Returns the diameter of the sphere.
bool isEmpty () const
 Returns true if the sphere is considered empty, i.e.
bool isNull () const
 Returns true if the sphere is a null (default constructed) sphere.
bool operator!= (const QgsSphere &other) const
bool operator== (const QgsSphere &other) const
double radius () const
 Returns the radius of the sphere.
void setCenter (const QgsPoint &center)
 Sets the center point of the sphere.
void setCenter (double x, double y, double z)
 Sets the center point of the sphere to (x, y, z).
void setRadius (double radius)
 Sets the radius of the sphere.
double surfaceArea () const
 Returns the surface area of the sphere.
QgsCircle toCircle () const
 Converts the sphere to a 2-dimensional circle.
double volume () const
 Returns the volume of the sphere.

Detailed Description

A spherical geometry object.

Represents a simple 3-dimensional sphere.

Since
QGIS 3.34

Definition at line 41 of file qgssphere.h.

Constructor & Destructor Documentation

◆ QgsSphere() [1/2]

QgsSphere::QgsSphere ( )
default

Constructor for an invalid QgsSphere.

◆ QgsSphere() [2/2]

QgsSphere::QgsSphere ( double x,
double y,
double z,
double radius )

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

Definition at line 25 of file qgssphere.cpp.

Member Function Documentation

◆ boundingBox()

QgsBox3D QgsSphere::boundingBox ( ) const

Returns the 3-dimensional bounding box containing the sphere.

Definition at line 79 of file qgssphere.cpp.

◆ center()

QgsPoint QgsSphere::center ( ) const

Returns the center point of the sphere.

See also
centerX()
centerY()
centerZ()
setCenter()

Definition at line 44 of file qgssphere.cpp.

◆ centerVector()

QgsVector3D QgsSphere::centerVector ( ) const

Returns the vector to the center of the sphere.

See also
centerX()
centerY()
centerZ()
setCenter()

Definition at line 49 of file qgssphere.cpp.

◆ centerX()

double QgsSphere::centerX ( ) const
inline

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

See also
center()
centerY()
centerZ()
setCenter()

Definition at line 100 of file qgssphere.h.

◆ centerY()

double QgsSphere::centerY ( ) const
inline

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

See also
center()
centerX()
centerZ()
setCenter()

Definition at line 110 of file qgssphere.h.

◆ centerZ()

double QgsSphere::centerZ ( ) const
inline

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

See also
center()
centerX()
centerY()
setCenter()

Definition at line 120 of file qgssphere.h.

◆ diameter()

double QgsSphere::diameter ( ) const
inline

Returns the diameter of the sphere.

See also
radius()

Definition at line 154 of file qgssphere.h.

◆ isEmpty()

bool QgsSphere::isEmpty ( ) const

Returns true if the sphere is considered empty, i.e.

it has a radius of 0.

Definition at line 39 of file qgssphere.cpp.

◆ isNull()

bool QgsSphere::isNull ( ) const

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

Definition at line 34 of file qgssphere.cpp.

◆ operator!=()

bool QgsSphere::operator!= ( const QgsSphere & other) const
inline

Definition at line 60 of file qgssphere.h.

◆ operator==()

bool QgsSphere::operator== ( const QgsSphere & other) const
inline

Definition at line 56 of file qgssphere.h.

◆ radius()

double QgsSphere::radius ( ) const
inline

Returns the radius of the sphere.

See also
setRadius()
diameter()

Definition at line 140 of file qgssphere.h.

◆ setCenter() [1/2]

void QgsSphere::setCenter ( const QgsPoint & center)

Sets the center point of the sphere.

See also
center()

Definition at line 54 of file qgssphere.cpp.

◆ setCenter() [2/2]

void QgsSphere::setCenter ( double x,
double y,
double z )
inline

Sets the center point of the sphere to (x, y, z).

See also
center()

Definition at line 132 of file qgssphere.h.

◆ setRadius()

void QgsSphere::setRadius ( double radius)
inline

Sets the radius of the sphere.

See also
radius()

Definition at line 147 of file qgssphere.h.

◆ surfaceArea()

double QgsSphere::surfaceArea ( ) const

Returns the surface area of the sphere.

Definition at line 66 of file qgssphere.cpp.

◆ toCircle()

QgsCircle QgsSphere::toCircle ( ) const

Converts the sphere to a 2-dimensional circle.

Definition at line 71 of file qgssphere.cpp.

◆ volume()

double QgsSphere::volume ( ) const

Returns the volume of the sphere.

Definition at line 61 of file qgssphere.cpp.


The documentation for this class was generated from the following files: