|
ViewDesignEngine
3.1.0
高性能 CAD 计算几何引擎
|
SDF 梯度计算(数值微分、解析梯度、链式法则) 更多...
#include "vde/sdf/sdf_primitives.h"#include "vde/sdf/sdf_operations.h"#include "vde/core/point.h"#include <cmath>#include <functional>

类 | |
| struct | vde::sdf::GradResult |
| 前向模梯度结果: SDF 值 + 梯度 更多... | |
| struct | vde::sdf::ParamGrad |
| 参数梯度结构体 更多... | |
命名空间 | |
| vde | |
| vde::sdf | |
函数 | |
| Vector3D | vde::sdf::gradient (const std::function< double(const Point3D &)> &f, const Point3D &p, double h=1e-6) |
| SDF 的空间梯度(中心差分近似) 更多... | |
| GradResult | vde::sdf::evaluate_with_gradient (const std::function< double(const Point3D &)> &f, const Point3D &p, double h=1e-6) |
| 同时计算 SDF 值和梯度的便捷函数 更多... | |
| double | vde::sdf::sphere_radius_gradient (const Point3D &p, double radius, double h=1e-6) |
| 球体 SDF 对半径的参数梯度 ∂f/∂r 更多... | |
| double | vde::sdf::box_extent_gradient (const Point3D &p, const Point3D &extents, int axis, double h=1e-6) |
| 长方体 SDF 对各轴半尺寸的参数梯度 ∂f/∂extent[i] 更多... | |
| double | vde::sdf::torus_major_gradient (const Point3D &p, double major_r, double minor_r, double h=1e-6) |
| 圆环 SDF 对主半径的参数梯度 ∂f/∂major_r 更多... | |
| double | vde::sdf::torus_minor_gradient (const Point3D &p, double major_r, double minor_r, double h=1e-6) |
| 圆环 SDF 对副半径的参数梯度 ∂f/∂minor_r 更多... | |
| double | vde::sdf::cylinder_height_gradient (const Point3D &p, double radius, double height, double h=1e-6) |
| 圆柱 SDF 对高度的参数梯度 ∂f/∂height 更多... | |
| double | vde::sdf::cylinder_radius_gradient (const Point3D &p, double radius, double height, double h=1e-6) |
| 圆柱 SDF 对半径的参数梯度 ∂f/∂radius 更多... | |
| Vector3D | vde::sdf::sphere_gradient_analytic (const Point3D &p, double) |
| 球体 SDF 的解析梯度 更多... | |
| Vector3D | vde::sdf::box_gradient_analytic (const Point3D &p, const Point3D &half_extents) |
| 长方体 SDF 的解析梯度 更多... | |
| Vector3D | vde::sdf::torus_gradient_analytic (const Point3D &p, double major_r, double minor_r) |
| 圆环 SDF 的解析梯度 更多... | |
| Vector3D | vde::sdf::cylinder_gradient_analytic (const Point3D &p, double) |
| 无限圆柱(沿 Y 轴)的解析梯度 更多... | |
| Vector3D | vde::sdf::plane_gradient_analytic (const Vector3D &normal) |
| 平面的解析梯度 更多... | |
| Vector3D | vde::sdf::capsule_gradient_analytic (const Point3D &p, const Point3D &a, const Point3D &b, double radius) |
| 胶囊体 SDF 的解析梯度 更多... | |
| Vector3D | vde::sdf::chain_union (const Vector3D &grad_a, const Vector3D &grad_b, double d1, double d2) |
| 并集操作后的梯度传递 更多... | |
| Vector3D | vde::sdf::chain_intersection (const Vector3D &grad_a, const Vector3D &grad_b, double d1, double d2) |
| 交集操作后的梯度传递 更多... | |
| Vector3D | vde::sdf::chain_difference (const Vector3D &grad_a, const Vector3D &grad_b, double d1, double d2) |
| 差集操作后的梯度传递 更多... | |
| Vector3D | vde::sdf::chain_smooth_union (const Vector3D &grad_a, const Vector3D &grad_b, double d1, double d2, double k) |
| 平滑并集操作的梯度传递(含完整链式法则) 更多... | |
| GradResult | vde::sdf::chain_translate (const GradResult &child_result, const Point3D &) |
| 平移变换后的梯度传递(梯度不变) 更多... | |
| GradResult | vde::sdf::chain_rotate (const GradResult &child_result, double angle_rad) |
| 绕 Y 轴旋转后的梯度传递 更多... | |
| GradResult | vde::sdf::chain_scale (const GradResult &child_result, const Point3D &factors) |
| 非均匀缩放后的梯度传递 更多... | |
| GradResult | vde::sdf::chain_twist (const GradResult &child_result, double amount, const Point3D &p) |
| 扭曲变换后的梯度传递(含完整雅可比) 更多... | |
| GradResult | vde::sdf::chain_repeat (const GradResult &child_result, const Point3D &, const Point3D &) |
| 周期重复后的梯度传递(梯度不变) 更多... | |
| ParamGrad | vde::sdf::sphere_param_grad (const Point3D &p, double radius, double h=1e-6) |
| 球体所有参数的梯度(当前仅 radius 有意义) 更多... | |
| ParamGrad | vde::sdf::box_param_grad (const Point3D &p, const Point3D &half_extents, double h=1e-6) |
| 长方体所有参数的梯度 更多... | |
| ParamGrad | vde::sdf::cylinder_param_grad (const Point3D &p, double radius, double height, double h=1e-6) |
| 圆柱所有参数的梯度 更多... | |
SDF 梯度计算(数值微分、解析梯度、链式法则)
提供两类梯度计算:
对于 SDF,梯度指向距离增加最快的方向。 在表面上 (f=0),∇f 等于外法向量(单位长度)。 在外部 (f>0),∇f 指向远离表面的方向。 在内部 (f<0),∇f 指向最近的表面。
在文件 sdf_gradient.h 中定义.