38 #ifndef FCL_CCD_INTERVAL_MATRIX_INL_H
39 #define FCL_CCD_INTERVAL_MATRIX_INL_H
48 struct IMatrix3<double>;
71 v_[0].setValue(m.row(0)[0], m.row(0)[1], m.row(0)[2]);
72 v_[1].setValue(m.row(1)[0], m.row(1)[1], m.row(1)[2]);
73 v_[2].setValue(m.row(2)[0], m.row(2)[1], m.row(2)[2]);
100 v_[2].setValue(m[2]);
104 template <
typename S>
113 template <
typename S>
116 v_[0].setValue(1, 0, 0);
117 v_[1].setValue(0, 1, 0);
118 v_[2].setValue(0, 0, 1);
122 template <
typename S>
129 template <
typename S>
136 template <
typename S>
139 return Vector3<S>(v_[0][i][0], v_[1][i][0], v_[2][i][0]);
143 template <
typename S>
146 return Vector3<S>(v_[i][0][0], v_[i][1][0], v_[i][2][0]);
150 template <
typename S>
153 return Vector3<S>(v_[0][i][1], v_[1][i][1], v_[2][i][1]);
157 template <
typename S>
160 return Vector3<S>(v_[i][0][1], v_[i][1][1], v_[i][2][1]);
164 template <
typename S>
168 m << v_[0][0][1], v_[0][1][1], v_[0][2][1],
169 v_[1][0][1], v_[1][1][1], v_[1][2][1],
170 v_[2][0][1], v_[2][1][1], v_[2][2][1];
175 template <
typename S>
179 m << v_[0][0][1], v_[0][1][1], v_[0][2][1],
180 v_[1][0][1], v_[1][1][1], v_[1][2][1],
181 v_[2][0][1], v_[2][1][1], v_[2][2][1];
186 template <
typename S>
193 template <
typename S>
200 template <
typename S>
203 return IMatrix3(
IVector3<S>(v_[0].dot(m.col(0)), v_[0].dot(m.col(1)), v_[0].dot(m.col(2))),
204 IVector3<S>(v_[1].dot(m.col(0)), v_[1].dot(m.col(1)), v_[1].dot(m.col(2))),
205 IVector3<S>(v_[2].dot(m.col(0)), v_[2].dot(m.col(1)), v_[2].dot(m.col(2))));
209 template <
typename S>
212 return IVector3<S>(v_[0].dot(v), v_[1].dot(v), v_[2].dot(v));
216 template <
typename S>
219 return IVector3<S>(v_[0].dot(v), v_[1].dot(v), v_[2].dot(v));
223 template <
typename S>
231 IVector3<S>(v_[1].dot(mc0), v_[1].dot(mc1), v_[1].dot(mc2)),
232 IVector3<S>(v_[2].dot(mc0), v_[2].dot(mc1), v_[2].dot(mc2)));
236 template <
typename S>
239 v_[0].setValue(v_[0].dot(m.col(0)), v_[0].dot(m.col(1)), v_[0].dot(m.col(2)));
240 v_[1].setValue(v_[1].dot(m.col(0)), v_[1].dot(m.col(1)), v_[1].dot(m.col(2)));
241 v_[2].setValue(v_[2].dot(m.col(0)), v_[2].dot(m.col(1)), v_[2].dot(m.col(2)));
246 template <
typename S>
253 v_[0].setValue(v_[0].dot(mc0), v_[0].dot(mc1), v_[0].dot(mc2));
254 v_[1].setValue(v_[1].dot(mc0), v_[1].dot(mc1), v_[1].dot(mc2));
255 v_[2].setValue(v_[2].dot(mc0), v_[2].dot(mc1), v_[2].dot(mc2));
260 template <
typename S>
263 return IMatrix3(v_[0] + m.
v_[0], v_[1] + m.
v_[1], v_[2] + m.
v_[2]);
267 template <
typename S>
277 template <
typename S>
280 return IMatrix3(v_[0] - m.
v_[0], v_[1] - m.
v_[1], v_[2] - m.
v_[2]);
284 template <
typename S>
294 template <
typename S>
297 for(std::size_t i = 0; i < 3; ++i)
299 for(std::size_t j = 0; j < 3; ++j)
301 if(v_[i][j][0] < -1) v_[i][j][0] = -1;
302 else if(v_[i][j][0] > 1) v_[i][j][0] = 1;
304 if(v_[i][j][1] < -1) v_[i][j][1] = -1;
305 else if(v_[i][j][1] > 1) v_[i][j][1] = 1;
313 template <
typename S>
316 std::cout <<
"[" << v_[0][0][0] <<
"," << v_[0][0][1] <<
"]" <<
" [" << v_[0][1][0] <<
"," << v_[0][1][1] <<
"]" <<
" [" << v_[0][2][0] <<
"," << v_[0][2][1] <<
"]" << std::endl;
317 std::cout <<
"[" << v_[1][0][0] <<
"," << v_[1][0][1] <<
"]" <<
" [" << v_[1][1][0] <<
"," << v_[1][1][1] <<
"]" <<
" [" << v_[1][2][0] <<
"," << v_[1][2][1] <<
"]" << std::endl;
318 std::cout <<
"[" << v_[2][0][0] <<
"," << v_[2][0][1] <<
"]" <<
" [" << v_[2][1][0] <<
"," << v_[2][1][1] <<
"]" <<
" [" << v_[2][2][0] <<
"," << v_[2][2][1] <<
"]" << std::endl;
322 template <
typename S>
326 for(std::size_t i = 0; i < 3; ++i)
328 for(std::size_t j = 0; j < 3; ++j)
330 if(m(i, j)[0] < -1) res(i, j)[0] = -1;
331 else if(m(i, j)[0] > 1) res(i, j)[0] = 1;
333 if(m(i, j)[1] < -1) res(i, j)[1] = -1;
334 else if(m(i, j)[1] > 1) res(i, j)[1] = 1;