14#ifdef LAGRANGE_ENABLE_LEGACY_HEADERS
15 #include <lagrange/primitive/legacy/generate_rounded_cone.h>
18#include <lagrange/primitive/api.h>
20#include <lagrange/SurfaceMesh.h>
21#include <lagrange/internal/constants.h>
22#include <lagrange/primitive/PrimitiveOptions.h>
24namespace lagrange::primitive {
34 using Scalar = PrimitiveOptions::Scalar;
132 Scalar a1 = (Scalar)(lagrange::internal::pi_2 + psi) * .5f;
133 Scalar a2 = (Scalar)(lagrange::internal::pi_2 - psi) * .5f;
135 Scalar max_bevel_bottom =
137 max_bevel_bottom = std::min(
height * .5f, max_bevel_bottom);
138 max_bevel_bottom = std::max(max_bevel_bottom, 0.f);
141 Scalar max_bevel_top =
143 max_bevel_top = std::min(
height * .5f, max_bevel_top);
144 max_bevel_top = std::max(max_bevel_top, 0.f);
146 return std::pair<Scalar, Scalar>{max_bevel_top, max_bevel_bottom};
177template <
typename Scalar,
typename Index>
A general purpose polygonal mesh class.
Definition SurfaceMesh.h:73
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:33
void project_to_valid_range()
Clamps all parameters to valid ranges.
Definition generate_rounded_cone.h:95
Scalar radius_bottom
Radius of the cone at the bottom.
Definition generate_rounded_cone.h:41
Scalar start_sweep_angle
Starting angle for partial cone generation (in radians).
Definition generate_rounded_cone.h:77
Index bevel_segments_top
Number of segments used to approximate the top rounded edge.
Definition generate_rounded_cone.h:60
Index top_segments
Number of radial segments on the top cap when radius_top > 0.
Definition generate_rounded_cone.h:70
Scalar radius_top
Radius of the cone at the top. Set to 0 for a traditional cone.
Definition generate_rounded_cone.h:38
Scalar height
Height of the cone along the Y-axis.
Definition generate_rounded_cone.h:44
Index bevel_segments_bottom
Number of segments used to approximate the bottom rounded edge.
Definition generate_rounded_cone.h:64
Scalar bevel_radius_top
Radius of the bevel/rounding applied to the top edge.
Definition generate_rounded_cone.h:48
std::pair< Scalar, Scalar > get_max_cone_bevel() const
Computes the maximum allowable bevel radii for the cone geometry.
Definition generate_rounded_cone.h:128
Index side_segments
Number of segments along the cone's side surface (height direction).
Definition generate_rounded_cone.h:67
Scalar bevel_radius_bottom
Radius of the bevel/rounding applied to the bottom edge.
Definition generate_rounded_cone.h:52
Index radial_sections
Number of radial subdivisions around the cone circumference.
Definition generate_rounded_cone.h:56
Index bottom_segments
Number of radial segments on the bottom cap when radius_bottom > 0.
Definition generate_rounded_cone.h:73
Scalar end_sweep_angle
Ending angle for partial cone generation (in radians).
Definition generate_rounded_cone.h:81