QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | List of all members
QgsSphere Class Reference

A spherical geometry object. More...

#include <qgssphere.h>

Public Member Functions

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

Detailed Description

A spherical geometry object.

Represents a simple 3-dimensional sphere.

Since
QGIS 3.34

Definition at line 40 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 24 of file qgssphere.cpp.

Member Function Documentation

◆ boundingBox()

QgsBox3D QgsSphere::boundingBox ( ) const

Returns the 3-dimensional bounding box containing the sphere.

Definition at line 78 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 43 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 48 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 99 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 109 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 119 of file qgssphere.h.

◆ diameter()

double QgsSphere::diameter ( ) const
inline

Returns the diameter of the sphere.

See also
radius()

Definition at line 153 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 38 of file qgssphere.cpp.

◆ isNull()

bool QgsSphere::isNull ( ) const

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

Definition at line 33 of file qgssphere.cpp.

◆ operator!=()

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

Definition at line 59 of file qgssphere.h.

◆ operator==()

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

Definition at line 55 of file qgssphere.h.

◆ radius()

double QgsSphere::radius ( ) const
inline

Returns the radius of the sphere.

See also
setRadius()
diameter()

Definition at line 139 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 53 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 131 of file qgssphere.h.

◆ setRadius()

void QgsSphere::setRadius ( double  radius)
inline

Sets the radius of the sphere.

See also
radius()

Definition at line 146 of file qgssphere.h.

◆ surfaceArea()

double QgsSphere::surfaceArea ( ) const

Returns the surface area of the sphere.

Definition at line 65 of file qgssphere.cpp.

◆ toCircle()

QgsCircle QgsSphere::toCircle ( ) const

Converts the sphere to a 2-dimensional circle.

Definition at line 70 of file qgssphere.cpp.

◆ volume()

double QgsSphere::volume ( ) const

Returns the volume of the sphere.

Definition at line 60 of file qgssphere.cpp.


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