W3C home > Mailing lists > Public > www-svg@w3.org > April 2004

SuperFormula in SVG

From: Jan-Klaas Kollhof <keyjaque@yahoo.com>
Date: Sat, 3 Apr 2004 08:28:22 -0800 (PST)
Message-ID: <20040403162822.38948.qmail@web60109.mail.yahoo.com>
To: www-svg@w3.org

Hi,

I was reading about the superformula:
http://astronomy.swin.edu.au/~pbourke/curves/supershape/

The algorithm is quite simple so I thought I implement
it in SVG:
http://jan.kollhof.net/projects/svg/playground/superformula.svg

I added some functionality to use a superformula path
element in the svg document. This is just a namespaced
element which gets replaced with a path element that
shows a path for the superformula values using the
parameters given as attributes.

<sf:path x="150" y="50"
a="1" b="1" m="0.16666667" n1="0.5" n2="0.5" n3="0.5" 
phi-start="0" phi-end="12"
r="50" steps="500" 
fill="red" stroke="black" />

where m, n1, n2, n3, a, b are parameters to the
formula.
phi-start and phi-end are the range for the formula.
They are multiplied by Py. r is the scaling of the
path and steps is the calculation steps to use to
calculate the points of the resulting path. x and y
are just the offsets for the center. the rest of the
attributes are just copied to the resulting path
element.

What would be realy nice is to have the SVG path
extended to use the superformula.
<path d="S 0.16667 0.5 0.5 0.5 1 1 0 12 50" ... />

or a new element :)


Jan


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/
Received on Saturday, 3 April 2004 11:28:58 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:27 GMT