This is the simplest implementation of the Bezier line. All I’m doing here is taking the rectangle algorithm and deriving a start point, end point and two control handles by taking a point from each side. The rotation and starting side is the same each time and no accounting is made for trying to link the individual curves together. As a proof of concept, it works well enough, but I’m not where I want to be yet. The rectangle logic shows promise, though, so I’ll continue down that path as the foundation for future Bezier line development.
The next waypoint on this adventure gets me into Bezier curves. This is one of those places that I knew I’d end up, but the trip has been full of some fear and trepidation. I’ve started out by just mapping some of my existing logic to curved objects. Not really committing to points and handles yet, but a baby step towards including curve logic in the algorithm.
I went through a couple of iterations of this to see what was working, what wasn’t. There’s a model where the points generate a curved shape that’s larger than the calculated test area. Not good – but it took some time to figure out that that was what was happening. There’s another model where the curve generated does not follow the logical order of the points, producing wild petal shaped protuberances for each test shape. Interesting, but not desirable at this time.
I came up with a bunch of interesting new shape files that I’ll probably pull out and play with later, but I want to move on the the Bezier logic.
It’s been a while –
I’ve not touched the code base for more than six months – it’s taken me that long to figure out what to do next. What I’d done so far seemed like a good approach to dealing with getting the computer to paint – that is to work with swaths of color to approximate an image. That was enough for a while. I could run the app, come up with some interesting images and my friends could do the same. Over time though, there were some flaws in the program that kept nagging at me and some ideas started to form about what it was that I wanted to try and do next.
Right off the bat I had to deal with the triangle problem. Both circles and rectangles were working well and coming down to a fine level of detail. Triangles acted like there was a threshold below which they would not go. There was some relationship between the bounding rectangle and the triangle points that was not allowing small triangles to exist. So with that in mind and a need to familiarize myself with the code again I went about trying to solve the problem.
Triangles derived from circles (choose three random points on the curve) produces this:
Triangles based on rectangles produces this:
… far more interesting – and a lot more fun to watch generate as there was a lot of variation in the shape and location of objects produced. I’ll call the triangle problem done for the time being.