diff --git a/svgpathtools/path.py b/svgpathtools/path.py index 1b1322b..3cce50a 100644 --- a/svgpathtools/path.py +++ b/svgpathtools/path.py @@ -576,6 +576,10 @@ class Line(object): distance = self.end - self.start return self.start + distance*t + def points(self, ts): + """Faster than running Path.point many times.""" + return self.poly(ts) + def length(self, t0=0, t1=1, error=None, min_depth=None): """returns the length of the line segment between t0 and t1.""" return abs(self.end - self.start)*(t1-t0) @@ -815,6 +819,10 @@ class QuadraticBezier(object): """returns the coordinates of the Bezier curve evaluated at t.""" return (1 - t)**2*self.start + 2*(1 - t)*t*self.control + t**2*self.end + def points(self, ts): + """Faster than running Path.point many times.""" + return self.poly(ts) + def length(self, t0=0, t1=1, error=None, min_depth=None): if t0 == 1 and t1 == 0: if self._length_info['bpoints'] == self.bpoints(): @@ -1073,6 +1081,10 @@ class CubicBezier(object): -self.start + 3*(self.control1 - self.control2) + self.end ))) + def points(self, ts): + """Faster than running Path.point many times.""" + return self.poly(ts) + def length(self, t0=0, t1=1, error=LENGTH_ERROR, min_depth=LENGTH_MIN_DEPTH): """Calculate the length of the path up to a certain position""" if t0 == 0 and t1 == 1: