Jump to content

Bouncing ray inside a curve


AntoineSfx

Recommended Posts

I'm trying to bounce a ray inside a curve, starting from a point with an initial vector  v@v which tells the initial direction.

I'm providing a curve and a starting point so that we can see if and when it starts to differ / exit the curve.

curve.obj

The algorithm is as follows

Starting from (0,0,0) in  direction  (0,0,-1)

Ray SOP against the curve.

reflect @v using: v@v = reflect(v@v, v@N);

repeat

It quickly gets stuck on the curve for a reason that's not clear; 

The worst case scenario is when the direction is really close to the tangent of the polygon at the hit point; then it's possible that the next ray will start shooting through the curve if you use the bias option in Ray.

I mean .. it kinda solves the problem in some cases, but it opens the door to other ones.

Is there a robust solution to this ? It's not that critical, it's just for viz; but I'm curious because comp'l geometry is known to be really tricky. Probably going to end up with a collision pad 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...