Appearance
Constraints
Constraints are geometric and dimensional relationships between shapes that DrawMotive enforces automatically. They bring CAD-like precision to your diagrams.
How Constraints Work
When you add a constraint, the constraint solver calculates the correct positions for all affected shapes. Each constraint is formulated as an energy function — a mathematical expression that equals zero when the constraint is satisfied. The solver minimizes the total energy across all constraints simultaneously using the BFGS optimization algorithm.
In practice, this means:
- You define relationships (e.g., "these two lines are parallel")
- When you move any constrained shape, the solver adjusts all connected shapes
- All constraints are satisfied simultaneously, not sequentially
Geometric Constraints
Coincident
Forces two points to occupy the same location. Use this to connect line endpoints or snap a shape's corner to another shape.
Example: Make two lines share an endpoint by applying a coincident constraint between the end of one line and the start of another.
Parallel
Forces two lines to maintain the same direction. Neither line moves to match the other — the solver finds the best position for both.
Example: Keep the sides of a custom shape parallel as you adjust its proportions.
Perpendicular
Forces two lines to meet at exactly 90 degrees.
Example: Ensure a horizontal beam and vertical column in a structural diagram always form a right angle.
Horizontal
Forces a line to be parallel to the X-axis (perfectly horizontal).
Example: Lock a dimension line so it stays horizontal regardless of how you move its endpoints.
Vertical
Forces a line to be parallel to the Y-axis (perfectly vertical).
Example: Keep a vertical divider line straight in a layout diagram.
Collinear
Forces three or more points to lie on the same straight line.
Concentric
Forces two circles to share the same center point.
Example: Create nested circles (like a target or bullseye) that stay centered as you resize them.
Equal
Forces two dimensions to be equal — for example, two lines must have the same length, or two circles must have the same radius.
Example: Ensure both sides of a symmetrical diagram have matching dimensions.
Dimensional Constraints
Line Length
Sets a specific length for a line segment. The line maintains this length as you drag its endpoints — the solver adjusts both endpoints to satisfy the constraint.
Diameter
Sets a specific diameter for a circle. The circle maintains this size as you reposition it.
Angle
Sets a specific angle between two lines. The lines maintain this angular relationship as you move them.
Point Distance
Sets a specific distance between two points. The points maintain this separation as you drag connected shapes.
Fixed Point Constraints
A fixed point constraint anchors a point at specific coordinates. The point won't move when the solver adjusts other shapes. Use this to pin a shape in place while the rest of the diagram adjusts around it.
Working with Constraints
Adding a Constraint
- Select the shapes you want to constrain (usually two shapes)
- Choose the constraint type from the constraint menu
- The solver immediately adjusts shapes to satisfy the constraint
Removing a Constraint
Select the constraint indicator and delete it, or use the constraint panel to remove specific constraints from a shape.
Constraint Conflicts
If you add constraints that can't all be satisfied simultaneously (an over-constrained system), the solver reports the conflict. You'll need to remove one or more constraints to resolve it.
Performance
The constraint solver handles typical diagrams quickly:
- Simple setups (up to 5 constraints) resolve almost instantly
- Moderate setups (up to 50 constraints) resolve within a fraction of a second
- Very large setups (50+ constraints) may take slightly longer but remain interactive
Tips
- Start with a few constraints and add more as needed — it's easier to build up than to debug an over-constrained system
- Use fixed point constraints to anchor reference objects before constraining other shapes
- Constraints persist through undo/redo and sync across collaborators
- The constraint solver runs locally, so constraints work offline