converted tabs to spaces
This commit is contained in:
parent
cd7048ffbd
commit
2696e77cc1
|
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
#include <math.h> // Required for: sinf(), asinf(), cosf(), acosf(), sqrtf(), fabsf()
|
#include <math.h> // Required for: sinf(), asinf(), cosf(), acosf(), sqrtf(), fabsf()
|
||||||
#include <float.h> // Required for: FLT_EPSILON
|
#include <float.h> // Required for: FLT_EPSILON
|
||||||
#include <stdlib.h> // Required for: RL_FREE
|
#include <stdlib.h> // Required for: RL_FREE
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Defines and Macros
|
// Defines and Macros
|
||||||
|
|
@ -198,7 +198,7 @@ void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color)
|
||||||
Vector2 previous = startPos;
|
Vector2 previous = startPos;
|
||||||
Vector2 current = { 0 };
|
Vector2 current = { 0 };
|
||||||
|
|
||||||
Vector2* pts = RL_MALLOC((2*BEZIER_LINE_DIVISIONS+2)*sizeof(Vector2));
|
Vector2* pts = RL_MALLOC((2*BEZIER_LINE_DIVISIONS+2)*sizeof(Vector2));
|
||||||
|
|
||||||
for (int i = 1; i <= BEZIER_LINE_DIVISIONS; i++)
|
for (int i = 1; i <= BEZIER_LINE_DIVISIONS; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -207,27 +207,27 @@ void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color)
|
||||||
current.y = EaseCubicInOut((float)i, startPos.y, endPos.y - startPos.y, (float)BEZIER_LINE_DIVISIONS);
|
current.y = EaseCubicInOut((float)i, startPos.y, endPos.y - startPos.y, (float)BEZIER_LINE_DIVISIONS);
|
||||||
current.x = previous.x + (endPos.x - startPos.x)/ (float)BEZIER_LINE_DIVISIONS;
|
current.x = previous.x + (endPos.x - startPos.x)/ (float)BEZIER_LINE_DIVISIONS;
|
||||||
|
|
||||||
double dy = current.y-previous.y;
|
double dy = current.y-previous.y;
|
||||||
double dx = current.x-previous.x;
|
double dx = current.x-previous.x;
|
||||||
double size = 0.5*thick/sqrt(dx*dx+dy*dy);
|
double size = 0.5*thick/sqrt(dx*dx+dy*dy);
|
||||||
|
|
||||||
if (i==1) {
|
f (i==1) {
|
||||||
pts[0].x = previous.x+dy*size;
|
pts[0].x = previous.x+dy*size;
|
||||||
pts[0].y = previous.y-dx*size;
|
pts[0].y = previous.y-dx*size;
|
||||||
pts[1].x = previous.x-dy*size;
|
pts[1].x = previous.x-dy*size;
|
||||||
pts[1].y = previous.y+dx*size;
|
pts[1].y = previous.y+dx*size;
|
||||||
}
|
}
|
||||||
|
|
||||||
pts[2*i+1].x = current.x-dy*size;
|
pts[2*i+1].x = current.x-dy*size;
|
||||||
pts[2*i+1].y = current.y+dx*size;
|
pts[2*i+1].y = current.y+dx*size;
|
||||||
pts[2*i].x = current.x+dy*size;
|
pts[2*i].x = current.x+dy*size;
|
||||||
pts[2*i].y = current.y-dx*size;
|
pts[2*i].y = current.y-dx*size;
|
||||||
|
|
||||||
previous = current;
|
previous = current;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawTriangleStrip(pts, 2*BEZIER_LINE_DIVISIONS+2, color);
|
DrawTriangleStrip(pts, 2*BEZIER_LINE_DIVISIONS+2, color);
|
||||||
RL_FREE(pts);
|
RL_FREE(pts);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw line using quadratic bezier curves with a control point
|
// Draw line using quadratic bezier curves with a control point
|
||||||
|
|
@ -239,7 +239,7 @@ void DrawLineBezierQuad(Vector2 startPos, Vector2 endPos, Vector2 controlPos, fl
|
||||||
Vector2 current = { 0 };
|
Vector2 current = { 0 };
|
||||||
float t = 0.0f;
|
float t = 0.0f;
|
||||||
|
|
||||||
Vector2* pts = RL_MALLOC((2*BEZIER_LINE_DIVISIONS+2)*sizeof(Vector2));
|
Vector2* pts = RL_MALLOC((2*BEZIER_LINE_DIVISIONS+2)*sizeof(Vector2));
|
||||||
|
|
||||||
for (int i = 0; i <= BEZIER_LINE_DIVISIONS; i++)
|
for (int i = 0; i <= BEZIER_LINE_DIVISIONS; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -252,27 +252,27 @@ void DrawLineBezierQuad(Vector2 startPos, Vector2 endPos, Vector2 controlPos, fl
|
||||||
current.y = a*startPos.y + b*controlPos.y + c*endPos.y;
|
current.y = a*startPos.y + b*controlPos.y + c*endPos.y;
|
||||||
current.x = a*startPos.x + b*controlPos.x + c*endPos.x;
|
current.x = a*startPos.x + b*controlPos.x + c*endPos.x;
|
||||||
|
|
||||||
double dy = current.y-previous.y;
|
double dy = current.y-previous.y;
|
||||||
double dx = current.x-previous.x;
|
double dx = current.x-previous.x;
|
||||||
double size = 0.5*thick/sqrt(dx*dx+dy*dy);
|
double size = 0.5*thick/sqrt(dx*dx+dy*dy);
|
||||||
|
|
||||||
if (i==1) {
|
if (i==1) {
|
||||||
pts[0].x = previous.x+dy*size;
|
pts[0].x = previous.x+dy*size;
|
||||||
pts[0].y = previous.y-dx*size;
|
pts[0].y = previous.y-dx*size;
|
||||||
pts[1].x = previous.x-dy*size;
|
pts[1].x = previous.x-dy*size;
|
||||||
pts[1].y = previous.y+dx*size;
|
pts[1].y = previous.y+dx*size;
|
||||||
}
|
}
|
||||||
|
|
||||||
pts[2*i+1].x = current.x-dy*size;
|
pts[2*i+1].x = current.x-dy*size;
|
||||||
pts[2*i+1].y = current.y+dx*size;
|
pts[2*i+1].y = current.y+dx*size;
|
||||||
pts[2*i].x = current.x+dy*size;
|
pts[2*i].x = current.x+dy*size;
|
||||||
pts[2*i].y = current.y-dx*size;
|
pts[2*i].y = current.y-dx*size;
|
||||||
|
|
||||||
previous = current;
|
previous = current;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawTriangleStrip(pts, 2*BEZIER_LINE_DIVISIONS+2, color);
|
DrawTriangleStrip(pts, 2*BEZIER_LINE_DIVISIONS+2, color);
|
||||||
RL_FREE(pts);
|
RL_FREE(pts);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw line using cubic bezier curves with 2 control points
|
// Draw line using cubic bezier curves with 2 control points
|
||||||
|
|
@ -284,7 +284,7 @@ void DrawLineBezierCubic(Vector2 startPos, Vector2 endPos, Vector2 startControlP
|
||||||
Vector2 current = { 0 };
|
Vector2 current = { 0 };
|
||||||
float t = 0.0f;
|
float t = 0.0f;
|
||||||
|
|
||||||
Vector2* pts = RL_MALLOC((2*BEZIER_LINE_DIVISIONS+2)*sizeof(Vector2));
|
Vector2* pts = RL_MALLOC((2*BEZIER_LINE_DIVISIONS+2)*sizeof(Vector2));
|
||||||
|
|
||||||
for (int i = 0; i <= BEZIER_LINE_DIVISIONS; i++)
|
for (int i = 0; i <= BEZIER_LINE_DIVISIONS; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -297,27 +297,27 @@ void DrawLineBezierCubic(Vector2 startPos, Vector2 endPos, Vector2 startControlP
|
||||||
current.y = a*startPos.y + b*startControlPos.y + c*endControlPos.y + d*endPos.y;
|
current.y = a*startPos.y + b*startControlPos.y + c*endControlPos.y + d*endPos.y;
|
||||||
current.x = a*startPos.x + b*startControlPos.x + c*endControlPos.x + d*endPos.x;
|
current.x = a*startPos.x + b*startControlPos.x + c*endControlPos.x + d*endPos.x;
|
||||||
|
|
||||||
double dy = current.y-previous.y;
|
double dy = current.y-previous.y;
|
||||||
double dx = current.x-previous.x;
|
double dx = current.x-previous.x;
|
||||||
double size = 0.5*thick/sqrt(dx*dx+dy*dy);
|
double size = 0.5*thick/sqrt(dx*dx+dy*dy);
|
||||||
|
|
||||||
if (i==1) {
|
if (i==1) {
|
||||||
pts[0].x = previous.x+dy*size;
|
pts[0].x = previous.x+dy*size;
|
||||||
pts[0].y = previous.y-dx*size;
|
pts[0].y = previous.y-dx*size;
|
||||||
pts[1].x = previous.x-dy*size;
|
pts[1].x = previous.x-dy*size;
|
||||||
pts[1].y = previous.y+dx*size;
|
pts[1].y = previous.y+dx*size;
|
||||||
}
|
}
|
||||||
|
|
||||||
pts[2*i+1].x = current.x-dy*size;
|
pts[2*i+1].x = current.x-dy*size;
|
||||||
pts[2*i+1].y = current.y+dx*size;
|
pts[2*i+1].y = current.y+dx*size;
|
||||||
pts[2*i].x = current.x+dy*size;
|
pts[2*i].x = current.x+dy*size;
|
||||||
pts[2*i].y = current.y-dx*size;
|
pts[2*i].y = current.y-dx*size;
|
||||||
|
|
||||||
previous = current;
|
previous = current;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawTriangleStrip(pts, 2*BEZIER_LINE_DIVISIONS+2, color);
|
DrawTriangleStrip(pts, 2*BEZIER_LINE_DIVISIONS+2, color);
|
||||||
RL_FREE(pts);
|
RL_FREE(pts);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw lines sequence
|
// Draw lines sequence
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user