@@ -2084,21 +2084,41 @@ BOOST_AUTO_TEST_CASE(shapeIntersection_planecylinder) {
2084
2084
Vec3f normal ;
2085
2085
Vec3f p1, p2;
2086
2086
2087
- tf1 = Transform3f ();
2087
+ FCL_REAL eps = 1e-6 ;
2088
+ tf1 = Transform3f (Vec3f (eps, 0 , 0 ));
2088
2089
tf2 = Transform3f ();
2089
- p1 << -5 , 0 , 0 ;
2090
+ p1 << -5 + eps , 0 , 0 ;
2090
2091
p2 << 0 , 0 , 0 ;
2091
2092
contact << (p1 + p2) / 2 ;
2092
- depth = -5 ;
2093
+ depth = -5 + eps ;
2093
2094
normal << -1 , 0 , 0 ; // (1, 0, 0) or (-1, 0, 0)
2094
2095
SET_LINE;
2095
2096
testShapeIntersection (s, tf1, hs, tf2, true , &contact, &depth, &normal , true );
2096
2097
2097
- tf1 = transform;
2098
+ tf1 = transform * tf1 ;
2098
2099
tf2 = transform;
2099
- p1 << 5 , 0 , 0 ;
2100
2100
contact = transform.transform ((p1 + p2) / 2 );
2101
- depth = -5 ;
2101
+ depth = -5 + eps;
2102
+ normal =
2103
+ transform.getRotation () * Vec3f (-1 , 0 , 0 ); // (1, 0, 0) or (-1, 0, 0)
2104
+ SET_LINE;
2105
+ testShapeIntersection (s, tf1, hs, tf2, true , &contact, &depth, &normal , true );
2106
+
2107
+ eps = -1e-6 ;
2108
+ tf1 = Transform3f (Vec3f (eps, 0 , 0 ));
2109
+ tf2 = Transform3f ();
2110
+ p1 << 5 + eps, 0 , 0 ;
2111
+ p2 << 0 , 0 , 0 ;
2112
+ contact << (p1 + p2) / 2 ;
2113
+ depth = -5 - eps;
2114
+ normal << -1 , 0 , 0 ; // (1, 0, 0) or (-1, 0, 0)
2115
+ SET_LINE;
2116
+ testShapeIntersection (s, tf1, hs, tf2, true , &contact, &depth, &normal , true );
2117
+
2118
+ tf1 = transform * tf1;
2119
+ tf2 = transform;
2120
+ contact = transform.transform ((p1 + p2) / 2 );
2121
+ depth = -5 - eps;
2102
2122
normal =
2103
2123
transform.getRotation () * Vec3f (-1 , 0 , 0 ); // (1, 0, 0) or (-1, 0, 0)
2104
2124
SET_LINE;
@@ -2162,21 +2182,40 @@ BOOST_AUTO_TEST_CASE(shapeIntersection_planecylinder) {
2162
2182
2163
2183
hs = Plane (Vec3f (0 , 1 , 0 ), 0 );
2164
2184
2165
- tf1 = Transform3f ();
2185
+ eps = 1e-6 ;
2186
+ tf1 = Transform3f (Vec3f (0 , eps, 0 ));
2166
2187
tf2 = Transform3f ();
2167
- p1 << 0 , -5 , 0 ;
2188
+ p1 << 0 , -5 + eps , 0 ;
2168
2189
p2 << 0 , 0 , 0 ;
2169
2190
contact << (p1 + p2) / 2 ;
2170
- depth = -5 ;
2191
+ depth = -5 + eps ;
2171
2192
normal << 0 , 1 , 0 ; // (1, 0, 0) or (-1, 0, 0)
2172
2193
SET_LINE;
2173
2194
testShapeIntersection (s, tf1, hs, tf2, true , &contact, &depth, &normal , true );
2174
2195
2175
- tf1 = transform;
2196
+ tf1 = transform * tf1 ;
2176
2197
tf2 = transform;
2177
- p1 << 0 , 5 , 0 ;
2178
2198
contact = transform.transform ((p1 + p2) / 2 );
2179
- depth = -5 ;
2199
+ depth = -5 + eps;
2200
+ normal = transform.getRotation () * Vec3f (0 , 1 , 0 ); // (1, 0, 0) or (-1, 0, 0)
2201
+ SET_LINE;
2202
+ testShapeIntersection (s, tf1, hs, tf2, true , &contact, &depth, &normal , true );
2203
+
2204
+ eps = -1e-6 ;
2205
+ tf1 = Transform3f (Vec3f (0 , eps, 0 ));
2206
+ tf2 = Transform3f ();
2207
+ p1 << 0 , 5 + eps, 0 ;
2208
+ p2 << 0 , 0 , 0 ;
2209
+ contact << (p1 + p2) / 2 ;
2210
+ depth = -5 - eps;
2211
+ normal << 0 , 1 , 0 ; // (1, 0, 0) or (-1, 0, 0)
2212
+ SET_LINE;
2213
+ testShapeIntersection (s, tf1, hs, tf2, true , &contact, &depth, &normal , true );
2214
+
2215
+ tf1 = transform * tf1;
2216
+ tf2 = transform;
2217
+ contact = transform.transform ((p1 + p2) / 2 );
2218
+ depth = -5 - eps;
2180
2219
normal = transform.getRotation () * Vec3f (0 , 1 , 0 ); // (1, 0, 0) or (-1, 0, 0)
2181
2220
SET_LINE;
2182
2221
testShapeIntersection (s, tf1, hs, tf2, true , &contact, &depth, &normal , true );
@@ -2239,20 +2278,40 @@ BOOST_AUTO_TEST_CASE(shapeIntersection_planecylinder) {
2239
2278
2240
2279
hs = Plane (Vec3f (0 , 0 , 1 ), 0 );
2241
2280
2242
- tf1 = Transform3f ();
2281
+ eps = 1e-6 ;
2282
+ tf1 = Transform3f (Vec3f (0 , 0 , eps));
2243
2283
tf2 = Transform3f ();
2244
- p1 << 0 , 0 , 5 ;
2284
+ p1 << 0 , 0 , - 5 + eps ;
2245
2285
p2 << 0 , 0 , 0 ;
2246
2286
contact << (p1 + p2) / 2 ;
2247
- depth = -5 ;
2287
+ depth = -5 + eps ;
2248
2288
normal << 0 , 0 , 1 ; // (1, 0, 0) or (-1, 0, 0)
2249
2289
SET_LINE;
2250
2290
testShapeIntersection (s, tf1, hs, tf2, true , &contact, &depth, &normal , true );
2251
2291
2252
- tf1 = transform;
2292
+ tf1 = transform * tf1 ;
2253
2293
tf2 = transform;
2254
2294
contact = transform.transform ((p1 + p2) / 2 );
2255
- depth = -5 ;
2295
+ depth = -5 + eps;
2296
+ normal = transform.getRotation () * Vec3f (0 , 0 , 1 ); // (1, 0, 0) or (-1, 0, 0)
2297
+ SET_LINE;
2298
+ testShapeIntersection (s, tf1, hs, tf2, true , &contact, &depth, &normal , true );
2299
+
2300
+ eps = -1e-6 ;
2301
+ tf1 = Transform3f (Vec3f (0 , 0 , eps));
2302
+ tf2 = Transform3f ();
2303
+ p1 << 0 , 0 , 5 + eps;
2304
+ p2 << 0 , 0 , 0 ;
2305
+ contact << (p1 + p2) / 2 ;
2306
+ depth = -5 - eps;
2307
+ normal << 0 , 0 , 1 ; // (1, 0, 0) or (-1, 0, 0)
2308
+ SET_LINE;
2309
+ testShapeIntersection (s, tf1, hs, tf2, true , &contact, &depth, &normal , true );
2310
+
2311
+ tf1 = transform * tf1;
2312
+ tf2 = transform;
2313
+ contact = transform.transform ((p1 + p2) / 2 );
2314
+ depth = -5 - eps;
2256
2315
normal = transform.getRotation () * Vec3f (0 , 0 , 1 ); // (1, 0, 0) or (-1, 0, 0)
2257
2316
SET_LINE;
2258
2317
testShapeIntersection (s, tf1, hs, tf2, true , &contact, &depth, &normal , true );
0 commit comments