if (do_name() != 'Home') : ?>
endif ?>
Posted by Tom De Smedt on May 18, 2009
I assume you mean you want to smoothen the sharp intersections? There is currently no NodeBox command or library to do something like that.
As for a union between two Cornu curves, you can't do it directly, but interestingly the library has a path() command that returns a BezierPath from a cornu shape. So with a bit of conversion juggling we can go from Cornu to Bezier and back to Cornu.
The output of this script is probably not what you are looking for but it illustrates the principle:
cornu = ximport("cornu") points1 = [ (0.1,0.1), (0.15,0.33), (0.28, 0.22), (0.12, 0.26), ] p1 = cornu.path(points1) points2 = [ (0.4,0.2), (0.18,0.33), (0.29, 0.05), (0.14, 0.08), ] p2 = cornu.path(points2, close=True, tweaks=30) # The cornu.path() returns a BezierPath # on which we can do union(). p3 = p1.union(p2) # Get a list of points from the new, unified path. points3 = p3.points(100) # Convert to a list of (x,y)-tuples. points3 = [(pt.x, pt.y) for pt in points3] # Convert to relative (x,y) values. points3 = [(x/WIDTH, y/HEIGHT) for (x,y) in points3] print points3 fill(0) cornu.drawpath(points3)
Posted by Dillone Hailei Wang on May 21, 2009
include("util/comment.php"); ?>
Tom, thank you very much. This is a good solution.
I thought it in a roughly similar way, but I did not try it.
How to union 2 closed Cornu curves like to union() two ovals ?
Posted by Dillone Hailei Wang on May 05, 2009With path1.union(path2), we can intersect two ovals, but the intersection corners are very sharp. I want to union() two Cornu curves, and make the unioned the new Cornu also very spiraling. How can I do that?