ajvector.c
All constructors return a new vector by pointer. It is the responsibility
of the user to first destroy any previous vector. The target pointer
does not need to be initialised to NULL, but it is good programming practice
to do so anyway.
Functions: aj3dVectorNew aj3dVectorCreate
Default constructor for zeroed AJAX 3D vectors.
Synopsis
Prototype
AjP3dVector aj3dVectorNew (
void
);
Type | Name | Read/Write | Description |
AjP3dVector | | RETURN | Pointer to a zeroed 3D vector |
Returns
AjP3dVector: | Pointer to a zeroed 3D vector |
Description
Default constructor for zeroed AJAX 3D vectors.
See Also
See other functions in this section
Availability
In release 6.4.0
Constructor for initialised AJAX 3D vectors.
Synopsis
Prototype
AjP3dVector aj3dVectorCreate (
float fX,
float fY,
float fZ
);
Type | Name | Read/Write | Description |
float | fX | Input | x component of 3D vector |
float | fY | Input | y component of 3D vector |
float | fZ | Input | z component of 3D vector |
AjP3dVector | | RETURN | Pointer to an initialised 3D vector |
Input
fX: | (Input) | x component of 3D vector |
fY: | (Input) | y component of 3D vector |
fZ: | (Input) | z component of 3D vector |
Returns
AjP3dVector: | Pointer to an initialised 3D vector |
Description
Constructor for initialised AJAX 3D vectors.
See Also
See other functions in this section
Availability
In release 6.4.0
Destruction is achieved by deleting the pointer to the 3-D vector and
freeing the associated memory
Functions: aj3dVectorDel
Default destructor for Ajax 3-D Vectors.
If the given pointer is NULL, or a NULL pointer, simply returns.
Synopsis
Prototype
void aj3dVectorDel (
AjP3dVector* pthis
);
Type | Name | Read/Write | Description |
AjP3dVector* | pthis | Delete | Pointer to the 3-D vector to be deleted.
The pointer is always deleted. |
void | | RETURN | |
Output
pthis: | (Delete) | Pointer to the 3-D vector to be deleted.
The pointer is always deleted. |
Returns
Description
Default destructor for Ajax 3-D Vectors.
If the given pointer is NULL, or a NULL pointer, simply returns.
See Also
See other functions in this section
Availability
In release 6.4.0
General functions
Functions: aj3dVectorCrossProduct aj3dVectorBetweenPoints aj3dVectorLength aj3dVectorAngle aj3dVectorDihedralAngle aj3dVectorDotProduct aj3dVectorSum
calculates the cross product of two 3D vectors, that is their "torque"
Synopsis
Prototype
void aj3dVectorCrossProduct (
const AjP3dVector first,
const AjP3dVector second,
AjP3dVector crossProduct
);
Type | Name | Read/Write | Description |
const AjP3dVector | first | Input | first 3D vector |
const AjP3dVector | second | Input | second 3D vector |
AjP3dVector | crossProduct | Output | 3D vector to contain
cross product |
void | | RETURN | |
Input
first: | (Input) | first 3D vector |
second: | (Input) | second 3D vector |
Output
crossProduct: | (Output) | 3D vector to contain
cross product |
Returns
Description
calculates the cross product of two 3D vectors, that is their "torque"
See Also
See other functions in this section
Availability
In release 6.4.0
Calculates the vector from one point in space (start) to another (end)
Synopsis
Prototype
void aj3dVectorBetweenPoints (
AjP3dVector betweenPoints,
float fStartX,
float fStartY,
float fStartZ,
float fEndX,
float fEndY,
float fEndZ
);
Type | Name | Read/Write | Description |
AjP3dVector | betweenPoints | Modify | vector from start to end |
float | fStartX | Input | X coordinate of start |
float | fStartY | Input | Y coordinate of start |
float | fStartZ | Input | Z coordinate of start |
float | fEndX | Input | X coordinate of end |
float | fEndY | Input | Y coordinate of end |
float | fEndZ | Input | Z coordinate of end |
void | | RETURN | |
Input
fStartX: | (Input) | X coordinate of start |
fStartY: | (Input) | Y coordinate of start |
fStartZ: | (Input) | Z coordinate of start |
fEndX: | (Input) | X coordinate of end |
fEndY: | (Input) | Y coordinate of end |
fEndZ: | (Input) | Z coordinate of end |
Input & Output
betweenPoints: | (Modify) | vector from start to end |
Returns
Description
Calculates the vector from one point in space (start) to another (end)
See Also
See other functions in this section
Availability
In release 6.4.0
calculates the magnitude of a vector
Synopsis
Prototype
float aj3dVectorLength (
const AjP3dVector thys
);
Type | Name | Read/Write | Description |
const AjP3dVector | thys | Input | vector to be sized |
float | | RETURN | length of vector to be sized |
Input
thys: | (Input) | vector to be sized |
Returns
float: | length of vector to be sized |
Description
calculates the magnitude of a vector
See Also
See other functions in this section
Availability
In release 6.4.0
Calculates the angle between two vectors
method adapted from vmd
Synopsis
Prototype
float aj3dVectorAngle (
const AjP3dVector first,
const AjP3dVector second
);
Type | Name | Read/Write | Description |
const AjP3dVector | first | Input | first vector |
const AjP3dVector | second | Input | second vector |
float | | RETURN | angle between vectors in degrees |
Input
first: | (Input) | first vector |
second: | (Input) | second vector |
Returns
float: | angle between vectors in degrees |
Description
Calculates the angle between two vectors
method adapted from vmd
See Also
See other functions in this section
Availability
In release 6.4.0
calculates the angle from the plane perpendicular to A x B to the plane
perpendicular to B x C (where A, B and C are vectors)
Synopsis
Prototype
float aj3dVectorDihedralAngle (
const AjP3dVector veca,
const AjP3dVector vecb,
const AjP3dVector vecc
);
Type | Name | Read/Write | Description |
const AjP3dVector | veca | Input | Vector A |
const AjP3dVector | vecb | Input | Vector B |
const AjP3dVector | vecc | Input | Vector C |
float | | RETURN | dihedral angle |
Input
veca: | (Input) | Vector A |
vecb: | (Input) | Vector B |
vecc: | (Input) | Vector C |
Returns
Description
calculates the angle from the plane perpendicular to A x B to the plane
perpendicular to B x C (where A, B and C are vectors)
See Also
See other functions in this section
Availability
In release 6.4.0
calculates the dot product of two 3D vectors, that is their summed common
scalar magnitude
Synopsis
Prototype
float aj3dVectorDotProduct (
const AjP3dVector first,
const AjP3dVector second
);
Type | Name | Read/Write | Description |
const AjP3dVector | first | Input | first vector |
const AjP3dVector | second | Input | second vector |
float | | RETURN | dot product of first and second vectors |
Input
first: | (Input) | first vector |
second: | (Input) | second vector |
Returns
float: | dot product of first and second vectors |
Description
calculates the dot product of two 3D vectors, that is their summed common
scalar magnitude
See Also
See other functions in this section
Availability
In release 6.4.0
calculates the dot product of two 3D vectors, that is their summed common
"scalar magnitude"
Synopsis
Prototype
void aj3dVectorSum (
const AjP3dVector first,
const AjP3dVector second,
AjP3dVector sum
);
Type | Name | Read/Write | Description |
const AjP3dVector | first | Input | first vector |
const AjP3dVector | second | Input | second vector |
AjP3dVector | sum | Output | sum of first and second vectors |
void | | RETURN | |
Input
first: | (Input) | first vector |
second: | (Input) | second vector |
Output
sum: | (Output) | sum of first and second vectors |
Returns
Description
calculates the dot product of two 3D vectors, that is their summed common
"scalar magnitude"
See Also
See other functions in this section
Availability
In release 6.4.0