Skip to content

Class SFCGAL::Sphere

ClassList > SFCGAL > Sphere

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

  • #include <Sphere.h>

Public Functions

Type Name
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.
Sphere (const Sphere & other) = default
Copy constructor.
double area () const
Calculates the surface area of the Sphere .
const Kernel::Point_3 & center () const
Gets the center of the sphere.
const Kernel::Vector_3 & direction () const
Gets the direction of the sphere.
std::vector< Kernel::Point_3 > generatePoints ()
Generates a point cloud representation of the sphere.
CGAL::Polyhedron_3< Kernel > generatePolyhedron ()
Generates a polyhedron representation of the sphere.
int numHorizontal () const
Gets the number of horizontal divisions.
int numVertical () const
Gets the number of vertical divisions.
Sphere & operator= (Sphere other)
Assignment operator.
const Kernel::FT & radius () const
Gets the radius of the sphere.
void setCenter (const Kernel::Point_3 & center)
Sets the center of the sphere.
void setDirection (const Kernel::Vector_3 & direction)
Sets the direction of the sphere.
void setNumHorizontal (int num)
Sets the number of horizontal divisions.
void setNumVertical (int num)
Sets the number of vertical divisions.
void setRadius (const Kernel::FT & radius)
Sets the radius of the sphere.
double volume () const
Calculates the volume of the Sphere .
~Sphere () = default
Destructor.

Detailed Description

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

Public Functions Documentation

function Sphere [1/2]

Constructs a Sphere object.

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)
) 

Parameters:

  • radius The radius of the sphere
  • center The center point of the sphere
  • num_vertical The number of vertical divisions
  • num_horizontal The number of horizontal divisions
  • direction The direction vector for sphere orientation

function Sphere [2/2]

SFCGAL::Sphere::Sphere (
    const Sphere & other
) = default

function area

Calculates the surface area of the Sphere .

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

Returns:

The surface area of the sphere


function center

Gets the center of the sphere.

inline const Kernel::Point_3 & SFCGAL::Sphere::center () const

Returns:

The center point


function direction

Gets the direction of the sphere.

inline const Kernel::Vector_3 & SFCGAL::Sphere::direction () const

Returns:

The direction vector


function generatePoints

Generates a point cloud representation of the sphere.

std::vector< Kernel::Point_3 > SFCGAL::Sphere::generatePoints () 

Returns:

A vector of Point_3 objects representing points on the sphere's surface


function generatePolyhedron

Generates a polyhedron representation of the sphere.

CGAL::Polyhedron_3< Kernel > SFCGAL::Sphere::generatePolyhedron () 

Returns:

A CGAL::Polyhedron_3 object representing the sphere


function numHorizontal

Gets the number of horizontal divisions.

inline int SFCGAL::Sphere::numHorizontal () const

Returns:

The number of horizontal divisions


function numVertical

Gets the number of vertical divisions.

inline int SFCGAL::Sphere::numVertical () const

Returns:

The number of vertical divisions


function operator=

Sphere & SFCGAL::Sphere::operator= (
    Sphere other
) 

function radius

Gets the radius of the sphere.

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

Returns:

The radius


function setCenter

Sets the center of the sphere.

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

Parameters:

  • center The new center point

function setDirection

Sets the direction of the sphere.

inline void SFCGAL::Sphere::setDirection (
    const Kernel::Vector_3 & direction
) 

Parameters:

  • direction The new direction vector

function setNumHorizontal

Sets the number of horizontal divisions.

inline void SFCGAL::Sphere::setNumHorizontal (
    int num
) 

Parameters:

  • num The new number of horizontal divisions

function setNumVertical

Sets the number of vertical divisions.

inline void SFCGAL::Sphere::setNumVertical (
    int num
) 

Parameters:

  • num The new number of vertical divisions

function setRadius

Sets the radius of the sphere.

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

Parameters:

  • radius The new radius

function volume

Calculates the volume of the Sphere .

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

Returns:

The volume of the sphere


function ~Sphere

SFCGAL::Sphere::~Sphere () = default


The documentation for this class was generated from the following file /builds/sfcgal/SFCGAL/src/Sphere.h