Hi, I try to write a function to update points of a path from a transformation matrix. It's all ok except for elliptical arcs : I can't find the correct coefficients for r1 r2 and angle. Is it simplier to approximate arcs with bezier curves, like the normalizedPathSegList property would do (but not implemented yet) ? I wrote an example at http://jsfiddle.net/s32LX/, but I've put the code below anyway. Best regards,
Yannick Bochatay http://ybochatay.fr SVGPathElement.prototype.mtx2attrs = function(mtx) { var seg,letter,point,pt={}, angle = Math.atan2(mtx.b, mtx.a), svg = this.ownerSVGElement, list = this.pathSegList, i=0, N = list.numberOfItems; /* this.rel2abs(); function that change relative paths to absolute */ for (;i<N;i++) { seg = list.getItem(i); letter = seg.pathSegTypeAsLetter; ['','1','2'].forEach(function(ind) { if (seg['x'+ind] === undefined && seg['y'+ind] === undefined) { return; } if (seg['x'+ind] !== undefined) { pt['x'+ind] = seg['x'+ind]; } if (seg['y'+ind] !== undefined) { pt['y'+ind] = seg['y'+ind]; } var point = svg.createSVGPoint(); point.x = pt['x'+ind]; point.y = pt['y'+ind]; point = point.matrixTransform(mtx); seg['x'+ind] = point.x; seg['y'+ind] = point.y; }); if (angle!==0 && (letter === 'H' || letter === 'V')) { this.pathSegList.replaceItem( this.createSVGPathSegLinetoAbs(seg.x,seg.y) , i ); } else if (letter === 'A') { /*what to do in that case ?? seg.r1 = ? seg.r2 = ? seg.angle+= angle ? */ } } }; ------------------------------------ ----- 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/

