|
|
Release 4.0 |
 |
Datatype vector
A vector consist of three floating point numbers and normally is used to specify a point in the 3D space. It consists of three components, called x, y and z.
Writing down a vector is done by surrounding the three real numbers by parenthesis,
separating them by comma.
Examples
a = (1,2,3); // surrounded by brackets, separated by comma
Vectors are internally stored as three floating point numbers which use the 80 bit
FPU format (internal coprocessor format), with 14 bit exponent and 64 bit mantissa. So each
component of a vector number has the same precision as a real number.
Future versions of ChaosPro will perhaps allow you to use double or float for the four
floating point numbers.
Converting to/from vectors
Vectors are converted automatically to other datatypes if necessary and allowed.
Converting to:
- bool: not allowed, use partx(v) in order to convert to a real number first.
- int: not allowed, use partx(v) in order to convert to a real number first.
- real: not allowed, use partx(v) in order to convert to a real number first.
- complex: not allowed, use partx(v) and/or party(v) in order to extract components and construct a complex number from these values.
- quaternion: not allowed, use partx(v) and/or party(v) and/or partz(v) in order to extract components and construct a complex number from these values.
Converting from:
- bool: not supported, use vector(x,y,z) to construct a vector.
- int: not supported, use vector(x,y,z) to construct a vector.
- real: not supported, use vector(x,y,z) to construct a vector.
- complex: not supported, use vector(x,y,z) to construct a vector.
- quaternion: not supported, use vector(x,y,z) to construct a vector.
|