11 class Node:
public QVector2D {
20 Node(): QVector2D(), degree(0), group(-1) {};
26 Node(
double x,
double y): QVector2D(x, y), degree(0), group(-1) {};
28 operator QVector2D() {
return QVector2D(x(), y());};
29 void set(
double x,
double y) {setX(x); setY(y);};
30 void set(QPointF p) {setX(p.x()); setY(p.y());};
31 void set(QVector2D p) {setX(p.x()); setY(p.y());};
49 void setInfo(QString s) {description = s;};
51 QString
info() {
return description;};
52 QString toString() {
return QString(
"[") += QString::number(x()) += QString(
",") += QString::number(y())+= QString(
"]");};
62 QPolygonF subdivisionPoints;
63 QPolygonF newSubdivisionPoints;
75 subdivisionPoints << n1->toPointF() << n2->toPointF();
90 void clearSubdivisionPoints() {subdivisionPoints.clear();};
92 Node* start(
void) {
return node_start;};
93 Node* end(
void) {
return node_end;};
94 QVector2D midPoint(
void) {
return (*start() + *end())/2.0;};
95 QVector2D vector(
void) {
return *end() - *start();};
96 double length(
void) {
return vector().length();};
101 QString toString(
void) {
return this->start()->toString() +
" -> " + this->end()->toString();};
119 qDeleteAll(edges.begin(), edges.end());
122 qDeleteAll(nodes.begin(), nodes.end());
126 for (
int i=0; i<edges.count(); i++)
127 delete (edges.takeAt(0));
130 for (
int i=0; i<nodes.count(); i++)
131 delete (nodes.takeAt(0));
150 static QVector2D
midPoint(QVector2D a, QVector2D b) {
return (a + b) / 2.0;};
152 static QPointF
midPoint(QPointF a, QPointF b) {
return (a + b) / 2.0;};
QPair< QVector2D, QVector2D > bandOfSight(Edge *other)
Definition: graph.cpp:150
QList< Node * > * getNodes()
Definition: graph.h:136
double compatibility_angular(Edge *other)
Definition: graph.cpp:71
QString info()
Definition: graph.h:51
void setInfo(QString s)
Definition: graph.h:49
double compatibility(Edge *other)
Definition: graph.cpp:57
double visibilityFactor(Edge *other)
Definition: graph.cpp:136
static QVector2D midPoint(QVector2D a, QVector2D b)
Definition: graph.h:150
double compatibility_positional(Edge *other)
Definition: graph.cpp:102
void setNewSubdivisionPoints(QPolygonF p)
Definition: graph.h:84
int getDegree(void)
Definition: graph.h:47
void increaseSubdivisions(void)
Definition: graph.cpp:7
void addEdge(Edge *e)
Definition: graph.h:142
void setGroup(int g)
Definition: graph.h:37
int getGroup(void)
Definition: graph.h:42
double compatibility_visibility(Edge *other)
Definition: graph.cpp:119
void updateSubdivisionPoints()
Definition: graph.h:86
void increment(void)
Definition: graph.h:45
Node(double x, double y)
Definition: graph.h:26
static QPointF midPoint(QPointF a, QPointF b)
Definition: graph.h:152
QPolygonF getSubdivisionPoints()
Definition: graph.h:89
double compatibility_scale(Edge *other)
Definition: graph.cpp:86
QList< Edge * > * getEdges()
Definition: graph.h:138
Edge(Node *n1, Node *n2)
Definition: graph.h:72
Node()
Definition: graph.h:20
void addNode(Node *n)
Definition: graph.h:140