yuanming-hu / taichi_mpm

High-performance moving least squares material point method (MLS-MPM) solver. (ACM Transactions on Graphics, SIGGRAPH 2018)
MIT License
2.36k stars 315 forks source link

Condition for a grid node in rigid_transfer.cpp for 2D and 3D case. #56

Open yuichiro-student opened 2 years ago

yuichiro-student commented 2 years ago

Hi, I am trying to understand the code, having a problem in understanding rigid_transfer.cpp. Specifically, the condition for determining whether an grid node is valid for a rigid body element.

If I am understanding correctly, in 3D case described in line 47 to line 51, coord[0] and coord[1] are position of a grid node projected on a triangular mesh and thus it seems to be reasonable to have the condition; 0 <= coord[0] && 0 <= coord[1] && coord[0] + coord[1] <= 1. image

In 2D case described in line 42 to line 46, however, although the code is applying similar condition to the projected grid point on a elemental bar, the condition seems to be relaxed by 2%. -0.02 <= coord[0] && coord[0] <= 1.02 image

Could anyone tell me why the difference between 2D and 3D are necessary and where do the numbers -0.02 and 1.02 come from? Thank you so much.