Skip to main content

Module rules

Module rules 

Source
Expand description

Residual builders for the supported rule classes.

Linear rules: fix, equal, linear relation (sum/difference/ratio/min/max with constant coefficients), equal spacing.

Geometric rules: coincident, horizontal, vertical, fixed point, distance (point–point, signed point–line), point on line/circle, length, equal length, parallel, perpendicular, angle, concentric, radius, equal radius, line–circle and circle–circle tangency.

Every builder returns residual rows; the solver decides linearity from the expressions themselves. Residuals of direction rules are normalized (sine/cosine of angles) so their scale is 1 regardless of segment length.

Enums§

CircleTangency
Tangency between two circles.
Cmp
Linear comparison operators.

Functions§

all_equal
Equal values: v₀ = v₁ = ….
angle
Signed angle from segment 1 to segment 2 equals theta (radians). The residual is the wrapped angle difference, smooth everywhere except at ±π.
at_least
a ≥ min.
at_most
a ≤ max.
coincident
Coincident points.
concentric
Concentric circles/arcs.
distance
|q − p| = d.
distance_cmp
|q − p| (cmp) d.
equal
a = b.
equal_length
Equal segment lengths.
equal_radius
Equal radii.
equal_spacing
Consecutive differences are equal: v₁−v₀ = v₂−v₁ = ….
fix
v = value.
fix_point
Point fixed at a location.
horizontal
Same Y.
length
Segment length.
linear
Σ cᵢ·eᵢ (cmp) rhs.
parallel
Parallel (or anti-parallel) segments: sin(angle) = 0.
perpendicular
Perpendicular segments: cos(angle) = 0.
point_line_distance
Signed point–line distance equals d (sign selects the side).
point_on_circle
Point lies on the circle (c, r).
point_on_line
Point lies on the infinite line through a, b.
polar_point
Point expression of an arc/circle point at an angle: c + r·(cos a, sin a).
radius
Radius equals value.
ratio
a = k · b (constant ratio).
signed_line_distance
Signed distance from p to the line a → b (positive on the left).
tangent_circles
Circle–circle tangency.
tangent_line_circle
Line a → b tangent to circle (c, r); side (±1) keeps the circle on its current side of the line.
v
Convenience: variable expression.
vertical
Same X.