# Question about the "0.05" in (O.bodies[i.id2].state.jointNormal1.cross(nRef)).norm()>0.05)

Asked by Jiannan Wang on 2020-06-03

Hello,

I'm quit a newbie of Yade. As I am reading through the /examples/jointedCohesiveFrictionalPM/, there is this if condition in [1] that is puzzling to me: where is the number 0.05 came from? What is the reason of choosing this particular number? Thanks.

Best
Jiannan

## Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
Jiannan Wang
Solved:
2020-06-05
Last query:
2020-06-05
2020-06-05
 Bruno Chareyre (bruno-chareyre) said on 2020-06-03: #1

Hi,
You made me realize that the obsolete github repository was still available though obsolete for quite some time now.
Your link is now broken since I turned that repo private (to avoid confusion in the future), sorry for that.
You'll find a similar line on the gitlab repo hopefully.
Regards
Bruno

 Jiannan Wang (jnwang) said on 2020-06-03: #2

Hello Bruno,

Thank you for that. There is the github link:

Best
Jiannan

 Jérôme Duriez (jduriez) said on 2020-06-04: #3

Hi,

This line wants to check whether two unit normal vectors are different (or not equal).

If they were equal (including the n1 = - n2 case), their cross product would be strictly the zero vector, with a zero norm. Because we were maybe not too ambitious in terms of precision here, we did not check against zero but against 0.05.

You can see this as a 5% tolerance for error (responsible for false positive in equal comparison). Or as the fact that two vectors whose directions just deviate from 2.9 degrees are here considered as equal (even though they're not)

 Bruno Chareyre (bruno-chareyre) said on 2020-06-04: #4

> not too ambitious in terms of precision here, we did not check against zero but against 0.05

That's fairly tolerant... False positive is no issue?
If you want to check equality as described I think you can check it directly (n1==n2 or n1==-n2).
B

 Jiannan Wang (jnwang) said on 2020-06-05: #5

Hello Jerome and Bruno,

Thank you very much for the explanations. That really helps me understand a lot. Just a follow up question in case I'm not fully grasp the full scope of this, if that is OK: In the case of [1], while it find out the sphere is on the joint with 3 facets already, why not reorient the normal with the fourth facet as before? It is because there is not such thing as state.jointNormal4 or there are more to it?

I hope it is OK to follow up in the same thread. Thank you.

Best
Jiannan

 Jérôme Duriez (jduriez) said on 2020-06-05: #6

> It is because there is not such thing as state.jointNormal4

That's exactly that. By current design, the JCFpm code is limited to a maximum of 3 different discontinuity planes crossing a given sphere.

 Jiannan Wang (jnwang) said on 2020-06-05: #7

Hello Jerome,

Thank you so much for the helps. Now I can carry on my happy reading :p

Best
Jiannan