Thanks for the help has been very useful
--- In [email protected], John Delacour <j...@...> wrote: > > At 11:46 +0000 20/10/10, fi...@... wrote: > > >Anybody can help me with svg rect convertion to svg path? I need > >know the steps to convert rect parameters to path commands. > > > >Example, I have: > > > >rect: > >height 2.8569181 > >width 90.898613 > >x 20.280216 > >y 838.27399 > >rx 0.9670065 > >ry 1.2499017 > > > >Inkscape make this: > > > >m 21.247223,838.27399 88.964597,0 c 0.53572,0 0.96701,0.55745 > >0.96701,1.2499 l 0,0.35711 c 0,0.69245 -0.43129,1.2499 > >-0.96701,1.2499 l -88.964597,0 c -0.535722,0 -0.967007,-0.55745 > >-0.967007,-1.2499 l 0,-0.35711 c 0,-0.69245 0.431285,-1.2499 > >0.967007,-1.2499 z > > > >My problem is with c command control points. > > You are dealing here not with curves but elliptical arcs, so the > maths is extremely simple. Here's a perl script that does the job > and should be self-explanatory. Where you actually start the path is > up to you. > > > #!/usr/bin/perl > use strict; > # Rectangle > my $height = 2.8569181; > my $width = 90.898613; > my $x = 20.280216; > my $y = 838.27399; > my $rx = 0.9670065; > my $ry = 1.2499017; > # My dims > my $mx = $x; > my $my = $y + $ry; > my $v = $height - 2 * $ry; > my $h = $width - 2 * $rx; > # Print path > print "<path d=\"" . > "m $mx $my " . > "v $v " . > "a $rx $ry 0 0 0 $rx $ry " . > "h $h " . > "a $rx $ry 0 0 0 $rx -$ry " . > "v -$v " . > "a $rx $ry 0 0 0 -$rx -$ry " . > "h -$h " . > "a $rx $ry 0 0 0 -$rx $ry" . > "\" />"; > > RESULT: > <path d="m 20.280216 839.5238917 v 0.3571147 a 0.9670065 1.2499017 0 > 0 0 0.9670065 1.2499017 h 88.9646 a 0.9670065 1.2499017 0 0 0 > 0.9670065 -1.2499017 v -0.3571147 a 0.9670065 1.2499017 0 0 0 > -0.9670065 -1.2499017 h -88.9646 a 0.9670065 1.2499017 0 0 0 > -0.9670065 1.2499017" /> > > JD > ------------------------------------ ----- To unsubscribe send a message to: [email protected] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ----Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/svg-developers/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

