def draw(self, cr, pos, save): cr.set_source_rgba(0., 0., 0., 1) cr.set_line_width(1) B = (self.pv[0] * py2geom.Matrix(py2geom.Translate(*self.handles[0].pos))).toPwSb() n = py2geom.rot90(py2geom.unit_vector(py2geom.derivative(B), 0.01, 3)) al = py2geom.arcLengthSb(B, 0.1) offset = 10. offset_curve = B + py2geom.sin(al * 0.1, 0.01, 2) * n * 10. offset_path = py2geom.path_from_piecewise(offset_curve, 0.1, True) py2geom.cairo_path(cr, offset_path) cr.stroke() self.notify = '' toyframework.Toy.draw(self, cr, pos, save)
def draw(self, cr, pos, save): cr.set_source_rgba (0., 0., 0., 1) cr.set_line_width (1) B = (self.pv[0]*py2geom.Matrix(py2geom.Translate(*self.handles[0].pos))).toPwSb(); n = py2geom.rot90(py2geom.unit_vector(py2geom.derivative(B), 0.01, 3)); al = py2geom.arcLengthSb(B, 0.1); offset = 10. offset_curve = B+py2geom.sin(al*0.1, 0.01, 2)*n*10. offset_path = py2geom.path_from_piecewise(offset_curve, 0.1, True) py2geom.cairo_path(cr, offset_path) cr.stroke() self.notify = '' toyframework.Toy.draw(self, cr, pos, save)
point_fns_2 = ["dot", "angle_between", "distance", "distanceSq", "cross"] for i in point_fns_1: print "%s:" % i, g.__dict__[i](a) for i in point_fns_2: print "%s:" % i, g.__dict__[i](a, b) print "a == b", a == b print "Lerp:", g.lerp(0.3, a, b) bo = g.BezOrd(2, 3) print bo print bo.point_at(0.3) print bo.reverse() sn = g.sin(g.BezOrd(0.0, 8.0), 5) print sn print g.inverse(sn, 10) print list(sn) r_sn = g.roots(sn) print len(r_sn) print list(r_sn) bo = g.BezOrd(-1, 1) sb = g.SBasis() print sb print list(g.roots(sb)) sb.append(bo) print list(g.roots(sb))
point_fns_2 = ["dot", "angle_between", "distance", "distanceSq", "cross"] for i in point_fns_1: print "%s:" % i, g.__dict__[i](a) for i in point_fns_2: print "%s:" % i, g.__dict__[i](a,b) print "a == b", a == b print "Lerp:", g.lerp(0.3, a,b) bo = g.BezOrd(2,3) print bo print bo.point_at(0.3) print bo.reverse() sn = g.sin(g.BezOrd(0.0,8.0),5) print sn print g.inverse(sn,10) print list(sn) r_sn = g.roots(sn) print len(r_sn) print list(r_sn) bo = g.BezOrd(-1,1) sb = g.SBasis() print sb print list(g.roots(sb)) sb.append(bo) print list(g.roots(sb))