Skip to main content

bounding-box-h

source

Types


bounding-box

bounding-box: structuresource
Fields
min: vector
max: vector
Methods
add-spheres!(obj: bounding-box, spheres: inline-array, count: int) => intsource
Add count spheres.
add-box!(obj: bounding-box, arg0: bounding-box) => intsource
Expand the box as needed to contain the given box.
add-point!(obj: bounding-box, arg0: vector) => nonesource
Expand the box as needed to contain the given point.
intersects-line-segment?(obj: bounding-box, arg0: vector, arg1: vector) => symbolsource
Check intersection in xz plane, using liang-barsky. Not sure if this actually
a useful check or not...
set-from-point-offset!(obj: bounding-box, arg0: vector, arg1: vector) => nonesource
Set to the smallest box containing arg0, (arg0 + arg1)
set-from-point-offset-pad!(obj: bounding-box, arg0: vector, arg1: vector, arg2: float) => intsource
Set the box to contain arg0, arg0 + offset, with some padding.
set-to-point!(obj: bounding-box, arg0: vector) => nonesource
Set the box to be a single point.
set-from-sphere!(obj: bounding-box, arg0: sphere) => nonesource
Set the box to contain a single sphere.
set-from-spheres!(obj: bounding-box, spheres: inline-array, count: int) => intsource
Reset box to hold the given spheres. Note: this implementation could be optimized.
get-bounding-sphere(obj: bounding-box, arg0: vector) => vectorsource
Get a bounding sphere for a bounding box.
inside-xyz?(obj: bounding-box, arg0: vector) => symbolsource
Is the point in the box?
inside-xz?(obj: bounding-box, arg0: vector) => symbolsource
Is the point in the box? Check xz only.

bounding-box-array

bounding-box-array: inline-array-classsource
Fields
type: type
length: int32
allocated-length: int32
_data: uint8
data: bounding-box

bounding-box-both

bounding-box-both: structuresource

bounding-box4w

bounding-box4w: structuresource
Fields
min: vector4w
max: vector4w

bounding-box

source
Expand description
Implementation of bounding box functions.

These boxes are used as a primitive in the foreground collision system.
### Types ---

liang-barsky-line-clip-params

liang-barsky-line-clip-params: structuresource
Fields
te: float
tl: float

Functions


box-vector-enside?

box-vector-enside?(arg0: bounding-box, arg1: vector) => symbolsource
Is the point in the box? On the edge doesn't count.

box-vector-inside?

box-vector-inside?(arg0: bounding-box, arg1: vector) => symbolsource
Is the point in the box? On the edge counts.

liang-barsky-line-clipt

liang-barsky-line-clipt(arg0: liang-barsky-line-clip-params, arg1: float, arg2: float) => symbolsource
Clip test in 1 dimension. Is arg1 in arg2?

cylinder

source

Types


cylinder-flat-verts

cylinder-flat-verts: structuresource
Fields
vert: vector

cylinder-verts

cylinder-verts: structuresource
Fields
vert: vector

Functions


ray-arbitrary-circle-intersect

ray-arbitrary-circle-intersect(arg0: vector, arg1: vector, arg2: vector, arg3: vector, arg4: float) => floatsource

geometry-h

source

Types


border-plane

border-plane: basicsource
Fields
type: type
name: symbol
action: basic
slot: int8
trans: vector
normal: vector
Methods
debug-draw(obj: border-plane) => intsource
point-past-plane?(obj: border-plane, arg0: vector) => symbolsource

curve

curve: structuresource
Fields
cverts: inline-array
num-cverts: int32
knots: pointer
num-knots: int32
length: float

geometry

source

Functions


calculate-basis-functions-vector!

calculate-basis-functions-vector!(arg0: vector, arg1: int, arg2: float, arg3: pointer) => vectorsource
Calculate polynomial basis for a given control point.

circle-circle-xz-intersect

circle-circle-xz-intersect(arg0: sphere, arg1: sphere, arg2: vector, arg3: vector) => intsource

circle-test

