wo80 / Triangle

CMake project for Jonathan Shewchuk's Triangle mesh generator.
Other
63 stars 26 forks source link

Vertex attribute interpolation #4

Closed wo80 closed 8 years ago

wo80 commented 9 years ago

Attributes of vertices inserted during refinement might have unexpected values.

When fixing a bad triangle, we get barycentric coordinates for the new vertex with respect to the bad triangle. But the vertex might lie outside the bad triangle, so this might result in unwanted interpolation values.

Example:

5 2 1 1
1  0.0 0.0  0.0  1
2  4.0 0.0  0.0  1
3  5.0 2.0  2.0  1
4  4.0 4.0  0.0  1
5  0.0 4.0  0.0  1
5 1
1 1 2 1
2 2 3 1
3 3 4 1
4 4 5 1
5 5 1 1
0

Command: triangle.exe -pq30DC example.poly

The bad tiangle is to the right of the box (corner vertices (2, 3, 4)). The new vertex will clearly lie inside the box, so the z attribute should be 0.0, while the value computed in splittriangle method is -3.0.

wo80 commented 8 years ago

Fixed in commit b88832b453aa617906171a932d22bb085df20236