11-02-2021, 10:20 PM
Your comments on my questions were spot on, thanks, and I've progressed quite a bit in the few days since then. Some follow ups to these questions:
I have working hit testing code, using GetClosestHitObject (and I've played with GetAllHitObjects as well) and that seems to work well. I have a sphere that I'm dragging around with mouse movement using VisualEventSource3D.MouseMove. That works fine, but even though I'm excluding the sphere with EventManager3D.RegisterExcludedVisual3D, GetClosestHitObject and GetAllHitObjects seem to be returning the sphere, rather than the my Model3D loaded STL. Any suggestions?
Related to that, dragging the sphere around via the mouse is moderately slow and if I move the mouse fast enough, the sphere doesn't move at all until I stop the motion. I'm assuming it's because VisualEventSource3D.MouseMove is having to iterate the triangles for hit testing and I have 715K triangles (and some models will be 3-5M triangles). I've seen an example that is using octtree.HitTest for higher performance. Is there any way to use the octtree with VisualEventSource3D.MouseMove? I assume I could screen coord mouse position in 2D and project from the camera (or something else?) to the cursor using DXScene.GetRayFromCamera (which I have used) and then hit test with the octtree but if there's an integrated solution, that would be preferred.
I explained this incredibly poorly. What I will have is a pair of points that sit in the surface of a mesh (from my loaded STL) and would like to create a polyline (or similar construct) along the surface of the mesh from one point to the other. So, I'd need to traverse triangle to triangle from start to end. I'm pretty sure I can do it outside of your libraries by constructing a plane from the two points (and a 3rd orthogonal point) and use that to find intersecting triangles and then walk the polyline creating along the plane surface from one point to the other. But again, if there are library methods you can think of that will assist that, it would be helpful.
Quote:You have multiple options for hit testing when using Ab3d.DXEngine.... <cut>
I have working hit testing code, using GetClosestHitObject (and I've played with GetAllHitObjects as well) and that seems to work well. I have a sphere that I'm dragging around with mouse movement using VisualEventSource3D.MouseMove. That works fine, but even though I'm excluding the sphere with EventManager3D.RegisterExcludedVisual3D, GetClosestHitObject and GetAllHitObjects seem to be returning the sphere, rather than the my Model3D loaded STL. Any suggestions?
Related to that, dragging the sphere around via the mouse is moderately slow and if I move the mouse fast enough, the sphere doesn't move at all until I stop the motion. I'm assuming it's because VisualEventSource3D.MouseMove is having to iterate the triangles for hit testing and I have 715K triangles (and some models will be 3-5M triangles). I've seen an example that is using octtree.HitTest for higher performance. Is there any way to use the octtree with VisualEventSource3D.MouseMove? I assume I could screen coord mouse position in 2D and project from the camera (or something else?) to the cursor using DXScene.GetRayFromCamera (which I have used) and then hit test with the octtree but if there's an integrated solution, that would be preferred.
Quote:"Can you give any guidance on if it would be reasonable/possible to be able to draw a polyline (or some similar feature) along a mesh, between two points?"
You have many options to draw lines, multi-lines, polylines, lines with arrows. See "Basic use with Ab3d.PowerToys / Lines3D sample". With using Ab3d.DXEngine you can also render lines with different start and end colors and with line patterns and use line depth bias. You can also render lines on top of other objects or hidden lines. For those samples please check the "Improved visuals" section.
I explained this incredibly poorly. What I will have is a pair of points that sit in the surface of a mesh (from my loaded STL) and would like to create a polyline (or similar construct) along the surface of the mesh from one point to the other. So, I'd need to traverse triangle to triangle from start to end. I'm pretty sure I can do it outside of your libraries by constructing a plane from the two points (and a 3rd orthogonal point) and use that to find intersecting triangles and then walk the polyline creating along the plane surface from one point to the other. But again, if there are library methods you can think of that will assist that, it would be helpful.

