Files Classes Functions Hierarchy
#include <simplexD1listlinked.h>
Public Member Functions | |
| simplexD1listlinked (VI vi_, INDX length_) | |
| Pass the array vi[] reference and length. | |
| template<typename T > | |
| void | readindexed (T const *beg) |
| Read indexed lines. | |
| operator stringc () const | |
| Serialize this object. | |
| boolc | serializeInverse (stringc &s) |
| Read in/construct an object. | |
| void | makelinks (INDX const pointsmaxindex) |
| Assuming this is an indexed list of lines without links, an O(n) algorithm connects the lines. | |
| void | consistantwinding () |
| Assuming this is a linked loop, it can be made either clockwise or anticlockise. | |
Public Attributes | |
| VI | vi |
| Assume vi[] of simplexD1linked<INDX>. | |
| INDX | length |
| Length of vi array. | |
See simpelxD1linked. The structure can be built from indexed simplexes, assuming one linked line which I will call a curve.
vi[0] is a dummy variable because 0 is used to indicate nothing.
Definition at line 25 of file simplexD1listlinked.h.
| simplexD1listlinked< VI, INDX >::simplexD1listlinked | ( | VI | vi_, | |
| INDX | length_ | |||
| ) | [inline] |
| void simplexD1listlinked< VI, INDX >::consistantwinding | ( | ) | [inline] |
Assuming this is a linked loop, it can be made either clockwise or anticlockise.
Follow the links and swap points as necessary: vi[i].pi[0] is not equal to vi[k].pi[0] when i!=k.
Definition at line 85 of file simplexD1listlinked.h.
References simplexD1listlinked< VI, INDX >::length, and simplexD1listlinked< VI, INDX >::vi.
Referenced by simplexD1listlinkedtest::test03().
00086 { 00087 INDX w=1; 00088 INDX t; 00089 for (INDX i=1; i<=length; ++i) 00090 { 00091 t=vi[w].ni[0]; 00092 if (vi[t].piInverse( vi[w].pi[1] ) != 0 ) 00093 vi[t].togglelinedirection(); 00094 w = t; 00095 } 00096 }
| void simplexD1listlinked< VI, INDX >::makelinks | ( | INDX const | pointsmaxindex | ) | [inline] |
Assuming this is an indexed list of lines without links, an O(n) algorithm connects the lines.
Definition at line 99 of file simplexD1listlinked.h.
References simplexD1listlinked< VI, INDX >::length, pts, simplexD1listlinked< VI, INDX >::vi, point2< T >::x, and point2< T >::y.
Referenced by simplexD1listlinkedtest::test03().
00100 { 00101 // Build a table of points to simplexes 00102 point2<INDX> pts[pointsmaxindex+1]; 00103 00104 INDX a; 00105 INDX b; 00106 00107 for (INDX i=0; i<length; ++i) 00108 { 00109 a = vi[i].pi[0]; 00110 b = vi[i].pi[1]; 00111 if (pts[a].x == 0) 00112 pts[a].x = i; 00113 else 00114 pts[a].y = i; 00115 if (pts[b].x == 0) 00116 pts[b].x = i; 00117 else 00118 pts[b].y = i; 00119 } 00120 00121 //cout << "Points to Simplexes table" << endl; 00122 //for (INDX k=1; k<pointsmaxindex+1; ++k) 00123 //{ 00124 // cout << k << ": " << pts[k] << endl; 00125 //} 00126 00127 INDX s1; 00128 INDX s2; 00129 INDX w; 00130 for (INDX k=1; k<pointsmaxindex+1; ++k) 00131 { 00132 s1 = pts[k].x; 00133 s2 = pts[k].y; 00134 if (s1==0) 00135 continue; 00136 if (s2==0) 00137 continue; 00138 00139 // Link the two lines. 00140 00141 w = ((vi[s2].piInverse(k))+1)%2; 00142 vi[s2].ni[ w ] = s1; 00143 00144 w = ((vi[s1].piInverse(k))+1)%2; 00145 vi[s1].ni[ w ] = s2; 00146 } 00147 }
| simplexD1listlinked< VI, INDX >::operator stringc | ( | ) | const [inline] |
Serialize this object.
Definition at line 197 of file simplexD1listlinked.h.
References simplexD1listlinked< VI, INDX >::length, and simplexD1listlinked< VI, INDX >::vi.
00198 { 00199 stringstream ss; 00200 ss << length << "\n"; 00201 INDX i=0; 00202 for ( ; i<length; ++i ) 00203 { 00204 ss << (string)vi[i] << "\n"; 00205 } 00206 00207 return ss.str(); 00208 }
| void simplexD1listlinked< VI, INDX >::readindexed | ( | T const * | beg | ) | [inline] |
Read indexed lines.
typedef vector< simplexD1linked<uint> > vec;
vec v2(8);
simplexD1listlinked< vec &, uint > s1(v2,8);
uint v[] =
{
0, 0,
2, 6,
7, 5,
4, 1,
5, 4,
6, 1,
3, 7,
2, 3
};
s1.readindexed(v);
Definition at line 184 of file simplexD1listlinked.h.
References simplexD1listlinked< VI, INDX >::length, and simplexD1listlinked< VI, INDX >::vi.
Referenced by simplexD1listlinkedtest::test01(), simplexD1listlinkedtest::test02(), and simplexD1listlinkedtest::test03().
00185 { 00186 T const * x = beg; 00187 00188 for (INDX i=0; i<length; ++i) 00189 { 00190 vi[i].construct(*x,*(x+1)); 00191 ++x; ++x; 00192 //cout << SHOW(i) << endl; 00193 } 00194 }
| boolc simplexD1listlinked< VI, INDX >::serializeInverse | ( | stringc & | s | ) | [inline] |
Read in/construct an object.
Definition at line 150 of file simplexD1listlinked.h.
References simplexD1listlinked< VI, INDX >::length, tokenizer::readaslinesgeneral(), tokenizer::reset(), and simplexD1listlinked< VI, INDX >::vi.
Referenced by simplexD1listlinkedtest::test02().
00151 { 00152 tokenizer tokenstream; 00153 tokenstream.readaslinesgeneral(s); 00154 00155 INDX mylength; 00156 tokenstream.reset(); 00157 stringstream(tokenstream()) >> mylength; 00158 ++tokenstream; 00159 assert(mylength==length); 00160 if (mylength!=length) 00161 return false; 00162 00163 //cout << SHOW(s) << endl; 00164 00165 for (INDX i=0; i<length; ++i) 00166 { 00167 string z(tokenstream()); 00168 ++tokenstream; 00169 z += (" " + tokenstream()); 00170 ++tokenstream; 00171 z += (" " + tokenstream()); 00172 ++tokenstream; 00173 z += (" " + tokenstream()); 00174 ++tokenstream; 00175 //cout << SHOW(z) << endl; 00176 vi[i].serializeInverse(z); 00177 } 00178 00179 return true; 00180 }
| INDX simplexD1listlinked< VI, INDX >::length |
Length of vi array.
Definition at line 33 of file simplexD1listlinked.h.
Referenced by simplexD1listlinked< VI, INDX >::consistantwinding(), simplexD1listlinked< VI, INDX >::makelinks(), simplexD1listlinked< VI, INDX >::operator stringc(), simplexD1listlinked< VI, INDX >::readindexed(), and simplexD1listlinked< VI, INDX >::serializeInverse().
| VI simplexD1listlinked< VI, INDX >::vi |
Assume vi[] of simplexD1linked<INDX>.
Definition at line 30 of file simplexD1listlinked.h.
Referenced by simplexD1listlinked< VI, INDX >::consistantwinding(), simplexD1listlinked< VI, INDX >::makelinks(), simplexD1listlinked< VI, INDX >::operator stringc(), simplexD1listlinked< VI, INDX >::readindexed(), and simplexD1listlinked< VI, INDX >::serializeInverse().
1.5.8