ajvector.c


Section: 3-D vector Constructors

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


Function aj3dVectorNew

Default constructor for zeroed AJAX 3D vectors.

Synopsis

Prototype
AjP3dVector aj3dVectorNew (
      void
);

TypeNameRead/WriteDescription
AjP3dVector RETURNPointer 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

Function aj3dVectorCreate

Constructor for initialised AJAX 3D vectors.

Synopsis

Prototype
AjP3dVector aj3dVectorCreate (
      float fX,
      float fY,
      float fZ
);

TypeNameRead/WriteDescription
floatfXInputx component of 3D vector
floatfYInputy component of 3D vector
floatfZInputz component of 3D vector
AjP3dVector RETURNPointer 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

Section: 3D Vector Destructors

Destruction is achieved by deleting the pointer to the 3-D vector and freeing the associated memory

Functions: aj3dVectorDel


Function 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
);

TypeNameRead/WriteDescription
AjP3dVector*pthisDeletePointer 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
void:No return value

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

Section: 3D Vector Functions

General functions

Functions: aj3dVectorCrossProduct aj3dVectorBetweenPoints aj3dVectorLength aj3dVectorAngle aj3dVectorDihedralAngle aj3dVectorDotProduct aj3dVectorSum


Function aj3dVectorCrossProduct

calculates the cross product of two 3D vectors, that is their "torque"

Synopsis

Prototype
void aj3dVectorCrossProduct (
      const AjP3dVector first,
      const AjP3dVector second,
      AjP3dVector crossProduct
);

TypeNameRead/WriteDescription
const AjP3dVectorfirstInputfirst 3D vector
const AjP3dVectorsecondInputsecond 3D vector
AjP3dVectorcrossProductOutput3D 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
void:No return value

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

Function aj3dVectorBetweenPoints

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
);

TypeNameRead/WriteDescription
AjP3dVectorbetweenPointsModifyvector from start to end
floatfStartXInputX coordinate of start
floatfStartYInputY coordinate of start
floatfStartZInputZ coordinate of start
floatfEndXInputX coordinate of end
floatfEndYInputY coordinate of end
floatfEndZInputZ 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
void:No return value

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

Function aj3dVectorLength

calculates the magnitude of a vector

Synopsis

Prototype
float aj3dVectorLength (
      const AjP3dVector thys
);

TypeNameRead/WriteDescription
const AjP3dVectorthysInputvector to be sized
float RETURNlength 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

Function aj3dVectorAngle

Calculates the angle between two vectors

method adapted from vmd

Synopsis

Prototype
float aj3dVectorAngle (
      const AjP3dVector first,
      const AjP3dVector second
);

TypeNameRead/WriteDescription
const AjP3dVectorfirstInputfirst vector
const AjP3dVectorsecondInputsecond vector
float RETURNangle 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

Function aj3dVectorDihedralAngle

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
);

TypeNameRead/WriteDescription
const AjP3dVectorvecaInputVector A
const AjP3dVectorvecbInputVector B
const AjP3dVectorveccInputVector C
float RETURNdihedral angle

Input
veca:(Input)Vector A
vecb:(Input)Vector B
vecc:(Input)Vector C
Returns
float:dihedral angle

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

Function aj3dVectorDotProduct

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
);

TypeNameRead/WriteDescription
const AjP3dVectorfirstInputfirst vector
const AjP3dVectorsecondInputsecond vector
float RETURNdot 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

Function aj3dVectorSum

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
);

TypeNameRead/WriteDescription
const AjP3dVectorfirstInputfirst vector
const AjP3dVectorsecondInputsecond vector
AjP3dVectorsumOutputsum 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
void:No return value

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