SFCGAL 2.3.0
SFCGAL::Cone Class Reference

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

#include <Cone.h>

Public Member Functions

 Cone (const Kernel::FT &bottom_radius=1.0, const Kernel::FT &top_radius=0.0, const Kernel::FT &height=1.0, unsigned int num_radial=32)
 Constructs a Cone object with its base centered on the origin and in the XY plane A cone frustum is a cone with a top_radius greater than zero.
 Cone (const Cone &other)=default
 Copy constructor.
auto primitiveType () const -> std::string override
 returns the primitive type
auto primitiveTypeId () const -> PrimitiveType override
 ~Cone () override=default
 Destructor.
void setHeight (const Kernel::FT &height)
 Sets the cone height.
void setBottomRadius (const Kernel::FT &bottom_radius)
 Sets the bottom face radius of the cone.
void setTopRadius (const Kernel::FT &top_radius)
 Sets the top face radius of the cone.
void setNumRadial (const unsigned int &num_radial)
 Sets the number of radial divisions.
auto height () const -> const Kernel::FT &
 Gets the cone height.
auto bottomRadius () const -> const Kernel::FT &
 Gets the bottom face radius of the cone.
auto topRadius () const -> const Kernel::FT &
 Gets the top face radius of the cone.
auto numRadial () const -> unsigned int
 Gets the number of radial divisions.
auto generatePolyhedralSurface () const -> PolyhedralSurface override
 Generates a surface mesh representation of the cone.
auto baseVolume (bool withDiscretization=false) const -> double override
 Returns the sphere volume without scaling.
auto area3D (bool withDiscretization=false) const -> double override
 Returns the primitive area.
auto baseArea3D (bool withDiscretization=false) const -> double
 Computes cone base area without scaling effect.

Protected Member Functions

void validateParameters (std::unordered_map< std::string, PrimitiveParameter > const &tempParameters) const override
 Verifies that all parameters are valid.

Detailed Description

Represents a cone in 3D space.

This class provides methods to generate a polyhedral surface representation of a cone. It uses SFCGAL's Kernel for exact computations.

Constructor & Destructor Documentation

◆ Cone() [1/2]

SFCGAL::Cone::Cone ( const Kernel::FT & bottom_radius = 1.0,
const Kernel::FT & top_radius = 0.0,
const Kernel::FT & height = 1.0,
unsigned int num_radial = 32 )

Constructs a Cone object with its base centered on the origin and in the XY plane A cone frustum is a cone with a top_radius greater than zero.

Parameters
bottom_radiusthe bottom face radius of the cone
top_radiusthe top face radius of the cone
heightthe height of the cone
num_radialThe number of radial divisions

◆ Cone() [2/2]

SFCGAL::Cone::Cone ( const Cone & other)
default

Copy constructor.

Parameters
othercopy from

◆ ~Cone()

SFCGAL::Cone::~Cone ( )
overridedefault

Destructor.

Member Function Documentation

◆ area3D()

auto SFCGAL::Cone::area3D ( bool withDiscretization = false) const -> double
nodiscardoverride

Returns the primitive area.

Parameters
withDiscretizationComputes volume with discretization (true) or as perfect primitive (false). Defaults to false.
Returns
The primitive volume

◆ baseArea3D()

auto SFCGAL::Cone::baseArea3D ( bool withDiscretization = false) const -> double

Computes cone base area without scaling effect.

Parameters
withDiscretizationComputes area with discretization (true) or as perfect primitive (false). Defaults to false.
Returns
base area

◆ baseVolume()

auto SFCGAL::Cone::baseVolume ( bool withDiscretization = false) const -> double
nodiscardoverride

Returns the sphere volume without scaling.

Parameters
withDiscretizationComputes volume with discretization (true) or as perfect primitive (false). Defaults to false.
Returns
The sphere volume

◆ bottomRadius()

auto SFCGAL::Cone::bottomRadius ( ) const -> const Kernel::FT &
nodiscard

Gets the bottom face radius of the cone.

Returns
The bottom face radius

◆ generatePolyhedralSurface()

auto SFCGAL::Cone::generatePolyhedralSurface ( ) const -> PolyhedralSurface
override

Generates a surface mesh representation of the cone.

Returns
A CGAL::Surface_mesh object representing the cone

◆ height()

auto SFCGAL::Cone::height ( ) const -> const Kernel::FT &
nodiscard

Gets the cone height.

Returns
The cone height

◆ numRadial()

auto SFCGAL::Cone::numRadial ( ) const -> unsigned int
nodiscard

Gets the number of radial divisions.

Returns
The number of radial divisions

◆ primitiveType()

auto SFCGAL::Cone::primitiveType ( ) const -> std::string
nodiscardoverride

returns the primitive type

Warning
use CamelCase (Cylinder, not CYLINDER)
Returns
the primitive type as string

◆ primitiveTypeId()

auto SFCGAL::Cone::primitiveTypeId ( ) const -> PrimitiveType
nodiscardoverride

Returns
a code corresponding to the type

◆ setBottomRadius()

void SFCGAL::Cone::setBottomRadius ( const Kernel::FT & bottom_radius)

Sets the bottom face radius of the cone.

Parameters
bottom_radiusThe new bottom face radius

◆ setHeight()

void SFCGAL::Cone::setHeight ( const Kernel::FT & height)

Sets the cone height.

Parameters
heightThe new cone height

◆ setNumRadial()

void SFCGAL::Cone::setNumRadial ( const unsigned int & num_radial)

Sets the number of radial divisions.

Parameters
num_radialThe new number of radial divisions

◆ setTopRadius()

void SFCGAL::Cone::setTopRadius ( const Kernel::FT & top_radius)

Sets the top face radius of the cone.

Parameters
top_radiusThe new top face radius

◆ topRadius()

auto SFCGAL::Cone::topRadius ( ) const -> const Kernel::FT &
nodiscard

Gets the top face radius of the cone.

Returns
The top face radius

◆ validateParameters()

void SFCGAL::Cone::validateParameters ( std::unordered_map< std::string, PrimitiveParameter > const & tempParameters) const
overrideprotected

Verifies that all parameters are valid.

For instance, it raises an error if a radius is negative.

Parameters
tempParametersa temp map of parameter with new values
Exceptions
SFCGAL::Exceptionif one of the parameters if not valid provided variant type is not compatible with the parameter.