1.1 <GrapheneBox>

Structure: <GrapheneBox>

A 3D box, described as the volume between a minimum and a maximum vertices.

Procedures

Procedure: box:alloc ⇒ %return

Allocates a new <GrapheneBox>.

The contents of the returned structure are undefined.

%return

Returned: a <GrapheneBox>.

the newly allocated <GrapheneBox> structure. Use box:free to free the resources allocated by this function

Method: box:contains-box? self b ⇒ %return
Method: contains-box? self b ⇒ %return

Checks whether the <GrapheneBox> self contains the given <GrapheneBox> b.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

b

Passed: a <GrapheneBox>.

a <GrapheneBox>

%return

Returned: a boolean.

true if the box is contained in the given box

Method: box:contains-point? self point ⇒ %return
Method: contains-point? self point ⇒ %return

Checks whether self contains the given point.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

point

Passed: a <GraphenePoint3D>.

the coordinates to check

%return

Returned: a boolean.

true if the point is contained in the given box

Procedure: box:empty ⇒ %return

A degenerate <GrapheneBox> that can only be expanded.

The returned value is owned by Graphene and should not be modified or freed.

%return

Returned: a <GrapheneBox>.

a <GrapheneBox>

Method: box:equal? self b ⇒ %return
Method: equal? self b ⇒ %return

Checks whether the two given boxes are equal.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

b

Passed: a <GrapheneBox>.

a <GrapheneBox>

%return

Returned: a boolean.

true if the boxes are equal

Method: box:expand! self point res ⇒ res
Method: expand! self point res ⇒ res

Expands the dimensions of self to include the coordinates at point.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

point

Passed: a <GraphenePoint3D>.

the coordinates of the point to include

res

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

return location for the expanded box

Method: box:expand-scalar! self scalar res ⇒ res
Method: expand-scalar! self scalar res ⇒ res

Expands the dimensions of self by the given scalar value.

If scalar is positive, the <GrapheneBox> will grow; if scalar is negative, the <GrapheneBox> will shrink.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

scalar

Passed: a real number.

a scalar value

res

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

return location for the expanded box

Method: box:expand-vec3! self vec res ⇒ res
Method: expand-vec3! self vec res ⇒ res

Expands the dimensions of self to include the coordinates of the given vector.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

vec

Passed: a <GrapheneVec3>.

the coordinates of the point to include, as a <GrapheneVec3>

res

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

return location for the expanded box

Method: box:free self
Method: free self

Frees the resources allocated by box:alloc.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

Method: box:get-bounding-sphere! self sphere ⇒ sphere
Method: get-bounding-sphere! self sphere ⇒ sphere

Computes the bounding <GrapheneSphere> capable of containing the given <GrapheneBox>.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

sphere

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

return location for the bounding sphere

Method: box:get-center! self center ⇒ center
Method: get-center! self center ⇒ center

Retrieves the coordinates of the center of a <GrapheneBox>.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

center

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

return location for the coordinates of the center

Method: box:get-depth self ⇒ %return
Method: get-depth self ⇒ %return

Retrieves the size of the self on the Z axis.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

%return

Returned: a real number.

the depth of the box

Method: box:get-height self ⇒ %return
Method: get-height self ⇒ %return

Retrieves the size of the self on the Y axis.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

%return

Returned: a real number.

the height of the box

Method: box:get-max! self max ⇒ max
Method: get-max! self max ⇒ max

Retrieves the coordinates of the maximum point of the given <GrapheneBox>.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

max

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

return location for the maximum point

Method: box:get-min! self min ⇒ min
Method: get-min! self min ⇒ min

Retrieves the coordinates of the minimum point of the given <GrapheneBox>.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

min

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

return location for the minimum point

Method: box:get-size! self size ⇒ size
Method: get-size! self size ⇒ size

Retrieves the size of the box on all three axes, and stores it into the given size vector.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

size

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

return location for the size

Method: box:get-vertices! self vertices ⇒ vertices
Method: get-vertices! self vertices ⇒ vertices

Computes the vertices of the given <GrapheneBox>.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

vertices

Passed: a list or vector, each a <GrapheneVec3>. It is filled in, and returned: a vector, each a <GrapheneVec3>.

return location for an array of 8 <GrapheneVec3>

Method: box:get-width self ⇒ %return
Method: get-width self ⇒ %return

Retrieves the size of the self on the X axis.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

%return

Returned: a real number.

the width of the box

Procedure: box:infinite ⇒ %return

