lua.wetgenes.tardis.q4
The metatable for a quaternion class, use the new function to actually create an object.
We also inherit all the functions from tardis.v4
lua.wetgenes.tardis.q4.get_yaw_pitch_roll
v3 = q4:get_yaw_pitch_roll()
Get a yaw,pitch,roll degree rotation from this quaternion
If r is provided then the result is written into r and returned otherwise a new v3 is created and returned.
lua.wetgenes.tardis.q4.get_yaw_pitch_roll_in_radians
v3 = q4:get_yaw_pitch_roll_in_radians()
Get a yaw,pitch,roll degree rotation from this quaternion
If r is provided then the result is written into r and returned otherwise a new v3 is created and returned.
lua.wetgenes.tardis.q4.identity
q4 = q4:identity()
Set this q4 to its 0,0,0,1 identity
lua.wetgenes.tardis.q4.mix
q4 = q4:mix(q4b,s)
q4 = q4:mix(q4b,s,r)
Lerp from q4 to q4b by s.
If r is provided then the result is written into r and returned otherwise q4 is modified and returned.
lua.wetgenes.tardis.q4.new
q4 = tardis.q4.new()
Create a new q4 and optionally set it to the given values, q4 methods usually return the input q4 for easy function chaining.
lua.wetgenes.tardis.q4.prerotate
q4 = q4:prerotate(degrees,v3a)
q4 = q4:prerotate(degrees,v3a,r)
Pre apply a degree rotation to this quaternion.
If r is provided then the result is written into r and returned otherwise q4 is modified and returned.
lua.wetgenes.tardis.q4.prerrotate
q4 = q4:prerrotate(radians,v3a)
q4 = q4:prerrotate(radians,v3a,r)
Pre apply a radian rotation to this quaternion.
If r is provided then the result is written into r and returned otherwise q4 is modified and returned.
lua.wetgenes.tardis.q4.reverse
q4 = q4:reverse()
q4 = q4:reverse(r)
Reverse the rotation of this quaternion.
If r is provided then the result is written into r and returned otherwise q4 is modified and returned.
lua.wetgenes.tardis.q4.rotate
q4 = q4:rotate(degrees,v3a)
q4 = q4:rotate(degrees,v3a,r)
Apply a degree rotation to this quaternion.
If r is provided then the result is written into r and returned otherwise q4 is modified and returned.
lua.wetgenes.tardis.q4.rrotate
q4 = q4:rrotate(radians,v3a)
q4 = q4:rrotate(radians,v3a,r)
Apply a radian rotation to this quaternion.
If r is provided then the result is written into r and returned otherwise q4 is modified and returned.
lua.wetgenes.tardis.q4.set
q4 = tardis.q4.set(q4,{0,0,0,1})
q4 = tardis.q4.set(q4,0,0,0,1)
q4 = tardis.q4.set(q4,{"xyz",0,90,0})
q4 = tardis.q4.set(q4,"xyz",0,90,0)
q4 = tardis.q4.set(q4,"xyz",{0,90,0})
If the first item in the stream is not a string then this is just a normal array.set style.
If first parameter of the stream is a string then initialise the quaternion using a simple axis rotation notation Where the string is a list of axis. This string is lower case letters. x y or z and then the following numbers are amount of rotation to apply around that axis in degrees. You should provide as many numbers as letters.
Essentially this gives you a way of initialising quaternion rotations in an easily readable way.
lua.wetgenes.tardis.q4.set_yaw_pitch_roll
q4 = q4:set_yaw_pitch_roll(v3)
q4 = q4:set_yaw_pitch_roll({90,60,30}) -- 30yaw 60pitch 90roll
Set a V3(roll,pitch,yaw) degree rotation into this quaternion
yaw v[3] is rotation about the z axis and is applied first
pitch v[2] is rotation about the y axis and is applied second
roll v[1] is rotation about the z axis and is applied last
lua.wetgenes.tardis.q4.set_yaw_pitch_roll_in_radians
q4 = q4:set_yaw_pitch_roll_in_radians(v)
Set a V3(roll,pitch,yaw) radian rotation into this quaternion
yaw v[3] is rotation about the z axis and is applied first
pitch v[2] is rotation about the y axis and is applied second
roll v[1] is rotation about the z axis and is applied last
lua.wetgenes.tardis.q4.setrot
q4 = q4:setrot(degrees,v3a)
Set this quaternion to a rotation around the given normal by the given degrees.
lua.wetgenes.tardis.q4.setrrot
q4 = q4:setrrot(radians,v3a)
Set this quaternion to a rotation around the given normal by the given radians.