Vuo 2.4.4
Loading...
Searching...
No Matches
VuoRectangle.h
Go to the documentation of this file.
1
10#ifndef VuoRectangle_h
11#define VuoRectangle_h
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17#include "VuoPoint2d.h"
18
30typedef struct
31{
32 VuoPoint2d center;
33 VuoPoint2d size;
35
36#define VuoRectangle_SUPPORTS_COMPARISON
37
38VuoRectangle VuoRectangle_makeFromJson(struct json_object *js);
39struct json_object *VuoRectangle_getJson(const VuoRectangle r);
41
44
46
53
57static inline VuoRectangle VuoRectangle_make(float centerX, float centerY, float width, float height) __attribute__((const));
58static inline VuoRectangle VuoRectangle_make(float centerX, float centerY, float width, float height)
59{
60 return (VuoRectangle){ { centerX, centerY }, { width, height } };
61}
62
66static inline VuoRectangle VuoRectangle_makeTopLeft(float leftX, float topY, float width, float height) __attribute__((const));
67static inline VuoRectangle VuoRectangle_makeTopLeft(float leftX, float topY, float width, float height)
68{
69 return (VuoRectangle){ { leftX + width / 2.f, topY + height / 2.f }, { width, height } };
70}
71
72bool VuoRectangle_isPointInside(VuoRectangle r, VuoPoint2d p);
73
76
81#ifdef __cplusplus
82}
83#endif
84
85#endif