0
votes

I have a list of points say

a, b, c and d

that I want to join like

a - b - c - d.

Right now I'm just taking two points at a time and drawing a line between them. But the result is sharp corners. So I thought of joining them with curves so that corners are smooth. I read about Bezier curves to draw curves but that requires additional control points to draw the curve. I also couldn't get how to join multiple points in a row using curves. Is there some way of doing that or something that can I can do or work on to make this possible?

I am using both opengl and SVG to output the result.

1
OpenGL knows ONLY about points, lines, and triangles. Full stop. Drawing curves (Bezier, arcs, splines or whatever) must be done by you. Tessellation is a good help here.Ripi2
I should maybe refine Ripi2's answer by pointing out that the useful OpenGL implementations you can find these days support points, straight lines and triangles only (and rasterization only that anyway). Old and busted OpenGL-1.1 actually has something called "evaluators" which allowed to submit vertices in a glBegin/glEnd block by evaluating Bézier curves, specifying patch coordinates instead of model space coordinates. However this was just a convenience function and would tesselate the patch with flat/straight primitives.datenwolf

1 Answers

-1
votes

Catmull-Rom splines are perhaps the easiest way to join up points with curves without needing additional control points (well you need a couple of extra points at the beginning and end, but you can trivially make those up like e=d+(d-c)). This looks like a good primer: https://www.mvps.org/directx/articles/catmull/

I find it can be difficult to get aesthetically pleasing curves when the points are very unevenly spaced though.