How do I draw a vermiculated line in Java?
I know how to draw straight lines but could I draw a line which (around a straight l开发者_高级运维ine i.e.)?
Excuse me, I do not speak English very well to describe this more detailed ;-)
Edit: Hey sorry for my late answer - you are right, it should be something like a sine wave which "vericulates" and looks like a worm "coiling" (right word?) around a simple spline/curve (drawn by the user).
The "Noise" version looks a bit too random.
The wave should look like the above image.
why not draw a sine wave?
Java 2D examples of splines can be found at http://ibiblio.org/e-notes/Splines/Intro.htm
Perhaps PerlinNoise, but applied to a line for a hand-drawn look (see 'Drawing sketched lines' on this page...?
Hey sorry for my late answer - you are right, it should be something like a sine wave which "vericulates" and looks like a worm "coiling" (right word?) around a simple spline/curve (drawn by the user).
The "Noise" version looks a bit too random.
The wave should look like this: Image
You could use the Curve API (CAPI) (http://sourceforge.net/projects/curves/). As they describe in their site, you will find there: implementation of various mathematical curves that define themselves over a set of control points. The curves supported are: Bezier, B-Spline, Cardinal Spline, Catmull-Rom Spline, Lagrange, Natural Cubic Spline, and NURBS.
If you have a defined set of points for the curve you want to draw, I fully recommend Cardinal-Spline or a more general B-spline. This API is quite well implemented.
精彩评论