Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

how to find mininum distance between two points in a linear triangular element (3 nodes)?

1 visualización (últimos 30 días)
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 comentarios
Image Analyst
Image Analyst el 29 de Dic. de 2019
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 el 29 de Dic. de 2019
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......

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by