I have a home-made program that generates 4 BMP files (top inside, top outside, back inside, back outside) with contour lines for my luthier activity as a hobbyist from another BMP with the contour of the arch and the center line, and the height of the arch. It perfectly works, I crafted 3 violins and 3 cellos with original shapes, they work perfectly.
Now, as the program computes the altitude of each point, I would like to generate 3D models from the results.
At first, I look from a 2D point of view:
I make a list of consecutive 2D vertices (separated at a quite constant distance) that draws the contour of the instrument. I'd like a simple triangulation of the whole instrument, ie. make a 2D mesh inside the contour. I know there are algorithms like Delaunay, but I wanted to know if there is a simple way to do that.
See this picture:
- the blue line is the contour I want to fill
- the black grid is a grid whose square size depends on the precision I want - I would triangulate the inner part of the instrument with squares (made of 2 triangles) like the green ones
- the red line show the case when the 3 vertices of a triangle would be inside the contour but should'nt be drawn as part of it is outside of the contour
Now I have 2 questions:
- Is there an easy way to detect these triangles that are partly outside of the contour, but have their summit inside?
- Is there an easy way to triangulate the remaining parts between the contour and the fully inside squares without using a complicated algorithm like Delaunay?