SFCGAL  2.3.0
Public Member Functions | Protected Member Functions | List of all members
SFCGAL::Cone Class Reference

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

#include <Cone.h>

Inherits SFCGAL::PrimitiveImpl< Derived, Base >.

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. More...
 
 Cone (const Cone &other)=default
 Copy constructor. More...
 
auto primitiveType () const -> std::string override
 returns the primitive type More...
 
auto primitiveTypeId () const -> PrimitiveType override
 
 ~Cone () override=default
 Destructor. More...
 
void setHeight (const Kernel::FT &height)
 Sets the cone height. More...
 
void setBottomRadius (const Kernel::FT &bottom_radius)
 Sets the bottom face radius of the cone. More...
 
void setTopRadius (const Kernel::FT &top_radius)
 Sets the top face radius of the cone. More...
 
void setNumRadial (const unsigned int &num_radial)
 Sets the number of radial divisions. More...
 
auto height () const -> const Kernel::FT &
 Gets the cone height. More...
 
auto bottomRadius () const -> const Kernel::FT &
 Gets the bottom face radius of the cone. More...
 
auto topRadius () const -> const Kernel::FT &
 Gets the top face radius of the cone. More...
 
auto numRadial () const -> unsigned int
 Gets the number of radial divisions. More...
 
auto generatePolyhedralSurface () const -> PolyhedralSurface override
 Generates a surface mesh representation of the cone. More...
 
auto baseVolume (bool withDiscretization=false) const -> double override
 Returns the sphere volume without scaling. More...
 
auto area3D (bool withDiscretization=false) const -> double override
 Returns the primitive area. More...
 
auto baseArea3D (bool withDiscretization=false) const -> double
 Computes cone base area without scaling effect. More...
 

Protected Member Functions

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

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

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
SFCGAL::Cone::Cone ( const Cone &  other)
default

Copy constructor.

Parameters
othercopy from
SFCGAL::Cone::~Cone ( )
overridedefault

Destructor.

Member Function Documentation

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

Returns the primitive area.

Parameters
withDiscretizationComputes volume with discretization (true) or as perfect primitive (false). Defaults to false.
Returns
The primitive volume
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
auto SFCGAL::Cone::baseVolume ( bool  withDiscretization = false) const -> double
override

Returns the sphere volume without scaling.

Parameters
withDiscretizationComputes volume with discretization (true) or as perfect primitive (false). Defaults to false.
Returns
The sphere volume
auto SFCGAL::Cone::bottomRadius ( ) const -> const Kernel::FT &

Gets the bottom face radius of the cone.

Returns
The bottom face radius
auto SFCGAL::Cone::generatePolyhedralSurface ( ) const -> PolyhedralSurface
override

Generates a surface mesh representation of the cone.

Returns
A CGAL::Surface_mesh object representing the cone
auto SFCGAL::Cone::height ( ) const -> const Kernel::FT &

Gets the cone height.

Returns
The cone height
auto SFCGAL::Cone::numRadial ( ) const -> unsigned int

Gets the number of radial divisions.

Returns
The number of radial divisions
auto SFCGAL::Cone::primitiveType ( ) const -> std::string
override

returns the primitive type

Warning
use CamelCase (Cylinder, not CYLINDER)
Returns
the primitive type as string
auto SFCGAL::Cone::primitiveTypeId ( ) const -> PrimitiveType
override

Returns
a code corresponding to the type
void SFCGAL::Cone::setBottomRadius ( const Kernel::FT &  bottom_radius)

Sets the bottom face radius of the cone.

Parameters
bottom_radiusThe new bottom face radius
void SFCGAL::Cone::setHeight ( const Kernel::FT &  height)

Sets the cone height.

Parameters
heightThe new cone height
void SFCGAL::Cone::setNumRadial ( const unsigned int &  num_radial)

Sets the number of radial divisions.

Parameters
num_radialThe new number of radial divisions
void SFCGAL::Cone::setTopRadius ( const Kernel::FT &  top_radius)

Sets the top face radius of the cone.

Parameters
top_radiusThe new top face radius
auto SFCGAL::Cone::topRadius ( ) const -> const Kernel::FT &

Gets the top face radius of the cone.

Returns
The top face radius
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.