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
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?
asasdasdasdadsadasd
asasdasdasdadsadasd 2019년 12월 29일
thanks for your reply! I thinkt I have to reformulat my question, the task is not that simple, i.e.
100000 elements (3 nodes) are in used, each element contains 3 nodes, now we should calculate the minimum in each element
so:
for k = 1 : 100000
% loop over each element
for j = 1 : 3
% loop over each line in an element
...
end
% export
dist(k) = min (length(j,1),length(j,2),length(j,3))
end
so long is too long ... therefore I am looking for a very efficient way in Matlab......

답변 (0개)

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by