Calligraphy with Splines
How To
- Create a bunch of points in the order in which you want to connect them. A, B, ...
- Right click, hold and drag to select all the points in a box, press Alt and release the mouse button. This creates a list l1 of all the points.
- Create
a=Spline(l1)
- Create two sliders width and para between 0 and 1, step 0.01.
- Create the list l2:
Sequence(Point(a, k), k, 0, para, 0.01)
This is a list of a hundred points on the spline a. - Create the average point Ce of the list l1:
Ce=(MeanX(l1), MeanY(l1))
- Create two lists :
l2m=Enlarge(l2, 1 - width, Ce) l2p=Enlarge(l2, 1 + width, Ce)
- Finally, create the polygon shown in blue :
Polygon(Union(l2m, Reverse(l2p)))
It's the same idea with a constant width.
The problem is that the width of the previous stroke is not constant, but I found a work-around. The crazy one-liner here creates a polygon of given "width" around a spline "c". Drawn using "n" points when the slider "param" goes from 0 to 1.
Polygon(Union(Sequence(Intersect(Circle(Point(c,k), width),
PerpendicularLine(Point(c, k), Tangent(Point(c, k), c)), 1), k, 0, param, 1 / n),
Reverse(Sequence(Intersect(Circle(Point(c, k), width),
PerpendicularLine(Point(c, k), Tangent(Point(c, k), c)), 2), k, 0, param, 1 /n))))
All you need to do is :
- Create a bunch of points in the order in which you want to connect them. A, B, ...
- Right click, hold and drag to select all the points in a box, press Alt and release the mouse button. This creates a list l1 of all the points.
- Create c
=Spline(l1)
- Create two sliders width and param between 0 and 1, step 0.01 and create this polygon :
Polygon(Union(Sequence(Intersect(Circle(Point(c,k), width), PerpendicularLine(Point(c, k), Tangent(Point(c, k), c)), 1), k, 0, param, 1 / n), Reverse(Sequence(Intersect(Circle(Point(c, k), width), PerpendicularLine(Point(c, k), Tangent(Point(c, k), c)), 2), k, 0, param, 1 /n))))