0

I want to connect two point using a curve, we know the coordinates of start point, the coordinates of end point, curve length. Since the length is greater than the direct straight line of the two points, a curve should be used. Any method using the d3 library would be better. I found something similar to my question here. But the question is not actually solved since calculating the length is far too complex. Thanks.

Here is one way of using circle arc, I analytically try it but it seems not good enough since we need some numerical method such as Newton's method to obtain theta, the function has the form

sin theta / theta = 2l / s

where l is the length of the curve and s is the length of the straight line (segment).

Community
  • 1
  • 1
  • It's gone 3AM and I'm probably tired, but aren't there an infinite number of such curves? – Niet the Dark Absol Feb 07 '14 at 03:15
  • You work so late!! Yes, you are correct. I am thinking about some curve that look good. Also I have some problem with the implementation using d3 library. I will edit my question and post some code. If you have time, please have a look. Thanks. – user3282188 Feb 07 '14 at 05:16

1 Answers1

0

The answer is very simple: the curve that satisfies the condition is an arc. Given points, and desired curve length, finding such arc is a matter of high school math. Since you didn't bother attaching a jsfiddle or similar prototype showing some effort from your side, I won't bother too.

VividD
  • 10,456
  • 6
  • 64
  • 111
  • I did try the method of arc but it is not that simple as it looks. I just edited my question. In order to obtain the circle length you need some numerical method such as Newton's method. I have some simple code for a simpler one and I will add to the question later. Thanks. – user3282188 Feb 07 '14 at 05:13
  • Try half-elipse, if arc is too difficult. – VividD Feb 07 '14 at 05:30