circle-test() => nonesource
Test the circle-circle-xz-intersect function.

closest-pt-in-triangle

closest-pt-in-triangle(arg0: vector, arg1: vector, arg2: matrix, arg3: vector) => nonesource
arg2 is the vertices of the triangle, arg3 is the normal, arg1 is the input point, arg0 is the output.

curve-closest-point

curve-closest-point(arg0: curve, arg1: vector, arg2: float, arg3: float, arg4: int, arg5: float) => floatsource
Get the input value for the point on the curve. Approximate! And is O(n_knots)

curve-copy!

curve-copy!(arg0: curve, arg1: curve) => curvesource
Shallow copy a curve.

curve-evaluate!

curve-evaluate!(arg0: vector, arg1: float, arg2: inline-array, arg3: int, arg4: pointer, arg5: int) => vectorsource
Evaluate a curve.
arg0 is the output
arg1 is the input.
arg2 is control vertices
arg3 is the number of control vertices
arg4 is the knot points
arg5 is the number of knots

curve-get-pos!

curve-get-pos!(arg0: vector, arg1: float, arg2: curve) => vectorsource
Get the position on the curve at the given input.

curve-length

curve-length(arg0: curve) => floatsource
Compute the approximate curve length as the sum of distances between knots.

find-knot-span

find-knot-span(arg0: int, arg1: int, arg2: float, arg3: inline-array) => intsource
Binary serach over knots to find which contains the value float in (arg0 arg1). Unused.

forward-down->inv-matrix

forward-down->inv-matrix(arg0: matrix, arg1: vector, arg2: vector) => matrixsource
Create a matrix representing an inverse transform where arg1 is forward (+z) and arg2 is down (-y). Will have the pitch of forward

forward-down-nopitch->inv-matrix

forward-down-nopitch->inv-matrix(arg0: matrix, arg1: vector, arg2: vector) => matrixsource
Create a matrix representing an inverse transform where arg1 is forward (+z) and arg2 is down (-y). Will not use the pitch of forward

forward-up->inv-matrix

forward-up->inv-matrix(arg0: matrix, arg1: vector, arg2: vector) => matrixsource
Create a matrix representing an inverse transform where arg1 is forward (+z) and arg2 is up (+y). Will use the pitch of forward

forward-up->quaternion

forward-up->quaternion(arg0: quaternion, arg1: vector, arg2: vector) => quaternionsource
Create a quaternion representing a transform where arg1 is forward (+z) and arg2 is up (+y). Will use the pitch of forward

forward-up-nopitch->inv-matrix

forward-up-nopitch->inv-matrix(arg0: matrix, arg1: vector, arg2: vector) => matrixsource
Create a matrix representing an inverse transform where arg1 is forward (+z) and arg2 is up (+y). Will not use the pitch of forward

forward-up-nopitch->quaternion

forward-up-nopitch->quaternion(arg0: quaternion, arg1: vector, arg2: vector) => quaternionsource
Create a quaternion representing a transform where arg1 is forward (+z) and arg2 is up (+y). Will not use the pitch of forward

intersect-ray-plane

intersect-ray-plane(arg0: vector, arg1: vector, arg2: vector, arg3: vector) => floatsource
arg1 is ray direction, arg3 is plane normal, others don't really make sense to me.

line-sphere-intersection?

line-sphere-intersection?(arg0: vector, arg1: vector, arg2: vector) => symbolsource
Does [arg1, arg2] intersect sphere arg0?

matrix-from-two-vectors!

matrix-from-two-vectors!(arg0: matrix, arg1: vector, arg2: vector) => matrixsource
Create a rotation matrix representing the rotation between two vectors

matrix-from-two-vectors-max-angle!

matrix-from-two-vectors-max-angle!(arg0: matrix, arg1: vector, arg2: vector, arg3: float) => matrixsource
Create a rotation matrix representing the rotation between two vectors, allowing at most a rotation of arg3 degrees

matrix-from-two-vectors-max-angle-partial!

