GCS: Simple refactor magic numbers into enum

============================================

A new enum to remove magic numbers for constraint tags.

A previous version of the commit introduced more magic numbers, which
demonstrated not to be up for the task.

About the Tag numbers:
- Positive Tags identify a higher level constraint form which the solver constraint originates
- Negative Tags represent temporary constraints, used for example in moving operations, these
have a different handling in component splitting, see GCS::initSolution. Lifetime is defined by
the container object via GCS::clearByTag
- Hardcoded value -1 is used for these constraints.The effect is parameters are not truly enforced
  (it gives a nice effect when dragging the edge of an unconstrained circle, that the center won't
  move if the edge can be dragged, and only when/if the edge cannot be dragged,  e.g. radius constraint,
  the center is moved).
This commit is contained in:
Abdullah Tahiri
2020-12-06 10:53:37 +01:00
committed by abdullahtahiriyo
parent 00cf07d1dd
commit be8e5ac338

View File

@@ -69,6 +69,19 @@ namespace GCS
IterationLevel = 2
};
// Magic numbers for Constraint tags
// - Positive Tags identify a higher level constraint form which the solver constraint originates
// - Negative Tags represent temporary constraints, used for example in moving operations, these
// have a different handling in component splitting, see GCS::initSolution. Lifetime is defined by
// the container object via GCS::clearByTag.
// - -1 is typically used as tag for these temporary constraints, its parameters are enforced with
// a lower priority than the main system (real sketcher constraints). It gives a nice effect when
// dragging the edge of an unconstrained circle, that the center won't move if the edge can be dragged,
// and only when/if the edge cannot be dragged, e.g. radius constraint, the center is moved).
enum SpecialTag {
DefaultTemporaryConstraint = -1
};
class System
{
// This is the main class. It holds all constraints and information