111: m_center(0.0, 0.0, 0.0)
150 return (4.0 / 3.0) *
I_PI * m_radius * m_radius * m_radius;
156 return 4.0 *
I_PI * m_radius * m_radius;
162 double distSq = (point - m_center).GetLength2();
163 double radiusTol = m_radius + tolerance;
164 return distSq <= radiusTol * radiusTol;
170 double centerDist = (m_center - other.m_center).GetLength();
171 return centerDist <= (m_radius + other.m_radius);
177 return (point - m_center).GetLength() - m_radius;
183 CVector3d direction = (point - m_center).GetNormalized();
184 return m_center + direction * m_radius;
190 return m_center == sphere.m_center && qAbs(m_radius - sphere.m_radius) <
I_BIG_EPSILON;
196 return !(*
this == sphere);
Definition of a line in 3D space.
Definition of a sphere in 3D space.
double GetRadius() const
Get radius of the sphere.
bool Contains(const CVector3d &point, double tolerance=0.0) const
Check if point is inside the sphere.
double GetVolume() const
Calculate volume of the sphere.
void SetCenter(const CVector3d ¢er)
Set center of the sphere.
bool operator==(const CSphere &sphere) const
CVector3d GetClosestPoint(const CVector3d &point) const
Get closest point on sphere surface to given point.
bool operator!=(const CSphere &sphere) const
bool Intersects(const CSphere &other) const
Check if this sphere intersects another sphere.
double GetSignedDistance(const CVector3d &point) const
Get distance from sphere surface to point.
void SetRadius(double radius)
Set radius of the sphere.
bool Serialize(iser::IArchive &archive)
Serialize this sphere to specified archive.
const CVector3d & GetCenter() const
Get center of the sphere.
bool Intersects(const CLine3d &line) const
Check if this sphere intersects a line segment.
double GetSurfaceArea() const
Calculate surface area of the sphere.
CSphere()
Default constructor.
Represents a position or mathematical vector in 3D space with double precision.
Represents an input/output persistence archive for object serialization.
static const double I_PI
Mathematical constant value PI.
static const double I_BIG_EPSILON