Comments (4)
One other thing: in all the code the DOF that derivatives are taken with respect to are the vertices flattened row-wise. That is, for vertices
v0x v0y v0z
v1x v1y v1z
⋮
you will get the derivatives in the order
v0x
v0y
v0z
v1x
v1y
v1z
⋮
from ipc-toolkit.
I couldn't label this as documentation
and ended up with bug
. Perhaps it should have been enhancement
, as it's not really a bug!
from ipc-toolkit.
Thanks again for pointing this out.
CollisionMesh::build_from_full_mesh
takes the full (volumetric) mesh vertices and surface edges/faces which index into the full mesh vertices. It then builds a selection matrix to go from full to surface vertices and maps the edge/faces entries accordingly.
CollisionConstraints::compute_potential_hessian
returns a matrix of size vertices.size()
xvertices.size()
(vertices.size() = vertices.rows() * vertices.cols()
). Where vertices
are the CollisionMesh's vertices (i.e., just the surface vertices if you are working with a volumetric mesh).
If you then want the Hessian in terms of the full (volumetric) mesh that was used to build the collision mesh there is the function:
/// @brief Map a matrix quantity on the collision mesh to the full mesh.
/// This is useful for mapping Hessians from the collision mesh to the full
/// mesh (i.e., applies the chain-rule).
/// @param X Matrix quantity on the collision mesh with size equal to ndof() × ndof().
/// @return Matrix quantity on the full mesh with size equal to full_ndof() × full_ndof().
Eigen::SparseMatrix<double> CollisionMesh::to_full_dof(const Eigen::SparseMatrix<double>& X) const;
This handles applying the chain rule of going from full to surface vertices (i.e., multiplying by the transpose of the selection matrix).
Hopefully, this answers your questions.
P.s. I was thinking I will finally add a basic example in the docs of all this (like #5 asked for). Hopefully, that will help new users get started. In the meantime don't hesitate to reach out with any other questions.
from ipc-toolkit.
Thanks @zfergus, that really helps clear things up! I think that might just have saved me from some headaches later :-)
from ipc-toolkit.
Related Issues (16)
- issue in distance_type.tpp HOT 3
- std::array issue HOT 2
- Co-dimensional simulations HOT 4
- EdgeEdgeConstraint distance gradient crash HOT 1
- Questions regarding RigidIPC and GPU CCD HOT 1
- Clarify dimensions of matrix inputs HOT 3
- Shallow checkout with FetchContent may fail if tag is not HEAD HOT 4
- Control threading behavior HOT 3
- Unexpectedly slow CCD HOT 13
- Consider changing naming convention to indicate squared distances HOT 3
- Possibly inconsistent results for convergent formulation with respect to dhat? HOT 2
- Average body mass in IPC-toolkit vs average lumped nodal mass in IPC HOT 4
- Basic example of initialization and simulation loop HOT 2
- Closed-form expressions for the Distance Gradients / Hessians HOT 1
- Possible Bug in the Definition of the Hash Structure HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ipc-toolkit.