A degenerate <GrapheneBox> that cannot be expanded.

The returned value is owned by Graphene and should not be modified or freed.

%return

Returned: a <GrapheneBox>.

a <GrapheneBox>

Method: box:init self [min] [max] ⇒ %return
Method: init self [min] [max] ⇒ %return

Initializes the given <GrapheneBox> with two vertices.

self

Passed: a <GrapheneBox>.

the <GrapheneBox> to initialize

min

Passed, or left out: a <GraphenePoint3D>, or #f.

the coordinates of the minimum vertex

max

Passed, or left out: a <GraphenePoint3D>, or #f.

the coordinates of the maximum vertex

%return

Returned: a <GrapheneBox>.

the initialized <GrapheneBox>

Method: box:init-from-box self src ⇒ %return
Method: init-from-box self src ⇒ %return

Initializes the given <GrapheneBox> with the vertices of another <GrapheneBox>.

self

Passed: a <GrapheneBox>.

the <GrapheneBox> to initialize

src

Passed: a <GrapheneBox>.

a <GrapheneBox>

%return

Returned: a <GrapheneBox>.

the initialized <GrapheneBox>

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

Initializes the given <GrapheneBox> with the given array of vertices.

If n-points is 0, the returned box is initialized with box-empty.

self

Passed: a <GrapheneBox>.

the <GrapheneBox> to initialize

points

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

an array of <GraphenePoint3D>

%return

Returned: a <GrapheneBox>.

the initialized <GrapheneBox>

n-points

Not passed: guile-gi gives the length of points.

the number <GraphenePoint3D> in the points array

Method: box:init-from-vec3 self [min] [max] ⇒ %return
Method: init-from-vec3 self [min] [max] ⇒ %return

Initializes the given <GrapheneBox> with two vertices stored inside <GrapheneVec3>.

self

Passed: a <GrapheneBox>.

the <GrapheneBox> to initialize

min

Passed, or left out: a <GrapheneVec3>, or #f.

the coordinates of the minimum vertex

max

Passed, or left out: a <GrapheneVec3>, or #f.

the coordinates of the maximum vertex

%return

Returned: a <GrapheneBox>.

the initialized <GrapheneBox>

Method: box:init-from-vectors self vectors ⇒ %return
Method: init-from-vectors self vectors ⇒ %return

Initializes the given <GrapheneBox> with the given array of vertices.

If n-vectors is 0, the returned box is initialized with box-empty.

self

Passed: a <GrapheneBox>.

the <GrapheneBox> to initialize

vectors

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

an array of <GrapheneVec3>

%return

Returned: a <GrapheneBox>.

the initialized <GrapheneBox>

n-vectors

Not passed: guile-gi gives the length of vectors.

the number <GraphenePoint3D> in the vectors array

Method: box:intersection! self b res ⇒ %return res
Method: intersection! self b res ⇒ %return res

Intersects the two given <GrapheneBox>.

If the two boxes do not intersect, res will contain a degenerate box initialized with box-empty.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

b

Passed: a <GrapheneBox>.

a <GrapheneBox>

res

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

return location for the result

%return

Returned: a boolean.

true if the two boxes intersect

Procedure: box:minus-one ⇒ %return

A <GrapheneBox> with the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (0, 0, 0).

The returned value is owned by Graphene and should not be modified or freed.

%return

Returned: a <GrapheneBox>.

a <GrapheneBox>

Procedure: box:one ⇒ %return

A <GrapheneBox> with the minimum vertex set at (0, 0, 0) and the maximum vertex set at (1, 1, 1).

The returned value is owned by Graphene and should not be modified or freed.

%return

Returned: a <GrapheneBox>.

a <GrapheneBox>

Procedure: box:one-minus-one ⇒ %return

A <GrapheneBox> with the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (1, 1, 1).

The returned value is owned by Graphene and should not be modified or freed.

%return

Returned: a <GrapheneBox>.

a <GrapheneBox>

Method: box:union! self b res ⇒ res
Method: union! self b res ⇒ res

Unions the two given <GrapheneBox>.

self

Passed: a <GrapheneBox>.

a <GrapheneBox>

b

Passed: a <GrapheneBox>.

the box to union to self

res

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

return location for the result

Procedure: box:zero ⇒ %return

A <GrapheneBox> with both the minimum and maximum vertices set at (0, 0, 0).

The returned value is owned by Graphene and should not be modified or freed.

%return

Returned: a <GrapheneBox>.

a <GrapheneBox>