From dae15639184ce9c903d8e5812622894b1651f277 Mon Sep 17 00:00:00 2001 From: Eric J <49599659+ProfJski@users.noreply.github.com> Date: Sun, 11 Jul 2021 15:20:43 -0400 Subject: [PATCH] Added DrawArc() function --- src/models.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/models.c b/src/models.c index 532dd1788..dcab4a201 100644 --- a/src/models.c +++ b/src/models.c @@ -629,6 +629,26 @@ void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, fl rlPopMatrix(); } +//Draw an arc between two points +//If iradius=0. the arc is a semi-circle with a center at the midpoint of the line between the two points. Increase iradius for a flatter arc with a center off the midpoint. Theta rotates the arc around the line between the two points. +void DrawArc(Vector3 v1, Vector3 v2, float iradius, float theta, int steps, Color color) { + float increment=1.0/(float)steps; + Vector3 p; + + rlCheckRenderBatchLimit(2*(steps+1)); + rlBegin(RL_LINES); + rlColor4ub(color.r, color.g, color.b, color.a); + for (float t=0.0;t<1.0;t+=increment) { + p=Vector3Slerp(v1,v2,t,iradius,theta); + rlVertex3f(p.x,p.y,p.z); + p=Vector3Slerp(v1,v2,t+increment,iradius,theta); + rlVertex3f(p.x,p.y,p.z); + + } + rlEnd(); +return; +} + // Draw a plane void DrawPlane(Vector3 centerPos, Vector2 size, Color color) {