Giter Club home page Giter Club logo

Comments (5)

rms80 avatar rms80 commented on August 19, 2024

DMeshAABBTree.FindAllHitTriangles() will find all the hit triangles. Pass each triangle ID into MeshQueries. TriangleIntersection() to get the intersection objects. Sort by ray parameter. Then you have ray T values [t0,t1,t2,t3,t4,...]

if your objects are clean closed manifold meshes w/ no self-intersections, then you can just sequentially pair sequential t's - ie the spans are [t0,t1], [t2,t3], etc. Add up widths of these intervals.

If your objects are not nice closed solids, things get...complicated =).

from geometry3sharp.

rajxabc avatar rajxabc commented on August 19, 2024

And i have to check for vertex edges and planes And normals for in_out in code ?

from geometry3sharp.

rms80 avatar rms80 commented on August 19, 2024

yes, if you want to handle edge/plane intersections then things also get more complicated. The intersection object returned by MeshQueries.TriangleIntersection() returns flags that indicate these cases.

if your rays are always starting outside the object, and the object is a closed non-self-intersecting mesh, then you don't need to do the normal checking, you can just pair the intervals. In all other cases yes you need to do some kind of hack like that.

An alternative that is more robust but less precise would be to densely sample the mesh winding number along the ray (the AABBTree class has a function for this). The value is 0 outside and non-zero inside. This works w/ self-intersections. If you want precision you can do a bisection rootfinding at each zero/nonzero crossing.

from geometry3sharp.

rms80 avatar rms80 commented on August 19, 2024

also you should know that the current AABB ray-intersection is not strictly water-tight, so rays can sometimes sneak between two coincident edges, or hit two triangles on their shared edge, depending on the numerics. To work around this you could jitter the ray and combine multiple samples.

from geometry3sharp.

rajxabc avatar rajxabc commented on August 19, 2024

I see, thank you Ryan.
Have a nice day

from geometry3sharp.

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.