<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.inkscape.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mgsloan</id>
	<title>Inkscape Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.inkscape.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mgsloan"/>
	<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/Special:Contributions/Mgsloan"/>
	<updated>2026-04-08T15:38:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://wiki.inkscape.org/wiki/index.php?title=Working_with_2Geom_FAQ&amp;diff=16662</id>
		<title>Working with 2Geom FAQ</title>
		<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=Working_with_2Geom_FAQ&amp;diff=16662"/>
		<updated>2007-11-01T22:37:06Z</updated>

		<summary type="html">&lt;p&gt;Mgsloan: /* How to convert from Path to pwd2 to d2pw to path and back? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Questions that arise during coding with 2geom are put here. To see other 2geom related questions go to the general [[lib2geom FAQ]].&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===How to create a straight line (for types: Path, pwd2, d2pw)?===&lt;br /&gt;
    Path p;&lt;br /&gt;
    p.appendNew&amp;lt;LineSegment&amp;gt;(a, b);&lt;br /&gt;
    &lt;br /&gt;
    Piecewise&amp;lt;D2&amp;lt;SBasis&amp;gt; &amp;gt; pwd2 = Piecewise&amp;lt;D2&amp;lt;SBasis&amp;gt; &amp;gt;(D2&amp;lt;SBasis&amp;gt;(Linear(a[X], b[X]), Linear(a[Y], b[Y])));&lt;br /&gt;
&lt;br /&gt;
===How to convert from Path to pwd2 to d2pw to path and back?===&lt;br /&gt;
&lt;br /&gt;
    D2&amp;lt;Piecewise&amp;lt;SBasis&amp;gt; &amp;gt; y;&lt;br /&gt;
    Piecewise&amp;lt;D2&amp;lt;SBasis&amp;gt; &amp;gt; x;&lt;br /&gt;
    Path p;&lt;br /&gt;
    //Assume the above vars are initialized&lt;br /&gt;
    x = p.toPwSb();&lt;br /&gt;
    y = make_cuts_independant(x);  // pwd2 -&amp;gt; d2pw&lt;br /&gt;
    x = sectionize(y);             // d2pw -&amp;gt; pwd2&lt;br /&gt;
&lt;br /&gt;
===How do I calculate the bounding box of a path?===&lt;br /&gt;
&lt;br /&gt;
    Rect r = path.boundsFast(); &lt;br /&gt;
or&lt;br /&gt;
    Rect r = path.boundsExact();&lt;br /&gt;
&lt;br /&gt;
===How do I convert 2geom to svgd and back?===&lt;br /&gt;
inkscape has code for this somewhere :p  (Johan knows this)&lt;br /&gt;
&lt;br /&gt;
===What does &amp;quot;compose&amp;quot; do?===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Function_composition Compose] is the mathematical operation f(?) o g(?) = f(g(?)).  Any transformation, be it translation or mesh distort, can be considered a composition of the original path P(t)-&amp;gt;(u,v) and a function T(u,v)-&amp;gt;(x,y) which takes each point in the plane to a new point.  We write this transformation as compose(T, P).  For examples of such composition at work look at the toys&lt;br /&gt;
&lt;br /&gt;
* '2dsb2d', which composes the path with a polynomial mesh function called a coons patch&lt;br /&gt;
* 'plane3d', which composes the path with a 3d projection onto a plane surface&lt;br /&gt;
* 'center-warp', which shows how repeated composition produces the tweak tool effect&lt;br /&gt;
* 'path-along-path' which shows how composition allows mapping a shape along a path&lt;br /&gt;
&lt;br /&gt;
2Geom provides various compose operations for functions representable using piecewise sbasis functions, as well the ability to compose arbitrary functions defined directly in code.  All the mathematics is performed in sbasis space.&lt;/div&gt;</summary>
		<author><name>Mgsloan</name></author>
	</entry>
	<entry>
		<id>https://wiki.inkscape.org/wiki/index.php?title=Working_with_2Geom_FAQ&amp;diff=16661</id>
		<title>Working with 2Geom FAQ</title>
		<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=Working_with_2Geom_FAQ&amp;diff=16661"/>
		<updated>2007-11-01T22:26:56Z</updated>

		<summary type="html">&lt;p&gt;Mgsloan: /* How to convert from Path to pwd2 to d2pw to path and back? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Questions that arise during coding with 2geom are put here. To see other 2geom related questions go to the general [[lib2geom FAQ]].&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===How to create a straight line (for types: Path, pwd2, d2pw)?===&lt;br /&gt;
    Path p;&lt;br /&gt;
    p.appendNew&amp;lt;LineSegment&amp;gt;(a, b);&lt;br /&gt;
    &lt;br /&gt;
    Piecewise&amp;lt;D2&amp;lt;SBasis&amp;gt; &amp;gt; pwd2 = Piecewise&amp;lt;D2&amp;lt;SBasis&amp;gt; &amp;gt;(D2&amp;lt;SBasis&amp;gt;(Linear(a[X], b[X]), Linear(a[Y], b[Y])));&lt;br /&gt;
&lt;br /&gt;
===How to convert from Path to pwd2 to d2pw to path and back?===&lt;br /&gt;
&lt;br /&gt;
    D2&amp;lt;Piecewise&amp;lt;SBasis&amp;gt; &amp;gt; y;&lt;br /&gt;
    Piecewise&amp;lt;D2&amp;lt;SBasis&amp;gt; &amp;gt; x;&lt;br /&gt;
    //Assume the above vars are initialized&lt;br /&gt;
    y = make_cuts_independant(x);  // pwd2 -&amp;gt; d2pw&lt;br /&gt;
    x = sectionize(y);             // d2pw -&amp;gt; pwd2&lt;br /&gt;
&lt;br /&gt;
===How do I calculate the bounding box of a path?===&lt;br /&gt;
&lt;br /&gt;
    Rect r = path.boundsFast(); &lt;br /&gt;
or&lt;br /&gt;
    Rect r = path.boundsExact();&lt;br /&gt;
&lt;br /&gt;
===How do I convert 2geom to svgd and back?===&lt;br /&gt;
inkscape has code for this somewhere :p  (Johan knows this)&lt;br /&gt;
&lt;br /&gt;
===What does &amp;quot;compose&amp;quot; do?===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Function_composition Compose] is the mathematical operation f(?) o g(?) = f(g(?)).  Any transformation, be it translation or mesh distort, can be considered a composition of the original path P(t)-&amp;gt;(u,v) and a function T(u,v)-&amp;gt;(x,y) which takes each point in the plane to a new point.  We write this transformation as compose(T, P).  For examples of such composition at work look at the toys&lt;br /&gt;
&lt;br /&gt;
* '2dsb2d', which composes the path with a polynomial mesh function called a coons patch&lt;br /&gt;
* 'plane3d', which composes the path with a 3d projection onto a plane surface&lt;br /&gt;
* 'center-warp', which shows how repeated composition produces the tweak tool effect&lt;br /&gt;
* 'path-along-path' which shows how composition allows mapping a shape along a path&lt;br /&gt;
&lt;br /&gt;
2Geom provides various compose operations for functions representable using piecewise sbasis functions, as well the ability to compose arbitrary functions defined directly in code.  All the mathematics is performed in sbasis space.&lt;/div&gt;</summary>
		<author><name>Mgsloan</name></author>
	</entry>
	<entry>
		<id>https://wiki.inkscape.org/wiki/index.php?title=Working_with_2Geom_FAQ&amp;diff=16651</id>
		<title>Working with 2Geom FAQ</title>
		<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=Working_with_2Geom_FAQ&amp;diff=16651"/>
		<updated>2007-10-31T00:45:50Z</updated>

		<summary type="html">&lt;p&gt;Mgsloan: /* How to create a straight line (for types: Path, pwd2, d2pw)? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Questions that arise during coding with 2geom are put here. To see other 2geom related questions go to the general [[lib2geom FAQ]].&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===How to create a straight line (for types: Path, pwd2, d2pw)?===&lt;br /&gt;
    Path p;&lt;br /&gt;
    p.appendNew&amp;lt;LineSegment&amp;gt;(a, b);&lt;br /&gt;
    &lt;br /&gt;
    Piecewise&amp;lt;D2&amp;lt;SBasis&amp;gt; &amp;gt; pwd2 = Piecewise&amp;lt;D2&amp;lt;SBasis&amp;gt; &amp;gt;(D2&amp;lt;SBasis&amp;gt;(Linear(a[X], b[X]), Linear(a[Y], b[Y])));&lt;br /&gt;
&lt;br /&gt;
===How to convert from Path to pwd2 to d2pw to path and back?===&lt;br /&gt;
&lt;br /&gt;
    D2&amp;lt;Piecewise&amp;lt;SBasis&amp;gt; &amp;gt; y = make_cuts_independant(x);&lt;br /&gt;
    x = sectionize(y);&lt;br /&gt;
&lt;br /&gt;
===How do I calculate the bounding box of a path?===&lt;br /&gt;
&lt;br /&gt;
    Rect r = path.boundsFast(); &lt;br /&gt;
or&lt;br /&gt;
    Rect r = path.boundsExact();&lt;br /&gt;
&lt;br /&gt;
===How do I convert 2geom to svgd and back?===&lt;br /&gt;
inkscape has code for this somewhere :p  (Johan knows this)&lt;br /&gt;
&lt;br /&gt;
===What does &amp;quot;compose&amp;quot; do?===&lt;br /&gt;
(i keep forgetting)&lt;/div&gt;</summary>
		<author><name>Mgsloan</name></author>
	</entry>
	<entry>
		<id>https://wiki.inkscape.org/wiki/index.php?title=Working_with_2Geom_FAQ&amp;diff=16650</id>
		<title>Working with 2Geom FAQ</title>
		<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=Working_with_2Geom_FAQ&amp;diff=16650"/>
		<updated>2007-10-31T00:45:40Z</updated>

		<summary type="html">&lt;p&gt;Mgsloan: /* Questions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Questions that arise during coding with 2geom are put here. To see other 2geom related questions go to the general [[lib2geom FAQ]].&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
===How to create a straight line (for types: Path, pwd2, d2pw)?===&lt;br /&gt;
    Path p;&lt;br /&gt;
    p.appendNew&amp;lt;LineSegment&amp;gt;(a, b);&lt;br /&gt;
&lt;br /&gt;
    Piecewise&amp;lt;D2&amp;lt;SBasis&amp;gt; &amp;gt; pwd2 = Piecewise&amp;lt;D2&amp;lt;SBasis&amp;gt; &amp;gt;(D2&amp;lt;SBasis&amp;gt;(Linear(a[X], b[X]), Linear(a[Y], b[Y])));&lt;br /&gt;
&lt;br /&gt;
===How to convert from Path to pwd2 to d2pw to path and back?===&lt;br /&gt;
&lt;br /&gt;
    D2&amp;lt;Piecewise&amp;lt;SBasis&amp;gt; &amp;gt; y = make_cuts_independant(x);&lt;br /&gt;
    x = sectionize(y);&lt;br /&gt;
&lt;br /&gt;
===How do I calculate the bounding box of a path?===&lt;br /&gt;
&lt;br /&gt;
    Rect r = path.boundsFast(); &lt;br /&gt;
or&lt;br /&gt;
    Rect r = path.boundsExact();&lt;br /&gt;
&lt;br /&gt;
===How do I convert 2geom to svgd and back?===&lt;br /&gt;
inkscape has code for this somewhere :p  (Johan knows this)&lt;br /&gt;
&lt;br /&gt;
===What does &amp;quot;compose&amp;quot; do?===&lt;br /&gt;
(i keep forgetting)&lt;/div&gt;</summary>
		<author><name>Mgsloan</name></author>
	</entry>
</feed>