polynomial intersection

Started by
10 comments, last by jefferytitan 11 years, 8 months ago
Hi all,
I’m doing some university work based around aircraft in the air traffic system and I’m looking to use a lot of geometrical math typically found in game development. Right now, I'm trying to find out if an aircraft trajectory path intersects a circle in 2D. My path is defined by 7th degree x and y polynomials parameterised by time. The distance between the circle (Coordinates [EQN]W_x[/EQN] , [EQN]W_y[/EQN] and radius r)and the x,y trajectory path is then


[EQN]d(t)=\sqrt{(x(t)-W_x )^2+(y(t)-W_y )^2 }-r[/EQN]


By setting d(t) to zero and finding the roots of the equation I can find either the intersection time or the closest point of approach time between the path and the circle. However, to find the roots of the equation, which factors out to be a 14th degree polynomial, I have to use a numerical root finder. Are there analytical or simply better ways of finding the time of intersection between a trajectory path and a circle?? Also, what if I wanted to find the time of intersection between a trajectory and a rotated rectangle/ square? Can I do it with simple math, such as the root finding approach I used above, or do I need an algorithms with if statements etc? I've seen people here recommend the GJK algorithm, so I'll try that next. Any recommendatins, pointers or suggestions would be warmly received.
Advertisement
There might be a great reason for using a 7th order polynomial, but this is the thing that I would discard first. Replace it with a simple linear, piece-wise curve and then your intersection problem becomes a set of simple intersection tests between line-segments and a circle. Once you get that working you can refine the approximation of the curve.

-Josh

--www.physicaluncertainty.com
--linkedin
--irc.freenode.net#gdnet

In general I don't believe there's an analytical solution to polynomials anywhere near that complicated. However it occurs to me that if you could provide limits on the values of t, a bounding box could be estimated very easily. To get a minimum limit on x, put the lower value of the t range in all positive terms, and the maximum value of the t range in all negative terms. Similarly you could create quick and easy values for max x, min y and max y. If this box doesn't intersect the circle, done.
Thanks Josh,
I did have a few thoughts along the lines you suggested. I guess I was hoping that there might be some special properties of polynomials that I could take advantage of to help simplify the problem.

I'm essentially doing a trajectory optimization problem. For these sorts of problems the aircraft's positions, speeds and accelerations are represented by a series of linked linear segments (like you suggested) or by polynomials. Polynomials are more accurate at representing the changes in the position and speeds of things with time, but linear segments can come with a lot fewer headaches. I might have to just keep it simple this time. Cheers!!
Thanks Jeffrey Titan, I was going to chop up my trajectory with lots of discrete points and then measure the distances from the points on the line to bounding boxes to determine if I needed to run a more detailed collision detection. However I do have knowledge of my max time and yes I could use that as an initial bounding box to eliminate spatial areas that will never interact with my trajectory. As a first cut, it should definitely save me some computational time.


I've been reading these forums for a while now, I should have asked some questions sooner.
I had a thought on tightening the bounds on the box that I suggested. My previous method looks at each term of the polynomial individually. Terms can be grouped, as long as the max/min for each group can be calculated analytically.

For example, our original equation is:
x = at^7 + bt^6 + ct^5 + dt^4 + et^3 + ft^2 + gt + h

We then extract two groups out of it:
x = at^7 + (bt^6 + ct^5 + dt^4) + (et^3 + ft^2 + gx) + h
x = at^7 + t^4(bt^2 + ct + d) + t(et^2 + ft + g) + h

We can analytically find the min and max values of the bcd and efg groups in the appropriate range of t values. As per my previous approach we fudge the at^7, t^4 and t terms using t(min) and t(max) as appropriate. And h is constant, so... yeah.

My other thought is whether it would be possible to find two linear, quadratic or stepwise equations which are guaranteed to upper and lower bound your function, because they might give a much tighter bound than a box.

Edit:

I thought of a quadratic bounding approach which I'm kicking myself over for not noticing before. Use fgh as your quadratic, then use estimates based on all the other terms as a big constant. The estimate could be based on t^6 times the linear equation (at + b) and t^3 times the quadratic equation (ct^2 + dt + e). It may also work if you break it up the other way, e.g. quadratic in abc times a constant approximation for t^5.
This idea of bounding groups of terms in an expression seems quite unorthodox. The minima and the maxima of the different pieces will not line up, so I can't see how this helps at all.

The roots of a polynomial equation of degree 5 of larger cannot generally be expressed using a closed formula involving +,-,*,/ and taking roots (the precise statement of the theorem is more complicated, but look up Galois Theory if you are interested). This means that numeric approximations will have to do. The good news is that numeric approximations for this type of problem work very well in practice, and a lot of people have worked on this problem before.
@alvaro: Agreed that it is unorthodox, however the OPs particular request has some special features: a limitation on the range of t, more than one dimension, existence of roots rather than their values, and lastly the OP asked for an analytical solution. Also based upon my guesses on the purpose of this, a bounding approach could be easily extended for multiple circles, or for a z dimension as well. It doesn't give an exact answer, but if it works as I imagined it gives certainty from one angle (if it's not within the bounding area there is no possibility of intersection), and for an exact answer I'd hand over to numerical methods.

@alvaro: Agreed that it is unorthodox, however the OPs particular request has some special features: a limitation on the range of t, more than one dimension, existence of roots rather than their values, and lastly the OP asked for an analytical solution.

Oh, I missed the part where he is not interested in the values of the roots. The number of real roots of a polynomial in an interval can be computed using Sturm's theorem. Perhaps that's all the OP needed?

EDIT: Hmmm... Silly link bug... This should work: http://en.wikipedia.org/wiki/Sturm%27s_theorem
@alvaro: Interesting, I hadn't heard of Sturm's theorem. I'm not positive that he doesn't require the values of the roots, but that's how I read it. I think your link got truncated, link below:

http://en.wikipedia....m's_theorem

Edit: Oh Sturm, you and your apostrophe. I'm not going to try any more. wink.png

This topic is closed to new replies.

Advertisement