38 #ifndef FCL_BV_RSS_INL_H 39 #define FCL_BV_RSS_INL_H 79 const Matrix3<double>& Rab,
80 const Vector3<double>& Tab,
89 const Transform3<double>& tfab,
97 RSS<double>
translate(
const RSS<double>& bv,
const Vector3<double>& t);
100 template <
typename S>
108 template <
typename S>
113 axis.col(0).dot(t), axis.col(1).dot(t), axis.col(2).dot(t));
117 return (dist <= (
r + other.
r));
121 template <
typename S>
129 template <
typename S>
134 axis.col(0).dot(local_p),
135 axis.col(1).dot(local_p),
136 axis.col(2).dot(local_p));
137 S abs_proj2 = fabs(proj[2]);
140 if((proj[0] < l[0]) && (proj[0] > 0) && (proj[1] < l[1]) && (proj[1] > 0))
142 return (abs_proj2 <
r);
144 else if((proj[0] < l[0]) && (proj[0] > 0) && ((proj[1] < 0) || (proj[1] > l[1])))
146 S y = (proj[1] > 0) ? l[1] : 0;
148 return ((proj - v).squaredNorm() <
r *
r);
150 else if((proj[1] < l[1]) && (proj[1] > 0) && ((proj[0] < 0) || (proj[0] > l[0])))
152 S x = (proj[0] > 0) ? l[0] : 0;
154 return ((proj - v).squaredNorm() <
r *
r);
158 S x = (proj[0] > 0) ? l[0] : 0;
159 S y = (proj[1] > 0) ? l[1] : 0;
161 return ((proj - v).squaredNorm() <
r *
r);
166 template <
typename S>
172 axis.col(0).dot(local_p),
173 axis.col(1).dot(local_p),
174 axis.col(2).dot(local_p));
175 S abs_proj2 = fabs(proj[2]);
178 if((proj[0] < l[0]) && (proj[0] > 0) && (proj[1] < l[1]) && (proj[1] > 0))
184 r = 0.5 * (
r + abs_proj2);
187 To[2] += 0.5 * (abs_proj2 -
r);
189 To[2] -= 0.5 * (abs_proj2 -
r);
192 else if((proj[0] < l[0]) && (proj[0] > 0) && ((proj[1] < 0) || (proj[1] > l[1])))
194 S y = (proj[1] > 0) ? l[1] : 0;
196 S new_r_sqr = (proj - v).squaredNorm();
197 if(new_r_sqr <
r *
r)
203 S delta_y = - std::sqrt(r * r - proj[2] * proj[2]) + fabs(proj[1] - y);
210 S delta_y = fabs(proj[1] - y);
216 To[2] += 0.5 * (abs_proj2 -
r);
218 To[2] -= 0.5 * (abs_proj2 -
r);
222 else if((proj[1] < l[1]) && (proj[1] > 0) && ((proj[0] < 0) || (proj[0] > l[0])))
224 S x = (proj[0] > 0) ? l[0] : 0;
226 S new_r_sqr = (proj - v).squaredNorm();
227 if(new_r_sqr <
r *
r)
233 S delta_x = - std::sqrt(r * r - proj[2] * proj[2]) + fabs(proj[0] - x);
240 S delta_x = fabs(proj[0] - x);
246 To[2] += 0.5 * (abs_proj2 -
r);
248 To[2] -= 0.5 * (abs_proj2 -
r);
254 S x = (proj[0] > 0) ? l[0] : 0;
255 S y = (proj[1] > 0) ? l[1] : 0;
257 S new_r_sqr = (proj - v).squaredNorm();
258 if(new_r_sqr <
r *
r)
264 S diag = std::sqrt(new_r_sqr - proj[2] * proj[2]);
265 S delta_diag = - std::sqrt(r * r - proj[2] * proj[2]) + diag;
267 S delta_x = delta_diag / diag * fabs(proj[0] - x);
268 S delta_y = delta_diag / diag * fabs(proj[1] - y);
272 if(proj[0] < 0 && proj[1] < 0)
280 S delta_x = fabs(proj[0] - x);
281 S delta_y = fabs(proj[1] - y);
286 if(proj[0] < 0 && proj[1] < 0)
293 To[2] += 0.5 * (abs_proj2 -
r);
295 To[2] -= 0.5 * (abs_proj2 -
r);
304 template <
typename S>
307 *
this = *
this + other;
312 template <
typename S>
328 v[0] = other.
To + d0_pos + d1_pos + d2_pos;
329 v[1] = other.
To + d0_pos + d1_pos + d2_neg;
330 v[2] = other.
To + d0_pos + d1_neg + d2_pos;
331 v[3] = other.
To + d0_pos + d1_neg + d2_neg;
332 v[4] = other.
To + d0_neg + d1_pos + d2_pos;
333 v[5] = other.
To + d0_neg + d1_pos + d2_neg;
334 v[6] = other.
To + d0_neg + d1_neg + d2_pos;
335 v[7] = other.
To + d0_neg + d1_neg + d2_neg;
337 d0_pos.noalias() = axis.col(0) * (l[0] +
r);
338 d1_pos.noalias() = axis.col(1) * (l[1] +
r);
339 d0_neg.noalias() = axis.col(0) * (-
r);
340 d1_neg.noalias() = axis.col(1) * (-
r);
341 d2_pos.noalias() = axis.col(2) *
r;
342 d2_neg.noalias() = axis.col(2) * (-
r);
344 v[8] = To + d0_pos + d1_pos + d2_pos;
345 v[9] = To + d0_pos + d1_pos + d2_neg;
346 v[10] = To + d0_pos + d1_neg + d2_pos;
347 v[11] = To + d0_pos + d1_neg + d2_neg;
348 v[12] = To + d0_neg + d1_pos + d2_pos;
349 v[13] = To + d0_neg + d1_pos + d2_neg;
350 v[14] = To + d0_neg + d1_neg + d2_pos;
351 v[15] = To + d0_neg + d1_neg + d2_neg;
358 getCovariance<S>(v,
nullptr,
nullptr,
nullptr, 16, M);
362 if(s[0] > s[1]) { max = 0; min = 1; }
363 else { min = 0; max = 1; }
364 if(s[2] < s[min]) { mid =
min; min = 2; }
365 else if(s[2] > s[max]) { mid =
max; max = 2; }
369 bv.
axis.col(0) = E.col(max);
370 bv.
axis.col(1) = E.col(mid);
371 bv.
axis.col(2).noalias() = axis.col(0).cross(axis.col(1));
374 getRadiusAndOriginAndRectangleSize<S>(v,
nullptr,
nullptr,
nullptr, 16, bv.
axis, bv.
To, bv.
l, bv.
r);
380 template <
typename S>
387 template <
typename S>
394 template <
typename S>
401 template <
typename S>
408 template <
typename S>
411 return (std::sqrt(l[0] * l[0] + l[1] * l[1]) + 2 *
r);
415 template <
typename S>
419 p_ToCenter_T << l[0] * 0.5, l[1] * 0.5, 0.0;
420 return p_FoTo_F() + R_FT() * p_ToCenter_T;
423 template <
typename S>
427 p_ToCenter_T << l[0] * 0.5, l[1] * 0.5, 0.0;
428 p_FoTo_F() = p_FoCenter_F - R_FT() * p_ToCenter_T;
432 template <
typename S>
440 axis.col(0).dot(t), axis.col(1).dot(t), axis.col(2).dot(t));
444 dist -= (
r + other.
r);
445 return (dist < (
S)0.0) ? (
S)0.0 : dist;
449 template <
typename S>
453 else if(val > b) val = b;
457 template <
typename S>
458 void segCoords(S& t, S& u, S a, S b, S A_dot_B, S A_dot_T, S B_dot_T)
460 S denom = 1 - A_dot_B * A_dot_B;
462 if(denom == 0) t = 0;
465 t = (A_dot_T - B_dot_T * A_dot_B) / denom;
469 u = t * A_dot_B - B_dot_T;
479 t = u * A_dot_B + A_dot_T;
485 template <
typename S>
486 bool inVoronoi(S a, S b, S Anorm_dot_B, S Anorm_dot_T, S A_dot_B, S A_dot_T, S B_dot_T)
488 if(fabs(Anorm_dot_B) < 1e-7)
return false;
492 u = -Anorm_dot_T / Anorm_dot_B;
495 t = u * A_dot_B + A_dot_T;
498 v = t * A_dot_B - B_dot_T;
502 if(v > (u + 1e-7))
return true;
506 if(v < (u - 1e-7))
return true;
512 template <
typename S>
515 S A0_dot_B0, A0_dot_B1, A1_dot_B0, A1_dot_B1;
517 A0_dot_B0 = Rab(0, 0);
518 A0_dot_B1 = Rab(0, 1);
519 A1_dot_B0 = Rab(1, 0);
520 A1_dot_B1 = Rab(1, 1);
522 S aA0_dot_B0, aA0_dot_B1, aA1_dot_B0, aA1_dot_B1;
523 S bA0_dot_B0, bA0_dot_B1, bA1_dot_B0, bA1_dot_B1;
525 aA0_dot_B0 = a[0] * A0_dot_B0;
526 aA0_dot_B1 = a[0] * A0_dot_B1;
527 aA1_dot_B0 = a[1] * A1_dot_B0;
528 aA1_dot_B1 = a[1] * A1_dot_B1;
529 bA0_dot_B0 = b[0] * A0_dot_B0;
530 bA1_dot_B0 = b[0] * A1_dot_B0;
531 bA0_dot_B1 = b[1] * A0_dot_B1;
532 bA1_dot_B1 = b[1] * A1_dot_B1;
541 S ALL_x, ALU_x, AUL_x, AUU_x;
542 S BLL_x, BLU_x, BUL_x, BUU_x;
543 S LA1_lx, LA1_ux, UA1_lx, UA1_ux, LB1_lx, LB1_ux, UB1_lx, UB1_ux;
546 ALU_x = ALL_x + aA1_dot_B0;
547 AUL_x = ALL_x + aA0_dot_B0;
548 AUU_x = ALU_x + aA0_dot_B0;
566 BLU_x = BLL_x + bA0_dot_B1;
567 BUL_x = BLL_x + bA0_dot_B0;
568 BUU_x = BLU_x + bA0_dot_B0;
587 if((UA1_ux > b[0]) && (UB1_ux > a[0]))
589 if(((UA1_lx > b[0]) ||
590 inVoronoi(b[1], a[1], A1_dot_B0, aA0_dot_B0 - b[0] - Tba[0],
591 A1_dot_B1, aA0_dot_B1 - Tba[1],
592 -Tab[1] - bA1_dot_B0))
595 inVoronoi(a[1], b[1], A0_dot_B1, Tab[0] + bA0_dot_B0 - a[0],
596 A1_dot_B1, Tab[1] + bA1_dot_B0, Tba[1] - aA0_dot_B1)))
598 segCoords(t, u, a[1], b[1], A1_dot_B1, Tab[1] + bA1_dot_B0,
599 Tba[1] - aA0_dot_B1);
601 D[0] = Tab[0] + Rab(0, 0) * b[0] + Rab(0, 1) * u - a[0] ;
602 D[1] = Tab[1] + Rab(1, 0) * b[0] + Rab(1, 1) * u - t;
603 D[2] = Tab[2] + Rab(2, 0) * b[0] + Rab(2, 1) * u;
618 if((UA1_lx < 0) && (LB1_ux > a[0]))
621 inVoronoi(b[1], a[1], -A1_dot_B0, Tba[0] - aA0_dot_B0,
622 A1_dot_B1, aA0_dot_B1 - Tba[1], -Tab[1]))
625 inVoronoi(a[1], b[1], A0_dot_B1, Tab[0] - a[0],
626 A1_dot_B1, Tab[1], Tba[1] - aA0_dot_B1)))
628 segCoords(t, u, a[1], b[1], A1_dot_B1, Tab[1], Tba[1] - aA0_dot_B1);
630 D[0] = Tab[0] + Rab(0, 1) * u - a[0];
631 D[1] = Tab[1] + Rab(1, 1) * u - t;
632 D[2] = Tab[2] + Rab(2, 1) * u;
646 if((LA1_ux > b[0]) && (UB1_lx < 0))
648 if(((LA1_lx > b[0]) ||
649 inVoronoi(b[1], a[1], A1_dot_B0, -Tba[0] - b[0],
650 A1_dot_B1, -Tba[1], -Tab[1] - bA1_dot_B0))
653 inVoronoi(a[1], b[1], -A0_dot_B1, -Tab[0] - bA0_dot_B0,
654 A1_dot_B1, Tab[1] + bA1_dot_B0, Tba[1])))
656 segCoords(t, u, a[1], b[1], A1_dot_B1, Tab[1] + bA1_dot_B0, Tba[1]);
658 D[0] = Tab[0] + Rab(0, 0) * b[0] + Rab(0, 1) * u;
659 D[1] = Tab[1] + Rab(1, 0) * b[0] + Rab(1, 1) * u - t;
660 D[2] = Tab[2] + Rab(2, 0) * b[0] + Rab(2, 1) * u;
674 if((LA1_lx < 0) && (LB1_lx < 0))
677 inVoronoi(b[1], a[1], -A1_dot_B0, Tba[0], A1_dot_B1,
681 inVoronoi(a[1], b[1], -A0_dot_B1, -Tab[0], A1_dot_B1,
684 segCoords(t, u, a[1], b[1], A1_dot_B1, Tab[1], Tba[1]);
686 D[0] = Tab[0] + Rab(0, 1) * u;
687 D[1] = Tab[1] + Rab(1, 1) * u - t;
688 D[2] = Tab[2] + Rab(2, 1) * u;
700 S ALL_y, ALU_y, AUL_y, AUU_y;
703 ALU_y = ALL_y + aA1_dot_B1;
704 AUL_y = ALL_y + aA0_dot_B1;
705 AUU_y = ALU_y + aA0_dot_B1;
707 S LA1_ly, LA1_uy, UA1_ly, UA1_uy, LB0_lx, LB0_ux, UB0_lx, UB0_ux;
741 if((UA1_uy > b[1]) && (UB0_ux > a[0]))
743 if(((UA1_ly > b[1]) ||
744 inVoronoi(b[0], a[1], A1_dot_B1, aA0_dot_B1 - Tba[1] - b[1],
745 A1_dot_B0, aA0_dot_B0 - Tba[0], -Tab[1] - bA1_dot_B1))
748 inVoronoi(a[1], b[0], A0_dot_B0, Tab[0] - a[0] + bA0_dot_B1,
749 A1_dot_B0, Tab[1] + bA1_dot_B1, Tba[0] - aA0_dot_B0)))
751 segCoords(t, u, a[1], b[0], A1_dot_B0, Tab[1] + bA1_dot_B1,
752 Tba[0] - aA0_dot_B0);
754 D[0] = Tab[0] + Rab(0, 1) * b[1] + Rab(0, 0) * u - a[0] ;
755 D[1] = Tab[1] + Rab(1, 1) * b[1] + Rab(1, 0) * u - t;
756 D[2] = Tab[2] + Rab(2, 1) * b[1] + Rab(2, 0) * u;
770 if((UA1_ly < 0) && (LB0_ux > a[0]))
773 inVoronoi(b[0], a[1], -A1_dot_B1, Tba[1] - aA0_dot_B1, A1_dot_B0,
774 aA0_dot_B0 - Tba[0], -Tab[1]))
777 inVoronoi(a[1], b[0], A0_dot_B0, Tab[0] - a[0],
778 A1_dot_B0, Tab[1], Tba[0] - aA0_dot_B0)))
780 segCoords(t, u, a[1], b[0], A1_dot_B0, Tab[1], Tba[0] - aA0_dot_B0);
782 D[0] = Tab[0] + Rab(0, 0) * u - a[0];
783 D[1] = Tab[1] + Rab(1, 0) * u - t;
784 D[2] = Tab[2] + Rab(2, 0) * u;
798 if((LA1_uy > b[1]) && (UB0_lx < 0))
800 if(((LA1_ly > b[1]) ||
801 inVoronoi(b[0], a[1], A1_dot_B1, -Tba[1] - b[1],
802 A1_dot_B0, -Tba[0], -Tab[1] - bA1_dot_B1))
806 inVoronoi(a[1], b[0], -A0_dot_B0, -Tab[0] - bA0_dot_B1, A1_dot_B0,
807 Tab[1] + bA1_dot_B1, Tba[0])))
809 segCoords(t, u, a[1], b[0], A1_dot_B0, Tab[1] + bA1_dot_B1, Tba[0]);
811 D[0] = Tab[0] + Rab(0, 1) * b[1] + Rab(0, 0) * u;
812 D[1] = Tab[1] + Rab(1, 1) * b[1] + Rab(1, 0) * u - t;
813 D[2] = Tab[2] + Rab(2, 1) * b[1] + Rab(2, 0) * u;
828 if((LA1_ly < 0) && (LB0_lx < 0))
831 inVoronoi(b[0], a[1], -A1_dot_B1, Tba[1], A1_dot_B0,
835 inVoronoi(a[1], b[0], -A0_dot_B0, -Tab[0], A1_dot_B0,
838 segCoords(t, u, a[1], b[0], A1_dot_B0, Tab[1], Tba[0]);
840 D[0] = Tab[0] + Rab(0, 0) * u;
841 D[1] = Tab[1] + Rab(1, 0) * u - t;
842 D[2] = Tab[2] + Rab(2, 0) * u;
854 S BLL_y, BLU_y, BUL_y, BUU_y;
857 BLU_y = BLL_y + bA1_dot_B1;
858 BUL_y = BLL_y + bA1_dot_B0;
859 BUU_y = BLU_y + bA1_dot_B0;
861 S LA0_lx, LA0_ux, UA0_lx, UA0_ux, LB1_ly, LB1_uy, UB1_ly, UB1_uy;
895 if((UA0_ux > b[0]) && (UB1_uy > a[1]))
897 if(((UA0_lx > b[0]) ||
898 inVoronoi(b[1], a[0], A0_dot_B0, aA1_dot_B0 - Tba[0] - b[0],
899 A0_dot_B1, aA1_dot_B1 - Tba[1], -Tab[0] - bA0_dot_B0))
902 inVoronoi(a[0], b[1], A1_dot_B1, Tab[1] - a[1] + bA1_dot_B0,
903 A0_dot_B1, Tab[0] + bA0_dot_B0, Tba[1] - aA1_dot_B1)))
905 segCoords(t, u, a[0], b[1], A0_dot_B1, Tab[0] + bA0_dot_B0,
906 Tba[1] - aA1_dot_B1);
908 D[0] = Tab[0] + Rab(0, 0) * b[0] + Rab(0, 1) * u - t;
909 D[1] = Tab[1] + Rab(1, 0) * b[0] + Rab(1, 1) * u - a[1];
910 D[2] = Tab[2] + Rab(2, 0) * b[0] + Rab(2, 1) * u;
924 if((UA0_lx < 0) && (LB1_uy > a[1]))
927 inVoronoi(b[1], a[0], -A0_dot_B0, Tba[0] - aA1_dot_B0, A0_dot_B1,
928 aA1_dot_B1 - Tba[1], -Tab[0]))
931 inVoronoi(a[0], b[1], A1_dot_B1, Tab[1] - a[1], A0_dot_B1, Tab[0],
932 Tba[1] - aA1_dot_B1)))
934 segCoords(t, u, a[0], b[1], A0_dot_B1, Tab[0], Tba[1] - aA1_dot_B1);
936 D[0] = Tab[0] + Rab(0, 1) * u - t;
937 D[1] = Tab[1] + Rab(1, 1) * u - a[1];
938 D[2] = Tab[2] + Rab(2, 1) * u;
952 if((LA0_ux > b[0]) && (UB1_ly < 0))
954 if(((LA0_lx > b[0]) ||
955 inVoronoi(b[1], a[0], A0_dot_B0, -b[0] - Tba[0], A0_dot_B1, -Tba[1],
956 -bA0_dot_B0 - Tab[0]))
959 inVoronoi(a[0], b[1], -A1_dot_B1, -Tab[1] - bA1_dot_B0, A0_dot_B1,
960 Tab[0] + bA0_dot_B0, Tba[1])))
962 segCoords(t, u, a[0], b[1], A0_dot_B1, Tab[0] + bA0_dot_B0, Tba[1]);
964 D[0] = Tab[0] + Rab(0, 0) * b[0] + Rab(0, 1) * u - t;
965 D[1] = Tab[1] + Rab(1, 0) * b[0] + Rab(1, 1) * u;
966 D[2] = Tab[2] + Rab(2, 0) * b[0] + Rab(2, 1) * u;
980 if((LA0_lx < 0) && (LB1_ly < 0))
983 inVoronoi(b[1], a[0], -A0_dot_B0, Tba[0], A0_dot_B1, -Tba[1],
987 inVoronoi(a[0], b[1], -A1_dot_B1, -Tab[1], A0_dot_B1,
990 segCoords(t, u, a[0], b[1], A0_dot_B1, Tab[0], Tba[1]);
992 D[0] = Tab[0] + Rab(0, 1) * u - t;
993 D[1] = Tab[1] + Rab(1, 1) * u;
994 D[2] = Tab[2] + Rab(2, 1) * u;
1006 S LA0_ly, LA0_uy, UA0_ly, UA0_uy, LB0_ly, LB0_uy, UB0_ly, UB0_uy;
1040 if((UA0_uy > b[1]) && (UB0_uy > a[1]))
1042 if(((UA0_ly > b[1]) ||
1043 inVoronoi(b[0], a[0], A0_dot_B1, aA1_dot_B1 - Tba[1] - b[1],
1044 A0_dot_B0, aA1_dot_B0 - Tba[0], -Tab[0] - bA0_dot_B1))
1047 inVoronoi(a[0], b[0], A1_dot_B0, Tab[1] - a[1] + bA1_dot_B1, A0_dot_B0,
1048 Tab[0] + bA0_dot_B1, Tba[0] - aA1_dot_B0)))
1050 segCoords(t, u, a[0], b[0], A0_dot_B0, Tab[0] + bA0_dot_B1,
1051 Tba[0] - aA1_dot_B0);
1053 D[0] = Tab[0] + Rab(0, 1) * b[1] + Rab(0, 0) * u - t;
1054 D[1] = Tab[1] + Rab(1, 1) * b[1] + Rab(1, 0) * u - a[1];
1055 D[2] = Tab[2] + Rab(2, 1) * b[1] + Rab(2, 0) * u;
1069 if((UA0_ly < 0) && (LB0_uy > a[1]))
1072 inVoronoi(b[0], a[0], -A0_dot_B1, Tba[1] - aA1_dot_B1, A0_dot_B0,
1073 aA1_dot_B0 - Tba[0], -Tab[0]))
1076 inVoronoi(a[0], b[0], A1_dot_B0, Tab[1] - a[1],
1077 A0_dot_B0, Tab[0], Tba[0] - aA1_dot_B0)))
1079 segCoords(t, u, a[0], b[0], A0_dot_B0, Tab[0], Tba[0] - aA1_dot_B0);
1081 D[0] = Tab[0] + Rab(0, 0) * u - t;
1082 D[1] = Tab[1] + Rab(1, 0) * u - a[1];
1083 D[2] = Tab[2] + Rab(2, 0) * u;
1097 if((LA0_uy > b[1]) && (UB0_ly < 0))
1099 if(((LA0_ly > b[1]) ||
1100 inVoronoi(b[0], a[0], A0_dot_B1, -Tba[1] - b[1], A0_dot_B0, -Tba[0],
1101 -Tab[0] - bA0_dot_B1))
1105 inVoronoi(a[0], b[0], -A1_dot_B0, -Tab[1] - bA1_dot_B1, A0_dot_B0,
1106 Tab[0] + bA0_dot_B1, Tba[0])))
1108 segCoords(t, u, a[0], b[0], A0_dot_B0, Tab[0] + bA0_dot_B1, Tba[0]);
1110 D[0] = Tab[0] + Rab(0, 1) * b[1] + Rab(0, 0) * u - t;
1111 D[1] = Tab[1] + Rab(1, 1) * b[1] + Rab(1, 0) * u;
1112 D[2] = Tab[2] + Rab(2, 1) * b[1] + Rab(2, 0) * u;
1126 if((LA0_ly < 0) && (LB0_ly < 0))
1129 inVoronoi(b[0], a[0], -A0_dot_B1, Tba[1], A0_dot_B0,
1133 inVoronoi(a[0], b[0], -A1_dot_B0, -Tab[1], A0_dot_B0,
1136 segCoords(t, u, a[0], b[0], A0_dot_B0, Tab[0], Tba[0]);
1138 D[0] = Tab[0] + Rab(0, 0) * u - t;
1139 D[1] = Tab[1] + Rab(1, 0) * u;
1140 D[2] = Tab[2] + Rab(2, 0) * u;
1159 if (Rab(2, 0) < 0.0) sep1 += b[0] * Rab(2, 0);
1160 if (Rab(2, 1) < 0.0) sep1 += b[1] * Rab(2, 1);
1165 if (Rab(2, 0) > 0.0) sep1 -= b[0] * Rab(2, 0);
1166 if (Rab(2, 1) > 0.0) sep1 -= b[1] * Rab(2, 1);
1172 if (Rab(0, 2) < 0.0) sep2 += a[0] * Rab(0, 2);
1173 if (Rab(1, 2) < 0.0) sep2 += a[1] * Rab(1, 2);
1178 if (Rab(0, 2) > 0.0) sep2 -= a[0] * Rab(0, 2);
1179 if (Rab(1, 2) > 0.0) sep2 -= a[1] * Rab(1, 2);
1182 if(sep1 >= sep2 && sep1 >= 0)
1196 if(sep2 >= sep1 && sep2 >= 0)
1202 P_[0] = Rab(0, 2) * sep2 + Tab[0];
1203 P_[1] = Rab(1, 2) * sep2 + Tab[1];
1204 P_[2] = Rab(2, 2) * sep2 + Tab[2];
1208 P_[0] = -Rab(0, 2) * sep2 + Tab[0];
1209 P_[1] = -Rab(1, 2) * sep2 + Tab[1];
1210 P_[2] = -Rab(2, 2) * sep2 + Tab[2];
1222 S sep = (sep1 > sep2 ? sep1 : sep2);
1223 return (sep > 0 ? sep : 0);
1227 template <
typename S>
1235 S A0_dot_B0 = tfab.linear()(0, 0);
1236 S A0_dot_B1 = tfab.linear()(0, 1);
1237 S A1_dot_B0 = tfab.linear()(1, 0);
1238 S A1_dot_B1 = tfab.linear()(1, 1);
1240 S aA0_dot_B0 = a[0] * A0_dot_B0;
1241 S aA0_dot_B1 = a[0] * A0_dot_B1;
1242 S aA1_dot_B0 = a[1] * A1_dot_B0;
1243 S aA1_dot_B1 = a[1] * A1_dot_B1;
1244 S bA0_dot_B0 = b[0] * A0_dot_B0;
1245 S bA1_dot_B0 = b[0] * A1_dot_B0;
1246 S bA0_dot_B1 = b[1] * A0_dot_B1;
1247 S bA1_dot_B1 = b[1] * A1_dot_B1;
1249 Vector3<S> Tba = tfab.linear().transpose() * tfab.translation();
1256 S LA1_lx, LA1_ux, UA1_lx, UA1_ux, LB1_lx, LB1_ux, UB1_lx, UB1_ux;
1259 S ALU_x = ALL_x + aA1_dot_B0;
1260 S AUL_x = ALL_x + aA0_dot_B0;
1261 S AUU_x = ALU_x + aA0_dot_B0;
1278 S BLL_x = tfab.translation()[0];
1279 S BLU_x = BLL_x + bA0_dot_B1;
1280 S BUL_x = BLL_x + bA0_dot_B0;
1281 S BUU_x = BLU_x + bA0_dot_B0;
1300 if((UA1_ux > b[0]) && (UB1_ux > a[0]))
1302 if(((UA1_lx > b[0]) ||
1303 inVoronoi(b[1], a[1], A1_dot_B0, aA0_dot_B0 - b[0] - Tba[0],
1304 A1_dot_B1, aA0_dot_B1 - Tba[1],
1305 -tfab.translation()[1] - bA1_dot_B0))
1308 inVoronoi(a[1], b[1], A0_dot_B1, tfab.translation()[0] + bA0_dot_B0 - a[0],
1309 A1_dot_B1, tfab.translation()[1] + bA1_dot_B0, Tba[1] - aA0_dot_B1)))
1311 segCoords(t, u, a[1], b[1], A1_dot_B1, tfab.translation()[1] + bA1_dot_B0,
1312 Tba[1] - aA0_dot_B1);
1314 D[0] = tfab.translation()[0] + tfab.linear()(0, 0) * b[0] + tfab.linear()(0, 1) * u - a[0] ;
1315 D[1] = tfab.translation()[1] + tfab.linear()(1, 0) * b[0] + tfab.linear()(1, 1) * u - t;
1316 D[2] = tfab.translation()[2] + tfab.linear()(2, 0) * b[0] + tfab.linear()(2, 1) * u;
1331 if((UA1_lx < 0) && (LB1_ux > a[0]))
1334 inVoronoi(b[1], a[1], -A1_dot_B0, Tba[0] - aA0_dot_B0,
1335 A1_dot_B1, aA0_dot_B1 - Tba[1], -tfab.translation()[1]))
1338 inVoronoi(a[1], b[1], A0_dot_B1, tfab.translation()[0] - a[0],
1339 A1_dot_B1, tfab.translation()[1], Tba[1] - aA0_dot_B1)))
1341 segCoords(t, u, a[1], b[1], A1_dot_B1, tfab.translation()[1], Tba[1] - aA0_dot_B1);
1343 D[0] = tfab.translation()[0] + tfab.linear()(0, 1) * u - a[0];
1344 D[1] = tfab.translation()[1] + tfab.linear()(1, 1) * u - t;
1345 D[2] = tfab.translation()[2] + tfab.linear()(2, 1) * u;
1359 if((LA1_ux > b[0]) && (UB1_lx < 0))
1361 if(((LA1_lx > b[0]) ||
1362 inVoronoi(b[1], a[1], A1_dot_B0, -Tba[0] - b[0],
1363 A1_dot_B1, -Tba[1], -tfab.translation()[1] - bA1_dot_B0))
1366 inVoronoi(a[1], b[1], -A0_dot_B1, -tfab.translation()[0] - bA0_dot_B0,
1367 A1_dot_B1, tfab.translation()[1] + bA1_dot_B0, Tba[1])))
1369 segCoords(t, u, a[1], b[1], A1_dot_B1, tfab.translation()[1] + bA1_dot_B0, Tba[1]);
1371 D[0] = tfab.translation()[0] + tfab.linear()(0, 0) * b[0] + tfab.linear()(0, 1) * u;
1372 D[1] = tfab.translation()[1] + tfab.linear()(1, 0) * b[0] + tfab.linear()(1, 1) * u - t;
1373 D[2] = tfab.translation()[2] + tfab.linear()(2, 0) * b[0] + tfab.linear()(2, 1) * u;
1387 if((LA1_lx < 0) && (LB1_lx < 0))
1389 if (((LA1_ux < 0) ||
1390 inVoronoi(b[1], a[1], -A1_dot_B0, Tba[0], A1_dot_B1,
1391 -Tba[1], -tfab.translation()[1]))
1394 inVoronoi(a[1], b[1], -A0_dot_B1, -tfab.translation()[0], A1_dot_B1,
1395 tfab.translation()[1], Tba[1])))
1397 segCoords(t, u, a[1], b[1], A1_dot_B1, tfab.translation()[1], Tba[1]);
1399 D[0] = tfab.translation()[0] + tfab.linear()(0, 1) * u;
1400 D[1] = tfab.translation()[1] + tfab.linear()(1, 1) * u - t;
1401 D[2] = tfab.translation()[2] + tfab.linear()(2, 1) * u;
1413 S ALL_y, ALU_y, AUL_y, AUU_y;
1416 ALU_y = ALL_y + aA1_dot_B1;
1417 AUL_y = ALL_y + aA0_dot_B1;
1418 AUU_y = ALU_y + aA0_dot_B1;
1420 S LA1_ly, LA1_uy, UA1_ly, UA1_uy, LB0_lx, LB0_ux, UB0_lx, UB0_ux;
1454 if((UA1_uy > b[1]) && (UB0_ux > a[0]))
1456 if(((UA1_ly > b[1]) ||
1457 inVoronoi(b[0], a[1], A1_dot_B1, aA0_dot_B1 - Tba[1] - b[1],
1458 A1_dot_B0, aA0_dot_B0 - Tba[0], -tfab.translation()[1] - bA1_dot_B1))
1461 inVoronoi(a[1], b[0], A0_dot_B0, tfab.translation()[0] - a[0] + bA0_dot_B1,
1462 A1_dot_B0, tfab.translation()[1] + bA1_dot_B1, Tba[0] - aA0_dot_B0)))
1464 segCoords(t, u, a[1], b[0], A1_dot_B0, tfab.translation()[1] + bA1_dot_B1,
1465 Tba[0] - aA0_dot_B0);
1467 D[0] = tfab.translation()[0] + tfab.linear()(0, 1) * b[1] + tfab.linear()(0, 0) * u - a[0] ;
1468 D[1] = tfab.translation()[1] + tfab.linear()(1, 1) * b[1] + tfab.linear()(1, 0) * u - t;
1469 D[2] = tfab.translation()[2] + tfab.linear()(2, 1) * b[1] + tfab.linear()(2, 0) * u;
1483 if((UA1_ly < 0) && (LB0_ux > a[0]))
1486 inVoronoi(b[0], a[1], -A1_dot_B1, Tba[1] - aA0_dot_B1, A1_dot_B0,
1487 aA0_dot_B0 - Tba[0], -tfab.translation()[1]))
1490 inVoronoi(a[1], b[0], A0_dot_B0, tfab.translation()[0] - a[0],
1491 A1_dot_B0, tfab.translation()[1], Tba[0] - aA0_dot_B0)))
1493 segCoords(t, u, a[1], b[0], A1_dot_B0, tfab.translation()[1], Tba[0] - aA0_dot_B0);
1495 D[0] = tfab.translation()[0] + tfab.linear()(0, 0) * u - a[0];
1496 D[1] = tfab.translation()[1] + tfab.linear()(1, 0) * u - t;
1497 D[2] = tfab.translation()[2] + tfab.linear()(2, 0) * u;
1511 if((LA1_uy > b[1]) && (UB0_lx < 0))
1513 if(((LA1_ly > b[1]) ||
1514 inVoronoi(b[0], a[1], A1_dot_B1, -Tba[1] - b[1],
1515 A1_dot_B0, -Tba[0], -tfab.translation()[1] - bA1_dot_B1))
1519 inVoronoi(a[1], b[0], -A0_dot_B0, -tfab.translation()[0] - bA0_dot_B1, A1_dot_B0,
1520 tfab.translation()[1] + bA1_dot_B1, Tba[0])))
1522 segCoords(t, u, a[1], b[0], A1_dot_B0, tfab.translation()[1] + bA1_dot_B1, Tba[0]);
1524 D[0] = tfab.translation()[0] + tfab.linear()(0, 1) * b[1] + tfab.linear()(0, 0) * u;
1525 D[1] = tfab.translation()[1] + tfab.linear()(1, 1) * b[1] + tfab.linear()(1, 0) * u - t;
1526 D[2] = tfab.translation()[2] + tfab.linear()(2, 1) * b[1] + tfab.linear()(2, 0) * u;
1541 if((LA1_ly < 0) && (LB0_lx < 0))
1544 inVoronoi(b[0], a[1], -A1_dot_B1, Tba[1], A1_dot_B0,
1545 -Tba[0], -tfab.translation()[1]))
1548 inVoronoi(a[1], b[0], -A0_dot_B0, -tfab.translation()[0], A1_dot_B0,
1549 tfab.translation()[1], Tba[0])))
1551 segCoords(t, u, a[1], b[0], A1_dot_B0, tfab.translation()[1], Tba[0]);
1553 D[0] = tfab.translation()[0] + tfab.linear()(0, 0) * u;
1554 D[1] = tfab.translation()[1] + tfab.linear()(1, 0) * u - t;
1555 D[2] = tfab.translation()[2] + tfab.linear()(2, 0) * u;
1567 S BLL_y, BLU_y, BUL_y, BUU_y;
1569 BLL_y = tfab.translation()[1];
1570 BLU_y = BLL_y + bA1_dot_B1;
1571 BUL_y = BLL_y + bA1_dot_B0;
1572 BUU_y = BLU_y + bA1_dot_B0;
1574 S LA0_lx, LA0_ux, UA0_lx, UA0_ux, LB1_ly, LB1_uy, UB1_ly, UB1_uy;
1608 if((UA0_ux > b[0]) && (UB1_uy > a[1]))
1610 if(((UA0_lx > b[0]) ||
1611 inVoronoi(b[1], a[0], A0_dot_B0, aA1_dot_B0 - Tba[0] - b[0],
1612 A0_dot_B1, aA1_dot_B1 - Tba[1], -tfab.translation()[0] - bA0_dot_B0))
1615 inVoronoi(a[0], b[1], A1_dot_B1, tfab.translation()[1] - a[1] + bA1_dot_B0,
1616 A0_dot_B1, tfab.translation()[0] + bA0_dot_B0, Tba[1] - aA1_dot_B1)))
1618 segCoords(t, u, a[0], b[1], A0_dot_B1, tfab.translation()[0] + bA0_dot_B0,
1619 Tba[1] - aA1_dot_B1);
1621 D[0] = tfab.translation()[0] + tfab.linear()(0, 0) * b[0] + tfab.linear()(0, 1) * u - t;
1622 D[1] = tfab.translation()[1] + tfab.linear()(1, 0) * b[0] + tfab.linear()(1, 1) * u - a[1];
1623 D[2] = tfab.translation()[2] + tfab.linear()(2, 0) * b[0] + tfab.linear()(2, 1) * u;
1637 if((UA0_lx < 0) && (LB1_uy > a[1]))
1640 inVoronoi(b[1], a[0], -A0_dot_B0, Tba[0] - aA1_dot_B0, A0_dot_B1,
1641 aA1_dot_B1 - Tba[1], -tfab.translation()[0]))
1644 inVoronoi(a[0], b[1], A1_dot_B1, tfab.translation()[1] - a[1], A0_dot_B1, tfab.translation()[0],
1645 Tba[1] - aA1_dot_B1)))
1647 segCoords(t, u, a[0], b[1], A0_dot_B1, tfab.translation()[0], Tba[1] - aA1_dot_B1);
1649 D[0] = tfab.translation()[0] + tfab.linear()(0, 1) * u - t;
1650 D[1] = tfab.translation()[1] + tfab.linear()(1, 1) * u - a[1];
1651 D[2] = tfab.translation()[2] + tfab.linear()(2, 1) * u;
1665 if((LA0_ux > b[0]) && (UB1_ly < 0))
1667 if(((LA0_lx > b[0]) ||
1668 inVoronoi(b[1], a[0], A0_dot_B0, -b[0] - Tba[0], A0_dot_B1, -Tba[1],
1669 -bA0_dot_B0 - tfab.translation()[0]))
1672 inVoronoi(a[0], b[1], -A1_dot_B1, -tfab.translation()[1] - bA1_dot_B0, A0_dot_B1,
1673 tfab.translation()[0] + bA0_dot_B0, Tba[1])))
1675 segCoords(t, u, a[0], b[1], A0_dot_B1, tfab.translation()[0] + bA0_dot_B0, Tba[1]);
1677 D[0] = tfab.translation()[0] + tfab.linear()(0, 0) * b[0] + tfab.linear()(0, 1) * u - t;
1678 D[1] = tfab.translation()[1] + tfab.linear()(1, 0) * b[0] + tfab.linear()(1, 1) * u;
1679 D[2] = tfab.translation()[2] + tfab.linear()(2, 0) * b[0] + tfab.linear()(2, 1) * u;
1693 if((LA0_lx < 0) && (LB1_ly < 0))
1696 inVoronoi(b[1], a[0], -A0_dot_B0, Tba[0], A0_dot_B1, -Tba[1],
1697 -tfab.translation()[0]))
1700 inVoronoi(a[0], b[1], -A1_dot_B1, -tfab.translation()[1], A0_dot_B1,
1701 tfab.translation()[0], Tba[1])))
1703 segCoords(t, u, a[0], b[1], A0_dot_B1, tfab.translation()[0], Tba[1]);
1705 D[0] = tfab.translation()[0] + tfab.linear()(0, 1) * u - t;
1706 D[1] = tfab.translation()[1] + tfab.linear()(1, 1) * u;
1707 D[2] = tfab.translation()[2] + tfab.linear()(2, 1) * u;
1719 S LA0_ly, LA0_uy, UA0_ly, UA0_uy, LB0_ly, LB0_uy, UB0_ly, UB0_uy;
1753 if((UA0_uy > b[1]) && (UB0_uy > a[1]))
1755 if(((UA0_ly > b[1]) ||
1756 inVoronoi(b[0], a[0], A0_dot_B1, aA1_dot_B1 - Tba[1] - b[1],
1757 A0_dot_B0, aA1_dot_B0 - Tba[0], -tfab.translation()[0] - bA0_dot_B1))
1760 inVoronoi(a[0], b[0], A1_dot_B0, tfab.translation()[1] - a[1] + bA1_dot_B1, A0_dot_B0,
1761 tfab.translation()[0] + bA0_dot_B1, Tba[0] - aA1_dot_B0)))
1763 segCoords(t, u, a[0], b[0], A0_dot_B0, tfab.translation()[0] + bA0_dot_B1,
1764 Tba[0] - aA1_dot_B0);
1766 D[0] = tfab.translation()[0] + tfab.linear()(0, 1) * b[1] + tfab.linear()(0, 0) * u - t;
1767 D[1] = tfab.translation()[1] + tfab.linear()(1, 1) * b[1] + tfab.linear()(1, 0) * u - a[1];
1768 D[2] = tfab.translation()[2] + tfab.linear()(2, 1) * b[1] + tfab.linear()(2, 0) * u;
1782 if((UA0_ly < 0) && (LB0_uy > a[1]))
1785 inVoronoi(b[0], a[0], -A0_dot_B1, Tba[1] - aA1_dot_B1, A0_dot_B0,
1786 aA1_dot_B0 - Tba[0], -tfab.translation()[0]))
1789 inVoronoi(a[0], b[0], A1_dot_B0, tfab.translation()[1] - a[1],
1790 A0_dot_B0, tfab.translation()[0], Tba[0] - aA1_dot_B0)))
1792 segCoords(t, u, a[0], b[0], A0_dot_B0, tfab.translation()[0], Tba[0] - aA1_dot_B0);
1794 D[0] = tfab.translation()[0] + tfab.linear()(0, 0) * u - t;
1795 D[1] = tfab.translation()[1] + tfab.linear()(1, 0) * u - a[1];
1796 D[2] = tfab.translation()[2] + tfab.linear()(2, 0) * u;
1810 if((LA0_uy > b[1]) && (UB0_ly < 0))
1812 if(((LA0_ly > b[1]) ||
1813 inVoronoi(b[0], a[0], A0_dot_B1, -Tba[1] - b[1], A0_dot_B0, -Tba[0],
1814 -tfab.translation()[0] - bA0_dot_B1))
1818 inVoronoi(a[0], b[0], -A1_dot_B0, -tfab.translation()[1] - bA1_dot_B1, A0_dot_B0,
1819 tfab.translation()[0] + bA0_dot_B1, Tba[0])))
1821 segCoords(t, u, a[0], b[0], A0_dot_B0, tfab.translation()[0] + bA0_dot_B1, Tba[0]);
1823 D[0] = tfab.translation()[0] + tfab.linear()(0, 1) * b[1] + tfab.linear()(0, 0) * u - t;
1824 D[1] = tfab.translation()[1] + tfab.linear()(1, 1) * b[1] + tfab.linear()(1, 0) * u;
1825 D[2] = tfab.translation()[2] + tfab.linear()(2, 1) * b[1] + tfab.linear()(2, 0) * u;
1839 if((LA0_ly < 0) && (LB0_ly < 0))
1842 inVoronoi(b[0], a[0], -A0_dot_B1, Tba[1], A0_dot_B0,
1843 -Tba[0], -tfab.translation()[0]))
1846 inVoronoi(a[0], b[0], -A1_dot_B0, -tfab.translation()[1], A0_dot_B0,
1847 tfab.translation()[0], Tba[0])))
1849 segCoords(t, u, a[0], b[0], A0_dot_B0, tfab.translation()[0], Tba[0]);
1851 D[0] = tfab.translation()[0] + tfab.linear()(0, 0) * u - t;
1852 D[1] = tfab.translation()[1] + tfab.linear()(1, 0) * u;
1853 D[2] = tfab.translation()[2] + tfab.linear()(2, 0) * u;
1869 if(tfab.translation()[2] > 0.0)
1871 sep1 = tfab.translation()[2];
1872 if (tfab.linear()(2, 0) < 0.0) sep1 += b[0] * tfab.linear()(2, 0);
1873 if (tfab.linear()(2, 1) < 0.0) sep1 += b[1] * tfab.linear()(2, 1);
1877 sep1 = -tfab.translation()[2];
1878 if (tfab.linear()(2, 0) > 0.0) sep1 -= b[0] * tfab.linear()(2, 0);
1879 if (tfab.linear()(2, 1) > 0.0) sep1 -= b[1] * tfab.linear()(2, 1);
1885 if (tfab.linear()(0, 2) < 0.0) sep2 += a[0] * tfab.linear()(0, 2);
1886 if (tfab.linear()(1, 2) < 0.0) sep2 += a[1] * tfab.linear()(1, 2);
1891 if (tfab.linear()(0, 2) > 0.0) sep2 -= a[0] * tfab.linear()(0, 2);
1892 if (tfab.linear()(1, 2) > 0.0) sep2 -= a[1] * tfab.linear()(1, 2);
1895 if(sep1 >= sep2 && sep1 >= 0)
1897 if(tfab.translation()[2] > 0)
1909 if(sep2 >= sep1 && sep2 >= 0)
1915 P_.noalias() = tfab.linear().col(2) * sep2;
1916 P_.noalias() += tfab.translation();
1920 P_.noalias() = tfab.linear().col(2) * -sep2;
1921 P_.noalias() += tfab.translation();
1933 S sep = (sep1 > sep2 ? sep1 : sep2);
1934 return (sep > 0 ? sep : 0);
1938 template <
typename S,
typename DerivedA,
typename DerivedB>
1940 const Eigen::MatrixBase<DerivedA>& R0,
1941 const Eigen::MatrixBase<DerivedB>& T0,
1952 return (dist <= (b1.
r + b2.
r));
1956 template <
typename S,
typename DerivedA,
typename DerivedB>
1958 const Eigen::MatrixBase<DerivedA>& R0,
1959 const Eigen::MatrixBase<DerivedB>& T0,
1972 dist -= (b1.
r + b2.
r);
1973 return (dist < (S)0.0) ? (S)0.0 : dist;
1977 template <
typename S>
void segCoords(S &t, S &u, S a, S b, S A_dot_B, S A_dot_T, S B_dot_T)
Finds the parameters t & u corresponding to the two closest points on a pair of line segments. The first segment is defined as Pa + A*t, 0 <= t <= a, where "Pa" is one endpoint of the segment, "A" is a unit vector pointing to the other endpoint, and t is a scalar that produces all the points between the two endpoints. Since "A" is a unit vector, "a" is the segment's length. The second segment is defined as Pb + B*u, 0 <= u <= b. Many of the terms needed by the algorithm are already computed for other purposes,so we just pass these terms into the function instead of complete specifications of each segment. "T" in the dot products is the vector betweeen Pa and Pb. Reference: "On fast computation of distance between line segments." Vladimir J. Lumelsky, in Information Processing Letters, no. 21, pages 55-61, 1985.
RSS< S > translate(const RSS< S > &bv, const Vector3< S > &t)
Translate the RSS bv.
template void clipToRange(double &val, double a, double b)
template double rectDistance(const Matrix3< double > &Rab, const Vector3< double > &Tab, const double a[2], const double b[2], Vector3< double > *P, Vector3< double > *Q)
template TMatrix3< double > operator+(const Matrix3< double > &m1, const TMatrix3< double > &m2)
template class FCL_EXPORT RSS< double >
Eigen::Transform< S, 3, Eigen::Isometry > Transform3
AABB< S > translate(const AABB< S > &aabb, const Eigen::MatrixBase< Derived > &t)
translate the center of AABB by t
Eigen::Matrix< S, 3, 3 > Matrix3
Eigen::Matrix< S, 3, 1 > Vector3
void clipToRange(S &val, S a, S b)
Clip value between a and b.
S rectDistance(const Transform3< S > &tfab, const S a[2], const S b[2], Vector3< S > *P, Vector3< S > *Q)
Distance between two oriented rectangles; P and Q (optional return values) are the closest points in ...
bool inVoronoi(S a, S b, S Anorm_dot_B, S Anorm_dot_T, S A_dot_B, S A_dot_T, S B_dot_T)
Returns whether the nearest point on rectangle edge Pb + B*u, 0 <= u <= b, to the rectangle edge...
template void eigen_old(const Matrix3d &m, Vector3d &dout, Matrix3d &vout)
S distance(const Eigen::MatrixBase< DerivedA > &R0, const Eigen::MatrixBase< DerivedB > &T0, const RSS< S > &b1, const RSS< S > &b2, Vector3< S > *P, Vector3< S > *Q)
distance between two RSS bounding volumes P and Q (optional return values) are the closest points in ...
template bool inVoronoi(double a, double b, double Anorm_dot_B, double Anorm_dot_T, double A_dot_B, double A_dot_T, double B_dot_T)
bool overlap(const Eigen::MatrixBase< DerivedA > &R0, const Eigen::MatrixBase< DerivedB > &T0, const RSS< S > &b1, const RSS< S > &b2)
Check collision between two RSSs, b1 is in configuration (R0, T0) and b2 is in identity.
template void segCoords(double &t, double &u, double a, double b, double A_dot_B, double A_dot_T, double B_dot_T)