vectorized/parallel version of IntersectWithLine for ray casting
See original GitHub issueHi @marcomusy, I was checking on your example here and I was wondering whether it is possible to apply ray casting with multiple rays at once, without a for
loop. For example if I have an origin point at p1: [0,0,0]
and then multiple rays at different directions pnts: [[0,0,1], [0.25, 1, 0.5], [0.5, 1, 0.25]]
, how to get intersection points with a surface at once.
I was checking also whether I could maybe use intersectWithLine()
with numpy.vectorize()
or numpy.apply_along_axis()
, but I am not sure how to do it.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Need a fast ray-box intersection that handles if a ray is parallel ...
This is a C++ implementation. Slab is the space between a pair of parallel planes.Test if ray R(t) = p + t *...
Read more >Ray-Plane and Ray-Disk Intersection - Scratchapixel
If the ray intersects this plane, all we have to do is to compute the intersection point, then compute the distance from this...
Read more >How do you check for intersection between a line segment ...
Let r = (cos θ, sin θ). Then any point on the ray through p is representable as p + t r (for...
Read more >Ray tracing in Parallel - ScalaBlitz
Ray tracing is a way of rendering an image by simulating light ... For that, we need to be able to compute the...
Read more >Ray-casting algorithm - Rosetta Code
Where the function ray_intersects_segment return true if the horizontal ray starting from the point P intersects the side (segment), false ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, it should be easy to vectorize it. But for now I think that the accelerated solution from
trimesh
should be fine for my needs.Once I find some free time I will try to port it to
pycuda
. I think it would be a nice opportunity to get my hands dirty with cuda programming.Thanks for your time 😃
thanks for sharing this findings… my guess is that if you really need one or more orders of magnitude increase in speed you should go for the pycuda implementation, although just looking at the c++ Möller–Trumbore intersection algorithm implementation it seems to me that it could be vectorizable in numpy…
this is not vectorized, just a translation of the above Möller–Trumbore algo: