-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rshapes] Fix multisegment Bezier splines. #3744
Conversation
It seems to me that these functions are wrong, if you step the index by 1 you move to a control point instead of the next segment.
@spelufo Did you test it? Could you share some code example? |
I did, through raylib-go:
|
@spelufo I'm trying this fix with example Drawing code I'm using: Vector2 fullPoints[14] = {
points[0],
control[0].end,
control[1].start,
points[1],
control[1].end,
control[2].start,
points[2],
control[2].end,
control[3].start,
points[3],
control[3].end,
control[4].start,
points[4],
control[4].end
};
DrawSplineBezierCubic(fullPoints, 14, splineThickness, RED); The expected result is: |
I've fixed the example code. I tested that the previous version of |
Regarding the "connections", the gaps left on the points between segments, one way to cover them up would be to have |
I've gone ahead and did that. It is ready to merge if you want. |
@raysan5 ? |
@spelufo Excuse the late response! I'm quite busy lately... I want to review this code more carefully because I think the current |
Correcting the sequence of points and the iterator seems good. I'll take a look at the |
@colinwilcox I agree, circle should be in any case, optional, I considered using a flag for it...
DrawSplineSegmentBezierCubic(Vector2 p1, Vector2 c2, Vector2 c3, Vector2 p4, float thick, Color color); My concerns with the function were the expected sequence of points, they should follow the pattern: After review, it seems so. I also reviewed So, it seems the only issue is how In conclusion, raylib Cubic Bezier functions seem to be correct but the example could be confusing because it separates Ok, I'm merging the PR and I will review it with those comments on the example. |
It seems to me that these functions are wrong, if you step the index by 1 you move to a control point instead of the next segment.