59 if (p > maxv) maxv = p;
60 if (p < minv) minv = p;
96 d[6] = p[0] + p[1] - p[2];
97 d[7] = p[0] + p[2] - p[1];
98 d[8] = p[1] + p[2] - p[0];
103 FCL_REAL real_max = (std::numeric_limits<FCL_REAL>::max)();
104 dist_.template head<N / 2>().setConstant(real_max);
105 dist_.template tail<N / 2>().setConstant(-real_max);
110 for (
short i = 0; i < 3; ++i) {
111 dist_[i] = dist_[N / 2 + i] =
v[i];
116 for (
short i = 0; i < (N - 6) / 2; ++i) {
117 dist_[3 + i] = dist_[3 + i + N / 2] = d[i];
123 for (
short i = 0; i < 3; ++i) {
124 minmax(
a[i],
b[i], dist_[i], dist_[i + N / 2]);
127 FCL_REAL ad[(N - 6) / 2], bd[(N - 6) / 2];
130 for (
short i = 0; i < (N - 6) / 2; ++i) {
131 minmax(ad[i], bd[i], dist_[3 + i], dist_[3 + i + N / 2]);
137 if ((dist_.template head<N / 2>() > other.
dist_.template tail<N / 2>()).any())
139 if ((dist_.template tail<N / 2>() < other.
dist_.template head<N / 2>()).any())
146 FCL_REAL& sqrDistLowerBound)
const {
151 (dist_.template head<N / 2>() - other.
dist_.template tail<N / 2>())
153 if (
a > breakDistance) {
154 sqrDistLowerBound =
a *
a;
159 (other.
dist_.template head<N / 2>() - dist_.template tail<N / 2>())
161 if (
b > breakDistance) {
162 sqrDistLowerBound =
b *
b;
166 sqrDistLowerBound = std::min(
a,
b);
172 if ((p.array() < dist_.template head<3>()).any())
return false;
173 if ((p.array() > dist_.template segment<3>(N / 2)).any())
return false;
175 enum {
P = ((N - 6) / 2) };
176 Eigen::Array<FCL_REAL, P, 1> d;
177 getDistances<P>(p, d.data());
179 if ((d < dist_.template segment<P>(3)).any())
return false;
180 if ((d > dist_.template segment<P>(3 + N / 2)).any())
return false;
187 for (
short i = 0; i < 3; ++i) {
188 minmax(p[i], dist_[i], dist_[N / 2 + i]);
193 for (
short i = 0; i < (N - 6) / 2; ++i) {
194 minmax(pd[i], dist_[3 + i], dist_[3 + N / 2 + i]);
202 for (
short i = 0; i < N / 2; ++i) {
203 dist_[i] = std::min(other.
dist_[i], dist_[i]);
204 dist_[i + N / 2] = std::max(other.
dist_[i + N / 2], dist_[i + N / 2]);
218 std::cerr <<
"KDOP distance not implemented!" << std::endl;
225 for (
short i = 0; i < 3; ++i) {
227 res.dist(
short(N / 2 + i)) +=
t[i];
232 for (
short i = 0; i < (N - 6) / 2; ++i) {
233 res.dist(
short(3 + i)) += d[i];
234 res.dist(
short(3 + i + N / 2)) += d[i];
240 template class KDOP<16>;
241 template class KDOP<18>;
242 template class KDOP<24>;