Draw circles to fill gaps between bezier segments.

This commit is contained in:
spelufo 2024-02-21 10:56:37 -03:00
parent 8488606cb6
commit efa266624c

View File

@ -1831,7 +1831,10 @@ void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color co
void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Color color) void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Color color)
{ {
if (pointCount < 3) return; if (pointCount < 3) return;
for (int i = 2; i < pointCount - 2; i += 2)
{
DrawCircleV(points[i], thick/2.0f, color);
}
for (int i = 0; i < pointCount - 2; i += 2) for (int i = 0; i < pointCount - 2; i += 2)
{ {
DrawSplineSegmentBezierQuadratic(points[i], points[i + 1], points[i + 2], thick, color); DrawSplineSegmentBezierQuadratic(points[i], points[i + 1], points[i + 2], thick, color);
@ -1842,7 +1845,10 @@ void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Col
void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color color) void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color color)
{ {
if (pointCount < 4) return; if (pointCount < 4) return;
for (int i = 3; i < pointCount - 3; i += 3)
{
DrawCircleV(points[i], thick/2.0f, color);
}
for (int i = 0; i < pointCount - 3; i += 3) for (int i = 0; i < pointCount - 3; i += 3)
{ {
DrawSplineSegmentBezierCubic(points[i], points[i + 1], points[i + 2], points[i + 3], thick, color); DrawSplineSegmentBezierCubic(points[i], points[i + 1], points[i + 2], points[i + 3], thick, color);