PatchworkOS
966e257
A non-POSIX operating system.
Theme:
Default
Round
Robot
Loading...
Searching...
No Matches
polygon.h
Go to the documentation of this file.
1
#ifndef PATCHWORK_POLYGON
2
#define PATCHWORK_POLYGON 1
3
4
#include "
cmd.h
"
5
#include "
font.h
"
6
#include "
pixel.h
"
7
#include "
rect.h
"
8
#include "
surface.h
"
9
10
#include <
stdint.h
>
11
12
#if defined(__cplusplus)
13
extern
"C"
14
{
15
#endif
16
17
typedef
struct
image
image_t
;
18
19
/**
20
* @brief Polygon.
21
* @defgroup libpatchwork_polygon Polygon
22
* @ingroup libpatchwork
23
*
24
* @{
25
*/
26
27
/**
28
* @brief Rotate a polygon around a center point.
29
*
30
* @param points The points of the polygon.
31
* @param pointCount The number of points in the polygon.
32
* @param angle The angle to rotate by, in radians.
33
* @param center The center point to rotate around.
34
*/
35
void
polygon_rotate
(
point_t
* points,
uint64_t
pointCount,
double
angle,
point_t
center);
36
37
/**
38
* @brief Check if a point is inside a polygon.
39
*
40
* We use doubles for the point coordinates instead of just `point_t` to allow for sub-pixel points.
41
*
42
* @param px The x coordinate of the point.
43
* @param py The y coordinate of the point.
44
* @param points The points of the polygon.
45
* @param pointCount The number of points in the polygon.
46
* @return `true` if the point is inside the polygon, `false` otherwise.
47
*/
48
bool
polygon_contains
(
double
px,
double
py,
const
point_t
* points,
uint64_t
pointCount);
49
50
/** @} */
51
52
#if defined(__cplusplus)
53
}
54
#endif
55
56
#endif
cmd.h
font.h
polygon_rotate
void polygon_rotate(point_t *points, uint64_t pointCount, double angle, point_t center)
Rotate a polygon around a center point.
Definition
polygon.c:4
polygon_contains
bool polygon_contains(double px, double py, const point_t *points, uint64_t pointCount)
Check if a point is inside a polygon.
Definition
polygon.c:27
pixel.h
image
static image_t * image
Definition
main.c:5
rect.h
surface.h
stdint.h
uint64_t
__UINT64_TYPE__ uint64_t
Definition
stdint.h:17
image_t
Definition
internal.h:10
point_t
Definition
point.h:12
include
libpatchwork
polygon.h
Generated on Mon Dec 15 2025 21:55:53 for PatchworkOS by
1.9.8