lua.wetgenes.tardis.m4
The metatable for a 4x4 matrix class, use the new function to actually create an object.
We also inherit all the functions from tardis.array
lua.wetgenes.tardis.m4.add
m4 = m4:add(m4b)
m4 = m4:add(m4b,r)
Add m4b this m4.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.adjugate
m4 = m4:adjugate()
m4 = m4:adjugate(r)
Adjugate this m4.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.arotate
m4 = m4:arotate(degrees,v3a)
m4 = m4:arotate(degrees,v3a,r)
Apply a rotation in degres around the given axis to this matrix.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.cofactor
m4 = m4:cofactor()
m4 = m4:cofactor(r)
Cofactor this m4.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.determinant
value = m4:determinant()
Return the determinant value of this m4.
lua.wetgenes.tardis.m4.get_rotation_q4
q4 = m4:get_rotation_q4(r)
Get quaternion rotation from a scale/rot/trans matrix. Note that scale is assumed to be uniform which it usually is. If that is not the case then remove the scale first.
If r is provided then the result is written into r and returned otherwise a new q4 is created and returned.
lua.wetgenes.tardis.m4.get_scale_v3
v3 = m4:get_scale_v3(r)
Get v3 scale from a scale/rot/trans matrix
If r is provided then the result is written into r and returned otherwise a new v3 is created and returned.
lua.wetgenes.tardis.m4.get_translation_v3
v3 = m4:get_translation_v3(r)
Get v3 translation from a scale/rot/trans matrix
If r is provided then the result is written into r and returned otherwise a new v3 is created and returned.
lua.wetgenes.tardis.m4.identity
m4 = m4:identity()
Set this m4 to the identity matrix.
lua.wetgenes.tardis.m4.inverse
m4 = m4:inverse()
m4 = m4:inverse(r)
Inverse this m4.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.m3
m4 = m4:m3()
Grab tthe top,left parts of the m4 matrix as an m3 matrix.
lua.wetgenes.tardis.m4.minor_xy
value = m4:minor_xy()
Return the minor_xy value of this m4.
lua.wetgenes.tardis.m4.mix
m4 = m4:mix(m4b,s)
m4 = m4:mix(m4b,s,r)
Lerp from m4 to m4b by s.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.new
m4 = tardis.m4.new()
Create a new m4 and optionally set it to the given values, m4 methods usually return the input m4 for easy function chaining.
lua.wetgenes.tardis.m4.prearotate
m4 = m4:prearotate(degrees,v3a)
m4 = m4:prearotate(degrees,v3a,r)
Pre apply a rotation in degrees around the given axis to this matrix.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.preqrotate
m4 = m4:preqrotate(q)
m4 = m4:preqrotate(q,r)
Pre apply a quaternion rotation to this matrix.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.prerotate
m4 = m4:prerotate(degrees,v3a)
m4 = m4:prerotate(degrees,v3a,r)
m4 = m4:prerotate(degrees,x,y,z)
m4 = m4:prerotate(degrees,x,y,z,r)
m4 = m4:prerotate(q)
m4 = m4:prerotate(q,r)
Pre apply quaternion or angle rotation to this matrix depending on arguments provided.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.prerrotate
m4 = m4:prerrotate(radians,v3a)
m4 = m4:prerrotate(radians,v3a,r)
Pre apply a rotation in radians around the given axis to this matrix.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.prescale
m4 = m4:scale(s)
m4 = m4:scale(s,r)
m4 = m4:scale(x,y,z)
m4 = m4:scale(x,y,z,r)
m4 = m4:scale(v3)
m4 = m4:scale(v3,r)
Pre Scale this m4 by {s,s,s} or {x,y,z} or v3.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.pretranslate
m4 = m4:pretranslate(x,y,z)
m4 = m4:pretranslate(x,y,z,r)
m4 = m4:pretranslate(v3a)
m4 = m4:pretranslate(v3a,r)
Translate this m4 along its global axis by {x,y,z} or v3a.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.pretranslate_v3
m4 = m4:pretranslate_v3(v3a)
m4 = m4:pretranslate_v3(v3a,r)
Translate this m4 along its global axis by v3a.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.qrotate
m4 = m4:qrotate(q)
m4 = m4:qrotate(q,r)
Apply a quaternion rotation to this matrix.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.rotate
m4 = m4:rotate(degrees,v3a)
m4 = m4:rotate(degrees,v3a,r)
m4 = m4:rotate(degrees,x,y,z)
m4 = m4:rotate(degrees,x,y,z,r)
m4 = m4:rotate(q)
m4 = m4:rotate(q,r)
Apply quaternion or angle rotation to this matrix depending on arguments provided.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.rrotate
m4 = m4:rrotate(radians,v3a)
m4 = m4:rrotate(radians,v3a,r)
Apply a rotation in radians around the given axis to this matrix.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.scale
m4 = m4:scale(s)
m4 = m4:scale(s,r)
m4 = m4:scale(x,y,z)
m4 = m4:scale(x,y,z,r)
m4 = m4:scale(v3)
m4 = m4:scale(v3,r)
Scale this m4 by {s,s,s} or {x,y,z} or v3.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.scale_v3
m4 = m4:scale_v3(v3)
m4 = m4:scale_v3(v3,r)
Scale this m4 by {x,y,z} or v3.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.setrot
m4 = m4:setrot(degrees,v3a)
Set this matrix to a rotation matrix around the given normal by the given degrees.
we will automatically normalise v3a if necessary.
lua.wetgenes.tardis.m4.setrrot
m4 = m4:setrrot(radians,v3a)
Set this matrix to a rotation matrix around the given normal by the given radians.
we will automatically normalise v3a if necessary.
lua.wetgenes.tardis.m4.sub
m4 = m4:sub(m4b)
m4 = m4:sub(m4b,r)
Subtract m4b this m4.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.translate
m4 = m4:translate(x,y,z)
m4 = m4:translate(x,y,z,r)
m4 = m4:translate(v3a)
m4 = m4:translate(v3a,r)
Translate this m4 along its local axis by {x,y,z} or v3a.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.translate_v3
m4 = m4:translate_v3(v3a)
m4 = m4:translate_v3(v3a,r)
Translate this m4 along its local axis by v3a.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.transpose
m4 = m4:transpose()
m4 = m4:transpose(r)
Transpose this m4.
If r is provided then the result is written into r and returned otherwise m4 is modified and returned.
lua.wetgenes.tardis.m4.v3
v3 = m4:v3(n)
Extract and return a "useful" v3 from an m4 matrix. The first vector is the x axis, then y axis , then z axis and finally transform.
If n is not given or not a known value then we return the 4th vector which is the "opengl" transform as that is the most useful v3 part of an m4.