Sign in to follow this  
Alrecenk

(Vector vs Cubic surface) collision

Recommended Posts

Alrecenk    400
I wasn't sure exactly what to call this, but I knew if I just put vector plane collision I'd get a bunch of answers without my post even being read. I need to solve the following equation for all possible combinations of l, t , and p(there should be 3 or 6 I think). V*l = (1-t)^3*A + 3*(1-t)^2*t*B + 3*(1-t)*t^2*C + t^3*D + (1-p^3*A + 3*(1-p)^2*p*E + 3*(1-p)*p^2*F+p^3*G l,t and p (the lowercase letters) are scalars and V,A,B,C,D,E,F and G(capital letters) are vectors. I had a hard time coming up with this equation and now that I have it I'm not entirely sure what to do with it. I don't expect anyone to solve it for me I'd just like some idea of where to begin. This isn't homework, but it isn't technically game related at this point either. You can view my program here. It could be game related eventually though.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
You can try solving this problem numerically, of course.

I guess that Newton's or Broyden's methods are your best friend in this situation.
You can find a reasonably implementation of those algorithms in "Numerical Recipes in C", which is available on-line in PDF form.

Finding all of the solutions might be tricky through.
Maybe if you write about your problem in more detail, you'll get a better answer.

Share this post


Link to post
Share on other sites
timw    598
generally these types of things are done using newton's method there is no closed form solution for a general quadric/ray equation. there are also subdivision methods for bezier patches, but they're slow too.

Tim

Share this post


Link to post
Share on other sites
Alrecenk    400
Basically, I'm testing various methods for drawing curved surfaces. This equation would be used for a raytracing style method where the surface is created from 2 bezier curves. I know it's not the fastest way to go, but it would allow me to sample specific points. So, I guess I don't need all the possible combinations I just need the combination with the lowest "l".

So far I haven't been able to come up with any method for drawing curves that I consider fast enough to use in another program. So I would be interested to here about other methods for that as well.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this