Skip to content

Implement miters in DrawSplineLinear - #3585

Merged
raysan5 merged 2 commits into
raysan5:masterfrom
Toctave:segment_miters
Dec 15, 2023
Merged

Implement miters in DrawSplineLinear#3585
raysan5 merged 2 commits into
raysan5:masterfrom
Toctave:segment_miters

Conversation

@Toctave

@Toctave Toctave commented Nov 30, 2023

Copy link
Copy Markdown
Contributor

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!

Comment thread src/rshapes.c Outdated
@raysan5

raysan5 commented Dec 1, 2023

Copy link
Copy Markdown
Owner

@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

Toctave commented Dec 1, 2023

Copy link
Copy Markdown
Contributor Author

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

raysan5 commented Dec 3, 2023

Copy link
Copy Markdown
Owner

@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

raysan5 commented Dec 15, 2023

Copy link
Copy Markdown
Owner

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