versor  3.0
C++11 library for Geometric algebra
vsr_ega3D_draw.h
1 #ifndef VSR_EGA3D_DRAW_H_INCLUDED
2 #define VSR_EGA3D_DRAW_H_INCLUDED
3 
4 
5 #include "gfx/gfx_glyphs.h"
6 #include "space/vsr_ega3D_types.h"
7 
8 namespace vsr{
9 
10 //namespace ega{
11 
12  using namespace gfx;
13 
14  template<class A>
15  void Draw( const A& s, float r = 1, float g = 1, float b = 1, float a = 1){
16  glPushMatrix();
17  glNormal3f(0,0,1);
18  glColor4f(r,g,b,a);
19  Immediate(s);
20  glPopMatrix();
21  }
22 
23  ega::Rot AA( const ega::Vec& s){
24  //Biv b = Ro::dir( s ).copy<Biv>();
25  ega::Rot r = nga::Gen::ratio(ega::Vec::z, s.unit() );
26  return nga::Gen::aa(r);
27  }
28 
29  ega::Rot AA( const ega::Biv& s){
30  return nga::Gen::aa( nga::Gen::ratio( ega::Vec::z, s.dual().unit() ) );
31  }
32 
33  void Immediate (const ega::Vec& s){
35  glPushMatrix();
36  gfx::GL::translate( s.begin() );
37  gfx::GL::rotate( AA(s).begin() );
38  Glyph::Cone();
39  glPopMatrix();
40  }
41 
42  void Immediate (const ega::Biv& s){
43 
44  double ta = s.norm();
45  bool sn = nga::Op::sn( s , ega::Biv::xy * (-1));
46 
47  glPushMatrix();
48  gfx::GL::rotate( AA(s).begin() );
49  Glyph::DirCircle( ta, sn );
50  glPopMatrix();
51  }
52 //}
53 
54 }
55 
56 #endif
static auto ratio(const GAVec< A > &a, const GAVec< A > &b) -> decltype((a *b))
Generate general rotation as exponential of anonymous Implemented from "Square Root and Logarithm of ...
Definition: vsr_generic_op.h:504
Definition: vsr_cga2D_draw.h:13
static auto aa(const GARot< A > &r) -> GARot< A >
Axis Angle from Rotor (WARNING NOT GENERIC)
Definition: vsr_generic_op.h:348
the versor library namespace
Definition: vsr_algebra.h:29
Lin Line
Direct Line Trivector \(p_a \wedge p_b \wedge n_\infty\)
Definition: vsr_cga3D_types.h:140
static constexpr bool sn(const A &a, const A &b)
Sign of A with Respect to B (short hand)
Definition: vsr_generic_op.h:159