Select the types of activity you want to include in your feed.
Updated circle angle coefficient and added a check to fix issues with small radius circles not having enough segments to complete the shape. Thanks GiovanniCmpaner for the report!
···7676777778787979+#define SDL_GPU_CIRCLE_SEGMENT_ANGLE_FACTOR 0.625f
8080+8181+8282+#define CALCULATE_CIRCLE_DT_AND_SEGMENTS(radius) \
8383+ dt = SDL_GPU_CIRCLE_SEGMENT_ANGLE_FACTOR/sqrtf(radius); /* s = rA, so dA = ds/r. ds of 1.25*sqrt(radius) is good */ \
8484+ numSegments = (int)(2*PI/dt) + 1; \
8585+ \
8686+ if(numSegments < 16) \
8787+ { \
8888+ numSegments = 16; \
8989+ dt = 2*PI/(numSegments-1); \
9090+ }
799180928193static float SetLineThickness(GPU_Renderer* renderer, float thickness)
···178190 }
179191180192181181- dt = ((end_angle - start_angle)/360)*(1.25f/sqrtf(outer_radius)); // s = rA, so dA = ds/r. ds of 1.25*sqrt(radius) is good, use A in degrees.
193193+ dt = ((end_angle - start_angle)/360)*(SDL_GPU_CIRCLE_SEGMENT_ANGLE_FACTOR/sqrtf(outer_radius)); // s = rA, so dA = ds/r. ds of 1.25*sqrt(radius) is good, use A in degrees.
182194183195 numSegments = (int)((fabs(end_angle - start_angle)*PI/180)/dt);
184196 if(numSegments == 0)
···255267 end_angle -= 360;
256268 }
257269258258- dt = ((end_angle - start_angle)/360)*(1.25f/sqrtf(radius)); // s = rA, so dA = ds/r. ds of 1.25*sqrt(radius) is good, use A in degrees.
270270+ dt = ((end_angle - start_angle)/360)*(SDL_GPU_CIRCLE_SEGMENT_ANGLE_FACTOR/sqrtf(radius)); // s = rA, so dA = ds/r. ds of 1.25*sqrt(radius) is good, use A in degrees.
259271260272 numSegments = (int)((fabs(end_angle - start_angle)*RAD_PER_DEG)/dt);
261273 if(numSegments == 0)
···314326 float t = thickness/2;
315327 float inner_radius = radius - t;
316328 float outer_radius = radius + t;
317317- float dt = (1.25f/sqrtf(outer_radius)); // s = rA, so dA = ds/r. ds of 1.25*sqrt(radius) is good, use A in degrees.
318318- int numSegments = (int)(2*PI/dt)+1;
329329+ float dt;
330330+ int numSegments;
331331+332332+ CALCULATE_CIRCLE_DT_AND_SEGMENTS(outer_radius);
319333320334 float tempx;
321335 float c = cosf(dt);
···345359346360static void CircleFilled(GPU_Renderer* renderer, GPU_Target* target, float x, float y, float radius, SDL_Color color)
347361{
348348- float dt = (1.25f/sqrtf(radius)); // s = rA, so dA = ds/r. ds of 1.25*sqrt(radius) is good, use A in degrees.
362362+ float dt;
349363 float dx, dy;
350350- int numSegments = (int)(2*PI/dt)+1;
364364+ int numSegments;
351365 int i;
366366+367367+ CALCULATE_CIRCLE_DT_AND_SEGMENTS(radius);
352368353369 float tempx;
354370 float c = cosf(dt);
···395411 float outer_radius_x = rx + t;
396412 float inner_radius_y = ry - t;
397413 float outer_radius_y = ry + t;
398398- float dt = (1.25f/sqrtf(outer_radius_x > outer_radius_y? outer_radius_x : outer_radius_y)); // s = rA, so dA = ds/r. ds of 1.25*sqrt(radius) is good, use A in degrees.
399399- int numSegments = (int)(2*M_PI/dt)+1;
414414+ float dt;
415415+ int numSegments;
416416+417417+ CALCULATE_CIRCLE_DT_AND_SEGMENTS(outer_radius_x > outer_radius_y? outer_radius_x : outer_radius_y);
400418401419 float tempx;
402420 float c = cosf(dt);
···442460 int i;
443461 float rot_x = cosf(degrees*RAD_PER_DEG);
444462 float rot_y = sinf(degrees*RAD_PER_DEG);
445445- float dt = (1.25f/sqrtf(rx > ry? rx : ry)); // s = rA, so dA = ds/r. ds of 1.25*sqrt(radius) is good, use A in degrees.
446446- int numSegments = (int)(2*M_PI/dt)+1;
463463+ float dt;
464464+ int numSegments;
465465+ CALCULATE_CIRCLE_DT_AND_SEGMENTS(rx > ry? rx : ry);
447466448467 float tempx;
449468 float c = cosf(dt);
···586605587606588607 t = start_angle;
589589- dt = ((end_angle - start_angle)/360)*(1.25f/sqrtf(outer_radius)) * DEG_PER_RAD; // s = rA, so dA = ds/r. ds of 1.25*sqrt(radius) is good, use A in degrees.
608608+ dt = ((end_angle - start_angle)/360)*(SDL_GPU_CIRCLE_SEGMENT_ANGLE_FACTOR/sqrtf(outer_radius)) * DEG_PER_RAD; // s = rA, so dA = ds/r. ds of 1.25*sqrt(radius) is good, use A in degrees.
590609591610 numSegments = (int)(fabs(end_angle - start_angle)/dt);
592611 if(numSegments == 0)
···808827 float t = thickness/2;
809828 float inner_radius = radius - t;
810829 float outer_radius = radius + t;
811811- float dt = (1.25f/sqrtf(outer_radius)); // s = rA, so dA = ds/r. ds of 1.25*sqrt(radius) is good, use A in degrees.
812812- int numSegments = (int)(2*PI/dt)+1;
813813- if(numSegments < 4)
814814- numSegments = 4;
830830+ float dt;
831831+ int numSegments;
832832+ CALCULATE_CIRCLE_DT_AND_SEGMENTS(outer_radius);
815833816834 // Make a multiple of 4 so we can have even corners
817835 numSegments += numSegments % 4;