Represents a sphere in 3D space centered at the origin.
More...
#include <Sphere.h>
Inherits SFCGAL::PrimitiveImpl< Derived, Base >.
Represents a sphere in 3D space centered at the origin.
This class provides methods to generate a polyhedron and a point cloud representation of a sphere. It uses SFCGAL's Kernel for exact computations.
| SFCGAL::Sphere::Sphere |
( |
const Kernel::FT & |
radius = 1.0, |
|
|
unsigned int |
num_subdivisions = 2 |
|
) |
| |
Constructs a Sphere object.
- Parameters
-
| radius | The radius of the sphere |
| num_subdivisions | The number of icosahedron subdivisions (0=12 vertices, 1=42, 2=162, etc.) |
| SFCGAL::Sphere::Sphere |
( |
const Sphere & |
other | ) |
|
|
default |
Copy constructor.
- Parameters
-
| SFCGAL::Sphere::~Sphere |
( |
| ) |
|
|
overridedefault |
| auto SFCGAL::Sphere::area3D |
( |
bool |
withDiscretization = false | ) |
const -> double |
|
override |
Returns the sphere area.
- Parameters
-
| withDiscretization | Computes area with discretization (true) or as perfect primitive (false). Defaults to false. |
- Returns
- The sphere area
- Note
- only perfect primitive version is available
| auto SFCGAL::Sphere::baseVolume |
( |
bool |
withDiscretization = false | ) |
const -> double |
|
override |
Returns the sphere volume without scaling.
- Parameters
-
| withDiscretization | Computes volume with discretization (true) or as perfect primitive (false). Defaults to false. |
- Returns
- The sphere volume
- Note
- only perfect primitive version is available
| auto SFCGAL::Sphere::generatePoints |
( |
| ) |
const -> std::vector<Kernel::Point_3> |
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 |
( |
| ) |
const -> CGAL::Polyhedron_3<Kernel> |
Generates a polyhedron representation of the sphere.
- Returns
- A CGAL::Polyhedron_3 object representing the sphere
| void SFCGAL::Sphere::invalidateCache |
( |
| ) |
|
|
overrideprotected |
Invalidates the cached geometries.
| auto SFCGAL::Sphere::numSubdivisions |
( |
| ) |
const -> unsigned int
|
|
inline |
Gets the number of subdivisions.
- Returns
- The number of subdivisions
| auto SFCGAL::Sphere::primitiveType |
( |
| ) |
const -> std::string |
|
override |
returns the primitive type
- Warning
- use CamelCase (Sphere, not SPHERE)
- Returns
- the primitive type as string
returns a code corresponding to the type
- Returns
- a code corresponding to the type
| auto SFCGAL::Sphere::radius |
( |
| ) |
const -> const Kernel::FT &
|
|
inline |
Gets the radius of the sphere.
- Returns
- The radius
| void SFCGAL::Sphere::setNumSubdivisions |
( |
unsigned int |
num | ) |
|
|
inline |
Sets the number of subdivisions.
- Parameters
-
| num | The new number of subdivisions |
| void SFCGAL::Sphere::setRadius |
( |
const Kernel::FT & |
radius | ) |
|
|
inline |
Sets the radius of the sphere.
- Parameters
-
| void SFCGAL::Sphere::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
-
| tempParameters | a temp map of parameter with new values |
- Exceptions
-
| SFCGAL::Exception | if one of the parameters if not valid provided variant type is not compatible with the parameter. |