matrix-from-two-vectors-max-angle-partial!(arg0: matrix, arg1: vector, arg2: vector, arg3: float, arg4: float) => matrixsource
Create a rotation matrix representing the given fraction of the rotation between two heading vectors,
rotating by at most the given angle.

matrix-from-two-vectors-partial-linear!

matrix-from-two-vectors-partial-linear!(arg0: matrix, arg1: vector, arg2: vector, arg3: float) => matrixsource
Create a rotation matrix representing doing arg3 fraction of the rotation between two vectors.

matrix-from-two-vectors-smooth!

matrix-from-two-vectors-smooth!(arg0: matrix, arg1: vector, arg2: vector, arg3: float, arg4: int) => matrixsource
This function can help smoothly rotate from a current heading vector to a target one.
It returns a rotation to move arg1 closer to arg2, subject to two different speed limits.
arg3 is a rotations-per-frame rate. This limit takes frame rate into account (when lagging, the rotation is larger)
arg4 is a 'slow down when getting close to the end' limit.
This is used in rotate-toward-orientation, which is much improved from jak 1.

matrix-from-two-vectors-the-long-way-smooth!

matrix-from-two-vectors-the-long-way-smooth!(arg0: matrix, arg1: vector, arg2: vector, arg3: float, arg4: int) => matrixsource
Same as above, but rotates you away from the target.
Note that the 'near the end' smoothing will apply when you're near the target.

matrix-remove-z-rot

matrix-remove-z-rot(arg0: matrix, arg1: vector) => matrixsource
Remove the z rotation component of a rotation.

matrix-rot-diff!

matrix-rot-diff!(arg0: vector, arg1: matrix, arg2: matrix) => floatsource
Get the difference of rotation between two matrices, expressed as a quaternion.

normal-of-plane

normal-of-plane(arg0: vector, arg1: vector, arg2: vector, arg3: vector) => vectorsource
Given three points on a plane, compute the plane's normal

point-in-plane-<-point+normal!

point-in-plane-<-point+normal!(arg0: vector, arg1: vector, arg2: vector) => vectorsource
Very strange function. Takes a plane, in point-normal form, then returns some other point on that plane.
It will move 1m in two of &lcub;x, y, z&rcub; directions. The direction not moved in is the one which is closest to point-in-triangle-cross
in the same direction of the normal (this prevent moving huge distances for nearly vertical planes for example).

point-in-triangle-cross

point-in-triangle-cross(arg0: vector, arg1: vector, arg2: vector, arg3: vector, arg4: vector) => symbolsource
Check if point is in the triangle using cross product check (so you have to get the order of points right)

quaternion-from-two-vectors!

quaternion-from-two-vectors!(arg0: quaternion, arg1: vector, arg2: vector) => quaternionsource
Create a quaternion representing the rotation between two vectors

quaternion-from-two-vectors-max-angle!

quaternion-from-two-vectors-max-angle!(arg0: quaternion, arg1: vector, arg2: vector, arg3: float) => quaternionsource
Create a quaternion representing the rotation between two vectors, allowing at most a rotation of arg3 degrees

quaternion-from-two-vectors-max-angle-partial!

quaternion-from-two-vectors-max-angle-partial!(arg0: quaternion, arg1: vector, arg2: vector, arg3: float, arg4: float) => quaternionsource
Create a quaternion representing the arg4 fraction of the rotation between two vectors, allowing at most a rotation of arg3 degrees

quaternion-from-two-vectors-partial!

quaternion-from-two-vectors-partial!(arg0: quaternion, arg1: vector, arg2: vector, arg3: float) => quaternionsource
Create a quaternion representing the rotation between two vectors, doing arg3 fraction of the total rotation.

quaternion-from-two-vectors-smooth!

quaternion-from-two-vectors-smooth!(arg0: quaternion, arg1: vector, arg2: vector, arg3: float, arg4: int) => quaternionsource
Same as above, but returns a quaternion.

quaternion-seek

quaternion-seek(arg0: quaternion, arg1: quaternion, arg2: quaternion, arg3: float, arg4: float) => quaternionsource
Strange quaternion rotate toward function. Arg3 is ignored. Arg4 is the max seek amount.

