versor  3.0
C++11 library for Geometric algebra
vsr_ega2D_draw.h
1 /*
2  * =====================================================================================
3  *
4  * Filename: vsr_ega2D_draw.h
5  *
6  * Description: 2d euclidean draw routines
7  *
8  * Version: 1.0
9  * Created: 11/19/2013 11:59:49
10  * Revision: none
11  * Compiler: gcc
12  *
13  * Author: Pablo Colapinto (), wolftype (gmail)
14  * Organization:
15  *
16  * =====================================================================================
17  */
18 
19 #include "vsr_products.h"
20 #include "vsr_generic_op.h"
21 #include "vsr_ega2D_types.h"
22 #include "gfx/gfx_glyphs.h"
23 
24 namespace vsr {
25 
26  using namespace ega2D;
27 
28  template<class A>
29  void Draw( const A& s, float r = 1, float g = 1, float b = 1, float a = 1){
30  glPushMatrix();
31  glNormal3f(0,0,1);
32  glColor4f(r,g,b,a);
33  Immediate(s);
34  glPopMatrix();
35  }
36 
37  Rot AA( const Vec& s){
38  Rot r = Gen::ratio(Vec::y, s.unit() );
39  VT deg = Gen::iphi(r) * ( -180 / PI );
40  return Rot(deg, Gen::pl( r )[0]);
41 
42  }
43 
44  void Immediate (const Vec& s){
45  Rot t = AA(s);
46 
47  gfx::Glyph::Line2D(s);
48  glPushMatrix();
49  gfx::GL::translate( s[0], s[1], 0 );
50  gfx::GL::rotate(t[0], 0, 0, t[1] );
51  Glyph::Tri();
52  glPopMatrix();
53  }
54 
55 }
56 
core namespaced operations that are metric-agnostic
static Rot ratio(const Vec &v, const Vec &v2)
vsr::cga::Rotor that takes one vec to another
the versor library namespace
Definition: vsr_algebra.h:29
NTri< 5 > Tri
Trivector
Definition: vsr_cga3D_types.h:65
NRot< 5 > Rot
Rotor
Definition: vsr_cga3D_types.h:64