Libraries
3D Vector Source Code
 previous   up   next 

Types
vector3d
3D vectors represented with float values for the three dimensions.

vector3d

const type: vector3d

3D vectors represented with float values for the three dimensions. 3D vector literals do not exist.


Operator Summary
boolean
(in vector3d: a) = (in vector3d: b)
Check if two 3D vectors are equal.
boolean
(in vector3d: a) <> (in vector3d: b)
Check if two 3D vectors are not equal.
vector3d
- (in vector3d: a)
Minus sign, negate a 3D vector.
vector3d
(in vector3d: a) + (in vector3d: b)
Add two 3D vectors.
vector3d
(in vector3d: a) - (in vector3d: b)
Subtract two 3D vectors.
vector3d
(in vector3d: v) * (in float: num)
Multiply a 3D vector with a float number.
vector3d
(in vector3d: v) / (in float: num)
Divide a 3D vector by a float number.
void
(inout vector3d: vect) +:= (in float: delta)
Increment a 3D vector by a float delta.
void
(inout vector3d: vect) -:= (in float: delta)
Decrement a 3D vector by a float delta.
void
(inout vector3d: vect) *:= (in float: number)
Multiply a 3D vector by a float factor and assign the result back.
void
(inout vector3d: vect) /:= (in float: number)
Divide a 3D vector by a float factor and assign the result back.

Function Summary
vector3d
vector3d (in float: x, in float: y, in float: z)
Create a 3D vector from its x, y and z values.
float
abs (in vector3d: v)
Compute the absolute value of a 3D vector.
float
sqrAbs (in vector3d: v)
Compute the square of the absolute value of a 3D vector.
float
dot (in vector3d: a, in vector3d: b)
Inner product of two 3D vectors.
vector3d
cross (in vector3d: a, in vector3d: b)
Cross product of two 3D vectors.
vector3d
reflect (in vector3d: vect, in vector3d: normal)
Reflect the vector vect at a surface defined by normal.
vector3d
unitVector (in vector3d: v)
Unit vector of a given 3D vector.
integer
compare (in vector3d: vect1, in vector3d: vect2)
Compare two 3D vectors in lexicographic order.
integer
hashCode (in vector3d: vect)
Compute the hash value of a 3D vector.
string
str (in vector3d: a)
Convert a 3D vector to a string.

Operator Detail

=

const func boolean: (in vector3d: a) = (in vector3d: b)

Check if two 3D vectors are equal.

Returns:
TRUE if both 3D vectors are equal, FALSE otherwise.

<>

const func boolean: (in vector3d: a) <> (in vector3d: b)

Check if two 3D vectors are not equal.

Returns:
FALSE if both 3D vectors are equal, TRUE otherwise.

-

const func vector3d: - (in vector3d: a)

Minus sign, negate a 3D vector.

Returns:
the negated value of the 3D vector.

+

const func vector3d: (in vector3d: a) + (in vector3d: b)

Add two 3D vectors.

Returns:
the sum of the two 3D vectors.

-

const func vector3d: (in vector3d: a) - (in vector3d: b)

Subtract two 3D vectors.

Returns:
the difference of the two 3D vectors.

*

const func vector3d: (in vector3d: v) * (in float: num)

Multiply a 3D vector with a float number.

Returns:
the product of the multiplication.

/

const func vector3d: (in vector3d: v) / (in float: num)

Divide a 3D vector by a float number.

Returns:
the quotient of the division.

+:=

const proc: (inout vector3d: vect) +:= (in float: delta)

Increment a 3D vector by a float delta.


-:=

const proc: (inout vector3d: vect) -:= (in float: delta)

Decrement a 3D vector by a float delta.


*:=

const proc: (inout vector3d: vect) *:= (in float: number)

Multiply a 3D vector by a float factor and assign the result back.


/:=

const proc: (inout vector3d: vect) /:= (in float: number)

Divide a 3D vector by a float factor and assign the result back.


Function Detail

vector3d

const func vector3d: vector3d (in float: x, in float: y, in float: z)

Create a 3D vector from its x, y and z values.

Returns:
the created 3D vector.

abs

const func float: abs (in vector3d: v)

Compute the absolute value of a 3D vector.

Returns:
the absolute value.

sqrAbs

const func float: sqrAbs (in vector3d: v)

Compute the square of the absolute value of a 3D vector.

Returns:
the square of the absolute value.

dot

const func float: dot (in vector3d: a, in vector3d: b)

Inner product of two 3D vectors.

Returns:
the inner product of the two 3D vectors.

cross

const func vector3d: cross (in vector3d: a, in vector3d: b)

Cross product of two 3D vectors.

Returns:
the cross product of the two 3D vectors.

reflect

const func vector3d: reflect (in vector3d: vect, in vector3d: normal)

Reflect the vector vect at a surface defined by normal. The surface is representing by its normal at the intersection point.

Returns:
the reflected vector.

unitVector

const func vector3d: unitVector (in vector3d: v)

Unit vector of a given 3D vector.

Returns:
the unit vector of the given 3D vector.

compare

const func integer: compare (in vector3d: vect1, in vector3d: vect2)

Compare two 3D vectors in lexicographic order.

Returns:
-1, 0 or 1 if the first argument is considered to be respectively less than, equal to, or greater than the second.

hashCode

const func integer: hashCode (in vector3d: vect)

Compute the hash value of a 3D vector.

Returns:
the hash value.

str

const func string: str (in vector3d: a)

Convert a 3D vector to a string.

Returns:
the string result of the conversion.


 previous   up   next