Comments (5)
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.
And i have to check for vertex edges and planes And normals for in_out in code ?
from geometry3sharp.
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.
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.
I see, thank you Ryan.
Have a nice day
from geometry3sharp.
Related Issues (20)
- Convert mesh regions to 2d, alter in 2d, push back into 3d mesh
- Is this project dead? HOT 1
- Get brick materials right
- Fix hover info on bricks
- Rewrite right pointer (PLEASE!) HOT 1
- Mesh expansion and comparison
- Refactor cursor3d
- Refactor HandR and HandL to use input action class
- Write playmode tests for right pointer flow
- Rider clean project to adjust line length
- Break up LDrawConfig into different classes
- Refactor BrickMaterialsLoader (PLEASE!!!)
- Example of mesh volume calculation HOT 3
- 这个可以做曲面拟合吗?
- Can this be used for surface fitting?
- Narrow band SDF generation from meshes is adding a shell to objects HOT 1
- Minkowski sum 3D
- Get closest vertex on mesh surface HOT 2
- Boolean operations on polygons and polyhedra?
- Quadratic Bezier Curves HOT 1
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 geometry3sharp.