Geometry package: Difference between revisions

Jump to navigation Jump to search
Line 33: Line 33:
As you can see the polygon has lots of points. We need to simplify the polygon in order to obtain a mesh of reasonable size. Otherwise gmsh will have problems meshing and the result could be huge (or a segmentation fault :( ). The package geometry (> 1.5.0) comes with a simplification function that uses the [http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm Ramer-Douglas-Peucker algorithm] to reduce thenumber of points in the polygon.
As you can see the polygon has lots of points. We need to simplify the polygon in order to obtain a mesh of reasonable size. Otherwise gmsh will have problems meshing and the result could be huge (or a segmentation fault :( ). The package geometry (> 1.5.0) comes with a simplification function that uses the [http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm Ramer-Douglas-Peucker algorithm] to reduce thenumber of points in the polygon.
{{Code|Symplification of a polygon compatible with geometry package|<syntaxhighlight lang="matlab" style="font-size:13px">
{{Code|Symplification of a polygon compatible with geometry package|<syntaxhighlight lang="matlab" style="font-size:13px">
P  = symplifypolygon(Ps, 'tol', 1e-3);  
P  = simplifypolygon(P, 'tol', 1e-3);  
</syntaxhighlight>}}
</syntaxhighlight>}}
You should play with the tolerance option until you get a nice polygon.
You should play with the tolerance option until you get a nice polygon.
Anonymous user

Navigation menu