constraints.PointOnLineConstraint

constraints.PointOnLineConstraint(point, line1, line2, *, weight=1.0)

Constraint that forces a sketch point onto the infinite line through two points.

This constraint enforces collinearity of point, line1, and line2 via the 2D cross product: cross(point - line1, line2 - line1) = 0

Reduces DOF by 1 (one scalar equation).

Parameters

Name Type Description Default
point Vector2 The point to place on the line (Vector2 parameter) required
line1 Vector2 First point defining the line (Vector2 parameter) required
line2 Vector2 Second point defining the line (Vector2 parameter) required

Example

p = Vector2([1, 1], free=True, name='p')
l1 = Vector2([0, 0], free=True, name='l1')
l2 = Vector2([2, 0], free=True, name='l2')
constraint = PointOnLineConstraint(p, l1, l2)

Methods

Name Description
compute_residual Compute point-on-line residual: cross(point - line1, line2 - line1).
dof_reduction Point-on-line constraint adds 1 scalar equation.
get_parameters Return the point and both line-defining points.

compute_residual

constraints.PointOnLineConstraint.compute_residual(param_values)

Compute point-on-line residual: cross(point - line1, line2 - line1).

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 point lies on the line)

dof_reduction

constraints.PointOnLineConstraint.dof_reduction()

Point-on-line constraint adds 1 scalar equation.

get_parameters

constraints.PointOnLineConstraint.get_parameters()

Return the point and both line-defining points.