Adaptagrams
|
A page boundary contraint specifies constraints that attempt to keep the given nodes within a defined rectangular region. More...
#include <compound_constraints.h>
Public Member Functions | |
PageBoundaryConstraints (double xLow, double xHigh, double yLow, double yHigh, double weight=100.0) | |
Constructs a new PageBoundaryConstraints object with given page boundary positions and weight. More... | |
void | addShape (unsigned index, double halfW, double halfH) |
Mark a node as being contained within this page boundary. 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 &vars, vpsc::Constraints &gcs, vpsc::Rectangles &bbs) |
Implemented by the compound constraint to generate the low-level separation constraints in the given dimension. More... | |
void | updatePosition (const vpsc::Dim dim) |
Implemented by the compound constraint to send position information back to the interface. More... | |
A page boundary contraint specifies constraints that attempt to keep the given nodes within a defined rectangular region.
This compound constraint creates dummy variables for each of the four edges of the page and constraints between all nodes and these dummy vars such that nodes are contained between the edges. The variables for the page edges have a high weight but will "balloon out" if other constraints force nodes to stick out past the ideal edge positions.
cola::PageBoundaryConstraints::PageBoundaryConstraints | ( | double | xLow, |
double | xHigh, | ||
double | yLow, | ||
double | yHigh, | ||
double | weight = 100.0 |
||
) |
Constructs a new PageBoundaryConstraints object with given page boundary positions and weight.
[in] | xLow | The position of the left edge of the page. |
[in] | xHigh | The position of the right edge of the page. |
[in] | yLow | The position of the bottom edge of the page. |
[in] | yHigh | The position of the top edge of the page. |
[in] | weight | The weight to give the positions variables for the page edges. The default is 100.0. |
References vpsc::XDIM, and vpsc::YDIM.
void cola::PageBoundaryConstraints::addShape | ( | unsigned | index, |
double | halfW, | ||
double | halfH | ||
) |
Mark a node as being contained within this page boundary.
[in] | index | The index of the node in the Rectangles vector. |
[in] | halfW | Half of the width of the node. Needed because node position variables represent their centre. |
[in] | halfH | Half of the height of the node. |
|
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.
References vpsc::XDIM, and vpsc::YDIM.
|
virtual |
Implemented by the compound constraint to send position information back to the interface.
This will be called for each compound constraint once the VPSC instance is solved to allow them to pass information such as variable values back to the graphical user interface.
[in] | dim | The current active dimension. |
Reimplemented from cola::CompoundConstraint.