9 #ifndef VSR_GENERIC_DRAW_H_INCLUDED
10 #define VSR_GENERIC_DRAW_H_INCLUDED
12 #include "gfx/gfx_glyphs.h"
14 #include "form/vsr_field.h"
21 GARot<A> AA(
const GAVec<A>& s){
22 GARot<A> r =
Gen::ratio( GAVec<A>::z, s.unit() );
32 void Immediate(
const T& t){
33 printf(
"no generic draw function\n");
36 void ImmediateB(
const T& t){
37 printf(
"no generic draw function\n");
42 void Immediate (
const GAVec<A>& ts){
46 gfx::GL::translate( s.begin() );
47 gfx::GL::rotate( AA(s).begin() );
53 void ImmediateB (
const GAVec<A>& ts){
57 gfx::GL::translate( s.begin() );
58 gfx::Glyph::SolidSphere(.05);
63 void Immediate (
const GABiv<A>& s){
68 gfx::GL::rotate( AA(s).begin() );
69 gfx::Glyph::DirCircle( ta, sn );
74 GARot<A> AA(
const GACir<A>& s){
76 GARot<A> r =
Gen::ratio(GAVec<A>::z, nga::Op::dle( b ).unit() );
81 void Immediate(
const GACir<A>& s ) {
82 VSR_PRECISION rad = nga::Round::rad( s );
86 gfx::GL::translate( nga::Round::loc(s).begin() );
87 gfx::GL::rotate( AA(s).begin() );
93 void Immediate (
const GALin<A>& s){
96 gfx::GL::translate (v.begin());
101 void Immediate (
const GAPnt<A>& s){
106 if ( fabs(ta) > FPERROR ) {
108 bool real = ta > 0 ? 1 : 0;
111 VSR_PRECISION t = sqrt ( fabs ( ta ) );
113 gfx::GL::translate ( p.begin() );
114 (real) ? gfx::Glyph::SolidSphere(t, 5+ floor(t*30), 5+floor(t*30)) :
gfx::Glyph::Sphere(t);
122 void Immediate (
const GAPar<A>& s){
130 if ( fabs(ta) > FPERROR ) {
133 double t = sqrt ( fabs ( ta ) );
134 bool real = size > 0 ? 1 : 0;
137 gfx::GL::translate ( p1.begin() );
138 (real) ? gfx::Glyph::SolidSphere(t, 5+ floor(t*30), 5+floor(t*30)) :
gfx::Glyph::Sphere(t);
141 gfx::GL::translate ( p2.begin() );
142 (real) ? gfx::Glyph::SolidSphere(t, 5+ floor(t*30), 5+floor(t*30)) :
gfx::Glyph::Sphere(t);
152 void Immediate(
const Field<T>& f){
153 for (
int i = 0; i < f.num(); ++i){
162 void ColorTriangles(
const T& a,
const T& b,
const T& c){
164 auto normal = -NEVec<3>( ( nga::euc::hom(a) ^ nga::euc::hom(b) ^ nga::euc::hom(c) ).dual() ).unit();
166 GL::normal( normal.begin() );
167 glBegin(GL_TRIANGLES);
169 GL::vertex( a.begin() );
171 GL::vertex( b.begin() );
173 GL::vertex( c.begin() );
179 void Draw(
const A& s,
float r = 1,
float g = 1,
float b = 1,
float a = 1){
183 generic::Immediate(s);
188 void DrawB(
const A& s,
float r = 1,
float g = 1,
float b = 1,
float a = 1){
192 generic::ImmediateB(s);
197 template<
class A,
class B>
198 void DrawAt(
const A& s,
const B& p,
float r = 1,
float g = 1,
float b = 1,
float a = 1){
200 glTranslatef( p[0], p[1], p[2] );
203 generic::Immediate(s);
208 template<
class A,
class B>
209 void DrawAtB(
const A& s,
const B& p,
float r = 1,
float g = 1,
float b = 1,
float a = 1){
211 glTranslatef( p[0], p[1], p[2] );
214 generic::ImmediateB(s);
static constexpr GAPnt< A > null(const Multivector< A, B > &v)
Null Point from Arbitrary Multivector.
Definition: vsr_generic_op.h:548
Definition: vsr_cga2D_draw.h:13
static constexpr auto dir(const Multivector< A, B > &f) -> auto
Direction of Direct Flat.
static constexpr auto dir(const A &s) -> auto
Direction of Round Element (shorthand)
static VSR_PRECISION size(const A &r, bool dual)
Squared Size of a General Round Element (could be negative)
Definition: vsr_generic_op.h:678
core namespaced operations that are metric-agnostic
Cir Circle
Direct Circle 3-blade \(\kappa=p_a \wedge p_b \wedge p_c\)
Definition: vsr_cga3D_types.h:130
static constexpr P loc(const A &f, const P &p, bool dual)
Location of Flat A closest to Point p (shorthand)
Definition: vsr_generic_op.h:1025
static auto aa(const GARot< A > &r) -> GARot< A >
Axis Angle from Rotor (WARNING NOT GENERIC)
Definition: vsr_generic_op.h:348
static std::vector< GAPnt< A > > split(const GAPar< A > &pp)
Split Points from Point Pair.
Definition: vsr_generic_op.h:743
Pnt Point
Null Vector \(p=\{e_1,e_2,e_3,n_o,n_\infty\}\)
Definition: vsr_cga3D_types.h:128
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
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
Sph Sphere
Direct Sphere 4-blade \(\Sigma=p_a \wedge p_b \wedge p_c \wedge p_d\)
Definition: vsr_cga3D_types.h:131
static constexpr GAPnt< A > cen(const Multivector< A, B > &s)
Simple Center of A Round Element (shorthand)
Definition: vsr_generic_op.h:653