Skip to main content
Question

3D Line-Plane Clipping

  • May 6, 2025
  • 1 reply
  • 72 views

paetzold_s
Contributor
Forum|alt.badge.img+4

Hallo there,

I have a big collection of 3D-lines and a big collection of 3D-Triangles/Surfaces that I need to intersect with each other (I only need to know whether there is an intersection not length, position or number of intersections). Performance is somewhat important due to the size of the dataset.

I tried extruding the triangles to a short height to get a solid and this works but is super slow. 

 

Surely there must be a better/more efficient way to calculate the intersection between a 3D-line and a 3D-triangle?

 

Many thanks in advance.

 

1 reply

takashi
Influencer
  • May 8, 2025

Hi ​@paetzold_s ,

I think a mathematical solution will be required. Consider these properties of a plane and a line segment. 

  • n (nx, ny, nz) - normal vector of the plane
  • q (xq, yq, zq) - a point on the plane
  • p0 (x0, y0, z0) - an end point of the line segment
  • p1 (x1, y1, z1) - another end point of the line segment

Then, perform these vector operations.

  • v0 (vx0, vy0, vz0) = (x0 - xq, y0 - yq, z0 - zq) - 3D vector from q to p0
  • v1 (vx1, vy1, vz1) = (x1 - xq, y1 - yq, z1 - zq) - 3D vector from q to p1
  • dp0 = nx x vx0 + ny x vy0 + nz x vz0 - dot product of n and v0
  • dp1 = nx x vx1 + ny x vy1 + nz x vz1 - dot product of n and v1 

The condition for the plane and the line segment intersect is,

  • (dp0 < 0 and 0 < dp1) or (0 < dp0 and dp1 < 0), i.e. dp0 x dp1 < 0

In FME Workspace, you can use PlanarityFilter transformer (Expose Surface Normal: Yes) to calculate n (nx, ny, nz) : normal vector of a surface and q (xq, yq, zq) : coordinates of a point on the surface.

See the attached workspace that shows how you can implement the logic above to determine if a triangulated surface and a polyline are intersected. It could not be so efficient, but at least better than the solid approach you tried, I think.

Note: Assuming that any triangle face is not vertical to the XY plane and an end point of a line is not on the plane. If there is a such condition, additional processes will be required.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings