Sunday, November 7, 2010

Curves and lines

So, when plotting a 2(.5)D projected 3D embedding of an abstract graph, a critically important feature is, of course, the plotting of edges. To allow for flexibility in an embedding, it's important to allow for embeddings aside from simply straight-edge embeddings. Thus, one must be able to plot curved edges. Having implemented this feature in my prototype version of this plotter, I've gained a bit of experience in perhaps what to use and not to use to facilitate such an implementation. In the prototype I decided to roll my own logic for curved edges. I did this to allow for an unlimited number of control points through which a curve would travel, to facilitate the plotting of any curved shape one might imagine. This involved the utilization of a linear algebra/matrix package to solve polynomials of potentially nth degree, and was a big pain in the butt to implement. I promised myself I would take a cleaner approach for the "production" version of the plotter. Further, very rarely did we ever create an edge with more than 2 control points (not including the end points). Thus, a cubic curve would have worked just fine. Coincidentally, the Java standard library contains a CubicCurve2D. Hooray!! :)

No comments:

Post a Comment