We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I've got a question. What I want to do is be able to draw complex shapes with bezier curves (which I already know how to do). But then what I want to do is write a function that is able to determine if a specific point is either inside, outside, or touching the complex shape. I believe this is called raycasting. Does anybody know how to do that? Thank you.
Answers
@Scott06 -- Have you already searched the forum for recent discussions of raycasting?
Some of them might be helpful.
Can you say something more about these inside/outside tests? Are they in 2D or 3D? What is their purpose?
For beziers specifically you can figure out wheter a point is on the left or right side of a bezier segment by solving it's equation, here is my code which you can run on bookofshader.
https://github.com/Prince-Polka/bezier-boundary/blob/master/shadercoderevision
If you wan't to use actual raycasting you loop through one axis and store the points of intersection on the other axis.
My code above does not do that, but the bezier equation is the same.
Hey scott, I‘d be interested on your code how to display something like this
Mind to share your code?