Determine if the line intersects with the 3dtilefeature

I am currently working on a project to visualize underground pipe networks. I want to implement a function that draws a line and determines all the 3dtileFeatures (each pipe) that the line passes through. How can I find all the 3dtileFeatures that intersect with this line?

Hi there,

I think the functionality you’re looking for is drill picking.

That function I linked is targeting at picking on a ray from the camera to position on screen. Is that sufficient for your use case, or are you looking to do this with arbitrary rays?

Thank you, but what I want to achieve is to draw a line horizontally, which may pass through three pipelines at the same time, so I need to get these three pipelines

Ah, that may get a bit more tricky since you’ll need to ensure all data is loaded in a view in order to use the rendering engine to do any sort of picking. Then, you may need to engineer a picking solution specific to your use case.

As an alternative, you could implement a solution that doesn’t depend on the rendering engine. Performance may be a bit slower, but you could iterate through the 3D tileset tiles to determine the intersections with the line.

The horizontal line I draw is not necessarily on the same horizontal plane as the 3dtileFeature, so I should determine whether the 3dtileFeature passes through the vertical plane of the horizontal line or whether the horizontal line passes through the vertical plane of the 3dtileFeature. Is this possible?