14#ifdef LAGRANGE_ENABLE_LEGACY_FUNCTIONS
15 #include <lagrange/primitive/legacy/generate_rounded_cone.h>
18#include <lagrange/SurfaceMesh.h>
19#include <lagrange/internal/constants.h>
20#include <lagrange/primitive/PrimitiveOptions.h>
22namespace lagrange::primitive {
32 using Scalar = PrimitiveOptions::Scalar;
130 Scalar a1 = (Scalar)(lagrange::internal::pi_2 + psi) * .5f;
131 Scalar a2 = (Scalar)(lagrange::internal::pi_2 - psi) * .5f;
133 Scalar max_bevel_bottom =
135 max_bevel_bottom = std::min(
height * .5f, max_bevel_bottom);
136 max_bevel_bottom = std::max(max_bevel_bottom, 0.f);
139 Scalar max_bevel_top =
141 max_bevel_top = std::min(
height * .5f, max_bevel_top);
142 max_bevel_top = std::max(max_bevel_top, 0.f);
144 return std::pair<Scalar, Scalar>{max_bevel_top, max_bevel_bottom};
175template <
typename Scalar,
typename Index>
A general purpose polygonal mesh class.
Definition SurfaceMesh.h:66
SurfaceMesh< Scalar, Index > generate_rounded_cone(RoundedConeOptions setting)
Generate a rounded cone mesh.
Definition generate_rounded_cone.cpp:149
Common settings shared by all primitives.
Definition PrimitiveOptions.h:28
Options for generating a rounded cone mesh.
Definition generate_rounded_cone.h:31
void project_to_valid_range()
Clamps all parameters to valid ranges.
Definition generate_rounded_cone.h:93
Scalar radius_bottom
Radius of the cone at the bottom.
Definition generate_rounded_cone.h:39
Scalar start_sweep_angle
Starting angle for partial cone generation (in radians).
Definition generate_rounded_cone.h:75
Index bevel_segments_top
Number of segments used to approximate the top rounded edge.
Definition generate_rounded_cone.h:58
Index top_segments
Number of radial segments on the top cap when radius_top > 0.
Definition generate_rounded_cone.h:68
Scalar radius_top
Radius of the cone at the top. Set to 0 for a traditional cone.
Definition generate_rounded_cone.h:36
Scalar height
Height of the cone along the Y-axis.
Definition generate_rounded_cone.h:42
Index bevel_segments_bottom
Number of segments used to approximate the bottom rounded edge.
Definition generate_rounded_cone.h:62
Scalar bevel_radius_top
Radius of the bevel/rounding applied to the top edge.
Definition generate_rounded_cone.h:46
std::pair< Scalar, Scalar > get_max_cone_bevel() const
Computes the maximum allowable bevel radii for the cone geometry.
Definition generate_rounded_cone.h:126
Index side_segments
Number of segments along the cone's side surface (height direction).
Definition generate_rounded_cone.h:65
Scalar bevel_radius_bottom
Radius of the bevel/rounding applied to the bottom edge.
Definition generate_rounded_cone.h:50
Index radial_sections
Number of radial subdivisions around the cone circumference.
Definition generate_rounded_cone.h:54
Index bottom_segments
Number of radial segments on the bottom cap when radius_bottom > 0.
Definition generate_rounded_cone.h:71
Scalar end_sweep_angle
Ending angle for partial cone generation (in radians).
Definition generate_rounded_cone.h:79