rigz.vector: Functions Types Modinfo Source  

2d Vector and Matrix types for basic 2d geometry stuff

These types are basic with the minimum functionality required for the rest of the rigz collection of modules. These type grow as the overal need grows.

Functions Summary

CreateMatrix2 Create a new 2d matrix.
CreateVector2 Create a new 2d vector.

Types Summary

tlMatrix2 Matrix type which can be used to easily transform vectors.
tlVector2 2d vector type for basic vector handling.

Functions

Function CreateMatrix2:tlMatrix2(aa:Float = 1, ab:Float = 0, ba:Float = 0, bb:Float = 1)
DescriptionCreate a new 2d matrix.

Function CreateVector2:tlVector2(x:Float, y:Float)
DescriptionCreate a new 2d vector.

Types

Type tlMatrix2
DescriptionMatrix type which can be used to easily transform vectors.
InformationMatrices come in handy for transforming vectors such as scale and rotation.
Methods Summary
scale Scale the matrix by a given amount.
set Set the matrix to a new set of values.
transform Transfrom the matrix.
transformpoint Transfrom a point.
transformvector Transfrom a vector with the matrix.
transpose Transpose the matrix.
Functions Summary
Create Create a new matrix.
Method scale(s:Float)
DescriptionScale the matrix by a given amount.
Method set(_aa:Float = 1, _ab:Float = 0, _ba:Float = 0, _bb:Float = 1)
DescriptionSet the matrix to a new set of values.
InformationUse this to prepare the matrix for a new transform. For example if you wanted to to rotate a vector, then you could do

and then transform the vector with
matrix.transformvector(vector)
Method transform:tlMatrix2(m:tlMatrix2)
DescriptionTransfrom the matrix.
InformationMultiplies 2 matrices together returns: New transformed matrix.
Method transformpoint(x:Float, y:Float, tx:Float Var, ty:Float Var)
ReturnsNew coordinates for the tranformed point in tx and ty.
DescriptionTransfrom a point.
InformationThis will transform a point (x,y) and appply the new coordinates into tx and ty.
Method transformvector:tlVector2(v:tlVector2)
ReturnsNew transformed vector.
DescriptionTransfrom a vector with the matrix.
InformationYou can use this to transfrom a vector, rotating it, scaling it etc.
Method transpose()
DescriptionTranspose the matrix.
Function Create:tlMatrix2(aa:Float = 1, ab:Float = 0, ba:Float = 0, bb:Float = 1)
ReturnsNew matrix type.
DescriptionCreate a new matrix.

Type tlVector2
Description2d vector type for basic vector handling.
Methods Summary
AddVector Add this tlVector2 vector to another and return the result in a new vector.
Clone Clone a Vector.
Create Create a new vector with the given coordinates.
DotProduct Get the dot product of the vector.
Length Get the length of the vector.
Move Move a vector but the given x and y amount.
MoveByVector Move a vector buy the given vector.
Multiply multiply this vector with another and return the result.
Normal get the normal of the vector.
Normalise Normalise the vector.
Scale Scale the vector by the given amount and return the result in a new vector.
SetPosition Reposition the vector by the new x,y coordinates given.
SetPositionByVector Reposition the vector by the given vector.
SubtractVector Subtract this tlVector2 vector by another and return the result in a new vector.
Unit Get the unit vector of the vector.
Method AddVector:tlVector2(v:tlVector2)
ReturnsA new tlVector2.
DescriptionAdd this tlVector2 vector to another and return the result in a new vector.
Method Clone:tlVector2()
ReturnsNewly cloned tlVector2.
DescriptionClone a Vector.
Method Create:tlVector2(vx:Float, vy:Float)
ReturnsNew tlVector2.
DescriptionCreate a new vector with the given coordinates.
Method DotProduct:Float(v:tlVector2)
ReturnsThe dot product of the vector.
DescriptionGet the dot product of the vector.
Method Length:Float()
ReturnsThe length or magnitude of the vector.
DescriptionGet the length of the vector.
Method Move(distance_x:Float, distance_y:Float)
DescriptionMove a vector but the given x and y amount.
Method MoveByVector(distance:tlVector2)
DescriptionMove a vector buy the given vector.
Method Multiply:tlVector2(v:tlVector2)
ReturnsNew tlvector2.
Descriptionmultiply this vector with another and return the result.
Method Normal:tlVector2()
ReturnsNew tlVector2 normal of this vector.
Descriptionget the normal of the vector.
Method Normalise()
DescriptionNormalise the vector.
Method Scale:tlVector2(scale:Float)
Returnsnew scaled tlvector2.
DescriptionScale the vector by the given amount and return the result in a new vector.
Method SetPosition(_x:Float, _y:Float)
DescriptionReposition the vector by the new x,y coordinates given.
Method SetPositionByVector(v:tlVector2)
DescriptionReposition the vector by the given vector.
Method SubtractVector:tlVector2(v:tlVector2)
ReturnsA new tlVector2.
DescriptionSubtract this tlVector2 vector by another and return the result in a new vector.
Method Unit:tlVector2()
ReturnsNew unit vector of this vector.
DescriptionGet the unit vector of the vector.

Module Information

AuthorPeter J. Rigby
CopyrightPeter J. Rigby 2009
PurposeClasses for vectors and matrices
Versionv1.07