You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for your code and book. I am a student learning fluid simulation, and I am a little confused about the implementation in custom_implicit_surface2(3).cpp
For instance, near line 125, function closestIntersectionLocal, file fluid-engine-dev/src/jet/custom_implicit_surface2.cpp:
As far as I know, the function "fractionInsideSdf" always returns a positive number in [0, 1]. Also, the "t" here gets "newPhi" SDF. So why "t" has to add a positive number " _resolution * frac" instead of minus?
Thanks for your attention to this matter.
The text was updated successfully, but these errors were encountered:
Hi @Immocat ! Thanks for your question. I think you found a bug in the code :)
A B
---|-------------x-----|--->
prevPhi newPhi
So assume that we are under the situation like above. Point x is where the surface lies which is closer to B. The ray is marching from left to right, with fixed step _resolution (the interval between the bars |). If newPhi has different sign with prevPhi, we want to compute the distance of x between point A and B. To get the approximated distance, we are using fractionInsideSdf function which measures how much the negative SDF region is occupying the line segment AB.
For example, if prevPhi is -0.7 and newPhi is +0.3 (just some arbitrary numbers that make x closer to B), fractionInsideSdf will return 0.7, where the current code will return the right distance from A which is _resolution * 0.7. However, if prevPhi and newPhi are +0.7 and -0.3, the function will lead to _resolution * 0.3 which is not the correct distance from A to x.
Thanks for your code and book. I am a student learning fluid simulation, and I am a little confused about the implementation in custom_implicit_surface2(3).cpp
For instance, near line 125, function closestIntersectionLocal, file fluid-engine-dev/src/jet/custom_implicit_surface2.cpp:
As far as I know, the function "fractionInsideSdf" always returns a positive number in [0, 1]. Also, the "t" here gets "newPhi" SDF. So why "t" has to add a positive number " _resolution * frac" instead of minus?
Thanks for your attention to this matter.
The text was updated successfully, but these errors were encountered: