**1**

# polynomial intersection

###
#1
Members - Reputation: **107**

Posted 29 July 2012 - 04:26 PM

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 , and radius r)and the x,y trajectory path is then

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.

###
#2
Crossbones+ - Reputation: **2126**

Posted 29 July 2012 - 04:55 PM

-Josh

--www.physicaluncertainty.com

--linkedin

--irc.freenode.net#gdnet

###
#3
Crossbones+ - Reputation: **2451**

Posted 29 July 2012 - 05:02 PM

###
#4
Members - Reputation: **107**

Posted 29 July 2012 - 05:46 PM

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!!

###
#5
Members - Reputation: **107**

Posted 29 July 2012 - 06:16 PM

I've been reading these forums for a while now, I should have asked some questions sooner.

###
#6
Crossbones+ - Reputation: **2451**

Posted 29 July 2012 - 07:41 PM

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.

**Edited by jefferytitan, 29 July 2012 - 07:54 PM.**

###
#7
Crossbones+ - Reputation: **16179**

Posted 29 July 2012 - 09:13 PM

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.

###
#8
Crossbones+ - Reputation: **2451**

Posted 29 July 2012 - 09:34 PM

###
#9
Crossbones+ - Reputation: **16179**

Posted 29 July 2012 - 10:07 PM

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?@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.

EDIT: Hmmm... Silly link bug... This should work: http://en.wikipedia.org/wiki/Sturm%27s_theorem

###
#10
Crossbones+ - Reputation: **2451**

Posted 29 July 2012 - 10:25 PM

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

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

**Edited by jefferytitan, 29 July 2012 - 10:45 PM.**

###
#11
Members - Reputation: **107**

Posted 30 July 2012 - 11:33 AM

I have already tried Sturm, and it works. It can also be used recursively to find the roots. It does require a lot of convolution and deconvolution though (polynomial multiplication and division) and gets quite time consuming quite quickly.

Another thing I’ve tried is Chebfun, which generates a polynomial expansion of a function. It can be used to find the roots of a polynomial of any degree. It’s not analytical but it’s quite accurate. Again the computation time is a higher than I would like.

For Sturm and Chebfun, I don’t think there is any great advantage in using them over numerical root finders for my particular problem. JeffreyTitan your quadratic suggestion looks interesting, I’ll plug some numbers in to see what I think. Otherwise I think I’ll do something similar to what Josh suggested and break my trajectory into lots of small linear segments. This should keep things fast and the loss of accuracy should be minimal.

###
#12
Crossbones+ - Reputation: **2451**

Posted 30 July 2012 - 04:50 PM