Class: ExtMath

LuxModule: luxinialuacore

The Extended Math class contains some generic math operations. Vectors and matrices are passed as indexed tables from 1-3 or 1-16. Matrices are stored column-major. Compared to the Luxinia CoreApi functions, the operations here are written and processed entirely in Lua

Methods:

Method overview:


anglediff (radians1, radians2)
returns: (angle)
calculates the shortest angledifference between two angles (which is a bit tricky i.e. -Math.PI - Math.PI == 0)
interpolate (float fraction,float from, float to)
returns: (float)
returns interpolated value between from and to
spline (float fraction,float prevfrom, float from, float to, float nextto)
returns: (float)
returns catmull-rom spline interpolated value between from and to
v3cross (table a, b)
returns: (table vector)
returns cross product of 3d vector a and b
v3dif (table a,b)
returns: (table difference)
returns difference vector between a and b
v3dist (table v1,v2)
returns: (float sqdist)
return distance |(v1-v2)| of vectors
v3dot (table v1, v2)
returns: (float dot)
returns dotproduct for 2 3vectors
v3interpolate (float fraction,table from, table to)
returns: (table)
returns interpolated vector between from and to
v3len (table vec)
returns: (float len)
euklid length of vecotr (a²+b²+c²)^0.5
v3normalize (table vec)
returns: (table normalized,float origlength)
returns normalized vector 3d vector and the original length of the vector
v3polar (float len,planeangle,heightangle)
returns: (floar x,y,z)
converts polar coords to regular x,y,z
v3spline (float fraction, table prevfrom, table from, table to, table nextto)
returns: (table)
returns catmull-rom spline interpolated vector between from and to
v3sqdist (table v1,v2)
returns: (float sqdist)
return square distance |(v1-v2)|² of vectors
v3sqlen (table vec)
returns: (float len)
square distance. This function is a little bit faster than the len function which returns the squareroot of this function. If you only want to compare distances (i.e. is this point inside my distance), you can square the distance you would like to compare with. This is worth the effort since it does not make much difference in code and work.
v3sum (table a,b)
returns: (table sum)
returns summed vector between a and b
v4dif (table a,b)
returns: (table difference)
returns difference vector between a and b
v4interpolate (float fraction,table from, table to)
returns: (table)
returns interpolated vector between from and to
v4spline (float fraction, table prevfrom, table from, table to, table nextto)
returns: (table)
returns catmull-rom spline interpolated vector between from and to
v4sum (table a,b)
returns: (table sum)
returns summed vector between a and b