Jump to content
  • Advertisement
Sign in to follow this  
Zorrent

Issues with Bezier Clipping

This topic is 2547 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I'm currently working on an experimental graphics API idea I had and have run into some trouble with an algorithm called bezier clipping (an algorithm for finding points of intersection between two bezier curves).

Up to this point I had been teaching myself what I need to know to implement this algorithm. I've written out the code, but there seems to be an error. I'm not completely sure where this is, but I believe it's to do with the convex hull. The two articles I looked at didn't go into great detail about this portion of the algorithm, and I'm not entirely sure I've defined it correctly.

Here's a rough outline of my algorithm:
•A line from start to end point of curve one is defined, along with two parallel lines of the same length that bound the curve.
•A new curve called a distance function is defined using the y values of curve 2's points and x values that are at 0/3, 1/3, 2/3 and 3/3 of the previously defined baseline.
•The convex hull of the distance function is defined by drawing two lines from the start point of the curve to the control points, and then two lines from the endpoint of the distance function to the control points.
•A loop goes over each convex hull line, with an inner loop that checks the current convex hull line for intersection against the two outer bounding lines
-While the loop is checking the first two convex hull lines for intersection (which originate from the start point of the distance function) the lowest value is kept; while checking the final two convex hull lines (which originate from the endpoint of the distance function), the highest value is kept.

As I said, I'm unsure if I've correctly defined the convex hull. I've tried switching the start points of the final lines from the endpoint to the control points, but that didn't seem to correct the problem. I've been at this algorithm for a while now, and I'd really appreciate any help (or even a link that could help me out which I somehow missed in the searches I've done) at this point. Thank you for your time.

Edit: Nevermind. I've found a very specific way to define a convex hull.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!