Page 1 of 1

Making a perfect curve

Posted: Wed Jun 25, 2008 9:40 am
by sicvolo
Ever wanted to have a perfect curve in CFA? The one does not have gaps, smooth all around and done with with the minimal number of primitives?
Well here is my try at it. You can see it here.

Code: Select all

rule perfectCurve{
 boxRight {}
 perfectCurve { x (-.5+0.96/2*(cos(12)+sin(12))) y (.49+0.96/2*(cos(12)-sin(12))) r -12 s 0.96 z -1}
}
path boxRight {
   MOVETO {x -.5 y -.5}
   ARCTO {x -.5 y .5 r (1/sin(12)) p cw}
   LINETO{x .5 y .5}
   ARCTO{ x (-.5+1/0.96*cos(12)) y (-.5+1/0.96*sin(12)) r (1/sin(12)-1/0.96) }
   FILL {}
}
To use a different angle, change "12" in cos, sin and r arguments. To change the reduction rate change 0.96 everywhere in the code.

Hope you like it.

Posted: Thu Mar 05, 2009 4:37 pm
by askiopop
Do you have a starshape?