/*
** vim: set cindent
** vim: ts=4 sw=4 et tw=0 wm=0
*/
/**
* Functions to automatically generate constraints for the
* rectangular node overlap removal problem.
*/
/*
*
* Authors:
* Tim Dwyer <tgdwyer@gmail.com>
*
* Copyright (C) 2005 Authors
*
* Released under GNU LGPL. Read the file 'COPYING' for more information.
*/
#include <set>
#include <list>
#include <cassert>
#include "straightener.h"
#include <iostream>
#include <cmath>
#include <cstdlib>
namespace straightener {
// is point p on line a-b?
static bool pointOnLine(double px,double py, double ax, double ay, double bx, double by, double& tx) {
double ty=0;
// runty line!
} else {
//vertical line
}
} else {
}
//horizontal line
}
} else {
}
}
//printf(" tx=%f,ty=%f\n",tx,ty);
return true;
}
return false;
}
//printf("Edge::nodePath: (%d,%d) dummyNodes:%d\n",startNode,endNode,ds.size());
for(unsigned i=1;i<route->n;i++) {
//printf(" checking segment %d-%d\n",i-1,i);
double t=0;
//printf(" px=%f, py=%f, ax=%f, ay=%f, bx=%f, by=%f\n",px,py,ax,ay,bx,by);
//printf(" got node %d\n",*copyit);
}
}
for(set<pair<double,unsigned> >::iterator j=pntsOnLineSegment.begin();j!=pntsOnLineSegment.end();++j) {
}
//printf("\n");
}
}
struct Event {
Node *v;
Edge *e;
double pos;
};
static int compare_events(const void *a, const void *b) {
// when comparing opening and closing from object
// open must come first
return 1;
return 1;
return -1;
}
return 0;
}
if(l!=NULL) {
L.push_back(l);
}
if(dim==HORIZONTAL) {
} else {
}
//cerr << "edge(intersections="<<bs.size()<<":("<<e->startNode<<","<<e->endNode<<"))"<<endl;
}
}
// if edge is connected (start or end) to v then skip
// need to record start and end positions of edge segment!
//if(l!=NULL&&(e->startNode==l->id||e->endNode==l->id)) continue;
//cerr << "edge("<<e->startNode<<","<<e->endNode<<",pts="<<e->pts<<")"<<endl;
L.push_back(d);
}
L.push_back(v);
if(r!=NULL) {
}
// if edge is connected (start or end) to v then skip
// need to record start and end positions of edge segment!
//if(r!=NULL&&(e->startNode==r->id||e->endNode==r->id)) continue;
//cerr << "edge("<<e->startNode<<","<<e->endNode<<",pts="<<e->pts<<")"<<endl;
L.push_back(d);
}
if(r!=NULL) {
L.push_back(r);
}
}
g/=2;
//cerr << "Constraint: "<< u->id << "+"<<g<<"<="<<v->id<<endl;
}
void generateConstraints(vector<Node*>& nodes, vector<Edge*>& edges,vector<SimpleConstraint*>& cs,Dim dim) {
unsigned ctr=0;
if(dim==HORIZONTAL) {
//cout << "Scanning top to bottom..." << endl;
v->scanpos=v->x;
}
}
} else {
//cout << "Scanning left to right..." << endl;
v->scanpos=v->y;
}
}
}
for(unsigned i=0;i<nevents;i++) {
Node *v=e->v;
if(v!=NULL) {
v->open = true;
//printf("NEvent@%f,nid=%d,(%f,%f),w=%f,h=%f,openn=%d,opene=%d\n",e->pos,v->id,v->x,v->y,v->width,v->height,(int)openNodes.size(),(int)openEdges.size());
// it points to the first node to the right of v
// step left to find the first node to the left of v
l=*it;
//printf("l=%d\n",l->id);
}
r=*it;
}
}
//printf("L=[");
for(unsigned i=0;i<L.size();i++) {
//printf("%d ",L[i]->id);
}
//printf("]\n");
// Case A: create constraints between adjacent edges skipping edges joined
// to l,v or r.
if((*i)->dummy) {
// node is on an edge
//printf(" Rule A: Constraint: v%d +g <= v%d\n",lastNode->id,(*i)->id);
}
lastNode=*i;
}
} else {
// is an actual node
}
}
// Case B: create constraints for all the edges connected to the right of
// their own end, also in the scan line
if((*i)->dummy) {
// node is on an edge
} else {
//printf(" Rule B: Constraint: v%d +g <= v%d\n",(*j)->id,(*i)->id);
}
}
}
} else {
// is an actual node
lastNode=*i;
}
}
// Case C: reverse of B
if((*i)->dummy) {
// node is on an edge
} else {
//printf(" Rule C: Constraint: v%d +g <= v%d\n",(*i)->id,(*j)->id);
}
}
}
} else {
// is an actual node
lastNode=*i;
}
}
}
}
if(v!=NULL) {
} else {
//printf("EdgeOpen@%f,eid=%d,(u,v)=(%d,%d)\n", e->pos,e->e->id,e->e->startNode,e->e->endNode);
}
} else {
// Close
if(v!=NULL) {
v->open=false;
} else {
//printf("EdgeClose@%f,eid=%d,(u,v)=(%d,%d)\n", e->pos,e->e->id,e->e->startNode,e->e->endNode);
unsigned i=e->e->openInd;
}
}
delete e;
}
delete [] events;
}
}