# Shape touching shape

**URL:** <https://discourse.processing.org/t/shape-touching-shape/2818>\
**Category:** Coding Questions\
**Created:** [August 21, 2018, 2:38pm UTC](https://discourse.processing.org/t/shape-touching-shape/2818 "2018-08-21T14:38:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FurryNightShade](https://avatars.discourse-cdn.com/v4/letter/f/e5b9ba/32.png) [@FurryNightShade](https://discourse.processing.org/u/FurryNightShade)\
**Post date:** [August 21, 2018, 2:38pm UTC](https://discourse.processing.org/t/shape-touching-shape/2818/1 "2018-08-21T14:38:43Z")

</div>

Hello,  
as I am writing Dubtank 2, I came across a problem.  
I want to detect whether a tank touches another tank. I know or I can calculate the exact position of all points and detecting crossing straight line segments is easy. The problem begins with detecting ellipses touching line seqments. There could be a moment where an ellipse touches a line segment between its 2 points. I know it can be done with trigoniometry, but I have no idea, how…

---

<div class="post-metadata">

**Author:** ![WakeMeAtThree](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/wakemeatthree/32/38_2.png) [@WakeMeAtThree](https://discourse.processing.org/u/WakeMeAtThree)\
**Post date:** [August 21, 2018, 2:57pm UTC](https://discourse.processing.org/t/shape-touching-shape/2818/2 "2018-08-21T14:57:03Z")

</div>

Hello @FurryNightShade!  
Here’s a [resource](http://www.jeffreythompson.org/collision-detection/table_of_contents.php) that could possibly help you out. It covers different cases of collision detection, and your particular case of [Line/Circle collision detection can be found here](http://www.jeffreythompson.org/collision-detection/line-circle.php).

If you’re still facing issues, feel free to post your code here.

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [August 21, 2018, 4:27pm UTC](https://discourse.processing.org/t/shape-touching-shape/2818/3 "2018-08-21T16:27:06Z")

</div>

Shameless self-promotion: here is a tutorial on collision detection in Processing:

> **[Processing Collision Detection](https://happycoding.io/tutorials/processing/collision-detection)**
>
> Learn how to trigger an action when objects overlap in Processing!

In general, you can google something like “ellipse line segment collision detection” for a ton of results. Don’t be afraid to do some research.

---

<div class="post-metadata">

**Author:** ![FurryNightShade](https://avatars.discourse-cdn.com/v4/letter/f/e5b9ba/32.png) [@FurryNightShade](https://discourse.processing.org/u/FurryNightShade)\
**Post date:** [August 22, 2018, 4:45am UTC](https://discourse.processing.org/t/shape-touching-shape/2818/4 "2018-08-22T04:45:34Z")

</div>

Thanks to both of you. That is, what I’m looking for.
