SH4ZAM! 0.1.0
Fast math library for the Sega Dreamcast's SH4 CPU
Loading...
Searching...
No Matches
shz_circle.h
Go to the documentation of this file.
1/*! \file
2 \brief Algorithm to speed up circle drawing.
3 \ingroup misc
4
5 \author 2025 Paul Cercueil
6
7 \copyright MIT License
8*/
9
10#ifndef SHZ_CIRCLE_H
11#define SHZ_CIRCLE_H
12
13#include "shz_cdefs.h"
14#include "shz_vector.h"
15
16SHZ_DECLS_BEGIN
17
18/*! Get the transform matrix to speed up circle drawing
19
20 \note
21 This function can be used to obtain the transform matrix that can be used
22 to replace the following circle-drawing algorithm:
23 for (i = 0; i < order; i++) {
24 x += y / factor;
25 y -= x / factor;
26 }
27
28 To compute the final X/Y from the matrix, all you need to do then is:
29 x1 = x0 * matrix.x + y0 * matrix.y;
30 y1 = x0 * matrix.z + y0 * matrix.w;
31*/
32shz_vec4_t shz_circle_matrix(unsigned int order, float factor) SHZ_NOEXCEPT;
33
34SHZ_DECLS_END
35
36#endif
shz_vec4_t shz_circle_matrix(unsigned int order, float factor) SHZ_NOEXCEPT
Get the transform matrix to speed up circle drawing.