Geometry package: Difference between revisions

Jump to navigation Jump to search
m
No edit summary
Line 20: Line 20:


<!-- <syntaxhighlight lang="matlab"> -->
<!-- <syntaxhighlight lang="matlab"> -->
{{Code|Loading the file as polygon compatible with geometry package|<pre>
{{Code|Loading the file as polygon compatible with geometry package|<syntaxhighlight line="GESHI_FANCY_LINE_NUMBERS" lang="C">
octavesvg = svg ("octave.svg").normalize();
octavesvg = svg ("octave.svg").normalize();
ids      = octavesvg.pathid();
ids      = octavesvg.pathid();
P        = octavesvg.path2polygon (ids{1}, 12)(1:end-1,:);
P        = octavesvg.path2polygon (ids{1}, 12)(1:end-1,:);
P        = bsxfun (@minus, P, centroid (P));
P        = bsxfun (@minus, P, centroid (P));
</pre>}}
</syntaxhighlight>}}
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>
657

edits

Navigation menu