# contact detection between polyhedra and sphere

hello

i want to know the principle of contact detection between polyhedra and sphere,can you give me some advice?

## Question information

- Language:
- English Edit question

- Status:
- Answered

- For:
- Yade Edit question

- Assignee:
- No assignee Edit question

- Last query:
- 2019-09-12

- Last reply:
- 2019-09-12

Jan Stránský (honzik) said : | #1 |

In general or how it is implemented in Yade?

lip (mr.xie) said : | #2 |

in general

A Dinesh (adepu-dinesh-a) said : | #3 |

Hi Jan,

Can you atleast please give references for which Yade implemented the contact detection from? Thank you.

Jan Stránský (honzik) said : | #4 |

> Can you atleast please give references for which Yade implemented the contact detection from?

no :-) there is no reference, I just did something very simple to make it work.

- on polyhedron, find closes point ("closest") to the sphere's center ("center").

- then follow [1] to compute normal, penetrationDepth, contactPoint.

> in general

it is too general question :-) you can e.g.:

- use the current idea (see above)

- use the current idea, somehow enhanced (evaluate differently vertex/edge/face cases)

- do the same as polyhedron-

- surely something else..

cheers

Jan

[1] https:/

lip (mr.xie) said : | #5 |

Hi, Jan

for instance, for two spheres，If the distance between the centers of a sphere is greater than the sum of the radii of two spheres, we can say that the two spheres came into contact. what you say above is something that we already know polyhedra and sphere are contact, what i want to know is how to detect that wether polyhedra and sphere are contact or not.

A Dinesh (adepu-dinesh-a) said : | #6 |

Hi Lip,

That's what Jan is explaining, I guess. For a sphere-sphere interaction we have the contact force dependent

on the amount of overlap. But in the case of polyhedra, one needs to check the amount of volume. And the

force is proportional to the overlap volume.

See figure 1 of reference [1]. In this figure the author Herrmann describes the interaction between two polygons (It is 2d,

so he considers area, in place of volume). I think the same principle goes with sphere and polyhedra interaction.

Can Jan conform? Thanks

A Dinesh (adepu-dinesh-a) said : | #7 |

This reference also looks good [1]. See section 2.

[1] https:/

Jan Stránský (honzik) said : | #8 |

> what i want to know is how to detect that wether polyhedra and sphere are contact or not.

what is the use case? As it is on Yade forum, I assumed usage in Yade. Yade does:

- reject "too far away" bodies by a collider uisng axis aligned boundong boxes

- evaluate (determine contact point, normal, ...) potential contact. Yes/No contact is a possible natural outcome.

In general case, one way (used currently) is to compute the closest point of the polyhedron surface (to the sphere's center) and test if that point is inside the sphere*.

Currently I don't know about any other method (but I did no research on this topic)

* plus the case when the sphere is entirely inside the polyhedron

cheers

Jan

## Can you help with this problem?

Provide an answer of your own, or ask lip for more information if necessary.