creates a new quaternion from its coordinates * * Creates a new quaternion with the components set * according to the supplied parameter values. * * @name vmath.quat * @param x [type:number] x coordinate * @param y [type:number] y coordinate * @param z [type:number] z coordinate * @param w [type:number] w coordinate * @return q [type:quaternion] ne
| 1196 | * ``` |
| 1197 | */ |
| 1198 | static int Quat_new(lua_State* L) |
| 1199 | { |
| 1200 | Quat q; |
| 1201 | if (lua_gettop(L) == 0) |
| 1202 | { |
| 1203 | q = Quat::identity(); |
| 1204 | } |
| 1205 | else if (lua_gettop(L) == 1) |
| 1206 | { |
| 1207 | q = *CheckQuat(L, -1); |
| 1208 | } |
| 1209 | else |
| 1210 | { |
| 1211 | q.setX((float) luaL_checknumber(L, 1)); |
| 1212 | q.setY((float) luaL_checknumber(L, 2)); |
| 1213 | q.setZ((float) luaL_checknumber(L, 3)); |
| 1214 | q.setW((float) luaL_checknumber(L, 4)); |
| 1215 | } |
| 1216 | PushQuat(L, q); |
| 1217 | return 1; |
| 1218 | } |
| 1219 | |
| 1220 | /*# creates a quaternion to rotate between two unit vectors |
| 1221 | * |
nothing calls this directly
no test coverage detected