1.8 <GrapheneQuad>

Structure: <GrapheneQuad>

A 4 vertex quadrilateral, as represented by four <GraphenePoint>.

The contents of a <GrapheneQuad> are private and should never be accessed directly.

Procedures

Procedure: quad:alloc ⇒ %return

Allocates a new <GrapheneQuad> instance.

The contents of the returned instance are undefined.

%return

Returned: a <GrapheneQuad>.

the newly created <GrapheneQuad> instance

Method: quad:bounds! self r ⇒ r
Method: bounds! self r ⇒ r

Computes the bounding rectangle of self and places it into r.

self

Passed: a <GrapheneQuad>.

a <GrapheneQuad>

r

Passed, filled in, and returned: a <GrapheneRect>.

return location for a <GrapheneRect>

Method: quad:contains? self p ⇒ %return
Method: contains? self p ⇒ %return

Checks if the given <GrapheneQuad> contains the given <GraphenePoint>.

self

Passed: a <GrapheneQuad>.

a <GrapheneQuad>

p

Passed: a <GraphenePoint>.

a <GraphenePoint>

%return

Returned: a boolean.

true if the point is inside the <GrapheneQuad>

Method: quad:free self
Method: free self

Frees the resources allocated by quad:alloc

self

Passed: a <GrapheneQuad>.

a <GrapheneQuad>

Method: quad:get-point self index- ⇒ %return
Method: get-point self index- ⇒ %return

Retrieves the point of a <GrapheneQuad> at the given index.

self

Passed: a <GrapheneQuad>.

a <GrapheneQuad>

index-

Passed: an unsigned 32-bit integer.

the index of the point to retrieve

%return

Returned: a <GraphenePoint>.

a <GraphenePoint>

Method: quad:init self p1 p2 p3 p4 ⇒ %return
Method: init self p1 p2 p3 p4 ⇒ %return

Initializes a <GrapheneQuad> with the given points.

self

Passed: a <GrapheneQuad>.

the <GrapheneQuad> to initialize

p1

Passed: a <GraphenePoint>.

the first point of the quadrilateral

p2

Passed: a <GraphenePoint>.

the second point of the quadrilateral

p3

Passed: a <GraphenePoint>.

the third point of the quadrilateral

p4

Passed: a <GraphenePoint>.

the fourth point of the quadrilateral

%return

Returned: a <GrapheneQuad>.

the initialized <GrapheneQuad>

Method: quad:init-from-points self points ⇒ %return
Method: init-from-points self points ⇒ %return

Initializes a <GrapheneQuad> using an array of points.

self

Passed: a <GrapheneQuad>.

the <GrapheneQuad> to initialize

points

Passed: a list or vector, each a <GraphenePoint>.

an array of 4 <GraphenePoint>

%return

Returned: a <GrapheneQuad>.

the initialized <GrapheneQuad>

Method: quad:init-from-rect self r ⇒ %return
Method: init-from-rect self r ⇒ %return

Initializes a <GrapheneQuad> using the four corners of the given <GrapheneRect>.

self

Passed: a <GrapheneQuad>.

the <GrapheneQuad> to initialize

r

Passed: a <GrapheneRect>.

a <GrapheneRect>

%return

Returned: a <GrapheneQuad>.

the initialized <GrapheneQuad>