Skip to content
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

Implement miters in DrawSplineLinear #3585

Merged
merged 2 commits into from
Dec 15, 2023
Merged

Conversation

Toctave
Copy link
Contributor

@Toctave Toctave commented Nov 30, 2023

Hi,

I implemented segment miters for linear splines, meaning that the lines go from this :

Screenshot from 2023-11-30 11-09-39

to this :

Screenshot from 2023-11-30 11-07-37

This breaks when the angle between two consecutive line segments is close to 0° (works fine when it's 180° though), so I'm not sure it should stay as a replacement to DrawSplineLinear, but a DrawSplineLinearMitered could maybe be created instead ?

I feel like the usual use case is to have reasonably small angles, in order to draw arbitrary, nice-looking lines, but this is probably not worth breaking existing code.

Let me know what you think!

@raysan5
Copy link
Owner

raysan5 commented Dec 1, 2023

@Toctave This is actually a very nice improvement! Same issue happens with DrawSplineBezier*() that also needs to be addressed (avoiding the use of DrawSplineSegmentBezier*()).

Also, somewhat related is the support of begin-end caps for the splines, a semi-circle could be added to make then more beautiful.

@Toctave
Copy link
Contributor Author

Toctave commented Dec 1, 2023

Thank you! I'm going to add it to Bézier lines as well then. Would you prefer me to change the existing functions (as I did so far), or to e.g. add Draw*Mitered functions instead ?

@raysan5
Copy link
Owner

raysan5 commented Dec 3, 2023

@Toctave I prefer to avoid new functions but it would be nice if this improvement could be under a config flag for convenience.

@raysan5 raysan5 merged commit 0fc1765 into raysan5:master Dec 15, 2023
@raysan5
Copy link
Owner

raysan5 commented Dec 15, 2023

Just merging this improvement and reviewing it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants