enable.savage.svg.svg_extras module¶

Extra math for implementing SVG on top of Kiva.

`enable.savage.svg.svg_extras.``angle`(x1, y1, x2, y2)[source]

The angle in degrees between two vectors.

`enable.savage.svg.svg_extras.``bezier_arc`(x1, y1, x2, y2, start_angle=0, extent=90)[source]

Compute a cubic Bezier approximation of an elliptical arc.

(x1, y1) and (x2, y2) are the corners of the enclosing rectangle. The coordinate system has coordinates that increase to the right and down. Angles, measured in degress, start with 0 to the right (the positive X axis) and increase counter-clockwise. The arc extends from start_angle to start_angle+extent. I.e. start_angle=0 and extent=180 yields an openside-down semi-circle.

The resulting coordinates are of the form (x1,y1, x2,y2, x3,y3, x4,y4) such that the curve goes from (x1, y1) to (x4, y4) with (x2, y2) and (x3, y3) as their respective Bezier control points.

`enable.savage.svg.svg_extras.``elliptical_arc_to`(path, rx, ry, phi, large_arc_flag, sweep_flag, x1, y1, x2, y2)[source]

Add an elliptical arc to the kiva CompiledPath by approximating it with Bezier curves or a line segment.

Algorithm taken from the SVG 1.1 Implementation Notes:

http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes

`enable.savage.svg.svg_extras.``transform_from_local`(xp, yp, cphi, sphi, mx, my)[source]

Transform from the local frame to absolute space.