Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tools
frackit
Commits
6cfe1288
Commit
6cfe1288
authored
May 25, 2020
by
Dennis Gläser
Browse files
[python][common] register rotate function
parent
479751a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
frackit/python/common/math.hh
View file @
6cfe1288
...
@@ -20,15 +20,30 @@
...
@@ -20,15 +20,30 @@
#define FRACKIT_PYTHON_COMMON_MATH_HH
#define FRACKIT_PYTHON_COMMON_MATH_HH
#include <pybind11/pybind11.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <frackit/geometry/vector.hh>
#include <frackit/geometry/direction.hh>
#include <frackit/common/math.hh>
#include <frackit/common/math.hh>
namespace
Frackit
::
Python
{
namespace
Frackit
::
Python
{
namespace
py
=
pybind11
;
template
<
class
ctype
>
template
<
class
ctype
>
void
registerMath
(
py
bind11
::
module
&
module
)
void
registerMath
(
py
::
module
&
module
)
{
{
module
.
def
(
"toDegrees"
,
&
Frackit
::
toDegrees
<
double
>
,
"Converts radians into degrees"
);
module
.
def
(
"toDegrees"
,
&
Frackit
::
toDegrees
<
ctype
>
,
"Converts radians into degrees"
);
module
.
def
(
"toRadians"
,
&
Frackit
::
toRadians
<
double
>
,
"Converts degrees into radians"
);
module
.
def
(
"toRadians"
,
&
Frackit
::
toRadians
<
ctype
>
,
"Converts degrees into radians"
);
// Register rotation overload for single vector
using
namespace
py
::
literals
;
using
Vector_3
=
Vector
<
ctype
,
3
>
;
using
Direction_3
=
Direction
<
ctype
,
3
>
;
module
.
def
(
"rotate"
,
py
::
overload_cast
<
Vector_3
&
,
const
Direction_3
&
,
ctype
>
(
&
rotate
<
ctype
>
),
"Rotates a vector around the given axis & angle"
,
"vector"
_a
,
"axis"
_a
,
"angle"
_a
);
}
}
}
// end namespace Frackit::Python
}
// end namespace Frackit::Python
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment