Skip to content

Priority for constraints #146

@adamchalmers

Description

@adamchalmers

Problem

ZDS users will have some explicit constraints (e.g. "these two lines are the same length"). Other constraints are kinda implicit, e.g. when the user drags a point with their mouse, they're implicitly adding a constraint that the point should be coincident with the mouse's position. But if that would make the system unsolvable, we should probably just use the mouse location as a best guess, not as a constraint.

Right now ezpz has no way to say "try to satisfy all these constraints, and if you can, then also try adding this mouse constraint."

Solution

  • User can specify a constraint's priority as a u32. 0 is highest priority, larger numbers are lower priority.
  • First, ezpz solves for all the highest-priority constraints (i.e. priority 0)
  • If a solve fully satisfies all attempted constraints, then add the next lowest-priority constraints (e.g. priority 1)
  • Repeat until a system could not be fully satisfied.

As a first try, we'd set all explicit constraints to P0, and then the mouse drag constraint as P1.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions