Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
how to find mininum distance between two points in a linear triangular element (3 nodes)?
조회 수: 1 (최근 30일)
이전 댓글 표시
Dear All,
may I ask, how can we determine the minimum distance between two points in each triangular element (3 nodes) in a very efficient way in Matlab?
P.S. Input file includes a lot of triangular elements...
Best regards,
Jacob
댓글 수: 5
Image Analyst
2019년 12월 29일
You asked
how to find mininum distance between two points in a linear triangular element (3 nodes)?
may I ask, how can we determine the minimum distance between two points in each triangular element (3 nodes) in a very efficient way in Matlab?
P.S. Input file includes a lot of triangular elements...
Best regards,
Jacob
=====================================================
So, how long is too long? I just did 100,000 iterations and it took 61 milliseconds:
tic
numPoints = 100000;
r1 = rand(numPoints, 2);
r2 = rand(numPoints, 2);
for k = 1 : numPoints
d(k) = sqrt((r1(k, 1) - r2(k, 1))^2 + (r1(k, 2) - r2(k, 2))^2);
end
toc
Elapsed time is 0.061533 seconds.
What form are your points in? Double arrays of 100000-by-2?
답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!