versor  3.0
C++11 library for Geometric algebra
vsr_fiber.h
1 //
2 // vsr_fiber.h
3 // Versor
4 //
5 // SOME GOOD FIBRATIONS
6 //
7 // Created by Pablo Colapinto on 1/8/13.
8 // Copyright (c) 2013 __MyCompanyName__. All rights reserved.
9 //
10 
11 #ifndef Versor_vsr_fiber_h
12 #define Versor_vsr_fiber_h
13 
14 #include "space/vsr_cga3D_op.h"
15 #include "util/vsr_coord.h"
16 
17 
18 //Q: Given a Circle, can we find it's associated HopfBundle, and thereby a commuting Circle?
19 namespace vsr{ namespace cga {
20 
21 
26  class HopfFiber{
27 
28 
29  //Chirality
30  bool bHanded;
31 
32  //Circle base (at Phi = -.5)
33  Cir mCir;
34 
35  //Vector on S2
36  Vec mVec;
37 
38  //phase on cir
39  double mPhase;
40 
41  public:
42 
43  HopfFiber(bool hand=true) : bHanded(hand), mPhase(0) {
44  mCir = CXZ(1);
45  mVec = Vec::y;
46  }
47 
48  Cir& cir() { return mCir; }
49  const Cir cir() const { return mCir; }
50 
51  Vec& vec() { return mVec;}
52  Vec vec() const { return mVec; }
53 
54  double& phase() { return mPhase;}
55  double phase() const { return mPhase; }
56 
57  //Dual line axis of Circle South Pole (i.e. the North Pole)
58  Dll dll(){ return (Inf(1) <= mCir).runit(); }
59 
60  auto mtt(double theta, double phi) -> decltype( Mot() * Trv() ) {
61  double ptheta = PIOVERTWO * theta;
62  double pphi = phi+.5;
63 
64  Vec v = Vec::x.rot( Biv::xz * ptheta ) / Round::rad(mCir);
65  Lin lim = mCir.sp( Gen::trv( v ) ); //<-- Circle to a Line (Limit)
66  Mot mot = Gen::ratio( lim.dual().runit(), dll(), pphi);
67 
68  return mot * Gen::trv(v * pphi ) ;
69  }
70 
71  //boost only no twist
72  Trv trv(double theta, double phi){
73 
74  double ptheta = PIOVERTWO * theta;
75 
76  Vec v = Vec::x.rot( Biv::xz * ptheta );
77  return Gen::trv(v * phi );
78  }
79 
80  //twist only
81  Mot mot(double theta, double phi){
82 
83  double ptheta = PIOVERTWO * theta;
84 
85  Vec v = Vec::x.rot( Biv::xz * ptheta );
86  Lin lim = mCir.sp( Gen::trv(v.unit()) );
87  return Gen::ratio( lim.dual().runit(), dll(), phi );
88  }
89 
91  //theta from -1 to 1, phi from -.5 to .5
92  Cir fiber(double theta, double phi){
93 
94  double ptheta = PIOVERTWO * theta;
95  double pphi = phi+.5;
96 
97  //Divide by Radius
98  //Vector of Circle
99  Vec v = Round::vec( mCir, ptheta ) / Round::rad(mCir);
100 
101 // v.vprint();
102 // Vector v = Vec::x.rot( Biv::xz * ptheta ) / Round::rad(mCir);
103 
104  Vec c = Round::loc(mCir);
105 
106  Bst bst = Gen::bst( v, c , 1 );
107  // bst.vprint();
108 
109  Lin lim = mCir.sp( bst ); //<-- Circle to a Line (Limit)
110 // lim.vprint();
111  Mot mot = Gen::ratio( lim.dual().runit(), dll(), pphi);
112 
113 
114 
115  return mCir.sp( mot * Gen::bst(v ,c , pphi ) ) ;
116 
117  }
118 
119 
120  Cir fiber(const Vec& v){
121  Coord::Sph cs = Coord::vec2sph(v); // spherical coordinates [-1,1] and [-.5,.5]
122  return fiber(cs.theta/PI, cs.phi/PI);
123  }
124 
125  //Hopf Links a and b are orthogonal (a * b = b * a)
126  Cir fiberA() { return fiber (mVec); }
127  Cir fiberB() { return fiber (-mVec); }
128 
129  Lin lim(double theta){
130  double ptheta = PIOVERTWO * theta;
131  Vec v = Vec::x.rot( Biv::xz * ptheta );
132  return mCir.sp( Gen::trv(v) );
133  }
134 
135  vector<Cir> poles(double theta, double phi){
136  vector<Cir> cp;
137  cp.push_back( fiber(theta, phi) );
138  double theta2 = theta < 0 ? theta + 1 : theta - 1;
139  double phi2 = - phi;
140  cp.push_back( fiber(theta2, phi2) );
141  return cp;
142  }
143 
144  Pnt phase(double theta, double phi, double phs){
145  return Round::point( fiber(theta,phi), phs * PI);
146  }
147 
148 
149  Pnt pnt(){
150  return Round::point( fiberA(), mPhase * PI );
151  }
152 
153  };
154 
155 } } //vsr::cga::
156 #endif
static Bst bst(const Pair &p)
vsr::cga::Boost from vsr::cga::Pair
Common Operations Specific to CGA3D.
NCir< 5 > Cir
Circle
Definition: vsr_cga3D_types.h:74
static Vec vec(const Circle &c, VSR_PRECISION theta=0)
Euclidean Vector of Circle at theta.
NVec< 5 > Vec
Vector
Definition: vsr_cga3D_types.h:62
Generic Geometric Number Types (templated on an algebra and a basis )
Definition: vsr_algebra.h:69
NLin< 5 > Lin
Line
Definition: vsr_cga3D_types.h:80
#define CXZ(f)
A vsr::cga::Circle in xz plane with radius f.
Definition: vsr_cga3D_op.h:624
static Point loc(const A &s)
Location (normalizd) of a Round Element (shorthand)
Definition: vsr_cga3D_round.h:146
Hopf Fibration
Definition: vsr_fiber.h:26
NInf< 5 > Inf
Infinity
Definition: vsr_cga3D_types.h:68
static VSR_PRECISION rad(const T &t)
Squared Size of a DualSphere (result could be negative)
Definition: vsr_cga3D_round.h:203
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
Multivector rot(const MultivectorB< B > &b) const
static Trv trv(const A &a)
vsr::cga::Transversor from any type
Definition: vsr_cga3D_op.h:142
Definition: vsr_coord.h:23
NPnt< 5 > Pnt
Point
Definition: vsr_cga3D_types.h:72
static Point point(VSR_PRECISION x, VSR_PRECISION y, VSR_PRECISION z)
Null Point from Coordinates.
Cir fiber(double theta, double phi)
Feed in Coordinates of a 2-Sphere, get 3-Sphere Fiber out.
Definition: vsr_fiber.h:92
NTrv< 5 > Trv
Transversor
Definition: vsr_cga3D_types.h:93
NMot< 5 > Mot
Motor
Definition: vsr_cga3D_types.h:92