This function is used quite a bit in rendering, so I think there should be something suitable out there.
The application is a ray passing through matter defined as a voxelized 3D volume (in 2D would like a planar mesh) with different materials in each voxel. I would like to calculate the attenuation of the ray through the volume.
To do this, I would need to get the voxels that are intersected by the line and the path length through each voxel: VoxelID, Distance.
I can implement this in Rhino by creating an array of faces to form a 3D rectangular mesh and calculating the points of intersections with each face (done). Then, I would need to identify the corresponding voxels of the intersected faces and compute the distance. This can be done, but may take some time plus might be slow.
Is there a set of simpler functions in Rhino?
If not, what about C, C++, C# or VB?

Hi Nathan / All,
Unfortunately, it is not. Let me clarify.
In the enclosed picture, a volume broken into rectangular voxels (â€śboxesâ€ť) is shown. A ray (line) intersects the faces of the voxels at the points. The goal is to identify the voxelID and compute the path length (distance) through each voxel. The output would be an array of VoxelID and pathlength.
I created this geometry using a mesh of faces and found the points using Intersection.MeshLine. I reordered the points along the line, calculated the pathlengths and now need somehow to find the voxelDs associated with the intersected faces. So, there is a solution to this problem using this approach. But it is convoluted and not efficient
Again, this is a common problem.
Assume a light source and an object made of pixels with each pixel having an opacity. The source rays go through the object an the light is attenuated. To calculate the attenuated light, we need the opacity of the intersected pixels and the path length through each pixel.
Hopefully, this clarifies the problem.
Thank for your reply!