1.10 <GrapheneRay>

Structure: <GrapheneRay>

A ray emitted from an origin in a given direction.

The contents of the <GrapheneRay> structure are private, and should not be modified directly.

Procedures

Procedure: ray:alloc ⇒ %return

Allocates a new <GrapheneRay> structure.

The contents of the returned structure are undefined.

%return

Returned: a <GrapheneRay>.

the newly allocated <GrapheneRay>. Use ray:free to free the resources allocated by this function

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

Checks whether the two given <GrapheneRay> are equal.

self

Passed: a <GrapheneRay>.

a <GrapheneRay>

b

Passed: a <GrapheneRay>.

a <GrapheneRay>

%return

Returned: a boolean.

true if the given rays are equal

Method: ray:free self
Method: free self

Frees the resources allocated by ray:alloc.

self

Passed: a <GrapheneRay>.

a <GrapheneRay>

Method: ray:get-closest-point-to-point! self p res ⇒ res
Method: get-closest-point-to-point! self p res ⇒ res

Computes the point on the given <GrapheneRay> that is closest to the given point p.

self

Passed: a <GrapheneRay>.

a <GrapheneRay>

p

Passed: a <GraphenePoint3D>.

a <GraphenePoint3D>

res

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

return location for the closest point3d

Method: ray:get-direction! self direction ⇒ direction
Method: get-direction! self direction ⇒ direction

Retrieves the direction of the given <GrapheneRay>.

self

Passed: a <GrapheneRay>.

a <GrapheneRay>

direction

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

return location for the direction

Method: ray:get-distance-to-plane self p ⇒ %return
Method: get-distance-to-plane self p ⇒ %return

Computes the distance of the origin of the given <GrapheneRay> from the given plane.

If the ray does not intersect the plane, this function returns INFINITY.

self

Passed: a <GrapheneRay>.

a <GrapheneRay>

p

Passed: a <GraphenePlane>.

a <GraphenePlane>

%return

Returned: a real number.

the distance of the origin of the ray from the plane

Method: ray:get-distance-to-point self p ⇒ %return
Method: get-distance-to-point self p ⇒ %return

Computes the distance of the closest approach between the given <GrapheneRay> self and the point p.

The closest approach to a ray from a point is the distance between the point and the projection of the point on the ray itself.

self

Passed: a <GrapheneRay>.

a <GrapheneRay>

p

Passed: a <GraphenePoint3D>.

a <GraphenePoint3D>

%return

Returned: a real number.

the distance of the point

Method: ray:get-origin! self origin ⇒ origin
Method: get-origin! self origin ⇒ origin

Retrieves the origin of the given <GrapheneRay>.

self

Passed: a <GrapheneRay>.

a <GrapheneRay>

origin

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

return location for the origin

Method: ray:get-position-at! self t position ⇒ position
Method: get-position-at! self t position ⇒ position

Retrieves the coordinates of a point at the distance t along the given <GrapheneRay>.

self

Passed: a <GrapheneRay>.

a <GrapheneRay>

t

Passed: a real number.

the distance along the ray

position

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

return location for the position

Method: ray:init self [origin] [direction] ⇒ %return
Method: init self [origin] [direction] ⇒ %return

Initializes the given <GrapheneRay> using the given origin and direction values.

self

Passed: a <GrapheneRay>.

the <GrapheneRay> to initialize

origin

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

the origin of the ray

direction

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

the direction vector

%return

Returned: a <GrapheneRay>.

the initialized ray

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

Initializes the given <GrapheneRay> using the origin and direction values of another <GrapheneRay>.

self

Passed: a <GrapheneRay>.

the <GrapheneRay> to initialize

src

Passed: a <GrapheneRay>.

a <GrapheneRay>

%return

Returned: a <GrapheneRay>.

the initialized ray

Method: ray:init-from-vec3 self [origin] [direction] ⇒ %return
Method: init-from-vec3 self [origin] [direction] ⇒ %return

Initializes the given <GrapheneRay> using the given vectors.

self

Passed: a <GrapheneRay>.

the <GrapheneRay> to initialize

origin

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

a <GrapheneVec3>

direction

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

a <GrapheneVec3>

%return

Returned: a <GrapheneRay>.

the initialized ray

Method: ray:intersect-box self b ⇒ %return t-out
Method: intersect-box self b ⇒ %return t-out

Intersects the given <GrapheneRay> self with the given <GrapheneBox> b.

self

Passed: a <GrapheneRay>.

a <GrapheneRay>

b

Passed: a <GrapheneBox>.

a <GrapheneBox>

%return

Returned: a <%GrapheneRayIntersectionKind>.

the type of intersection

t-out

Returned: a real number.

the distance of the point on the ray that intersects the box

Method: ray:intersect-sphere self s ⇒ %return t-out
Method: intersect-sphere self s ⇒ %return t-out

Intersects the given <GrapheneRay> self with the given <GrapheneSphere> s.

self

Passed: a <GrapheneRay>.

a <GrapheneRay>

s

Passed: a <GrapheneSphere>.

a <GrapheneSphere>

%return

Returned: a <%GrapheneRayIntersectionKind>.

the type of intersection

t-out

Returned: a real number.

the distance of the point on the ray that intersects the sphere

Method: ray:intersect-triangle self t ⇒ %return t-out
Method: intersect-triangle self t ⇒ %return t-out

Intersects the given <GrapheneRay> self with the given <GrapheneTriangle> t.

self

Passed: a <GrapheneRay>.

a <GrapheneRay>

t

Passed: a <GrapheneTriangle>.

a <GrapheneTriangle>

%return

Returned: a <%GrapheneRayIntersectionKind>.

the type of intersection

t-out

Returned: a real number.

the distance of the point on the ray that intersects the triangle

Method: ray:intersects-box? self b ⇒ %return
Method: intersects-box? self b ⇒ %return

Checks whether the given <GrapheneRay> self intersects the given <GrapheneBox> b.

See also: ray:intersect-box

self

Passed: a <GrapheneRay>.

a <GrapheneRay>

b

Passed: a <GrapheneBox>.

a <GrapheneBox>

%return

Returned: a boolean.

true if the ray intersects the box

Method: ray:intersects-sphere? self s ⇒ %return
Method: intersects-sphere? self s ⇒ %return

Checks if the given <GrapheneRay> self intersects the given <GrapheneSphere> s.

See also: ray:intersect-sphere

self

Passed: a <GrapheneRay>.

a <GrapheneRay>

s

Passed: a <GrapheneSphere>.

a <GrapheneSphere>

%return

Returned: a boolean.

true if the ray intersects the sphere

Method: ray:intersects-triangle? self t ⇒ %return
Method: intersects-triangle? self t ⇒ %return

Checks whether the given <GrapheneRay> self intersects the given <GrapheneTriangle> b.

See also: ray:intersect-triangle

self

Passed: a <GrapheneRay>.

a <GrapheneRay>

t

Passed: a <GrapheneTriangle>.

a <GrapheneTriangle>

%return

Returned: a boolean.

true if the ray intersects the triangle