BRender Technical Reference Manual:4 Data Structures (Alphabetical Reference):br_vector4
Next|Prev|Up
The Structure
Members
Arithmetic
BrVector4Dot()
Copy/Assign
BrVector4Copy()
Referencing & Lifetime
Initialisation

br_vector4


The Structure

This is the four ordinate vector structure, typically used to hold homogenous 3D co-ordinates. Functions are provided to allow it be used as though it were an integral type.

The typedef

(See vector.h for precise declaration and ordering)

br_scalar v[4] Ordinates (0=x, 1=y, 2=z, 3=w)

Related Functions

See BrMatrix34TApply()
192, BrMatrix4[T]Apply[V|P]()216-219.

Related Structures

See br_matrix4214.

Members

br_scalar v[4]

First, second, third and fourth ordinate. Conventionally, the first ordinate is the x-axis component, the second, the y axis component, the third, the z axis component, and the fourth, the divisor.

Remember that BRender has a right handed co-ordinate system and so, with the x axis positive to the right, and the y axis positive upwards, the z axis is therefore positive toward you (typically, the z axis points out of the screen).

Arithmetic


BrVector4Dot()

Description:
Calculate the dot product of two vectors. Equivalent to the expression:

Declaration:
br_scalar BrVector4Dot(const br_vector4* v1, const br_vector4* v2)

Arguments:
const br_vector4 * v1

Pointer to left hand vector (may be same as source).

const br_vector4 * v2

Pointers to right hand vector.

Result:
br_scalar

Returns the dot product of the two source vectors. Equivalent to:


Copy/Assign

Although copy by structure assignment currently works, use BrVector4Copy()
366 to ensure compatibility.


BrVector4Copy()

Description:
Copy a vector. Equivalent to the expression:

Declaration:
void BrVector4Copy(br_vector4* v1, const br_vector4* v2)

Arguments:
br_vector4 * v1

A pointer to the destination vector (may be same as source).

const br_vector4 * v2

A pointer to the source vector.


Referencing & Lifetime

This structure may be freely referenced, though take care if there is potential to supply the same vector as more than one argument to the same function.

Initialisation

The following macro may be used as a static initialiser.

BR_VECTOR4(a,b,c,d)
Macro expands to {BR_SCALAR(a),BR_SCALAR(b),BR_SCALAR(c),BR_SCALAR(d)}.

All other initialisation should use member-wise initialisation or the function BrVector4Copy()366.


Generated with CERN WebMaker