Spline approaches a point from the wrong side
Show older comments
I am designing a course made out of points on lines and splines. I am using splines to connect the last point of a line to the first point of the next line. The slope at the 2 points has been specified. Even though the slope is correct at both points, the second line is aproached by the spline from the wrong direction, creating a cusp. I would like the spline to aproach the second line from underneath to create a smooth course. In this figure the horizontal line is line 1 and the other line is line 2.

spline_bounds_x = [xfinal1 xinitial2];
spline_bounds_y = [yfinal1 yinitial2];
n = 100;
xx = linspace (xinitial_spline,xinitial, n)
yy = spline(spline_bounds_x, [slope1 spline_bounds_y slope2],xx);
slope1 and slope2 unfortunately are not angles but simple line coefficients. Therefore they carry no information of the direction in which the lines are percurred. Is there a way to express them in radians? I also tried to put a point with coordinates p(22,7) and what happens is that the line is approached from underneath but with the wrong slope2.
1 Comment
Unai San Miguel
on 18 Jun 2019
There are some gaps to be filled in your spline curve: there is an infinite number of (spline) curves that can be used to join those two lines and match teh endslopes. And bear in mind that if you don't want the spline joint to have a cusp in the situations of your plot you need a curve (2-valued, 1-variate spline function), because there will be necessarily x locations with two y's.
Answers (0)
Categories
Find more on Splines in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!