1 #ifndef VSR_CGA2D_DRAW_H_INCLUDED
2 #define VSR_CGA2D_DRAW_H_INCLUDED
4 #include "gfx/gfx_glyphs.h"
5 #include "gfx/gfx_render.h"
8 #include "draw/vsr_draw.h"
9 #include "space/vsr_cga2D_types.h"
10 #include "form/vsr_field.h"
54 template<>
void Renderable<cga2D::Vec>::DrawImmediate(
const cga2D::Vec& s){
57 gfx::Glyph::Line2D(s);
59 gfx::GL::translate( s[0], s[1], 0 );
60 gfx::GL::rotate(t[0], 0, 0, t[1] );
65 template<>
void Renderable<cga2D::Drv>::DrawImmediate (
const cga2D::Drv& d){
70 template<>
void Renderable<cga2D::Point>::DrawImmediate(
const cga2D::Point& s){
75 if ( fabs(ta) > FPERROR ) {
77 bool real = ta > 0 ? 1 : 0;
80 VSR_PRECISION t = sqrt ( fabs ( ta ) );
82 gfx::GL::translate ( p[0], p[1], 0 );
86 gfx::Glyph::Point2D(s);
90 template<>
void Renderable<cga2D::Flp>::DrawImmediate(
const cga2D::Flp& s){
91 Renderable<cga2D::Point>::DrawImmediate( (s / s[2]).null() );
94 template<>
void Renderable<cga2D::Dfp>::DrawImmediate(
const cga2D::Dfp& s){
95 Renderable<cga2D::Flp>::DrawImmediate( s.dual() );
99 template<>
void Renderable<cga2D::Circle>::DrawImmediate(
const cga2D::Circle& s){
100 Renderable<cga2D::Point>::DrawImmediate( s.dual() );
103 template<>
void Renderable<cga2D::Pair>::DrawImmediate(
const cga2D::Pair& s){
110 if ( fabs(ta) > FPERROR ) {
113 double t = sqrt ( fabs ( ta ) );
114 bool real = size > 0 ? 1 : 0;
117 gfx::GL::translate ( p1[0], p1[1], 0 );
121 gfx::GL::translate ( p2[0], p2[1], 0 );
125 gfx::Glyph::Point2D(pp[0]);
126 gfx::Glyph::Point2D(pp[1]);
131 template<>
void Renderable<cga2D::Line>::DrawImmediate(
const cga2D::Line& s){
134 gfx::GL::translate (v[0], v[1],0);
135 gfx::Glyph::Line2D(d * 10, d * -10);
139 template<>
void Renderable<cga2D::DualLine>::DrawImmediate(
const cga2D::DualLine& s){
140 Renderable<cga2D::Line>::DrawImmediate(s.dual() );
148 template<>
void Renderable<Field<cga2D::Vec>>::DrawImmediate(
const Field<cga2D::Vec>& f){
149 for (
int i = 0; i < f.num(); ++i){
153 Renderable<cga2D::Vec>::DrawImmediate(f[i]);
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
Generic Geometric Number Types (templated on an algebra and a basis )
Definition: vsr_algebra.h:69
A Basic 3D Field (slowly porting this over from the now defunct vsr_lattice class) Use to Evaluate Ne...
Definition: vsr_field.h:67
static constexpr auto dir(const Multivector< A, B > &f) -> auto
Direction of Direct Flat.
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
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 std::vector< GAPnt< A > > split(const GAPar< A > &pp)
Split Points from Point Pair.
Definition: vsr_generic_op.h:743
static auto pl(const GARot< A > &r) -> GABiv< A >
Normalized plane of rotation from Rotor.
Definition: vsr_generic_op.h:321
static VSR_PRECISION iphi(const GARot< A > &r)
Angle of Rotation from Rotor.
Definition: vsr_generic_op.h:339
the versor library namespace
Definition: vsr_algebra.h:29
B copy() const
Copying to type B.
T::space::point & grid(int i)
Set Grid (position) Data.
Definition: vsr_cubicLattice.h:464
NTri< 5 > Tri
Trivector
Definition: vsr_cga3D_types.h:65
static constexpr NPnt< sizeof...(T)+2 > point(T...v)
Null Point from Coordinates.
Definition: vsr_generic_op.h:571
NRot< 5 > Rot
Rotor
Definition: vsr_cga3D_types.h:64
static constexpr GAPnt< A > cen(const Multivector< A, B > &s)
Simple Center of A Round Element (shorthand)
Definition: vsr_generic_op.h:653