summaryrefslogtreecommitdiffstats
path: root/src/libvpsc/block.cpp
diff options
context:
space:
mode:
authorAndrew Higginson <at.higginson@gmail.com>2011-12-27 21:04:47 +0000
committerAndrew <at.higginson@gmail.com>2011-12-27 21:04:47 +0000
commit80960b623a99aae1402ab651b2974ef544ed3b03 (patch)
treeba49d42c2789e9e11f805e2d5263e10f9fedeef8 /src/libvpsc/block.cpp
parenttry to fix bug (diff)
parentGDL: Cherry-pick upstream patch 73852 (2011-03-23) - Add missing return value. (diff)
downloadinkscape-80960b623a99aae1402ab651b2974ef544ed3b03.tar.gz
inkscape-80960b623a99aae1402ab651b2974ef544ed3b03.zip
merged with trunk so I can build again...
(bzr r10092.1.36)
Diffstat (limited to 'src/libvpsc/block.cpp')
-rw-r--r--src/libvpsc/block.cpp38
1 files changed, 6 insertions, 32 deletions
diff --git a/src/libvpsc/block.cpp b/src/libvpsc/block.cpp
index 221df536a..8171780d4 100644
--- a/src/libvpsc/block.cpp
+++ b/src/libvpsc/block.cpp
@@ -1,8 +1,4 @@
-/**
- * \brief A block is a group of variables that must be moved together to improve
- * the goal function without violating already active constraints.
- * The variables in a block are spanned by a tree of active constraints.
- *
+/*
* Authors:
* Tim Dwyer <tgdwyer@gmail.com>
*
@@ -72,7 +68,7 @@ void Block::setUpConstraintHeap(PairingHeap<Constraint*>* &h,bool in) {
for (Cit j=cs->begin();j!=cs->end();++j) {
Constraint *c=*j;
c->timeStamp=blockTimeCtr;
- if (c->left->block != this && in || c->right->block != this && !in) {
+ if ((c->left->block != this && in) || (c->right->block != this && !in)) {
h->insert(c);
}
}
@@ -95,13 +91,7 @@ void Block::merge(Block* b, Constraint* c) {
f<<" merged block="<<(b->deleted?*this:*b)<<endl;
#endif
}
-/**
- * Merges b into this block across c. Can be either a
- * right merge or a left merge
- * @param b block to merge into this
- * @param c constraint being merged
- * @param distance separation required to satisfy c
- */
+
void Block::merge(Block *b, Constraint *c, double dist) {
#ifdef RECTANGLE_OVERLAP_LOGGING
ofstream f(LOGFILE,ios::app);
@@ -317,10 +307,7 @@ void Block::reset_active_lm(Variable* const v, Variable* const u) {
}
}
}
-/**
- * finds the constraint with the minimum lagrange multiplier, that is, the constraint
- * that most wants to split
- */
+
Constraint *Block::findMinLM() {
Constraint *min_lm=NULL;
reset_active_lm(vars->front(),NULL);
@@ -363,12 +350,7 @@ bool Block::isActiveDirectedPathBetween(Variable* u, Variable *v) {
}
return false;
}
-/**
- * Block needs to be split because of a violated constraint between vl and vr.
- * We need to search the active constraint tree between l and r and find the constraint
- * with min lagrangrian multiplier and split at that point.
- * Returns the split constraint
- */
+
Constraint* Block::splitBetween(Variable* const vl, Variable* const vr,
Block* &lb, Block* &rb) {
#ifdef RECTANGLE_OVERLAP_LOGGING
@@ -383,11 +365,7 @@ Constraint* Block::splitBetween(Variable* const vl, Variable* const vr,
deleted = true;
return c;
}
-/**
- * Creates two new blocks, l and r, and splits this block across constraint c,
- * placing the left subtree of constraints (and associated variables) into l
- * and the right into r.
- */
+
void Block::split(Block* &l, Block* &r, Constraint* c) {
c->active=false;
l=new Block();
@@ -396,10 +374,6 @@ void Block::split(Block* &l, Block* &r, Constraint* c) {
populateSplitBlock(r,c->right,c->left);
}
-/**
- * Computes the cost (squared euclidean distance from desired positions) of the
- * current positions for variables in this block
- */
double Block::cost() {
double c = 0;
for (Vit v=vars->begin();v!=vars->end();++v) {