summaryrefslogtreecommitdiffstats
Side-by-side diff
-rw-r--r--src/model/geometry/datarose_geometry.c54
-rw-r--r--src/model/geometry/datarose_geometry.h11
2 files changed, 65 insertions, 0 deletions
diff --git a/src/model/geometry/datarose_geometry.c b/src/model/geometry/datarose_geometry.c
new file mode 100644
index 0000000..dded424
--- a/dev/null
+++ b/src/model/geometry/datarose_geometry.c
@@ -0,0 +1,54 @@
+#include "datarose_geometry.h"
+#include "../../util/check_error.h"
+#include "../../view/state0.h"
+#include <GL/glut.h>
+
+#define S state0
+
+void
+datarose_geometry (void)
+{
+ glNewList (S.list_offset + DATAROSE_GEOMETRY, GL_COMPILE);
+ glPolygonMode (GL_FRONT, GL_FILL);
+ glColor4f (DEFAULT_COLOR_R, DEFAULT_COLOR_G, DEFAULT_COLOR_B,
+ DEFAULT_COLOR_A);
+
+ /*
+ * The size of the rose will be a percentage of the world height so
+ * that it remains a fixed size when the window is resized or
+ * zoomed.
+ */
+ GLint viewport[4];
+ glGetIntegerv (GL_VIEWPORT, viewport);
+ const double *top = &S.ortho.max_y;
+ const double *bottom = &S.ortho.min_y;
+ double rose_radius = (*top - *bottom) / viewport[3] * 110.0;
+
+ /*
+ * Place the rose in the upper right of the display.
+ */
+ glMatrixMode (GL_MODELVIEW);
+ glPushMatrix ();
+ glLoadIdentity ();
+ const double *right = &S.ortho.max_x;
+ glTranslatef (*right - rose_radius - (rose_radius * 0.40),
+ *top - rose_radius - (rose_radius * 0.80),
+ 0.0);
+
+ /*
+ * Create a circle.
+ */
+ GLUquadricObj *obj = gluNewQuadric ();
+ gluQuadricDrawStyle (obj, GLU_LINE);
+ gluDisk (obj, rose_radius * 0.999, rose_radius, 60, 60);
+
+ glPopMatrix ();
+
+ glEndList ();
+
+ gluDeleteQuadric (obj);
+
+ check_error (__FILE__, __LINE__);
+
+ return;
+}
diff --git a/src/model/geometry/datarose_geometry.h b/src/model/geometry/datarose_geometry.h
new file mode 100644
index 0000000..0823064
--- a/dev/null
+++ b/src/model/geometry/datarose_geometry.h
@@ -0,0 +1,11 @@
+#ifndef DATAROSE_GEOMETRY_H
+#define DATAROSE_GEOMETRY_H
+
+/*
+ * DataRose from Elmqvist, N.; Stasko, J. & Tsigas, P. "DataMeadow: a
+ * visual canvas for analysis of large-scale multivariate data",
+ * Information Visualization, Palgrave Macmillan Ltd, 2008, 7, 18-33.
+ */
+void datarose_geometry (void);
+
+#endif // DATAROSE_GEOMETRY_H

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.