Geometry package: Difference between revisions

Jump to navigation Jump to search
m
small fixes
m (small fixes)
Line 27: Line 27:
Now we have our SVG as a polygon compatible with the Geometry package format. You can plot the polygon using the function {{Codeline|drawPolygon}}.  
Now we have our SVG as a polygon compatible with the Geometry package format. You can plot the polygon using the function {{Codeline|drawPolygon}}.  
{{Code|Plotting a polygon compatible with geometry package|<pre>
{{Code|Plotting a polygon compatible with geometry package|<pre>
drawPolygon (P,'-o');
drawPolygon (P, "-o");
</pre>}}
</pre>}}
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 comes with a simplification function but as of version 1.4.0, this function is very naive and wont fix this problem. If you know how to simplify polygons you can contribute!
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 comes with a simplification function but as of version 1.4.0, this function is very naïve and wont fix this problem. If you know how to simplify polygons you can contribute!
We are going to reduce the amount of points of the polygon in a drastic and destructive way (i.e. the shape may be considerably damaged). The codes to do so follows, in the future a better procedure will be published here.
We are going to reduce the amount of points of the polygon in a drastic and destructive way (i.e. the shape may be considerably damaged). The codes to do so follows, in the future a better procedure will be published here.
{{Code|Symplification of a polygon compatible with geometry package|<pre>
{{Code|Symplification of a polygon compatible with geometry package|<pre>
Line 59: Line 59:
{{Code|Plotting mesh with fpl package|<pre>
{{Code|Plotting mesh with fpl package|<pre>
pkg load fpl  
pkg load fpl  
graphics_toolkit('fltk')
graphics_toolkit ('fltk')
pdemesh (T.p, T.e, T.t);
pdemesh (T.p, T.e, T.t);
view (2)
view (2)

Navigation menu