38 #ifndef FCL_CCD_INTERVAL_VECTOR_INL_H 39 #define FCL_CCD_INTERVAL_VECTOR_INL_H 41 #include "fcl/math/motion/taylor_model/interval_vector.h" 48 struct IVector3<double>;
52 IVector3<double> bound(
const IVector3<double>& i,
const Vector3<double>& v);
56 IVector3<double> bound(
const IVector3<double>& i,
const IVector3<double>& v);
60 IVector3<S>::IVector3()
67 IVector3<S>::IVector3(S v)
74 IVector3<S>::IVector3(S x, S y, S z)
81 IVector3<S>::IVector3(S xl, S xu, S yl, S yu, S zl, S zu)
83 setValue(xl, xu, yl, yu, zl, zu);
88 IVector3<S>::IVector3(S v[3][2])
95 IVector3<S>::IVector3(Interval<S> v[3])
101 template <
typename S>
102 IVector3<S>::IVector3(
const Interval<S>& v1,
const Interval<S>& v2,
const Interval<S>& v3)
104 setValue(v1, v2, v3);
108 template <
typename S>
109 IVector3<S>::IVector3(
const Vector3<S>& v)
115 template <
typename S>
116 void IVector3<S>::setValue(S v)
124 template <
typename S>
125 void IVector3<S>::setValue(S x, S y, S z)
133 template <
typename S>
134 void IVector3<S>::setValue(S xl, S xu, S yl, S yu, S zl, S zu)
136 i_[0].setValue(xl, xu);
137 i_[1].setValue(yl, yu);
138 i_[2].setValue(zl, zu);
142 template <
typename S>
143 void IVector3<S>::setValue(S v[3][2])
145 i_[0].setValue(v[0][0], v[0][1]);
146 i_[1].setValue(v[1][0], v[1][1]);
147 i_[2].setValue(v[2][0], v[2][1]);
151 template <
typename S>
152 void IVector3<S>::setValue(Interval<S> v[3])
160 template <
typename S>
161 void IVector3<S>::setValue(
const Interval<S>& v1,
const Interval<S>& v2,
const Interval<S>& v3)
169 template <
typename S>
170 void IVector3<S>::setValue(
const Vector3<S>& v)
172 i_[0].setValue(v[0]);
173 i_[1].setValue(v[1]);
174 i_[2].setValue(v[2]);
178 template <
typename S>
179 void IVector3<S>::setValue(S v[])
181 i_[0].setValue(v[0]);
182 i_[1].setValue(v[1]);
183 i_[2].setValue(v[2]);
187 template <
typename S>
188 void IVector3<S>::setZero()
194 template <
typename S>
195 IVector3<S> IVector3<S>::operator + (
const IVector3<S>& other)
const 197 return IVector3(i_[0] + other.i_[0], i_[1] + other.i_[1], i_[2] + other.i_[2]);
201 template <
typename S>
202 IVector3<S>& IVector3<S>::operator += (
const IVector3<S>& other)
211 template <
typename S>
212 IVector3<S> IVector3<S>::operator - (
const IVector3<S>& other)
const 214 return IVector3(i_[0] - other.i_[0], i_[1] - other.i_[1], i_[2] - other.i_[2]);
218 template <
typename S>
219 IVector3<S>& IVector3<S>::operator -= (
const IVector3<S>& other)
228 template <
typename S>
229 Interval<S> IVector3<S>::dot(
const IVector3& other)
const 231 return i_[0] * other.i_[0] + i_[1] * other.i_[1] + i_[2] * other.i_[2];
235 template <
typename S>
236 IVector3<S> IVector3<S>::cross(
const IVector3<S>& other)
const 238 return IVector3(i_[1] * other.i_[2] - i_[2] * other.i_[1],
239 i_[2] * other.i_[0] - i_[0] * other.i_[2],
240 i_[0] * other.i_[1] - i_[1] * other.i_[0]);
244 template <
typename S>
245 Interval<S> IVector3<S>::dot(
const Vector3<S>& other)
const 247 return i_[0] * other[0] + i_[1] * other[1] + i_[2] * other[2];
251 template <
typename S>
252 const Interval<S>&IVector3<S>::operator [](
size_t i)
const 258 template <
typename S>
259 Interval<S>&IVector3<S>::operator [](
size_t i)
265 template <
typename S>
266 Vector3<S> IVector3<S>::getLow()
const 268 return Vector3<S>(i_[0][0], i_[1][0], i_[2][0]);
272 template <
typename S>
273 Vector3<S> IVector3<S>::getHigh()
const 275 return Vector3<S>(i_[0][1], i_[1][1], i_[2][1]);
279 template <
typename S>
280 IVector3<S> IVector3<S>::cross(
const Vector3<S>& other)
const 282 return IVector3(i_[1] * other[2] - i_[2] * other[1],
283 i_[2] * other[0] - i_[0] * other[2],
284 i_[0] * other[1] - i_[1] * other[0]);
288 template <
typename S>
289 S IVector3<S>::volumn()
const 291 return i_[0].diameter() * i_[1].diameter() * i_[2].diameter();
295 template <
typename S>
296 void IVector3<S>::print()
const 298 std::cout <<
"[" << i_[0][0] <<
"," << i_[0][1] <<
"]" << std::endl;
299 std::cout <<
"[" << i_[1][0] <<
"," << i_[1][1] <<
"]" << std::endl;
300 std::cout <<
"[" << i_[2][0] <<
"," << i_[2][1] <<
"]" << std::endl;
304 template <
typename S>
305 Vector3<S> IVector3<S>::center()
const 307 return Vector3<S>(i_[0].center(), i_[1].center(), i_[2].center());
311 template <
typename S>
312 void IVector3<S>::bound(
const IVector3& v)
314 if(v[0][0] < i_[0][0]) i_[0][0] = v[0][0];
315 if(v[1][0] < i_[1][0]) i_[1][0] = v[1][0];
316 if(v[2][0] < i_[2][0]) i_[2][0] = v[2][0];
318 if(v[0][1] > i_[0][1]) i_[0][1] = v[0][1];
319 if(v[1][1] > i_[1][1]) i_[1][1] = v[1][1];
320 if(v[2][1] > i_[2][1]) i_[2][1] = v[2][1];
324 template <
typename S>
325 void IVector3<S>::bound(
const Vector3<S>& v)
327 if(v[0] < i_[0][0]) i_[0][0] = v[0];
328 if(v[1] < i_[1][0]) i_[1][0] = v[1];
329 if(v[2] < i_[2][0]) i_[2][0] = v[2];
331 if(v[0] > i_[0][1]) i_[0][1] = v[0];
332 if(v[1] > i_[1][1]) i_[1][1] = v[1];
333 if(v[2] > i_[2][1]) i_[2][1] = v[2];
337 template <
typename S>
338 IVector3<S> bound(
const IVector3<S>& i,
const IVector3<S>& v)
341 if(v[0][0] < res.i_[0][0]) res.i_[0][0] = v[0][0];
342 if(v[1][0] < res.i_[1][0]) res.i_[1][0] = v[1][0];
343 if(v[2][0] < res.i_[2][0]) res.i_[2][0] = v[2][0];
345 if(v[0][1] > res.i_[0][1]) res.i_[0][1] = v[0][1];
346 if(v[1][1] > res.i_[1][1]) res.i_[1][1] = v[1][1];
347 if(v[2][1] > res.i_[2][1]) res.i_[2][1] = v[2][1];
353 template <
typename S>
354 IVector3<S> bound(
const IVector3<S>& i,
const Vector3<S>& v)
357 if(v[0] < res.i_[0][0]) res.i_[0][0] = v[0];
358 if(v[1] < res.i_[1][0]) res.i_[1][0] = v[1];
359 if(v[2] < res.i_[2][0]) res.i_[2][0] = v[2];
361 if(v[0] > res.i_[0][1]) res.i_[0][1] = v[0];
362 if(v[1] > res.i_[1][1]) res.i_[1][1] = v[1];
363 if(v[2] > res.i_[2][1]) res.i_[2][1] = v[2];
369 template <
typename S>
370 bool IVector3<S>::overlap(
const IVector3& v)
const 372 if(v[0][1] < i_[0][0])
return false;
373 if(v[1][1] < i_[1][0])
return false;
374 if(v[2][1] < i_[2][0])
return false;
376 if(v[0][0] > i_[0][1])
return false;
377 if(v[1][0] > i_[1][1])
return false;
378 if(v[2][0] > i_[2][1])
return false;
384 template <
typename S>
385 bool IVector3<S>::contain(
const IVector3& v)
const 387 if(v[0][0] < i_[0][0])
return false;
388 if(v[1][0] < i_[1][0])
return false;
389 if(v[2][0] < i_[2][0])
return false;
391 if(v[0][1] > i_[0][1])
return false;
392 if(v[1][1] > i_[1][1])
return false;
393 if(v[2][1] > i_[2][1])
return false;
Main namespace.
Definition: broadphase_bruteforce-inl.h:45