13 #ifndef ROOT_SYSTEM_INCLUDED
14 #define ROOT_SYSTEM_INCLUDED
125 static bool Compare(
const V& a,
const V& b,
bool ref =
true){
127 return ( ref ? (a<=b)[0] > .99999 : fabs ((a<=b)[0]) > .99999 );
131 template<
class V,
class ... R>
132 static vector<V> System(
const V& x,
const R&... v ){
136 int n =
sizeof...(R) + 1;
138 V root[] = {x, v... };
140 for (
int i = 0; i < n; ++i ){
141 initial.push_back( root[i].unit() );
144 return System( initial,
false );
149 static vector<V> System(
const vector<V>& root,
bool ref=
true,
int nMaxIter = 500){
152 vector< V > results = root;
156 bool keepGoing =
true;
161 int cs = results.size();
163 for (
int i=0; i<cs; ++i){
164 int ns = results.size();
166 for (
int j=0; j<ns; ++j ){
168 V nr = results[j].reflect( results[i] );
171 for (
int k=0; k<ns; ++k){
172 exists = ( Compare(nr.unit(),results[k].unit(),ref) );
179 results.push_back( nr );
185 if (done || (results.size() > nMaxIter) ) { keepGoing =
false; }
static bool Compare(const V &a, const V &b, bool ref=true)
Utility function to compare two unit vectors (looks at dot product, or norm of diff...)
Definition: vsr_root.h:125
core namespaced operations that are metric-agnostic
goal is to use generators to collect all the unique transformations of the group, so we can apply the...
Definition: vsr_root.h:115
Definition: vsr_root.h:119
the versor library namespace
Definition: vsr_algebra.h:29