Lagrange
Loading...
Searching...
No Matches
RoundedConeOptions Struct Reference

Options for generating a rounded cone mesh. More...

#include <lagrange/primitive/generate_rounded_cone.h>

Inheritance diagram for RoundedConeOptions:
PrimitiveOptions

Public Types

using Scalar = PrimitiveOptions::Scalar
 
using Index = size_t
 
- Public Types inherited from PrimitiveOptions
using Scalar = float
 

Public Member Functions

void project_to_valid_range ()
 Clamps all parameters to valid ranges.
 
std::pair< Scalar, Scalar > get_max_cone_bevel () const
 Computes the maximum allowable bevel radii for the cone geometry.
 

Public Attributes

Scalar radius_top = 0
 Radius of the cone at the top. Set to 0 for a traditional cone.
 
Scalar radius_bottom = 1
 Radius of the cone at the bottom.
 
Scalar height = 1
 Height of the cone along the Y-axis.
 
Scalar bevel_radius_top = 0
 Radius of the bevel/rounding applied to the top edge.
 
Scalar bevel_radius_bottom = 0
 Radius of the bevel/rounding applied to the bottom edge.
 
Index radial_sections = 32
 Number of radial subdivisions around the cone circumference.
 
Index bevel_segments_top = 1
 Number of segments used to approximate the top rounded edge.
 
Index bevel_segments_bottom = 1
 Number of segments used to approximate the bottom rounded edge.
 
Index side_segments = 1
 Number of segments along the cone's side surface (height direction).
 
Index top_segments = 1
 Number of radial segments on the top cap when radius_top > 0.
 
Index bottom_segments = 1
 Number of radial segments on the bottom cap when radius_bottom > 0.
 
Scalar start_sweep_angle = 0
 Starting angle for partial cone generation (in radians).
 
Scalar end_sweep_angle = static_cast<Scalar>(2 * lagrange::internal::pi)
 Ending angle for partial cone generation (in radians).
 
- Public Attributes inherited from PrimitiveOptions
std::array< Scalar, 3 > center {0, 0, 0}
 Center of the primitive in 3D space.
 
bool with_top_cap = true
 Whether to generate top cap of the primitive (if applicable).
 
bool with_bottom_cap = true
 Whether to generate bottom cap of the primitive (if applicable).
 
bool with_cross_section = true
 Whether to generate cross section of the primitive (if applicable).
 
bool triangulate = false
 Whether to triangulate the generated surface mesh.
 
bool fixed_uv = false
 Whether to use fixed UV coordinates regardless of the primitive parameters.
 
std::string_view normal_attribute_name = "@normal"
 Name of the output indexed attribute storing the normal vectors.
 
std::string_view uv_attribute_name = "@uv"
 Name of the output indexed attribute storing the UV coordinates.
 
std::string_view semantic_label_attribute_name = "@semantic_label"
 Name of the output facet attribute storing the semantic labels.
 
Scalar dist_threshold = static_cast<Scalar>(1e-6)
 Two vertices are considered coinciding if the distance between them is smaller than dist_threshold.
 
Scalar angle_threshold = static_cast<Scalar>(30 * lagrange::internal::pi / 180)
 An edge is considered sharp if its dihedral angle is larger than angle_threshold.
 
Scalar epsilon = static_cast<Scalar>(1e-6)
 Numerical tolerance used for comparing Scalar values.
 
Scalar uv_padding = static_cast<Scalar>(0.005)
 Padding size for UV charts to avoid bleeding.
 

Detailed Description

Options for generating a rounded cone mesh.

Member Function Documentation

◆ project_to_valid_range()

void project_to_valid_range ( )
inline

Clamps all parameters to valid ranges.

This method ensures that:

  • All radii (radius_top, radius_bottom) are non-negative
  • Height is non-negative
  • Bevel radii are non-negative and don't exceed geometric constraints
  • All segment counts are at least 1

The bevel radius constraints are computed based on cone geometry to prevent invalid configurations where bevels would overlap or exceed the cone dimensions.

◆ get_max_cone_bevel()

std::pair< Scalar, Scalar > get_max_cone_bevel ( ) const
inline

Computes the maximum allowable bevel radii for the cone geometry.

This function calculates geometric constraints on bevel radii based on the cone's dimensions and slope. The maximum bevel radius is limited by both the radius at each end and the cone's height to prevent geometric inconsistencies.

Returns
A pair containing (max_bevel_top, max_bevel_bottom) where:
  • max_bevel_top: Maximum allowable bevel radius for the top edge
  • max_bevel_bottom: Maximum allowable bevel radius for the bottom edge
Note
The calculation considers the cone's slope angle and ensures bevels don't exceed half the height or create overlapping rounded regions.

Member Data Documentation

◆ bevel_radius_top

Scalar bevel_radius_top = 0

Radius of the bevel/rounding applied to the top edge.

A value of 0 creates a sharp edge.

◆ bevel_radius_bottom

Scalar bevel_radius_bottom = 0

Radius of the bevel/rounding applied to the bottom edge.

A value of 0 creates a sharp edge.

◆ radial_sections

Index radial_sections = 32

Number of radial subdivisions around the cone circumference.

Higher values create smoother circular cross-sections.

◆ bevel_segments_top

Index bevel_segments_top = 1

Number of segments used to approximate the top rounded edge.

Only relevant when bevel_radius_top > 0.

◆ bevel_segments_bottom

Index bevel_segments_bottom = 1

Number of segments used to approximate the bottom rounded edge.

Only relevant when bevel_radius_bottom > 0.

◆ start_sweep_angle

Scalar start_sweep_angle = 0

Starting angle for partial cone generation (in radians).

0 corresponds to the positive X-axis.

◆ end_sweep_angle

Scalar end_sweep_angle = static_cast<Scalar>(2 * lagrange::internal::pi)

Ending angle for partial cone generation (in radians).

Default of 2π creates a full cone.


The documentation for this struct was generated from the following file: