"3DSP" 3D space manipulation extension
Fingerprint ID: | 0x33445350 |
New in version 0.5-rc2.
This fingerprint, from RC/Funge-98, implements operations on three-dimensional vectors and 4 by 4 matrices. It provides the following commands:
- A : av3 bv3 — (a+b)v3
- Adds two three-dimensional vectors.
- B : av3 bv3 — (a-b)v3
- Subtracts three-dimensional vector b from a.
- C : av3 bv3 — (a×b)v3
- Calculates cross product of two three-dimensional vectors. a and b should be in the correct order, as cross product is not commutative.
- D : av3 bv3 — (a·b)
- Calculates dot product of two three-dimensional vectors.
- L : av3 — sqrt(a·a)
- Calculates length of given three-dimensional vector, defined as a square root of dot product of a and a.
- M : av3 bv3 — (ab)v3
- Multiplies two three-dimensional vectors.
- N : av3 — a÷sqrt(a·a)v3
- Normalizes the given three-dimensional vector, so its length is 1. If a is zero vector, pushes itself.
- U : av3 — av3 av3
- Duplicates the given three-dimensional vector.
- V : av3 — x y
- Projects the given three-dimensional vector to 2D view. In the other words, a vector ai+bj+ck projects to (a÷c)i+(b÷c)j. If c is zero it is assumed to be 1.
- Z : av3 nfp — (na)v3
- Multiplies the given three-dimensional vector by scalar.
The following commands reflect in Unefunge mode.
- P : destv srcv —
- Copies the matrix starting at src to dest, in the Funge space.
- R : destv axis anglefp —
- Puts the transformation matrix rotating angle degrees by axis to dest in the Funge space. axis is 1 for X axis, 2 for Y axis and 3 for Z axis. Reflects if axis is invalid.
- S : destv scalev3 —
- Puts the transformation matrix scaling by factor of scale for each axes.
- T : destv offsetv3 —
- Puts the transformation matrix translating by offset for each axes.
- X : av3 sourcev — (aM)v3
- Multiplies the three-dimensional vector by the transformation matrix M given by source. Actually it multiplies in the reverse order: the result should be aM.
- Y : targetv sourceav sourcebv —
- Multiplies two matrices A and B given by sourcea and sourceb, and puts it to target in the Funge space. Actually it multiplies in the reverse order: the result should be BA.
Three-dimensional vector consists of three single precision floating point number, as used by FPSP fingerprint. 4 by 4 matrix in the Funge space occupies 4 by 4 cells, for example from (x,y,z) to (x+3,y+3,z) in Trefunge, and of course uses same floating point number.