| 132 | |
| 133 | |
| 134 | void Foam::geomCellLooper::getBase(const vector& n, vector& e0, vector& e1) |
| 135 | const |
| 136 | { |
| 137 | // Guess for vector normal to n. |
| 138 | vector base(1,0,0); |
| 139 | |
| 140 | scalar nComp = n & base; |
| 141 | |
| 142 | if (mag(nComp) > 0.8) |
| 143 | { |
| 144 | // Was bad guess. Try with different vector. |
| 145 | |
| 146 | base.x() = 0; |
| 147 | base.y() = 1; |
| 148 | |
| 149 | nComp = n & base; |
| 150 | |
| 151 | if (mag(nComp) > 0.8) |
| 152 | { |
| 153 | base.y() = 0; |
| 154 | base.z() = 1; |
| 155 | |
| 156 | nComp = n & base; |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | |
| 161 | // Use component normal to n as base vector. |
| 162 | e0 = base - nComp*n; |
| 163 | |
| 164 | e0 /= mag(e0) + VSMALL; |
| 165 | |
| 166 | e1 = n ^ e0; |
| 167 | |
| 168 | //Pout<< "Coord system:" << endl |
| 169 | // << " n : " << n << ' ' << mag(n) << endl |
| 170 | // << " e0 : " << e0 << ' ' << mag(e0) << endl |
| 171 | // << " e1 : " << e1 << ' ' << mag(e1) << endl |
| 172 | // << endl; |
| 173 | } |
| 174 | |
| 175 | |
| 176 | // Return true if the cut edge at loop[index] is preceded by cuts through |