Connected Curved Lines

Given a series of JSON coordinates, usually in the format:

{from: {x:0, y:0}, to: {x:0, y:10}, ...}

I would like to make a series of straight point paths that are connected with simple rounded corners with a fixed radius. I was looking for a slope intercept shape to calculate points along a straight line, but I'm a little perplexed about the approach to calculating points along curves (Bezier?).

eg. I want to draw curves between p1 and p2 and p3 and p4. Even though a poor layout can mean, I'm happy that the angles are a fixed radius, for example. 10px

Path

I would like to ignore the drawing logic, and therefore I am looking for a generalized approach to returning an array of JavaScript points, which can then be performed in several ways (therefore, I avoid using any of the built-in functions provided by SVG, Canvas, etc.).

+5
1

, , .

http://www.blackpawn.com/texts/splines/

. A - p1, D - p2, AB - 1, CD - 2, , - 1 2 .

, C D, 1, , , p1, , B, 2 p2 D. ( , , , ... ..)

:)

http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B.C3.A9zier_curves

, t (, 0,1 t, 0,01...) .

+1

All Articles