ACF $AcfVersion:0$
Public Member Functions | List of all members
i3d::CSphere Class Reference

Definition of a sphere in 3D space. More...

#include <CSphere.h>

Public Member Functions

 CSphere ()
 Default constructor.
 
 CSphere (double radius, const CVector3d &center)
 Construct sphere from radius and center.
 
double GetRadius () const
 Get radius of the sphere.
 
void SetRadius (double radius)
 Set radius of the sphere.
 
const CVector3dGetCenter () const
 Get center of the sphere.
 
void SetCenter (const CVector3d &center)
 Set center of the sphere.
 
double GetVolume () const
 Calculate volume of the sphere.
 
double GetSurfaceArea () const
 Calculate surface area of the sphere.
 
bool Contains (const CVector3d &point, double tolerance=0.0) const
 Check if point is inside the sphere.
 
bool Intersects (const CSphere &other) const
 Check if this sphere intersects another sphere.
 
bool Intersects (const CLine3d &line) const
 Check if this sphere intersects a line segment.
 
double GetSignedDistance (const CVector3d &point) const
 Get distance from sphere surface to point.
 
CVector3d GetClosestPoint (const CVector3d &point) const
 Get closest point on sphere surface to given point.
 
bool Serialize (iser::IArchive &archive)
 Serialize this sphere to specified archive.
 
bool operator== (const CSphere &sphere) const
 
bool operator!= (const CSphere &sphere) const
 

Detailed Description

Definition of a sphere in 3D space.

Sphere is stored as center position and radius.

Definition at line 20 of file CSphere.h.

Constructor & Destructor Documentation

◆ CSphere() [1/2]

i3d::CSphere::CSphere ( )
inline

Default constructor.

Creates a unit sphere at origin.

Definition at line 110 of file CSphere.h.

◆ CSphere() [2/2]

i3d::CSphere::CSphere ( double  radius,
const CVector3d center 
)
inline

Construct sphere from radius and center.

Parameters
radiusRadius of the sphere.
centerCenter position.

Definition at line 117 of file CSphere.h.

Member Function Documentation

◆ Contains()

bool i3d::CSphere::Contains ( const CVector3d point,
double  tolerance = 0.0 
) const
inline

Check if point is inside the sphere.

Parameters
pointPoint to check.
toleranceTolerance for boundary check.

Definition at line 160 of file CSphere.h.

◆ GetCenter()

const CVector3d & i3d::CSphere::GetCenter ( ) const
inline

Get center of the sphere.

Definition at line 136 of file CSphere.h.

◆ GetClosestPoint()

CVector3d i3d::CSphere::GetClosestPoint ( const CVector3d point) const
inline

Get closest point on sphere surface to given point.

Definition at line 181 of file CSphere.h.

◆ GetRadius()

double i3d::CSphere::GetRadius ( ) const
inline

Get radius of the sphere.

Definition at line 124 of file CSphere.h.

◆ GetSignedDistance()

double i3d::CSphere::GetSignedDistance ( const CVector3d point) const
inline

Get distance from sphere surface to point.

Positive if outside, negative if inside, zero if on surface.

Definition at line 175 of file CSphere.h.

◆ GetSurfaceArea()

double i3d::CSphere::GetSurfaceArea ( ) const
inline

Calculate surface area of the sphere.

Definition at line 154 of file CSphere.h.

References I_PI.

◆ GetVolume()

double i3d::CSphere::GetVolume ( ) const
inline

Calculate volume of the sphere.

Definition at line 148 of file CSphere.h.

References I_PI.

◆ Intersects() [1/2]

bool i3d::CSphere::Intersects ( const CLine3d line) const

Check if this sphere intersects a line segment.

◆ Intersects() [2/2]

bool i3d::CSphere::Intersects ( const CSphere other) const
inline

Check if this sphere intersects another sphere.

Definition at line 168 of file CSphere.h.

◆ operator!=()

bool i3d::CSphere::operator!= ( const CSphere sphere) const
inline

Definition at line 194 of file CSphere.h.

◆ operator==()

bool i3d::CSphere::operator== ( const CSphere sphere) const
inline

Definition at line 188 of file CSphere.h.

References I_BIG_EPSILON.

◆ Serialize()

bool i3d::CSphere::Serialize ( iser::IArchive archive)

Serialize this sphere to specified archive.

◆ SetCenter()

void i3d::CSphere::SetCenter ( const CVector3d center)
inline

Set center of the sphere.

Definition at line 142 of file CSphere.h.

◆ SetRadius()

void i3d::CSphere::SetRadius ( double  radius)
inline

Set radius of the sphere.

Definition at line 130 of file CSphere.h.


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