Adaptagrams
|
A separation constraint specifies a simple horizontal or vertical spacing constraint between 2 nodes or alignment constraints. More...
#include <compound_constraints.h>
Public Member Functions | |
SeparationConstraint (const vpsc::Dim dim, unsigned l, unsigned r, double g, bool equality=false) | |
Constructs a new SeparationConstraint between two nodes in the specified dimension. More... | |
SeparationConstraint (const vpsc::Dim dim, AlignmentConstraint *l, AlignmentConstraint *r, double g, bool equality=false) | |
Constructs a new SeparationConstraint between two alignment constraints in the specified dimension. More... | |
std::string | toString (void) const |
Returns a textual description of the compound constraint. More... | |
void | generateVariables (const vpsc::Dim dim, vpsc::Variables &vars) |
Implemented by the compound constraint to generate any additional required variables in the given dimension. More... | |
void | generateSeparationConstraints (const vpsc::Dim dim, vpsc::Variables &vs, vpsc::Constraints &cs, vpsc::Rectangles &bbs) |
Implemented by the compound constraint to generate the low-level separation constraints in the given dimension. More... | |
Public Member Functions inherited from cola::CompoundConstraint | |
virtual void | updatePosition (const vpsc::Dim dim) |
Implemented by the compound constraint to send position information back to the interface. More... | |
A separation constraint specifies a simple horizontal or vertical spacing constraint between 2 nodes or alignment constraints.
The non-equality constraint is lPos + g <= rPos and the equality constraint is lPos + g = rPos
cola::SeparationConstraint::SeparationConstraint | ( | const vpsc::Dim | dim, |
unsigned | l, | ||
unsigned | r, | ||
double | g, | ||
bool | equality = false |
||
) |
Constructs a new SeparationConstraint between two nodes in the specified dimension.
The constraint will keep the centre of the left node to the left of the right node by exactly or more than the specified gap.
[in] | dim | The dimension the constraint will operate in. |
[in] | l | The index of the left node. |
[in] | r | The index of the right node. |
[in] | g | The minimum or exact distance to separate the two nodes. |
[in] | equality | Whether or not the constraint is an exact distance. |
cola::SeparationConstraint::SeparationConstraint | ( | const vpsc::Dim | dim, |
AlignmentConstraint * | l, | ||
AlignmentConstraint * | r, | ||
double | g, | ||
bool | equality = false |
||
) |
Constructs a new SeparationConstraint between two alignment constraints in the specified dimension.
The constraint will keep the centre of the left alignment line to the left of the right alignment line by exactly or more than the specified gap.
[in] | dim | The dimension the constraint will operate in. |
[in] | l | A pointer to the left AlignmentConstraint. |
[in] | r | A pointer to the right AlignmentConstraint. |
[in] | g | The minimum or exact distance to separate the two alignment constraints. |
[in] | equality | Whether or not the constraint is an exact distance. |
|
virtual |
Implemented by the compound constraint to generate the low-level separation constraints in the given dimension.
These constraints will be added to the list of constraints cs.
[in] | dim | The current active dimension. |
[in] | vars | The list of variables for the overall problem instance. |
[in,out] | cs | The list of constraints to which the generated constraints will be added. |
[in] | bbs | The list of bounding boxes for all rectangles in the current problem. It has the same order as vars. |
Implements cola::CompoundConstraint.
|
virtual |
Implemented by the compound constraint to generate any additional required variables in the given dimension.
Generate any additional variables required by this compound constraint when operating in the given dimension dim and add them to vars. These variables should be cleaned up by the caller after the VPSC problem is solved.
The variables' ideal position and weight should be set by the compound constraint and they should be added to the end of vars.
[in] | dim | The current active dimension. |
[in,out] | vars | The list of variables for the overall problem instance to which any variables generated should be appended. |
Implements cola::CompoundConstraint.
|
virtual |
Returns a textual description of the compound constraint.
Implements cola::CompoundConstraint.