constraints.ParallelEdgesConstraint
constraints.ParallelEdgesConstraint(a1, a2, b1, b2, *, weight=1.0)
Constraint that forces two sketch edges to be parallel.
Edges are given by their endpoint parameters. Unlike :class:~cadjoint.constraints.types.parallel.ParallelConstraint, which operates on 3D direction vectors, this constrains the differences of 2D sketch points via the 2D cross product: cross(a2 - a1, b2 - b1) = 0
Reduces DOF by 1 (one scalar equation).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| a1 | Vector2 | First endpoint of edge A (Vector2 parameter) | required |
| a2 | Vector2 | Second endpoint of edge A (Vector2 parameter) | required |
| b1 | Vector2 | First endpoint of edge B (Vector2 parameter) | required |
| b2 | Vector2 | Second endpoint of edge B (Vector2 parameter) | required |
Example
a1 = Vector2([0, 0], free=True, name='a1')
a2 = Vector2([1, 0], free=True, name='a2')
b1 = Vector2([0, 1], free=True, name='b1')
b2 = Vector2([1, 2], free=True, name='b2')
constraint = ParallelEdgesConstraint(a1, a2, b1, b2)
Methods
| Name | Description |
|---|---|
| compute_residual | Compute parallel-edges residual: cross(a2 - a1, b2 - b1). |
| dof_reduction | Parallel-edges constraint adds 1 scalar equation (2D cross product). |
| get_parameters | Return all four endpoints involved in the constraint. |
compute_residual
constraints.ParallelEdgesConstraint.compute_residual(param_values)
Compute parallel-edges residual: cross(a2 - a1, b2 - b1).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| param_values | dict[str, Array] | Dict with keys matching parameter names | required |
Returns
| Name | Type | Description |
|---|---|---|
| Array | Scalar residual (0 when the edges are parallel) |
dof_reduction
constraints.ParallelEdgesConstraint.dof_reduction()
Parallel-edges constraint adds 1 scalar equation (2D cross product).
get_parameters
constraints.ParallelEdgesConstraint.get_parameters()
Return all four endpoints involved in the constraint.