15 #ifndef Versor_vsr_knot_h
16 #define Versor_vsr_knot_h
18 #include "vsr_fiber.h"
20 namespace vsr {
namespace cga {
50 pnt.push_back(p);
return *
this;
53 TorusKnot& add(
const Cir& c){
54 cir.push_back(c);
return *
this;
58 return ( P == 0 || Q == 0 ) ? 1.0/amt : P * Q / (amt *
Round::size(HF.cir(),
false) );
62 double a = P == 0 ? 0 : PI/P;
double b = Q == 0 ? 0 : PI/Q;
63 return HF.fiberA().dual() * a + HF.fiberB().dual() * b;
70 Bst bst(
double t) { amt = t;
return bst(); }
72 TorusKnot(
double p = 3,
double q = 2,
double a = .01) : P(p), Q(q), amt(a) {}
75 void calc(
const Pnt& p){
76 pnt.clear(); cir.clear();
82 for (
int i = 0; i < tnum; ++ i ){
88 for (
int i = 0; i < tnum; ++i ){
91 int idx = i < tnum -1 ? i + 1 : 0;
92 Par tpar = pnt[i] ^ pnt[idx];
99 void calc0(
const Pnt& p){
100 pnt.clear(); cir.clear();
105 for (
int i = 0; i < tnum; ++ i ){
111 for (
int i = 0; i < tnum; ++i ){
114 int idx = i < tnum -1 ? i + 1 : 0;
115 Par tpar = pnt[i] ^ pnt[idx];
123 vector<T> apply0(
const T& input){
127 for (
int i=0; i<iter();++i){
128 tmp = tmp.spin(tbst);
136 double totalEnergy = 0;
138 energies.push_back(0);
141 vector<double> globalA;
143 vector<double> local;
148 for (
int i = 0; i < num; ++i){
151 int idxA = i < num - 1 ? i + 1 : 0;
158 globalA.push_back( totalA );
161 for (
int i = 0; i < num; ++i){
165 for (
int j = 0; j < num; ++j){
170 double diffA = fabs( globalA[j] - globalA[i] );
171 double diffB = fabs( (totalA - globalA[j] ) + globalA[i] );
173 double diff = diffA < diffB ? diffA : diffB;
175 double tener = ( ( 1.0 / chord ) - (1.0 / (diff * diff) ) ) * local[j];
177 if (i == idx ) energies.push_back(tener);
182 totalEnergy += ta * local[i];
static Bst bst(const Pair &p)
vsr::cga::Boost from vsr::cga::Pair
NCir< 5 > Cir
Circle
Definition: vsr_cga3D_types.h:74
Generic Geometric Number Types (templated on an algebra and a basis )
Definition: vsr_algebra.h:69
vector< double > energies
Energy at idx (from pnt 0)
Definition: vsr_knot.h:39
static VSR_PRECISION sqd(const Point &a, const Point b)
Squared distance between two points.
Definition: vsr_cga3D_round.h:233
static Point loc(const A &s)
Location (normalizd) of a Round Element (shorthand)
Definition: vsr_cga3D_round.h:146
NPar< 5 > Par
Pair
Definition: vsr_cga3D_types.h:73
NBst< 5 > Bst
Boost
Definition: vsr_cga3D_types.h:94
Hopf Fibration
Definition: vsr_fiber.h:26
vector< Pnt > pnt
A vector of points in the knot orbit.
Definition: vsr_knot.h:37
vector< Cir > cir
A vector of circles in the knot orbit.
Definition: vsr_knot.h:35
Definition: vsr_knot.h:24
double energy(int idx, int num)
Definition: vsr_knot.h:134
static VSR_PRECISION dist(const Point &a, const Point &b)
Distance between points a and b (shorthand)
Definition: vsr_cga3D_round.h:239
the versor library namespace
Definition: vsr_algebra.h:29
static VSR_PRECISION size(const DualSphere &s, bool bDual=true)
Squared Size of a DualSphere (result could be negative)
NPnt< 5 > Pnt
Point
Definition: vsr_cga3D_types.h:72