« Return to Thread: free hand

Re: free hand

by thomas.deweese :: Rate this Message:

Reply to Author | View in Thread


Hi Peppe,

Peppe <peppe.delia@...> wrote on 12/16/2006 07:30:09 AM:

> i try to add a path creating a textstring but there is a problem...i don't
> know what values to use (M C Q T etc..)...for example: if i use C value,
> what value can i add in C parameters?


   So don't use 'C' just use 'M' at the start and 'L' everywhere else
(actually you don't even need the 'L's since "M x0,y0 x1,y1 x2,y2 ..."
is the same as "M x0,y0 L x1,y1 L x2,y2 ...").

> because C is C x1,y1 x2,y2 x,y but i
> have only the x,y values...
> pathValue = "M "+ startPt.getX()+","+startPt.getY()+" C ";
> pathValue = pathValue + pt.getX()+ ","+ pt.getY()+ " " + .......(what??!!);
> path.setAttributeNS(null, "d", pathValue);

   If you really wanted to you could go back after they are done
drawing and 'smooth' the curve, but that get's into 'interpolation'
and there is generally no one good answer here.  You could also
potentially use 'Q' which uses the tangent at the previous point
to generate the control point for a 'C'.  But really most people
just use L.

 « Return to Thread: free hand