Vec
Auto-generated from
src/stdlib/vec.mcrs— do not edit manually.
API
dot2d v1.0.0
Dot product of two 2D integer vectors.
redscript
fn dot2d(ax: int, ay: int, bx: int, by: int) -> intParameters
| Parameter | Description |
|---|---|
ax | X component of vector A |
ay | Y component of vector A |
bx | X component of vector B |
by | Y component of vector B |
Returns: axbx + ayby
Example
redscript
let d = dot2d(3, 4, 3, 4) // result: 25length2d_fixed v1.0.0
Euclidean length of a 2D vector, returned as ×1000 fixed-point.
redscript
fn length2d_fixed(x: int, y: int) -> intParameters
| Parameter | Description |
|---|---|
x | X component (raw integer; keep |
y | Y component |
Returns: sqrt(x²+y²) × 1000
Example
redscript
let l = length2d_fixed(3, 4) // result: 5000dot3d v1.0.0
Dot product of two 3D integer vectors.
redscript
fn dot3d(ax: int, ay: int, az: int, bx: int, by: int, bz: int) -> intParameters
| Parameter | Description |
|---|---|
ax | X component of vector A |
ay | Y component of vector A |
az | Z component of vector A |
bx | X component of vector B |
by | Y component of vector B |
bz | Z component of vector B |
Returns: axbx + ayby + az*bz
Example
redscript
let d = dot3d(1, 0, 0, 1, 0, 0) // result: 1cross3d_x v1.0.0
X component of the cross product A×B (aybz − azby).
redscript
fn cross3d_x(ax: int, ay: int, az: int, bx: int, by: int, bz: int) -> intParameters
| Parameter | Description |
|---|---|
ax | X of A @param ay Y of A @param az Z of A |
bx | X of B @param by Y of B @param bz Z of B |
Returns: aybz - azby
cross3d_y v1.0.0
Y component of the cross product A×B (azbx − axbz).
redscript
fn cross3d_y(ax: int, ay: int, az: int, bx: int, by: int, bz: int) -> intParameters
| Parameter | Description |
|---|---|
ax | X of A @param ay Y of A @param az Z of A |
bx | X of B @param by Y of B @param bz Z of B |
Returns: azbx - axbz
cross3d_z v1.0.0
Z component of the cross product A×B (axby − aybx).
redscript
fn cross3d_z(ax: int, ay: int, az: int, bx: int, by: int, bz: int) -> intParameters
| Parameter | Description |
|---|---|
ax | X of A @param ay Y of A @param az Z of A |
bx | X of B @param by Y of B @param bz Z of B |
Returns: axby - aybx
Example
redscript
let z = cross3d_z(1, 0, 0, 0, 1, 0) // result: 1