Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ProcrustesSubLayout.h
Go to the documentation of this file.
1
32#pragma once
33
35
36namespace ogdf {
37
39public:
41 explicit ProcrustesPointSet(int numPoints);
42
45
47 void normalize(bool flip = false);
48
51
53 double compare(const ProcrustesPointSet& other) const;
54
56 void set(int i, double x, double y) {
57 m_x[i] = x;
58 m_y[i] = y;
59 }
60
62 double getX(int i) const { return m_x[i]; }
63
65 double getY(int i) const { return m_y[i]; }
66
68 double originX() const { return m_originX; }
69
71 double originY() const { return m_originY; }
72
74 double scale() const { return m_scale; }
75
77 double angle() const { return m_angle; }
78
80 bool isFlipped() const { return m_flipped; }
81
82private:
85
87 double* m_x;
88
90 double* m_y;
91
93 double m_originX;
94
96 double m_originY;
97
99 double m_scale;
100
102 double m_angle;
103
105};
106
109public:
112
114 virtual ~ProcrustesSubLayout() { delete m_pSubLayout; }
115
116 virtual void call(GraphAttributes& GA) override;
117
119 void setScaleToInitialLayout(bool flag) { m_scaleToInitialLayout = flag; }
120
122 bool scaleToInitialLayout() const { return m_scaleToInitialLayout; }
123
124private:
127
129 void translate(GraphAttributes& graphAttributes, double dx, double dy);
130
133
136
139
143
146
149};
150
151}
Declaration of interface for layout algorithms (class LayoutModule)
Stores additional attributes of a graph (like layout information).
Interface of general layout algorithms.
~ProcrustesPointSet()
Destructor.
double getX(int i) const
Returns i'th x-coordinate.
double m_scale
Scale factor.
void rotateTo(const ProcrustesPointSet &other)
Rotates the point set so it fits somehow on other.
int m_numPoints
Number of points.
double * m_y
Y coordinates.
double originY() const
Returns the origin's y.
double getY(int i) const
Returns i'th y-coordinate.
double * m_x
X coordinates.
double m_originY
Original average center's y when normalized.
bool isFlipped() const
Returns true if the point set is flipped by y coord.
double m_angle
If rotated, the angle.
double m_originX
Original average center's x when normalized.
ProcrustesPointSet(int numPoints)
Constructor for allocating memory for numPoints points.
void normalize(bool flip=false)
Translates and scales the set such that the average center is 0, 0 and the average size is 1....
double angle() const
Returns the rotation angle.
double compare(const ProcrustesPointSet &other) const
Calculates a value how good the two point sets match.
double originX() const
Returns the origin's x.
void set(int i, double x, double y)
Sets i'th coordinate.
double scale() const
Returns the scale factor.
Simple procrustes analysis.
void scale(GraphAttributes &graphAttributes, double scale)
Scales all coords in graphAttributes by scale.
void flipY(GraphAttributes &graphAttributes)
Flips all y coordinates.
void rotate(GraphAttributes &graphAttributes, double angle)
Rotates all coords in graphAttributes by angle.
void copyFromGraphAttributes(const GraphAttributes &graphAttributes, ProcrustesPointSet &pointSet)
Copies the coords in graph attributes to the point set.
virtual ~ProcrustesSubLayout()
Destructor.
void reverseTransform(GraphAttributes &graphAttributes, const ProcrustesPointSet &pointSet)
Does a reverse transform of graph attributes by using the origin, scale and angle in pointset.
bool m_scaleToInitialLayout
Option for enabling/disabling scaling to initial layout scale.
LayoutModule * m_pSubLayout
Layout module to call for a new layout.
virtual void call(GraphAttributes &GA) override
Computes a layout of graph GA.
ProcrustesSubLayout(LayoutModule *pSubLayout)
Constructor.
void setScaleToInitialLayout(bool flag)
Should the new layout scale be used or the initial scale? Defaults to true.
void translate(GraphAttributes &graphAttributes, double dx, double dy)
Moves all coords in graphAttributes by dx, dy.
bool scaleToInitialLayout() const
Should the new layout scale be used or the initial scale? Defaults to true.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.