SFCGAL  2.2.0
Public Member Functions | List of all members
SFCGAL::Sphere Class Reference

Represents a sphere in 3D space. More...

#include <Sphere.h>

Public Member Functions

 Sphere (const Kernel::FT &radius=1.0, const Kernel::Point_3 &center=Kernel::Point_3(0, 0, 0), int num_vertical=16, int num_horizontal=32, const Kernel::Vector_3 &direction=Kernel::Vector_3(0, 0, 1))
 Constructs a Sphere object. More...
 
 Sphere (const Sphere &other)=default
 Copy constructor. More...
 
Sphereoperator= (Sphere other)
 Assignment operator. More...
 
 ~Sphere ()=default
 Destructor. More...
 
void setRadius (const Kernel::FT &radius)
 Sets the radius of the sphere. More...
 
void setCenter (const Kernel::Point_3 &center)
 Sets the center of the sphere. More...
 
void setNumVertical (int num)
 Sets the number of vertical divisions. More...
 
void setNumHorizontal (int num)
 Sets the number of horizontal divisions. More...
 
void setDirection (const Kernel::Vector_3 &direction)
 Sets the direction of the sphere. More...
 
const Kernel::FT & radius () const
 Gets the radius of the sphere. More...
 
const Kernel::Point_3 & center () const
 Gets the center of the sphere. More...
 
int numVertical () const
 Gets the number of vertical divisions. More...
 
int numHorizontal () const
 Gets the number of horizontal divisions. More...
 
const Kernel::Vector_3 & direction () const
 Gets the direction of the sphere. More...
 
CGAL::Polyhedron_3< KernelgeneratePolyhedron ()
 Generates a polyhedron representation of the sphere. More...
 
std::vector< Kernel::Point_3 > generatePoints ()
 Generates a point cloud representation of the sphere. More...
 
double volume () const
 Calculates the volume of the Sphere. More...
 
double area () const
 Calculates the surface area of the Sphere. More...
 

Detailed Description

Represents a sphere in 3D space.

This class provides methods to generate a polyhedron and a point cloud representation of a sphere. It uses SFCGAL's Kernel for exact computations.

Constructor & Destructor Documentation

SFCGAL::Sphere::Sphere ( const Kernel::FT &  radius = 1.0,
const Kernel::Point_3 &  center = Kernel::Point_3(0, 0, 0),
int  num_vertical = 16,
int  num_horizontal = 32,
const Kernel::Vector_3 &  direction = Kernel::Vector_3(0, 0, 1) 
)

Constructs a Sphere object.

Parameters
radiusThe radius of the sphere
centerThe center point of the sphere
num_verticalThe number of vertical divisions
num_horizontalThe number of horizontal divisions
directionThe direction vector for sphere orientation
SFCGAL::Sphere::Sphere ( const Sphere other)
default

Copy constructor.

SFCGAL::Sphere::~Sphere ( )
default

Destructor.

Member Function Documentation

double SFCGAL::Sphere::area ( ) const
inline

Calculates the surface area of the Sphere.

Returns
The surface area of the sphere
const Kernel::Point_3& SFCGAL::Sphere::center ( ) const
inline

Gets the center of the sphere.

Returns
The center point
const Kernel::Vector_3& SFCGAL::Sphere::direction ( ) const
inline

Gets the direction of the sphere.

Returns
The direction vector
auto SFCGAL::Sphere::generatePoints ( )

Generates a point cloud representation of the sphere.

Returns
A vector of Point_3 objects representing points on the sphere's surface
auto SFCGAL::Sphere::generatePolyhedron ( )

Generates a polyhedron representation of the sphere.

Returns
A CGAL::Polyhedron_3 object representing the sphere
int SFCGAL::Sphere::numHorizontal ( ) const
inline

Gets the number of horizontal divisions.

Returns
The number of horizontal divisions
int SFCGAL::Sphere::numVertical ( ) const
inline

Gets the number of vertical divisions.

Returns
The number of vertical divisions
auto SFCGAL::Sphere::operator= ( Sphere  other)

Assignment operator.

const Kernel::FT& SFCGAL::Sphere::radius ( ) const
inline

Gets the radius of the sphere.

Returns
The radius
void SFCGAL::Sphere::setCenter ( const Kernel::Point_3 &  center)
inline

Sets the center of the sphere.

Parameters
centerThe new center point
void SFCGAL::Sphere::setDirection ( const Kernel::Vector_3 &  direction)
inline

Sets the direction of the sphere.

Parameters
directionThe new direction vector
void SFCGAL::Sphere::setNumHorizontal ( int  num)
inline

Sets the number of horizontal divisions.

Parameters
numThe new number of horizontal divisions
void SFCGAL::Sphere::setNumVertical ( int  num)
inline

Sets the number of vertical divisions.

Parameters
numThe new number of vertical divisions
void SFCGAL::Sphere::setRadius ( const Kernel::FT &  radius)
inline

Sets the radius of the sphere.

Parameters
radiusThe new radius
double SFCGAL::Sphere::volume ( ) const
inline

Calculates the volume of the Sphere.

Returns
The volume of the sphere