657
edits
Line 35: | Line 35: | ||
n = 1e6; | n = 1e6; | ||
thrsd = 0.38; | thrsd = 0.38; | ||
while n>size (Ps,1) | while n > size (Ps,1) | ||
n = size (Ps,1); | n = size (Ps,1); | ||
ds = sqrt (sumsq (Ps(1:end,:) - Ps([2:end 1],:),2)); | ds = sqrt (sumsq (Ps(1:end,:) - Ps([2:end 1],:),2)); | ||
Ps = Ps(ds>mean (ds)*(1-thrsd),:); | Ps = Ps(ds > mean (ds)*(1-thrsd),:); | ||
end | end | ||
whos P Ps | whos P Ps | ||
Line 54: | Line 54: | ||
<!-- </syntaxhighlight> --> | <!-- </syntaxhighlight> --> | ||
To plot the generated mesh we use the function {{Codeline|pdemesh}} from the {{Forge|fpl}} package. | After this code finishes, the structure T contains our mesh. To plot the generated mesh we use the function {{Codeline|pdemesh}} from the {{Forge|fpl}} package. In general is a good idea to use the openGL render (called ''fltk'') to plot meshes. | ||
{{Code|Plotting mesh with fpl package|<pre> | {{Code|Plotting mesh with fpl package|<pre> | ||
pkg load fpl | pkg load fpl | ||
pdemesh (T.p, T.e, T.t) | graphics_toolkit('fltk') | ||
pdemesh (T.p, T.e, T.t); | |||
view (2) | |||
axis tight | |||
axis equal | |||
</pre>}} | </pre>}} | ||
The output should look something like this | |||
[[File:octave_meshed.png|600x400px|center]] | [[File:octave_meshed.png|600x400px|center]] | ||
Questions? Ideas? Join us in the mailing list of in the IRC channel. | |||
[[File:octave_meshed.png|200px|center]] | |||
=== From piece-wise polynomial shapes to polygons === | === From piece-wise polynomial shapes to polygons === |
edits