Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions python/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ add_subdirectory(ccd)
add_subdirectory(collisions)
add_subdirectory(distance)
add_subdirectory(friction)
add_subdirectory(geometry)
add_subdirectory(implicits)
add_subdirectory(math)
add_subdirectory(potentials)
add_subdirectory(tangent)
add_subdirectory(utils)
12 changes: 9 additions & 3 deletions python/src/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,18 @@ PYBIND11_MODULE(ipctk, m)

define_smooth_potential(m);

// geometry
define_angle(m);
define_area(m);
define_intersection(m);
define_normal(m);

// implicits
define_plane_implicit(m);

// math
define_interval(m);

// potentials
define_normal_potential(m); // define early because it is used next
define_barrier_potential(m);
Expand All @@ -102,9 +111,6 @@ PYBIND11_MODULE(ipctk, m)
define_tangential_adhesion_potential(m);

// utils
define_area_gradient(m);
define_interval(m);
define_intersection(m);
define_logger(m);
define_thread_limiter(m);
define_vertex_to_min_edge(m);
Expand Down
2 changes: 2 additions & 0 deletions python/src/bindings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#include <collisions/bindings.hpp>
#include <distance/bindings.hpp>
#include <friction/bindings.hpp>
#include <geometry/bindings.hpp>
#include <implicits/bindings.hpp>
#include <math/bindings.hpp>
#include <potentials/bindings.hpp>
#include <tangent/bindings.hpp>
#include <utils/bindings.hpp>
Expand Down
8 changes: 8 additions & 0 deletions python/src/geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set(SOURCES
area.cpp
angle.cpp
normal.cpp
intersection.cpp
)

target_sources(ipctk PRIVATE ${SOURCES})
60 changes: 60 additions & 0 deletions python/src/geometry/angle.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#include <common.hpp>

#include <ipc/geometry/angle.hpp>

using namespace ipc;

void define_angle(py::module_& m)
{
m.def(
"dihedral_angle", &dihedral_angle,
R"ipc_Qu8mg5v7(
Compute the bending angle between two triangles sharing an edge.
x0---x2
| \ |
x1---x3

Parameters
----------
x0 : Eigen::Vector3d
The first vertex of the edge.
x1 : Eigen::Vector3d
The second vertex of the edge.
x2 : Eigen::Vector3d
The opposite vertex of the first triangle.
x3 : Eigen::Vector3d
The opposite vertex of the second triangle.

Returns
-------
double
The bending angle between the two triangles.
)ipc_Qu8mg5v7",
py::arg("x0"), py::arg("x1"), py::arg("x2"), py::arg("x3"));

m.def(
"dihedral_angle_gradient", &dihedral_angle_gradient,
R"ipc_Qu8mg5v7(
Compute the Jacobian of the bending angle between two triangles sharing an edge.
x0---x2
| \ |
x1---x3

Parameters
----------
x0 : Eigen::Vector3d
The first vertex of the edge.
x1 : Eigen::Vector3d
The second vertex of the edge.
x2 : Eigen::Vector3d
The opposite vertex of the first triangle.
x3 : Eigen::Vector3d
The opposite vertex of the second triangle.

Returns
-------
Eigen::Vector<double, 12>
The Jacobian matrix of the bending angle with respect to the input vertices.
)ipc_Qu8mg5v7",
py::arg("x0"), py::arg("x1"), py::arg("x2"), py::arg("x3"));
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <common.hpp>

#include <ipc/utils/area_gradient.hpp>
#include <ipc/geometry/area.hpp>
#include <ipc/utils/eigen_ext.hpp>

using namespace ipc;

void define_area_gradient(py::module_& m)
void define_area(py::module_& m)
{
m.def(
"edge_length_gradient", &edge_length_gradient,
Expand Down
8 changes: 8 additions & 0 deletions python/src/geometry/bindings.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once

#include <pybind11/pybind11.h>

void define_angle(py::module_& m);
void define_area(py::module_& m);
void define_normal(py::module_& m);
void define_intersection(py::module_& m);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <common.hpp>

#include <ipc/utils/intersection.hpp>
#include <ipc/geometry/intersection.hpp>

#include <igl/predicates/segment_segment_intersect.h>

Expand Down
Loading