# Bounce balls inside an ellipse

**URL:** <https://discourse.processing.org/t/bounce-balls-inside-an-ellipse/42557>\
**Category:** Gallery\
**Created:** [August 5, 2023, 1:45pm UTC](https://discourse.processing.org/t/bounce-balls-inside-an-ellipse/42557 "2023-08-05T13:45:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [August 5, 2023, 1:45pm UTC](https://discourse.processing.org/t/bounce-balls-inside-an-ellipse/42557/1 "2023-08-05T13:45:29Z")

</div>

I saw a post somewhere on this forum about objects bouncing inside an ellipse so I decided to continue my exploration of ellipses by having a go.

Assuming that the objects inside the ellipse travel in a straight line I extend my work on ellipse-ellipse intersections to include ellipse-line intersections.

The next stage was to calculate the ellipse perimeter normal vector at the point of intersection. At first I thought I would have to differentiate the implicit equation of a the ellipse, a task I wasn’t confident of being able to do. Fortunately there was a simple geometric paper and pen solution that was easy to code and with the perimeter normal I could easily calculate the rebound vector and this sketch was the result.

https://openprocessing.org/sketch/1981589/embed/

😁
