Vuo  2.0.2
VuoRectangle.h
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include "VuoPoint2d.h"
13 
25 typedef struct
26 {
27  VuoPoint2d center;
28  VuoPoint2d size;
29 } VuoRectangle;
30 
34 
35 #define VuoRectangle_SUPPORTS_COMPARISON
36 bool VuoRectangle_areEqual(const VuoRectangle a, const VuoRectangle b);
38 
40 
48 
52 static inline VuoRectangle VuoRectangle_make(float centerX, float centerY, float width, float height) __attribute__((const));
53 static inline VuoRectangle VuoRectangle_make(float centerX, float centerY, float width, float height)
54 {
55  return (VuoRectangle){ { centerX, centerY }, { width, height } };
56 }
57 
61 static inline VuoRectangle VuoRectangle_makeTopLeft(float leftX, float topY, float width, float height) __attribute__((const));
62 static inline VuoRectangle VuoRectangle_makeTopLeft(float leftX, float topY, float width, float height)
63 {
64  return (VuoRectangle){ { leftX + width / 2.f, topY + height / 2.f }, { width, height } };
65 }
66 
67 bool VuoRectangle_isPointInside(VuoRectangle r, VuoPoint2d p);
68 
71