if (do_name() != 'Home') : ?>
endif ?>
Posted by anonymous on Nov 29, 2007
Hm… Ah hah! If I am correct, you must create the path, transform, and then draw it. Here is a revised version:
cornu = ximport("cornu") size(400, 400) colormode(CMYK, range=100) def curva(): crpoints = [] for i in range(4): x = random(0.25, 0.75) y = random(0.25, 0.75) coordenadas = (x, y) crpoints.append(coordenadas) return cornu.path(crpoints, tweaks=1) nofill() strokewidth(0.5) stroke(100, 0, 0, 0) # Path 1 drawpath(curva()) # Path 2. It must be the same as path 1 but scaled (or rotated, translated, etc.) p = curva() scale(.5) drawpath(p)That might work better.
Posted by Tom De Smedt on Nov 29, 2007
include("util/comment.php"); ?>
Since you are using random() commands inside your curva() command, two calls to curva() will never yield the same path.
You need to create one path from curva(), and then create copies of that path. The path.copy() command doesn't work with NodeBox 1.0rc7, but there's another way: drawpath() also accepts a list of points.
p1 = curva() drawpath(p1) try: # NodeBox 1.9 p2 = p1.copy() except: # NodeBox 1.0rc7 p2 = [pt for pt in p1] scale(0.5) drawpath(p2)
Multiple instances of a path
Posted by Sisra on Nov 28, 2007I'm using NodeBox 1.0rc7 with the Cornu library. How can I get Path 1 and Path 2 to be the same? The code is:
Also I tried using the bezier library and path.copy, but it seems don't work with v. 1.0rc7.Any help?
Thanks in advance.