-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathangleaxisf.cpp
More file actions
61 lines (44 loc) · 1.21 KB
/
Copy pathangleaxisf.cpp
File metadata and controls
61 lines (44 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "angleaxisf.hpp"
#include "quaternionf.hpp"
#include "matrix.hpp"
namespace LuaEigen {
AngleAxisf::AngleAxisf(lua_State *L)
{}
AngleAxisf::AngleAxisf(const Base &o)
: Base(o)
{}
AngleAxisf::~AngleAxisf()
{}
int AngleAxisf::oninit(lua_State *L) {
float angle = luaL_checknumber(L, 2);
Vector3f *axis = Lunar<Vector3f>::check(L, 3);
*this = Eigen::AngleAxisf(angle, *axis);
return 0;
}
int AngleAxisf::__mul(lua_State *L) {
AngleAxisf *op1a = Lunar<AngleAxisf>::test(L, 1);
if (op1a != nullptr) {
AngleAxisf *op2a = Lunar<AngleAxisf>::test(L, 2);
if (op2a != nullptr) {
Lunar<Quaternionf>::push(L, new Quaternionf((*op1a) * (*op2a)), true);
return 1;
}
Vector3f *op2v = Lunar<Vector3f>::test(L, 2);
if (op2v != nullptr) {
Lunar<Vector3f>::push(L, new Vector3f((*op1a) * (*op2v)), true);
return 1;
}
return luaL_argerror(L, 2, "Argument must be a AngleAxisf or Vector3f");
}
return luaL_argerror(L, 1, "Argument must be a AngleAxisf");
}
int AngleAxisf::__tostring(lua_State *L) {
lua_pushstring(L, "?");
return 1;
}
LUNAR_DEFINE(AngleAxisf) {
LUNAR_METHOD(AngleAxisf, __mul),
LUNAR_METHOD(AngleAxisf, __tostring),
{NULL, NULL}
};
}