SH4ZAM! 0.1.0
Fast math library for the Sega Dreamcast's SH4 CPU
Loading...
Searching...
No Matches
shz_circle.h File Reference
#include "shz_cdefs.h"
#include "shz_vector.h"
Include dependency graph for shz_circle.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

shz_vec4_t shz_circle_matrix (unsigned int order, float factor) SHZ_NOEXCEPT
 

Detailed Description

Algorithm to speed up circle drawing.

Author
2025 Paul Cercueil

Definition in file shz_circle.h.

Function Documentation

◆ shz_circle_matrix()

shz_vec4_t shz_circle_matrix ( unsigned int order,
float factor )

Get the transform matrix to speed up circle drawing.

Note
This function can be used to obtain the transform matrix that can be used to replace the following circle-drawing algorithm: for (i = 0; i < order; i++) { x += y / factor; y -= x / factor; }

To compute the final X/Y from the matrix, all you need to do then is: x1 = x0 * matrix.x + y0 * matrix.y; y1 = x0 * matrix.z + y0 * matrix.w;