   [2D] Sphere-Polynomial equation
  I'm messing around with a collision system that pinpoints collisions without time-stepping. The model consists of one moving (2D) point, and one static polygon in 2D space.The equation for a given trajectory of the point is ax^2 + bx + c, the formula we al know and love. With some standard calculations I created a working model for this. Now I want to change the moving point in a moving sphere. I already have the collision-models ready, but I need a way to compute the following point:|ax^2+bx+c-o| = RAny thoughts on how to calculate x from this? (given all other variables)a,b,c and o are all 2D vectors, x and R are scalars.Should I use a handy-dandy algebraic approach (can't seem to find one that I can solve), of use a recursive approach?   
  work with squares?(ax^2 + by + c)^2 = r^2   ;  I did something like that (with dot producs)(ax^2+bx+c).dot(ax^2+bx+c)=r^2, but I'm not sure how to refactor that to a workable equation of x.   ;  You could work with squares, and use whichever method to solve the resulting quartic, but I imagine it would then be rather difficult to extract the viable solutions from the set.Moduli are notoriously antisocial when the option of squaring is unavailable. Usually, the only remaining possibility is that of partitioning the interval and using a case-analysis. So another method is as follows:1. Solve ax2 + bx + c - o = 0. Let's say that we arrive at two real, distinct values x0, x1 (the degenerate cases are simpler).2. From the sign of a, we can establish the signs of the quadratic on the three intervals (-∞, x0), (x0, x1), (x1, ∞).3. From here, we can safely remove the modulus operator, negating its operand if necessary, leaving three quadratic equations in x to solve. We can immediately discard any solutions that lie outside of the interval in which we restricted them.With any luck, you'll be left with no more than four solutions for x.AdmiralEdit: Actually, separating real numbers from strictly-complex ones isn't that difficult [rolleyes].   ;Quote:Original post by jaapI did something like that (with dot producs)(ax^2+bx+c).dot(ax^2+bx+c)=r^2, but I'm not sure how to refactor that to a workable equation of x.Using (ax^2+bx+c).(ax^2+bx+c) = (a.a)x^4 + (b.b)x^2 + c^2 + 2(a.b)x^3 + 2(a.c)x^2 + 2(b.c)x , you convert it to a fourth-degree equation in x. Now you can try to find the explicit solution to that type of polynomial equation, or just use Newton-Raphson (much easier).;Quote:Original post by TheAdmiralYou could work with squares, and use whichever method to solve the resulting quartic, but I imagine it would then be rather difficult to extract the viable solutions from the set.Moduli are notoriously antisocial when the option of squaring is unavailable. Usually, the only remaining possibility is that of partitioning the interval and using a case-analysis. So another method is as follows:1. Solve ax2 + bx + c - o = 0. Let's say that we arrive at two real, distinct values x0, x1 (the degenerate cases are simpler).2. From the sign of a, we can establish the signs of the quadratic on the three intervals (-∞, x0), (x0, x1), (x1, ∞).3. From here, we can safely remove the modulus operator, negating its operand if necessary, leaving three quadratic equations in x to solve. We can immediately discard any solutions that lie outside of the interval in which we restricted them.With any luck, you'll be left with no more than four solutions for x.AdmiralEdit: Actually, separating real numbers from strictly-complex ones isn't that difficult [rolleyes].Wow that sounds pretty fancy. I understand the part about creating the three partitions, that is, if a,b,c were scalars. But how does it work with vectors. Can it be done in a similar fashion? (I have to ponder your texts a bit more, but it sounds logical :D)edit: I guess where I hit a snag is at the beginning, how do you solve the quadratic formula ax^2+bx+c = 0 with vectors? I did line-point intersections, so I could always dot with the normal first, and work with "normal" scalars from there, using -b+-sqrt(b*b-4ac)/2a.How does this translate to vectors?edit2: would it be very silly to do it seperately on the axes and then check if the returned x-values match?   ;  Did you not read my post? Using the fact that the dot product is bilinear, you can expand your equation into a fourth-degree equation in x. If you are not sure how that works, ask.   ;  I think the OP would prefer to stick to simpler/direct solutions; personally i'd be scared off by the complexity of solving anything beyond a quadratic.   ;Quote:Original post by raiganI think the OP would prefer to stick to simpler/direct solutions; personally i'd be scared off by the complexity of solving anything beyond a quadratic.Then the OP should try to solve simpler problems. :)What he posted was a 4th degree polynomial equation. I can't make the problem any easier. If he uses linear trajectories, he'll get quadratic equations.   