Polygon Intersections
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi everyone,
I actually have to compute intersections between thousands of 2D triangles and I found the function "Polygons_intersection" on the File Exchange. My only (and significant) problem is that it takes an infinite amount of time to perform the task,I was wondering if there would be a way to improve greatly the computational time of the algorithm? I really need quickly such a function working at enhanced speed.
Also, do you have any other idea on how to find the intersection of 2D triangles using matlab built-in functions?
Context: basically,what's behind my code is a simple flow solver. My algorithm starts by importing an ".stl" file (from whatever CAD program) within Matlab in terms of faces (f) and vertices (v). This helps me to define a mesh made up of triangle elements that follows the surface of my 3D model. After working through the mesh, and depending on the freestream velocity, I need to determine which of the triangle element is impacted by the rectilinear flow.
To do so, I define a new reference frame based on the freestream velocity vector,I calculate the vertices in this new reference frame,projects my vertices in a plane whose normal is the velocity vector and I want to determine the intersection between the triangles on the plane and determines which of the triangle is the foremost to keep only that one and remove the obstructed ones (once again depending on the flow direction).
Thanks a lot for you help,
Romain
댓글 수: 0
답변 (1개)
Image Analyst
2012년 3월 13일
Sure, if you're willing to do it numerically (i.e. with 2D arrays, which can be considered images) instead of analytically (using vertex coordinates and having to solve analytical equations to find out exactly where the lines cross). There would be some quantization error but maybe that doesn't matter, especially if you're already dealing with digitized images. You can use normal logical operators, like
intersectionImage = image1 & image2;
assuming image1 and image2 are binary (logical) images that define where the triangles are.
참고 항목
카테고리
Help Center 및 File Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!