vector-3pt-cross!

vector-3pt-cross!(arg0: vector, arg1: vector, arg2: vector, arg3: vector) => vectorsource
Cross product of 2 - 1 and 3 - 1. (will give a normal to the plane, but not of magnitude 1)

vector-circle-tangent

vector-circle-tangent(arg0: vector, arg1: vector, arg2: vector, arg3: vector) => nonesource
Also unused.

vector-circle-tangent-new

vector-circle-tangent-new(arg0: vector, arg1: vector, arg2: vector, arg3: vector) => nonesource
Unused.

vector-deg-seek

vector-deg-seek(arg0: vector, arg1: vector, arg2: vector, arg3: float) => vectorsource
Make one vector closer to another, doing at most a rotation by arg3 degrees.

vector-deg-slerp

vector-deg-slerp(arg0: vector, arg1: vector, arg2: vector, arg3: float) => vectorsource
Slerp for vectors. (imagine that they are the z axis of two frames)

vector-flatten!

vector-flatten!(arg0: vector, arg1: vector, arg2: vector) => vectorsource
Get the projection of src onto a plane with the given normal
The normal should have magnitude 1.0.

vector-inv-orient-by-quat!

vector-inv-orient-by-quat!(arg0: vector, arg1: vector, arg2: quaternion) => vectorsource
Rotate a vector by the inverse rotation.

vector-line-distance

vector-line-distance(arg0: vector, arg1: vector, arg2: vector) => floatsource
Weird function: given a point arg1, and an infinite line connecting arg2 and arg1, compute the distance
from arg0 to that line.

vector-line-distance-point!

