@@ -229,18 +229,21 @@ def length(self, error=None, min_depth=None):
229229 return s
230230
231231class Arc (Segment ):
232- def __init__ (self , start , radius , rotation , arc , sweep , end ):
232+ def __init__ (self , start , radius , rotation , arc , sweep , end , scaler = lambda z : z ):
233233 """radius is complex, rotation is in degrees,
234234 large and sweep are 1 or 0 (True/False also work)"""
235235
236- super (Arc , self ).__init__ (start ,end )
236+ super (Arc , self ).__init__ (scaler (start ),scaler (end ))
237+ self .start0 = start
238+ self .end0 = end
237239 self .radius = radius
238240 self .rotation = rotation
239241 self .arc = bool (arc )
240242 self .sweep = bool (sweep )
243+ self .scaler = scaler
241244
242245 self ._parameterize ()
243-
246+
244247 def __repr__ (self ):
245248 return 'Arc(start=%s, radius=%s, rotation=%s, arc=%s, sweep=%s, end=%s)' % (
246249 self .start , self .radius , self .rotation , self .arc , self .sweep , self .end )
@@ -263,8 +266,8 @@ def _parameterize(self):
263266
264267 cosr = cos (radians (self .rotation ))
265268 sinr = sin (radians (self .rotation ))
266- dx = (self .start .real - self .end .real ) / 2
267- dy = (self .start .imag - self .end .imag ) / 2
269+ dx = (self .start0 .real - self .end0 .real ) / 2
270+ dy = (self .start0 .imag - self .end0 .imag ) / 2
268271 x1prim = cosr * dx + sinr * dy
269272 x1prim_sq = x1prim * x1prim
270273 y1prim = - sinr * dx + cosr * dy
@@ -293,9 +296,9 @@ def _parameterize(self):
293296 cyprim = - c * ry * x1prim / rx
294297
295298 self .center = complex ((cosr * cxprim - sinr * cyprim ) +
296- ((self .start .real + self .end .real ) / 2 ),
299+ ((self .start0 .real + self .end0 .real ) / 2 ),
297300 (sinr * cxprim + cosr * cyprim ) +
298- ((self .start .imag + self .end .imag ) / 2 ))
301+ ((self .start0 .imag + self .end0 .imag ) / 2 ))
299302
300303 ux = (x1prim - cxprim ) / rx
301304 uy = (y1prim - cyprim ) / ry
@@ -323,7 +326,7 @@ def _parameterize(self):
323326 self .delta = delta % 360
324327 if not self .sweep :
325328 self .delta -= 360
326-
329+
327330 def point (self , pos ):
328331 if pos == 0. :
329332 return self .start
@@ -337,7 +340,7 @@ def point(self, pos):
337340 self .radius .imag + self .center .real )
338341 y = (sinr * cos (angle ) * self .radius .real + cosr * sin (angle ) *
339342 self .radius .imag + self .center .imag )
340- return complex (x , y )
343+ return self . scaler ( complex (x , y ) )
341344
342345 def length (self , error = ERROR , min_depth = MIN_DEPTH ):
343346 """The length of an elliptical arc segment requires numerical
0 commit comments