2020 07 12: Diagnostic of mesh indeces and overlapping lines. - syntaxmonkey/Thesis GitHub Wiki
Investigate line transfer
In the current implementation, lines transferred from the Generated Mesh (original) to the Flattened Mesh (Flat Triangulation) does not work properly. The transferred lines appear to be jagged and in some cases the lines overlap with themselves.
We'll try several approaches.
- Plotting through animation. This will allow us to confirm that the
- Check that the indexing is correct when we create the Mesh file.
- Check that the indexing is correct when we read the Mesh file.
- Plot the dots compose the line.
Plot the dots that compose the line
Plotting the points along the lines provides additional information. It appears most of the transferred lines do not overlap.
Plotting each line using a different colour and different dot marker reveals that most of the lines do not overlap, but there are some that do. There may be a problem in the barycentric process.
Take a closer look at barycentric transformation
The barycentric coordinate transformation does not appear to be working correctly. What is the cause?
-
Mixing x-y coordinates? Looking at the code, we are not mixing the x-y values.
-
Mixing the vertices? Looking at the code, we are not mixing the vertices.
-
Vertices order are being rearranged in the Mesh file?
- Try rotating the vertices in the triangles during the barycentric calculations. Rotating the vertices in the target triangle does fix the problem: vertices = vertices[2:] + vertices[:2]. Still unclear what is causing the vertices to be rotated.
The barycentric transformation rotation changes depending on the source Mesh. If the source is the flattened Mesh, then we need to use vertices = vertices[2:] + vertices[:2]. Otherwise, if the source is the Generated Mesh, we need to use vertices = vertices[1:] + vertices[:1].
TODO:
- Improve the line drawing algorithm. Currently we use static values for line densities and dot densities. This fails when the line density is greater than the triangle density.
Improving line density
We will take the following approaches to improve line density.
- Generate Poisson distributed points using the original mask. This set of points will be called the LineSeed points. When drawing vertical lines, we will use the x values from the LineSeed points for drawing the line.
- Vary the Poisson distrnce of the LineSeed points. Try various multiples of the original Poisson distance.
Generating LineSeed points
We were able to generate LineSeed points based on the original mask. The LineSeed points were then used as the x value for the lines.
Here is a screenshot of the vertical lines plotted on the original Mesh and then transferred to the flattened Mesh. The radius for the LineSeed points was equal to the original Mesh.
With the LineSeed radius set to twice the original radius we obtain the following images.
With the LineSeed radius set to three times the original radius we obtain the following images.
We still have uneven line density. To alleviate the line distribution, we can create buckets that span a specific range. We can then enforce that each bucket only contains one line.
Implementing buckets for LineSeed
When we implement buckets for LineSeed points, the lines are much more evenly distributed. Here are some results when we created buckets that are 3 times the size of the original Mesh radius.
TODO:
- We currently plot the vertical lines on the original Mesh. We need to draw the vertical lines on the flat Mesh. We need to convert the LinePoints from the original Mesh coordinates into the flat Mesh coordinates.