Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 27 Feb 2005
Offline Last Active Feb 19 2016 09:55 AM

Topics I've Started

Intersection of looping path and area inside

08 March 2011 - 01:52 PM

Ok, I'm gonna start by posting a video of the effect I'm looking for to make this easier:
- gameplay from good old NiGHTs on Saturn.

What I'm looking to achieve is the looping/collection effect seen in the game. To make it simpler I'm only looking to do this on a 2D plane. I assume you'd start by keeping track of previous points of movements (a trail), used to calculate line segments. The last segment can then be tested against the others for intersection to "complete a loop," and once found you would know which segment starts the loop, and the last segment would have to be the end. Because the already existing trail doesn't change you would only have to check as a new end segment is added. However, this may be pretty slow, and I'm sure this is a better way to go about doing this.

The biggest stump I'm on, is actually calculating what's inside the loop, and if objects are inside that area. I know how to calculate the area using calculus, but doing this as a step by step method would also be slow, plus I still don't know how to test if a point is actually within the area, as it can be very irregular or asymmetric ellipses. Any tips, ideas, etc?