ARGoS 3
A parallel, multi-engine simulator for swarm robotics
lua_quaternion.h
Go to the documentation of this file.
1#ifndef LUA_QUATERNION_H
2#define LUA_QUATERNION_H
3
10extern "C" {
11#include <lua.h>
12#include <lualib.h>
13#include <lauxlib.h>
14}
15
16#include <argos3/core/utility/datatypes/datatypes.h>
17#include <argos3/core/utility/math/quaternion.h>
18
19#include <string>
20#include <utility>
21
22namespace argos {
23
25
26 public:
27
28 static void RegisterType(lua_State* pt_state);
29
30 static const std::string& GetTypeId() {
31 return m_strTypeId;
32 }
33
34 static int Create(lua_State* pt_state);
35
36 template<class... TArguments>
37 static void PushQuaternion(lua_State* pt_state, TArguments&&... t_arguments) {
38 /* create a new quaternion */
39 void* pvUserdatum =
40 lua_newuserdata(pt_state, sizeof(CQuaternion));
41 /* run the constructor on the allocated memory */
42 new (pvUserdatum) CQuaternion(std::forward<TArguments>(t_arguments)...);
43 /* set the metatable for the userdatum */
44 luaL_getmetatable(pt_state, m_strTypeId.c_str());
45 lua_setmetatable(pt_state, -2);
46 }
47
48 static CQuaternion& ToQuaternion(lua_State* pt_state, int n_index);
49
50 static int Index(lua_State* pt_state);
51
52 static int NewIndex(lua_State* pt_state);
53
54 static int ToString(lua_State* pt_state);
55
56 static int Equal(lua_State* pt_state);
57
58 static int Multiply(lua_State* pt_state);
59
60 static int Normalize(lua_State* pt_state);
61
62 static int Inverse(lua_State* pt_state);
63
64 static int ToAngleAxis(lua_State* pt_state);
65
66 static int ToEulerAngles(lua_State* pt_state);
67
68
69 private:
70
71 static const std::string m_strTypeId;
72
73 };
74
75}
76
77#endif
The namespace containing all the ARGoS related code.
Definition ci_actuator.h:12
static CQuaternion & ToQuaternion(lua_State *pt_state, int n_index)
static int Normalize(lua_State *pt_state)
static int Inverse(lua_State *pt_state)
static int ToAngleAxis(lua_State *pt_state)
static void RegisterType(lua_State *pt_state)
static int ToEulerAngles(lua_State *pt_state)
static void PushQuaternion(lua_State *pt_state, TArguments &&... t_arguments)
static int NewIndex(lua_State *pt_state)
static int Equal(lua_State *pt_state)
static int ToString(lua_State *pt_state)
static int Create(lua_State *pt_state)
static const std::string & GetTypeId()
static int Multiply(lua_State *pt_state)
static int Index(lua_State *pt_state)