Vuo  2.3.2
Classes | Macros | Functions
VuoRectangle

Description

A 2-dimensional axis-aligned box.

Classes

struct  VuoRectangle
 A 2-dimensional axis-aligned box. More...
 

Functions

VuoRectangle VuoRectangle_makeFromJson (json_object *js)
 Decodes the JSON object js to create a new value. More...
 
json_objectVuoRectangle_getJson (const VuoRectangle r)
 Encodes r as a JSON object. More...
 
char * VuoRectangle_getSummary (const VuoRectangle r)
 Returns a compact string representation of r (comma-separated coordinates). More...
 
bool VuoRectangle_areEqual (const VuoRectangle a, const VuoRectangle b)
 Returns true if the two rectangles are equal (within tolerance). More...
 
bool VuoRectangle_isLessThan (const VuoRectangle a, const VuoRectangle b)
 Compares a to b primarily by center-value and secondarily by size-value, returning true if a is less than b. More...
 
static VuoRectangle VuoRectangle_make (float centerX, float centerY, float width, float height) __attribute__((const))
 Returns a rectangle with the specified coordinates. More...
 
static VuoRectangle VuoRectangle_makeTopLeft (float leftX, float topY, float width, float height) __attribute__((const))
 Returns a rectangle with the specified coordinates. More...
 
bool VuoRectangle_isPointInside (VuoRectangle r, VuoPoint2d p)
 Returns true if p is inside r. More...
 
VuoRectangle VuoRectangle_intersection (VuoRectangle rectangleA, VuoRectangle rectangleB)
 Returns the intersecting area of rectangleA and rectangleB. More...
 
VuoRectangle VuoRectangle_union (VuoRectangle rectangleA, VuoRectangle rectangleB)
 Returns the union area of rectangleA and rectangleB. More...
 
VuoRectangle VuoRectangle_makeFromString (const char *str)
 Automatically generated function. More...
 
char * VuoRectangle_getString (const VuoRectangle r)
 Automatically generated function. More...
 
void VuoRectangle_retain (VuoRectangle r)
 Automatically generated function. More...
 
void VuoRectangle_release (VuoRectangle r)
 Automatically generated function. More...
 

Class Documentation

◆ VuoRectangle

struct VuoRectangle
Class Members
VuoPoint2d center
VuoPoint2d size

Function Documentation

◆ VuoRectangle_areEqual()

bool VuoRectangle_areEqual ( const VuoRectangle  a,
const VuoRectangle  b 
)

Returns true if the two rectangles are equal (within tolerance).

Changed in Vuo 2.0.0:
New.

Definition at line 85 of file VuoRectangle.c.

◆ VuoRectangle_getJson()

struct json_object * VuoRectangle_getJson ( const VuoRectangle  r)

Encodes r as a JSON object.

Changed in Vuo 2.0.0:
New.

Definition at line 61 of file VuoRectangle.c.

◆ VuoRectangle_getString()

char* VuoRectangle_getString ( const VuoRectangle  r)

Automatically generated function.

◆ VuoRectangle_getSummary()

char * VuoRectangle_getSummary ( const VuoRectangle  r)

Returns a compact string representation of r (comma-separated coordinates).

Changed in Vuo 2.0.0:
New.

Definition at line 75 of file VuoRectangle.c.

◆ VuoRectangle_intersection()

VuoRectangle VuoRectangle_intersection ( VuoRectangle  rectangleA,
VuoRectangle  rectangleB 
)

Returns the intersecting area of rectangleA and rectangleB.

Edges that touch (but don't overlap) are not considered to be overlapping.

If the rectangles do not intersect, returns rectangle {{0,0},{0,0}}.

Changed in Vuo 2.0.0:
New.

Definition at line 126 of file VuoRectangle.c.

◆ VuoRectangle_isLessThan()

bool VuoRectangle_isLessThan ( const VuoRectangle  a,
const VuoRectangle  b 
)

Compares a to b primarily by center-value and secondarily by size-value, returning true if a is less than b.

Changed in Vuo 2.0.0:
New.

Definition at line 97 of file VuoRectangle.c.

◆ VuoRectangle_isPointInside()

bool VuoRectangle_isPointInside ( VuoRectangle  r,
VuoPoint2d  p 
)

Returns true if p is inside r.

Changed in Vuo 2.0.0:
New.

Definition at line 109 of file VuoRectangle.c.

◆ VuoRectangle_make()

static VuoRectangle VuoRectangle_make ( float  centerX,
float  centerY,
float  width,
float  height 
) const
inlinestatic

Returns a rectangle with the specified coordinates.

Definition at line 53 of file VuoRectangle.h.

◆ VuoRectangle_makeFromJson()

VuoRectangle VuoRectangle_makeFromJson ( json_object js)

Decodes the JSON object js to create a new value.

Example:
{
"center" : [0,0],
"size" : [1,1]
}
Changed in Vuo 2.0.0:
New.

Definition at line 47 of file VuoRectangle.c.

◆ VuoRectangle_makeFromString()

VuoRectangle VuoRectangle_makeFromString ( const char *  str)

Automatically generated function.

◆ VuoRectangle_makeTopLeft()

static VuoRectangle VuoRectangle_makeTopLeft ( float  leftX,
float  topY,
float  width,
float  height 
) const
inlinestatic

Returns a rectangle with the specified coordinates.

Definition at line 62 of file VuoRectangle.h.

◆ VuoRectangle_release()

void VuoRectangle_release ( VuoRectangle  r)

Automatically generated function.

◆ VuoRectangle_retain()

void VuoRectangle_retain ( VuoRectangle  r)

Automatically generated function.

◆ VuoRectangle_union()

VuoRectangle VuoRectangle_union ( VuoRectangle  rectangleA,
VuoRectangle  rectangleB 
)

Returns the union area of rectangleA and rectangleB.

Changed in Vuo 2.0.0:
New.

Definition at line 166 of file VuoRectangle.c.