LitDev Extension API

LDVector

3D vector algebra methods, useful for LD3DView manipulations.

All vectors or points are a 3 element array indexed by 1,2,3.

Add | AngleBetween | CrossProduct |

DotProduct | Length | Multiply |

Normalise | Rotate | RotatePoint |

Subtract |

Add(vector1,vector2)

Add 2 vectors.

vector1 The first vector.

vector2 The second vector.

returns The resulting vector or "" on failure.

AngleBetween(vector1,vector2)

Get the angle between 2 vectors.

vector1 The first vector.

vector2 The second vector.

returns The angle (in degrees) between the vectors or "" on failure.

CrossProduct(vector1,vector2)

Get the vector cross product of 2 vectors.

vector1 The first vector.

vector2 The second vector.

returns The vector cross product or "" on failure.

DotProduct(vector1,vector2)

Get the dot product of 2 vectors.

vector1 The first vector.

vector2 The second vector.

returns The dot product or "" on failure.

Length(vector)

Get the length of a vector.

vector The vector.

returns The vector length or "" on failure.

Multiply(vector,scalar)

Multiply a vector by a scalar.

vector The vector.

scalar A scalar number to resize the vector.

returns The rescaled vector or "" on failure.

Normalise(vector)

Normalise a vector to unit length.

vector The vector.

returns A rescaled vetor of unit length or "" on failure.

Rotate(vector,about,angle)

Rotate one vector about a direction defined by a second vector.

vector The vector to rotate.

about The vector axis direction to rotate about.

angle The angle (in degrees) to rotate the vector by.

returns The rotated vector or "" on failure.

RotatePoint(point,center,about,angle)

Rotate a point about a specified center point and direction.

point The point to rotate.

center The point to rotate about.

about The vector axis direction to rotate about.

angle The angle (in degrees) to rotate the point by.

returns The rotated point or "" on failure.

Subtract(vector1,vector2)

Subtract one vector from another.

vector1 The first vector.

vector2 The second vector (to subtract from the first).

returns The resulting vector or "" on failure.