BlueScript: VE Math Procedures
Contents
Description
An interface to vectors, quaternions, matrices, etc.
Documentation
The following objects and procedures are only available to
scripts running under the VE library.
Objects
VeMatrix4
An analogue to the VeMatrix4
type in VE.
VeQuat
An analogue to the VeQuat
type in VE.
VeVector3
This object represents the same data as VeVector3
object in VE. VeVector3 objects are required for some math
functions. Lists of 3 floats will be automatically converted
to VeVector3 objects as needed.
An analogue to the VeVector3
type in VE.
Procedures
acos
Usage
acos a
Returns
The arc coasine of a in radians. If a is out
of the range -1..1 then an error will be generated.
asin
Usage
asin a
Returns
The arc sine of a in radians. If a is out
of the range -1..1 then an error will be generated.
atan
Usage
atan a
or
atan y x
Returns
The arc tangent of its arguments.
If only one argument is specified, then the arc tangent of
that value is returned. If two arguments are specified then
the arc tangent of y/x is returned - additionally, the
signs of y and x are used to determine correct
quadrant for the result.
cos
Usage
cos a
Returns
The cosine of the angle a. The angle must be given in radians.
deg2rad
Usage
deg2rad a
Returns
Converts a value in degrees to a value in radians.
m4ident
Usage
m4ident
Returns
An identity matrix.
m4ind
Usage
m4ind m (0|1|2|3) (0|1|2|3)
Returns
The given element of the matrix.
m4invert
Usage
m4invert m
Returns
The inverse of matrix m. If the matrix cannot be
inverted then an error is generated.
m4mult
Usage
m4mult m1 m2
Returns
The product of the two matrices.
m4multv
Usage
m4multv m v
Returns
The transformation of vector v by matrix m.
m4rotate
Usage
m4rotate v ang
Returns
A matrix representing a rotation of ang degrees
around an arbitrary axis given by VeVector3 v.
m4trans
Usage
m4trans v
Returns
A matrix representing a translation given
by VeVector3 v.
qang
Usage
qang q
Returns
The angle of rotation in degrees corresponding to this quaternion.
qarb
Usage
qarb v ang
Returns
A quaternion corresponding to a rotation of ang
degrees around an arbitrary axis represented by VeVector3 v.
qaxis
Usage
qaxis q
Returns
The axis of rotation corresponding to this quaternion.
qind
Usage
qind q (0|1|2|3|x|y|z|w)
Returns
The specified element of the quaternion.
qmult
Usage
qmult q1 q2
Returns
The product of the two quaternions (which is itself a quaternion).
qnorm
Usage
qnorm q
Returns
A normalized quaternion.
rad2deg
Usage
rad2deg a
Returns
Converts a value in radians to a value in degrees.
sin
Usage
sin a
Returns
The sine of the angle a. The angle must be given in radians.
tan
Usage
tan a
Returns
The tangent of the angle a. The angle must be given in radians.
v3add
Usage
v3add v1 v2
Returns
A VeVector3 object corresponding to v1 + v2.
v3cross
Usage
v3cross v1 v2
Returns
A VeVector3 object which is the cross-product of vectors
v1 and v2.
v3dot
Usage
v3dot v1 v2
Returns
The dot-product (or inner-product) of vectors v1
and v2.
v3ind
Usage
v3ind v (0|1|2|x|y|z)
Returns
The specified component of vector v.
v3mag
Usage
v3mag v
Returns
The magnitude of vector v.
v3norm
Usage
v3norm v
Returns
A copy of vector v whose magnitude has been
normalized to 1.
v3scale
Usage
v3scale v f
Returns
A VeVector3 object which is vector v scaled by
floating-point factor f.
v3sub
Usage
v3sub v1 v2
Returns
A VeVector3 object corresponding to v1 - v2.