1

I currently have two points in 3D space, each of which has a vector associated with it describing the direction at that point.

I'm looking to interpolate a smooth-ish curve between the two, starting at the first point and facing the direction of the vector on that point and finishing at the second point with the facing of the vector at that point.

I have a vaguely simple idea of how I might approach this, but I was wondering if there were any existing techniques or algorithms for this type of problem that might exist?

djcmm476
  • 1,723
  • 6
  • 24
  • 46
  • Show some code. Maybe you're closer than you think. – Captain Kenpachi Aug 08 '14 at 14:16
  • see if this helps: http://stackoverflow.com/q/4034013/2348704. I think Bezier curve should do what you intend to do. You can also look at nurbs curve implementation found here:http://msdn.microsoft.com/en-us/library/windows/desktop/dd374369%28v=vs.85%29.aspx and this one http://stackoverflow.com/questions/1456162/how-can-i-create-a-simple-2d-nurbs-using-xaml – bhaskarc Aug 08 '14 at 14:19
  • Sounds more like a math problem than a coding problem. If you knew algorithm and were having question about translating it into code... otherwise suggest you try Math overflow... http://mathoverflow.net/ – Charles Bretana Aug 08 '14 at 14:19
  • One way to do this would be a cubic [Bézier curve](http://en.wikipedia.org/wiki/B%C3%A9zier_curve), where your two points are the first and last control points, and the second and third control points are some distance (to taste) along the leaving/approaching vectors respectively. [This](http://stackoverflow.com/questions/13940983) shows how to draw (piecewise) a 2D Bézier; you should be able to adapt it for a 3D one. – Rawling Aug 08 '14 at 14:42

2 Answers2

1

You are probably looking for cubic Hermite interpolation. In addition to specifying the tangent directions at both endpoints, you can freely adjust the length of the vectors with multiplicative parameters.

1

Either cubic Hermite curve or cubic Bezier curve can achieve what you want. Although cubic Hermite curve and cubic Bezier curve are mutually exchangable, there is one major difference: using cubic Bezier curve will be easier for manipulating the curve's shape. As long as the control polgon does not self-intersect, your curve will not self-intersect. Using cubic Hermite curve will very often result in self-intersecting curve when the providied derivatives have large magnitude.

fang
  • 3,473
  • 1
  • 13
  • 19