Temporary repository used to save branch code
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.
|
|
|
|
#pragma once
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <primitive_descriptor.h>
|
|
|
|
|
|
|
|
|
|
namespace internal
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
struct fillet_config_t {
|
|
|
|
|
double segment_ratio = 0.05 ;// 圆角切除量占相邻两段中较短段弦长的比例
|
|
|
|
|
double min_turn_angle_deg = 0.5; // 低于此角度(度)的衔接处视为共线,跳过
|
|
|
|
|
bool is_axis = false;
|
|
|
|
|
double max_fillet_turn_angle_deg = 135.0; // 超过此转角不做圆角
|
|
|
|
|
double min_fillet_radius = 1e-3; // 圆角半径下限
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 对 2D profile / axis 多段线的衔接顶点插入微小圆角弧,实现 G1 连续。
|
|
|
|
|
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
|