vector-line-distance-point!(arg0: vector, arg1: vector, arg2: vector, arg3: vector) => floatsource
Same as above function, but returns the point on arg2/arg1 in arg3 (ignored if #f)

vector-orient-by-quat!

vector-orient-by-quat!(arg0: vector, arg1: vector, arg2: quaternion) => vectorsource
Rotate a vector by a quaternion.

vector-plane-distance

vector-plane-distance(arg0: vector, arg1: plane, arg2: vector) => floatsource
Unused

vector-reflect!

vector-reflect!(arg0: vector, arg1: vector, arg2: vector) => vectorsource
Reflect a vector off of a plane.

vector-reflect-flat!

vector-reflect-flat!(arg0: vector, arg1: vector, arg2: vector) => vectorsource
This is a weird one. It doesn't care about the value of src dot normal
and it effectively replaces the component of src normal to the plane with
the plane's normal. I think this requires src/normal to both be unit vectors
in order to make sense.
NOTE: src should point from positive halfspace to negative otherwise it
doesn't work.

vector-reflect-flat-above!

vector-reflect-flat-above!(arg0: vector, arg1: vector, arg2: vector) => vectorsource
Not really a reflect. Same as flatten

vector-reflect-flat-gravity!

vector-reflect-flat-gravity!(arg0: vector, arg1: vector, arg2: vector, arg3: vector) => vectorsource

vector-segment-distance-point!

vector-segment-distance-point!(arg0: vector, arg1: vector, arg2: vector, arg3: vector) => floatsource
Compute the distance from a point to the closest point on the line segment.
arg0 is the point. arg1/arg2 are the endpoints of the line segment.
arg3 is an optional output closest point.

vector-segment-overlap

vector-segment-overlap(arg0: vector, arg1: vector, arg2: vector) => floatsource
Seems to compute (v1 - v0).dot(v2 - v1), but in a weird way.

vector-vector-deg-slerp!

vector-vector-deg-slerp!(arg0: vector, arg1: vector, arg2: vector, arg3: float, arg4: vector) => vectorsource
unused. no clue what this does.

path-h

source

Types


curve-control

curve-control: path-controlsource
Fields
type: type
flags: path-control-flag
name: symbol
process: process-drawable
curve: curve

path-control

path-control: basicsource
Fields
type: type
flags: path-control-flag
name: symbol
process: process-drawable
curve: curve
Methods
debug-draw(obj: path-control) => nonesource
get-point-in-path!(obj: path-control, ret: vector, idx: float, search-type: symbol) => vectorsource
Depending on the value of `idx`, the result can be quite different:
- if `idx` is less than `0.0` - return the first vertex in the path
- if `idx` is greater than the number of vertices in the path, return the last vertex
- if `search-type` is equal to `exact` OR `idx` is an integral number (ex 1.0), return that vertex
- otherwise, do a linear interpolation between the vertex at `idx` (truncated) and the next vertex
using the fractional component of `idx` as the interpolant, return this result
get-random-point(obj: path-control, arg0: vector) => vectorsource
Attempts to retrieve a random point along the path, returns the *null-vector* if no vertices are defined
displacement-between-two-points-copy!(obj: path-control, ret: vector, idx: float, mag: float) => vectorsource
Calls path-control::26 with the provided args
@see path-control::26
displacement-between-two-points-normalized!(obj: path-control, ret: vector, idx: float) => vectorsource
Calls [[path-control::26], with the provided `idx`
@see path-control::26
get-point-at-percent-along-path!(obj: path-control, ret: vector, percent: float, search-type: symbol) => vectorsource
displacement-between-points-at-percent-scaled!(obj: path-control, ret: vector, percent: float, mag: float) => vectorsource
Calls [[path-control::12], with the `idx` at a given percent along the path
displacement-between-points-at-percent-normalized!(obj: path-control, ret: vector, percent: float) => vectorsource
Calls [[path-control::13], with the `idx` at a given percent along the path
@see [[path-control::13]]
@see path-control::14
get-num-segments(obj: path-control) => floatsource
total-distance(obj: path-control) => floatsource
Calcuate the total path length by summing the distance between each adjacent curve vertex
get-num-verts(obj: path-control) => intsource
path-distance-equal-spacing(obj: path-control, arg0: float) => floatsource
average-segment-length(obj: path-control, arg0: float) => floatsource
get-furthest-point-on-path(obj: path-control, point: vector) => floatsource
get-path-percentage-at-furthest-point(obj: path-control, point: vector) => floatsource
path-control-method-24(obj: path-control, arg0: vector) => vectorsource
TODO
should-display-marks?(obj: path-control) => symbolsource
displacement-between-two-points!(obj: path-control, ret: vector, idx: float, mag: float) => vectorsource
Return value can differ quite a bit:
- If path-control-flag::4 is set OR there are less than 2 vertices OR `idx` is less than `0.0` - return [[*null-vector*]]
- Otherwise, find the scaled (by `mag`) displacement vector between two points in the path:
- If `idx` is not beyond the second last vertex, the result is between vertex `idx` and `idx+1`
- else, the result is between the second last vertex and the last

Types


plane-volume

plane-volume: structuresource
Fields
volume-type: symbol
point-count: int16
normal-count: int16
first-point: pointer
first-normal: pointer
num-planes: int32
plane: inline-array
Methods
plane-volume-method-9(obj: plane-volume, arg0: symbol, arg1: vector-array, arg2: vector-array) => plane-volumesource
debug-draw(obj: plane-volume) => nonesource
point-in-vol?(obj: plane-volume, arg0: vector, arg1: float) => symbolsource
TODO - Checks if the given vector point is inside the volume defined by 6 [[plane]]s by atleast the padding value provided

vol-control

vol-control: basicsource
Fields
type: type
flags: vol-flags
process: process-drawable
pos-vol-count: int32
pos-vol: plane-volume
neg-vol-count: int32
neg-vol: plane-volume
debug-point: vector-array
debug-normal: vector-array
Methods
debug-draw(obj: vol-control) => nonesource
vol-control-method-10(obj: vol-control, arg0: plane) => symbolsource
should-display?(obj: vol-control) => symbolsource
Returns true/false if the volume's marks should be displayed

Functions


plane-volume-intersect-dist

plane-volume-intersect-dist(arg0: vector, arg1: vector, arg2: vector) => floatsource