def get_tikz_pane(sample, width=6, height=6): shapes = None try: shapes = sample.get_superposition_shapes() except AttributeError as e: pass if shapes: return interlace.tikz_shape_superposition(shapes, width, height) else: return _get_tikz_pane_tree(sample)
def get_tikzpicture_body(ncurves, nsegs, morph): """ Try to use sympy for computation and bezier for drawing. """ # define the sympy expression for the warp sympy_t = sympy.abc.t sympy_t_warped = sympy.sin((sympy.pi / 2) * sympy_t) sympy_t_morphed = morph*sympy_t_warped + (1-morph)*sympy_t # define the shapes shapes = [] x_axis = interlace.PiecewiseLinearPathShape([(-1, 0), (1, 0)]) shapes.append(x_axis) for i in range(ncurves): x_expr = sympy_t y_expr = sympy.chebyshevt_poly(i+1, sympy_t_morphed) #cheby_expr = sympy.chebyshevt_poly(i+1, sympy_t) #y_expr = cheby_expr.subs(sympy_t, sympy_t_morphed) shape = interlace.DifferentiableShape( (x_expr, y_expr), -1.0, 1.0, nsegs) shapes.append(shape) width = 6 height = 6 return interlace.tikz_shape_superposition(shapes, width, height)