You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.6 KiB
38 lines
1.6 KiB
#pragma once
|
|
#include <vector>
|
|
#include <primitive_descriptor.h>
|
|
|
|
namespace internal
|
|
{
|
|
|
|
struct fillet_config_t {
|
|
bool auto_mode = true;
|
|
double max_segment_fraction = 0.10; // 每处圆角弧允许裁切相邻线段的最大比例
|
|
|
|
bool is_axis = false;
|
|
|
|
double min_turn_angle_deg = 0.5; // 小于此角度视为共线,跳过
|
|
double max_fillet_turn_angle_deg = 179.0; // 大于此角度视为极端折叠,跳过
|
|
|
|
double segment_ratio = 0.05; // 相对比例模式:trim = ratio × min_chord
|
|
double min_fillet_radius = 1e-3; // 圆弧半径下限(用于过滤退化圆弧)
|
|
double absolute_fillet_radius = 0.0; // 绝对半径模式:> 0 时以此为目标半径
|
|
};
|
|
|
|
// 对 2D profile / axis 多段线的衔接顶点插入微小圆角弧
|
|
void insert_polyline_corner_fillets(const polyline_descriptor_t& profile,
|
|
std::vector<vector3d>& out_points,
|
|
std::vector<double>& out_bulges,
|
|
const fillet_config_t& cfg = {});
|
|
|
|
/**
|
|
* @brief 检测并修复 polyline 中负 bulge 圆弧与相邻边的自相交。
|
|
* 将自相交段的 bulge 置 0(退化为直线),消除 PMC 歧义区域。
|
|
*/
|
|
void sanitize_negative_bulge_self_intersections(const std::vector<vector3d>& pts_3d,
|
|
std::vector<double>& bulges,
|
|
bool is_axis,
|
|
bool closed);
|
|
|
|
|
|
} // namespace internal
|