ViewDesignEngine  3.1.0
高性能 CAD 计算几何引擎
草图模块 (vde::sketch)

2D 约束求解器 更多...

struct  vde::sketch::SketchPoint
 草图点元素 更多...
 
struct  vde::sketch::SketchLine
 草图线段元素 更多...
 
struct  vde::sketch::SketchCircle
 草图圆元素 更多...
 
struct  vde::sketch::Constraint
 约束实例 更多...
 
struct  vde::sketch::SolverResult
 求解器返回结果 更多...
 
class  vde::sketch::ConstraintSolver
 二维几何约束求解器 更多...
 

枚举

enum class  vde::sketch::ConstraintType {
  vde::sketch::Horizontal , vde::sketch::Vertical , vde::sketch::Parallel , vde::sketch::Perpendicular ,
  vde::sketch::Coincident , vde::sketch::EqualLength , vde::sketch::Distance , vde::sketch::Radius ,
  vde::sketch::Tangent , vde::sketch::Concentric , vde::sketch::FixedPoint , vde::sketch::Fixed ,
  vde::sketch::Angle
}
 约束类型枚举 更多...
 

详细描述

2D 约束求解器

枚举类型说明

◆ ConstraintType

约束类型枚举

每个约束类型对应一个残差方程,方程数见注释:

  • 距离类约束:1 个方程
  • 位置/重合类:2 个方程(x + y)
枚举值
Horizontal 

水平线: y1 - y0 = 0 [1 eq]

Vertical 

垂直线: x1 - x0 = 0 [1 eq]

Parallel 

两线平行: cross(d0, d1) = 0 [1 eq]

Perpendicular 

两线垂直: dot(d0, d1) = 0 [1 eq]

Coincident 

两点重合: |p1-p0| = 0 [2 eqs: Δx=0, Δy=0]

EqualLength 

等长度: |d0| - |d1| = 0 [1 eq]

Distance 

距离约束: |p1-p0| - d = 0 [1 eq]

Radius 

半径约束 [1 eq]

Tangent 

相切 [1 eq]

Concentric 

同心 [2 eqs]

FixedPoint 

固定点(硬约束,排除变量)[0 eq — 系统预处理]

Fixed 

固定点位置: x-x0=0, y-y0=0 [2 eqs]

Angle 

角度约束: atan2(cross(d0,d1), dot(d0,d1)) - θ = 0 [1 eq]

在文件 constraint_solver.h49 行定义.