Skip to content

Commit 39c020b

Browse files
committed
Little changes to error messages
1 parent cecf559 commit 39c020b

File tree

1 file changed

+10
-10
lines changed
  • src/contactDetection/ContactDetectionMPR

1 file changed

+10
-10
lines changed

src/contactDetection/ContactDetectionMPR/mpr.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ end
6767
# belongs to construction of r0
6868
function checkCentersOfShapesOverlapp(r0::SupportPoint, neps::Float64, shapeA::Composition.Object3D, shapeB::Composition.Object3D)
6969
if norm(r0.p) <= neps
70-
error("MPR: Too large penetration (prerequisite of MPR violated). Centers are overlapping. Look at shapeA = ", shapeA, " shapeB = ", shapeB)
70+
error("MPR: Too large penetration (prerequisite of MPR violated). Centers are overlapping. Look at $(Modia3D.fullName(shapeA)) and $(Modia3D.fullName(shapeB)).")
7171
end
7272
end
7373

@@ -86,7 +86,7 @@ function checkIfShapesArePlanar(r0::SupportPoint,r1::SupportPoint,r2::SupportPoi
8686
# Shape is purely planar. Computing the shortest distance for a planar shape
8787
# requires an MPR 2D algorithm (using lines instead of triangles as portals).
8888
# However, this is not implemented and therefore the shortest distance cannot be computed
89-
error("MPR: Shapes are planar and MPR2D is not supported. abs(dot((r2.p-r1.p),n2)). Look at shapeA = ", shapeA, " shapeB = ", shapeB)
89+
error("MPR: Shapes are planar and MPR2D is not supported. abs(dot((r2.p-r1.p),n2)). Look at $(Modia3D.fullName(shapeA)) and $(Modia3D.fullName(shapeB)).")
9090
end
9191
# new normal to the triangle plane (r0-r1-r2_new)
9292
n3 = cross(r1.p-r0.p, r2.p-r0.p) # |n3| > 0 guaranteed, due to construction
@@ -106,7 +106,7 @@ function checkIfShapesArePlanar(r0::SupportPoint,r1::SupportPoint,r2::SupportPoi
106106
# Shape is purely planar. Computing the shortest distance for a planar shape
107107
# requires an MPR 2D algorithm (using lines instead of triangles as portals).
108108
# However, this is not implemented and therefore the shortest distance cannot be computed
109-
error("MPR: Shapes are planar and MPR2D is not supported. r1, r2, r3 are on the same ray. abs(dot((r3.p-r1.p),r3.n)) <= neps. Look at shapeA = ", shapeA, " shapeB = ", shapeB)
109+
error("MPR: Shapes are planar and MPR2D is not supported. r1, r2, r3 are on the same ray. abs(dot((r3.p-r1.p),r3.n)) <= neps. Look at $(Modia3D.fullName(shapeA)) and $(Modia3D.fullName(shapeB)).")
110110
end
111111
end
112112

@@ -144,11 +144,11 @@ function tetrahedronEncloseOrigin(r0::SupportPoint, r1::SupportPoint,
144144
break
145145
end
146146
if success != true
147-
if niter_max < 100
148-
@warn("MPR (phase 2): Max. number of iterations (= $niter_max) is reached. niter_max increased locally by 10 and phase 2 is rerun.")
147+
if niter_max <= 100
148+
@warn("MPR (phase 2): Max. number of iterations (= $niter_max) is reached. niter_max increased locally by 10 and phase 2 is rerun. Look at $(Modia3D.fullName(shapeA)) and $(Modia3D.fullName(shapeB)).")
149149
tetrahedronEncloseOrigin(r0, r1org, r2org, r3org, neps, niter_max + 10, shapeA, shapeB, scale)
150150
else
151-
error("MPR (phase 2): Max. number of iterations (= $niter_max) is reached and $niter_max > 100.")
151+
error("MPR (phase 2): Max. number of iterations (= $niter_max) is reached and $niter_max > 100, look at $(Modia3D.fullName(shapeA)) and $(Modia3D.fullName(shapeB)).")
152152
end
153153
end
154154
return (r1, r2, r3)
@@ -166,7 +166,7 @@ function constructR4(r0::SupportPoint,r1::SupportPoint,r2::SupportPoint,r3::Supp
166166
# Shape is purely planar. Computing the shortest distance for a planar shape
167167
# requires an MPR 2D algorithm (using lines instead of triangles as portals).
168168
# However, this is not implemented and therefore the shortest distance cannot be computed
169-
error("MPR: Shapes are planar and MPR2D is not supported. abs(dot((r3.p-r1.p),r3.n)). Look at shapeA = ", shapeA, " shapeB = ", shapeB)
169+
error("MPR: Shapes are planar and MPR2D is not supported. abs(dot((r3.p-r1.p),r3.n)). Look at $(Modia3D.fullName(shapeA)) and $(Modia3D.fullName(shapeB)).")
170170
end
171171
n4 = cross(r2.p-r1.p, r3.p-r1.p) # |n4| > 0 guaranteed, due to construction
172172
end
@@ -312,11 +312,11 @@ function phase3(r0::SupportPoint, r1::SupportPoint, r2::SupportPoint, r3::Suppor
312312
end
313313
end
314314
end
315-
if niter_max < 100
315+
if niter_max <= 100
316316
@warn("MPR (phase 3): Numerical issues with distance computation between $(Modia3D.fullName(shapeA)) and $(Modia3D.fullName(shapeB)). Max. number of iterations (= $niter_max) is reached. niter_max increased locally by 10 and phase 3 is rerun.")
317317
phase3(r0, r1org, r2org, r3org, neps, niter_max + 10, tol_rel, shapeA, shapeB, scale)
318318
else
319-
@warn("MPR (phase 3): Max. number of iterations (= $niter_max) is reached and $niter_max > 100. tol_rel increased locally for this computation to $new_tol.")
319+
@warn("MPR (phase 3): Max. number of iterations (= $niter_max) is reached and $niter_max > 100, look at $(Modia3D.fullName(shapeA)) and $(Modia3D.fullName(shapeB)). tol_rel increased locally for this computation to $new_tol.")
320320
if isTC2
321321
(distance,r1,r2,r3,r4) = finalTC2(r1_new,r2_new,r3_new,r4_new)
322322
return (distance, r4.a, r4.b, r4.n, true, r1.a, r1.b, r2.a, r2.b, r3.a, r3.b)
@@ -421,7 +421,7 @@ function mprTwoSpheres(ch::Composition.ContactDetectionMPR_handler, shapeA::Comp
421421
n = centroidSphereB - centroidSphereA
422422
distanceCentroids = norm(n)
423423
if distanceCentroids <= neps
424-
error("Centers of two spheres are overlapping. SphereA = ", shapeA, " sphereB = ", shapeB)
424+
error("Centers of two spheres are overlapping. Look at $(Modia3D.fullName(shapeA)) and $(Modia3D.fullName(shapeB)).")
425425
else
426426
normal = n/distanceCentroids
427427
end

0 commit comments

Comments
 (0)