Adaptagrams
Classes | Typedefs | Enumerations | Functions
vpsc Namespace Reference

libvpsc: Variable Placement with Separation Constraints quadratic program solver library. More...

Classes

class  Constraint
 A constraint determines a minimum or exact spacing required between two Variable objects. More...
 
class  IncSolver
 Incremental solver for Variable Placement with Separation Constraints problem instance. More...
 
class  Rectangle
 A rectangle represents a fixed-size shape in the diagram that may be moved to prevent overlaps and satisfy constraints. More...
 
class  Solver
 Static solver for Variable Placement with Separation Constraints problem instance. More...
 
class  Variable
 A variable is comprised of an ideal position, final position and a weight. More...
 

Typedefs

typedef std::vector< Variable * > Variables
 A vector of pointers to Variable objects.
 
typedef std::vector< Constraint * > Constraints
 A vector of pointers to Constraint objects.
 
typedef std::vector< Rectangle * > Rectangles
 A vector of pointers to Rectangle objects.
 

Enumerations

enum  Dim { HORIZONTAL = 0, XDIM = 0, VERTICAL = 1, YDIM = 1 }
 Indicates the x- or y-dimension. More...
 

Functions

Constraints constraintsRemovingRedundantEqualities (const Variables &vars, const Constraints &constraints)
 Given a set of variables and constraints, returns a modified set of constraints with all redundant equality constraints removed. More...
 
void removeoverlaps (Rectangles &rs)
 Uses VPSC to remove overlaps between rectangles. More...
 
void removeoverlaps (Rectangles &rs, const std::set< unsigned > &fixed, bool thirdPass=true)
 Uses VPSC to remove overlaps between rectangles, excluding some that should not be moved. More...
 

Detailed Description

libvpsc: Variable Placement with Separation Constraints quadratic program solver library.

You should use VPSC via an instance of the IncSolver or Solver classes.

Enumeration Type Documentation

◆ Dim

enum vpsc::Dim

Indicates the x- or y-dimension.

Enumerator
HORIZONTAL 

The x-dimension (0).

XDIM 

The x-dimension (0).

VERTICAL 

The y-dimension (1).

YDIM 

The y-dimension (1).

Function Documentation

◆ constraintsRemovingRedundantEqualities()

Constraints vpsc::constraintsRemovingRedundantEqualities ( const Variables vars,
const Constraints constraints 
)

Given a set of variables and constraints, returns a modified set of constraints with all redundant equality constraints removed.

VPSC doesn't work well with redundant equality constraints, usually showing them as unsatisfiable. This function looks for cycles of equality constraints and removes the redundant ones.

References vpsc::Constraint::equality, vpsc::Constraint::gap, vpsc::Constraint::left, and vpsc::Constraint::right.

◆ removeoverlaps() [1/2]

void vpsc::removeoverlaps ( Rectangles rs,
const std::set< unsigned > &  fixed,
bool  thirdPass = true 
)

Uses VPSC to remove overlaps between rectangles, excluding some that should not be moved.

Moves rectangles to remove all overlaps. A heuristic attempts to move shapes by as little as possible. The heuristic is that the overlaps are removed horizontally and then vertically, each pass being a quadratic program in which the total squared movement is minimised subject to non-overlap constraints.
An optional third horizontal pass (in addition to the first horizontal pass and the second vertical pass) can be applied wherein the x-positions of rectangles are reset to their original positions and overlap removal repeated. This may avoid some unnecessary movement.

Parameters
[in,out]rsThe rectangles which will be moved to remove overlap
[in]fixedA set of indices to rectangles which should not be moved.
[in]thirdPassOptionally run the third horizontal pass described above.

◆ removeoverlaps() [2/2]

void vpsc::removeoverlaps ( Rectangles rs)

Uses VPSC to remove overlaps between rectangles.

Moves rectangles to remove all overlaps. Heuristic attempts to move shapes by as little as possible.

Parameters
[in,out]rsThe rectangles which will be moved to remove overlap