Coder Social home page Coder Social logo

Comments (3)

doyubkim avatar doyubkim commented on May 23, 2024

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.

Let me fix the code and merge to the master soon.

Thanks,
Doyub

from fluid-engine-dev.

doyubkim avatar doyubkim commented on May 23, 2024

Just merged the fix to the master. Please let me know if you have further questions!

from fluid-engine-dev.

Immocat avatar Immocat commented on May 23, 2024

Thanks for your detailed explanation. :)

from fluid-engine-dev.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.