ViewDesignEngine  3.1.0
高性能 CAD 计算几何引擎
sdf_primitives.h 文件参考

有符号距离函数(SDF)基础图元 更多...

#include "vde/core/point.h"
#include <cmath>
#include <algorithm>
sdf_primitives.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

命名空间

 vde
 
 vde::sdf
 

函数

double vde::sdf::sphere (const Point3D &p, double radius)
 球体的 SDF 更多...
 
double vde::sdf::box (const Point3D &p, const Point3D &half_extents)
 轴对齐立方体的 SDF 更多...
 
double vde::sdf::round_box (const Point3D &p, const Point3D &half_extents, double r)
 圆角立方体的 SDF 更多...
 
double vde::sdf::torus (const Point3D &p, double major_radius, double minor_radius)
 圆环面的 SDF 更多...
 
double vde::sdf::capsule (const Point3D &p, const Point3D &a, const Point3D &b, double radius)
 胶囊体的 SDF 更多...
 
double vde::sdf::cylinder (const Point3D &p, double radius, double height)
 带平端盖的圆柱体 SDF 更多...
 
double vde::sdf::plane (const Point3D &p, const Vector3D &normal, double offset)
 平面的 SDF 更多...
 
double vde::sdf::ellipsoid (const Point3D &p, const Point3D &radii)
 椭球体的 SDF(有界梯度近似) 更多...
 
double vde::sdf::hex_prism (const Point3D &p, double radius, double height)
 正六棱柱的 SDF 更多...
 
double vde::sdf::infinite_cylinder (const Point3D &p, const Vector3D &axis, double radius)
 无限长圆柱的 SDF 更多...
 
double vde::sdf::wedge (const Point3D &p, double w, double h, double d)
 楔形体的 SDF 更多...
 
double vde::sdf::extrusion (const Point3D &, double sdf_2d)
 二维 SDF 沿 Z 轴的无限挤出 更多...
 
double vde::sdf::extrusion_bounded (const Point3D &p, double sdf_2d, double half_height)
 二维 SDF 的有限长度挤出 更多...
 
double vde::sdf::revolution (const Point3D &, double sdf_2d, double)
 二维轮廓绕 Y 轴的旋转体 SDF 更多...
 
double vde::sdf::cone (const Point3D &p, double angle_rad, double height)
 圆锥台的 SDF(非内联实现) 更多...
 
double vde::sdf::triangular_prism (const Point3D &p, const Point3D &a, const Point3D &b, const Point3D &c, double height)
 三角棱柱的 SDF(非内联实现) 更多...
 
double vde::sdf::link (const Point3D &p, double length, double major_r, double minor_r)
 双环链接体的 SDF(非内联实现) 更多...
 
double vde::sdf::infinite_cone (const Point3D &p, const Point3D &apex, const Vector3D &axis, double angle_rad)
 无限圆锥的 SDF(非内联实现) 更多...
 

详细描述

有符号距离函数(SDF)基础图元

提供常见几何体到三维空间中各点的有符号距离计算。 所有图元定义在 vde::sdf 命名空间下,使用 vde::core::Point3D 作为输入。

SDF 约定

  • f(p) < 0: 点 p 在几何体**内部**
  • f(p) = 0: 点 p 在几何体**表面**上
  • f(p) > 0: 点 p 在几何体**外部**
  • |f(p)| 的绝对值近似为 p 到最近表面的欧几里得距离

数值特性

  • 所有内联函数标记为 [[nodiscard]],强制调用方使用返回值
  • 距离函数在表面附近满足 |∇f| ≈ 1(Lipschitz 连续,步进可靠)
  • 部分复杂图元(cone, triangular_prism, link, infinite_cone)为非内联实现,定义在 src/sdf/ 中
注解
所有图元假设未施加变换——坐标系原点即图元中心/基点。 需要平移/旋转/缩放时,使用 sdf_operations.h 中的域变形算子对采样点预先变换。

在文件 sdf_primitives.h 中定义.