author | Don Pellegrino <don@coffee.donpellegrino.com> | 2009-09-03 01:42:37 (GMT) |
---|---|---|
committer | Don Pellegrino <don@coffee.donpellegrino.com> | 2009-09-03 01:42:37 (GMT) |
commit | 5e092a18b061cde68430f1b2bf4457d1e5e8b0fb (patch) (side-by-side diff) | |
tree | b7d812123e80f639f368dfa24289201fba61404e | |
parent | 1ed5cbf07842cfeffd45352d4345b021a9efd848 (diff) | |
download | exp005-5e092a18b061cde68430f1b2bf4457d1e5e8b0fb.zip exp005-5e092a18b061cde68430f1b2bf4457d1e5e8b0fb.tar.gz exp005-5e092a18b061cde68430f1b2bf4457d1e5e8b0fb.tar.bz2 |
Shell for development of the datarose geometry.
-rw-r--r-- | src/model/geometry/datarose_geometry.c | 54 | ||||
-rw-r--r-- | src/model/geometry/datarose_geometry.h | 11 |
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 |