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.
30 lines
1.2 KiB
30 lines
1.2 KiB
|
4 days ago
|
#pragma once
|
||
|
|
#include <vector>
|
||
|
|
#include <primitive_descriptor.h>
|
||
|
|
|
||
|
|
namespace internal
|
||
|
|
{
|
||
|
|
|
||
|
|
struct fillet_config_t {
|
||
|
|
// 圆角切除量占相邻两段中较短段弦长的比例(默认 5%)
|
||
|
|
// 越小则圆角越微小,棱角感越强。
|
||
|
|
double segment_ratio = 0.05;
|
||
|
|
// 低于此角度(度)的衔接处视为共线,跳过不处理
|
||
|
|
double min_turn_angle_deg = 0.5;
|
||
|
|
};
|
||
|
|
|
||
|
|
// 对 2D profile 多段线的衔接顶点插入微小圆角弧,实现 G1 连续。
|
||
|
|
//
|
||
|
|
// 闭合多边形:处理全部 n 个顶点,输出隐式首尾相连。
|
||
|
|
// 不闭合多段线:仅处理内部顶点 [1, n-2],首尾端点原样保留。
|
||
|
|
//
|
||
|
|
// @param profile 原始 profile descriptor(通过 is_closed 区分开闭)
|
||
|
|
// @param out_points 输出点列表
|
||
|
|
// @param out_bulges 输出 bulge 列表(与 out_points 等长)
|
||
|
|
// @param cfg 圆角参数
|
||
|
|
void insert_profile_corner_fillets(const polyline_descriptor_t& profile,
|
||
|
|
std::vector<vector3d>& out_points,
|
||
|
|
std::vector<double>& out_bulges,
|
||
|
|
const fillet_config_t& cfg = {});
|
||
|
|
|
||
|
|
} // namespace internal
|