ipc-sim / Codim-IPC

Source Codes for Codimensional Incremental Potential Contact (C-IPC)
https://ipc-sim.github.io/C-IPC/
Apache License 2.0
197 stars 35 forks source link

Export physical parameters like contact forces #7

Closed Shamp0o closed 2 years ago

Shamp0o commented 2 years ago

Thank you for this amazing piece of software and for open sourcing it.

I'm planning to use your software in an engineering research context. After playing around with it for a bit I was wondering if there is any way to get contact forces and other values like torques, internal foces, positions and velocities resulting from the simulation with the python bindings. I guess latter two can be calculated from the resulting obj files.

liminchen commented 2 years ago

Thanks for your interest in our work! Unfortunately we didn't expose these to the python binding. But all these information should be able to be obtained via certain C++ functions. For example, the contact forces can be obtained by first computing the barrier gradient using Compute_IncPotential_Gradient() in https://github.com/ipc-sim/Codim-IPC/blob/main/Library/FEM/Energy/IPC_ENERGY.h and then divide it by -dt^2.