fortran - Populating STL surface mesh uniformly with points -


I would like to be able to take an STL file (triangular surface mesh) and populate the trap with the numbers such as density constant In the points I am writing the program in Fortran.

So far, I can read in binary STL files and can store vertebrates and also read the normal surface. Here is an example file (which is read in 2D view for simplicity).

example file in STL 2 dimension.

My current algorithm Fills each triangle using the following formula:

x = v1 + a (v2 - v1) + b (v3 - v1)

Where v1, v2, v3 triangle and There is an arbitrary condition within the X triangle (or on the edges). "A" and "B" are different between 0 and 1 and their amount is less than 1. They represent the distance with two edges (which starts from the same head). The difference between the particles should be the same for each side. Below is an example of the results given below: Example STL file with 2 digits of population with numbers < / P>

resulting in particle density near the uniform nowhere. Do you have any idea how can I customize my code, like the density triangle from the triangle will remain constant? Related code below:

 ! Do the STL file for every triangle in DO I = 1, NT! V12 = second (v / v (1, j + 1) -v (1, j), v (2, j + 1) -v (2, j), v (3, j + 1) -v (3, j) /)! Distance from third point to third point vector = first v13 = (/ v (1, j + 2) -v (1, j), v (2, j + 2) -v (2, j), v (3, J + 2) - V (3, j) /)! Scale distance for dist_a = sqrt (v12 (1) ** 2 + v12 (2) ** 2 + v12 (3) ** 2) before the second point! Distance scalar from the third point before dist_b = sqrt (v13 (1) ** 2 + v13 (2) ** 2 + v 133 (3) ** 2)! The number of particles arises with vector vector of N / A / DI (dist_a / spacing)! The number of particles arises with the second edge vector NOT-B = INST (dist_b / spacing)! For all the particles one = 1, no_e on the first edge! For all the particles, the other edges DO B = 1, NO IB ((real (a) / no_a) + (REAL (b) / not_b)> 1) EXIT temp (1) = v (1, j) + (real (A) / no_a) * v12 (1) + (real (b) / no_b) * v13 (1) temporary (2) = v (2, j) + (real (a) / no_a) * v12 (2 ) + (Real (b) / no_b) * v13 (2) temporary (3) = v (3, j) + (real (a) / no_a) * v12 (3) + (real) / no_b) * v13 (3) k = k + 1 s_points (k, 1: 3) = (/ temporary (1), temporary (2), temporary (3) /) END DO J = J + 3 END with the solution I went with , It was divided into two triangle triangles. It launches the latex opposite the longest edge, which is orthogonely on the longest edge, it divides the triangle into two small triangles, each of which has a 90 degree angle. A detailed answer can be found on how to do this, by creating points with both 90 degree inclinations, a uniform distribution of particles can be obtained. 

This method needs to be adapted so that the particles are not produced more than once with the edges which are similar to many triangles. I have not done so yet See the picture below for the results This solution does not receive an isotropic distribution, but it is not a concern for my intent application.

(Thanks to Vedic F and for his advice on criteria 2, I tried to apply my attitude but that was not enough to make it work)

Enter image details here


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -