Commit 4472e953 by Dennis Gläser

### [python] mofify wrappers for common

```the rotate() function has been moved to the geometry module, and the
wrappers for toDegrees() or toRadians() have been removed as Python
offers such functions```
parent defc80dd
Pipeline #2848 passed with stages
in 9 minutes and 25 seconds
 ... ... @@ -141,6 +141,7 @@ ctype toRadians(const ctype degrees) * \param angle The rotation angle * \note The rotation matrix is taken from: * https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle * \todo TODO: This should probably be moved to geometry */ template void rotate(Vector& v, ... ... @@ -176,6 +177,7 @@ void rotate(Vector& v, * vector several times, as the rotation matrix is only constructed once! * \note The rotation matrix is taken from: * https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle * \todo TODO: This should probably be moved to geometry */ template void rotate(std::vector>& vectors, ... ...
 install(FILES id.hh math.hh DESTINATION \${CMAKE_INSTALL_INCLUDEDIR}/frackit/python/common)
 ... ... @@ -26,6 +26,7 @@ point.hh polygon.hh quadrilateral.hh registerdimensionproperties.hh rotate.hh segment.hh sphere.hh triangle.hh ... ...
 ... ... @@ -16,11 +16,10 @@ * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * *****************************************************************************/ #ifndef FRACKIT_PYTHON_COMMON_MATH_HH #define FRACKIT_PYTHON_COMMON_MATH_HH #ifndef FRACKIT_PYTHON_GEOMETRY_ROTATE_HH #define FRACKIT_PYTHON_GEOMETRY_ROTATE_HH #include #include #include #include ... ... @@ -31,11 +30,8 @@ namespace Frackit::Python { namespace py = pybind11; template void registerMath(py::module& module) void registerRotate(py::module& module) { module.def("toDegrees", &Frackit::toDegrees, "Converts radians into degrees"); module.def("toRadians", &Frackit::toRadians, "Converts degrees into radians"); // Register rotation overload for single vector using namespace py::literals; using Vector_3 = Vector; ... ...
 ... ... @@ -18,10 +18,8 @@ *****************************************************************************/ #include #include #include PYBIND11_MODULE(_common, module) { Frackit::Python::registerId(module); Frackit::Python::registerMath(module); }
 ... ... @@ -47,6 +47,7 @@ #include #include #include #include PYBIND11_MODULE(_geometry, module) { ... ... @@ -96,4 +97,7 @@ PYBIND11_MODULE(_geometry, module) // bounding box computation Frackit::Python::registerGetBoundingBox(module); // rotation algorithms Frackit::Python::registerRotate(module); }
 ... ... @@ -193,7 +193,7 @@ class DiskSampler: e2 = Direction_3(axes[1]) e3 = Direction_3(Vector_3(0.0, 0.0, 1.0)) from frackit.common import rotate from frackit.geometry import rotate rotate(axes[1], e1, alpha) # rotate minor axis around x rotate(axes[0], e2, beta) # rotate both axes around y rotate(axes[1], e2, beta) # rotate both axes around y ... ... @@ -338,7 +338,7 @@ class PolygonSampler: edgeVectors.sort(key=lambda v: getAngle(v)) # rotate by strike and dip angle from frackit.common import rotate from frackit.geometry import rotate from frackit.geometry import Direction dipAngle = self.dipAngleSampler() strikeAngle = self.strikeAngleSampler() ... ... @@ -435,7 +435,7 @@ class QuadrilateralSampler: axes = [Vector_3(1.0, 0.0, 0.0), Vector_3(0.0, 1.0, 0.0)] from frackit.geometry import Direction_3 from frackit.common import rotate from frackit.geometry import rotate rotate(axes[0], Direction_3(Vector_3(0.0, 0.0, 1.0)), strike); rotate(axes[1], Direction_3(Vector_3(0.0, 0.0, 1.0)), strike); rotate(axes[0], Direction_3(axes[1]), dip); ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!