Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advice/Guidance: triangle-triangle intersection in 3D with resulting (if any) closed-line-loop-polygons #19

Closed
a-jp opened this issue Jun 9, 2021 · 2 comments

Comments

@a-jp
Copy link

a-jp commented Jun 9, 2021

Hi,

Is there an implementation in GeometricTools of triangle-triangle intersection in 3D which also returns, if any, the closed line loops of the resulting polygons that result from the intersection? I found triangle-triangle in section 11.5.4 of your book Geometric Tools... which is great, but I wondered if the code was provided here?

I really need the resulting N closed-polygon-line-loops, if any, that define the N-polygons produced as a result of the intersection of the two triangles. Could you point me in the right direction for this?

Thanks,
Andy

@davideberly
Copy link
Owner

When two 3D triangles intersect, the top-level of the query needs to determine whether or not the triangles are coplanar. If the intersecting triangles are not coplanar, they can intersect in a point or a line segment. There is no "closed-polygon-line-loop." May I assume you are referring to the coplanar case? In this case, the triangles can overlap in a convex polygon. Are you looking for code that computes these polygons (if any)? If this is what you want, you can transform the triangle vertices from 3-tuples to 2-tuples. If the common plane contains point P, has normal vector N, and U and V are vectors in the plane so that {U,V,N} is a right-handed orthonormal set (unit-length vectors, mutually perpendicular, N = Cross(U,V)), you can write a vertex Q = P + xU + yV, where x = Dot(U,Q-P) and y = Dot(V,Q-P). Now you have two triangles in 2D. The file IntrTriangle2Triangle2.h has a find-intersection query, FIQuery<Real,Triangle2,Triangle2>, that computes the point, segment or polygon of the intersection (if there is an intersection).

@a-jp
Copy link
Author

a-jp commented Jun 15, 2021

Many thanks for your help here.

@a-jp a-jp closed this as completed Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants