draw_graphs.h
Go to the documentation of this file.00001 #ifndef VVELIB_ALGORITHMS_DRAW_GRAPHS_H
00002 #define VVELIB_ALGORITHMS_DRAW_GRAPHS_H
00003
00010 #include <config.h>
00011 #include <util/gl.h>
00012 #include <geometry/geometry.h>
00013
00014 namespace algorithms
00015 {
00027 template <typename GraphType, typename Model>
00028 void drawSymetricVVGraph(Model *model, const GraphType& G)
00029 {
00030 typedef typename GraphType::vertex_t vertex;
00031 glBegin(GL_LINES);
00032 forall(const vertex& v, G)
00033 {
00034 const geometry::Point3d& vpos = model->position(v);
00035 const geometry::Point3d& normal = model->normal(v);
00036 forall(const vertex& n, G.neighbors(v))
00037 {
00038 if(v<n)
00039 {
00040 glNormal3dv(normal.c_data());
00041 glVertex3dv(vpos.c_data());
00042 glNormal3dv(model->normal(n).c_data());
00043 glVertex3dv(model->position(n).c_data());
00044 }
00045 }
00046 }
00047 glEnd();
00048 }
00049 }
00050
00051 #endif // VVELIB_ALGORITHMS_DRAW_GRAPHS_H
00052