Fitting a straight line and a curve (hypocyloid) with C2/C1 continuity (problem at joints)

715 Views Asked by At

(Kindly have a look at the link of the picture in the link)
I am joining a straight line, a hypocycloid curve (in between), and a straight line again, which are joined arbitrarily. At the point of joint between the lines and the curve (see joint-1 and joint-2 in figure), it is not differentiable. Hence, at the two joints not C1-continuous, and therefore not C2-continuous either.

Question-1: How can I fit the data (points on the two straight lines and the curve) so that the resultant curve is C2 continuous? If C2 continuity is not possible, is there a way to make it C1 continuous

Question-2: If there is a way then how can I prove mathematically that it is C2/C1 continuous?

I searched and found that cubic splines can provide C2 continuous curves (bezier curves cannot). I tried tried to fit data using "smoothing spline" in Matlab's Curve Fitting Toolbox to fit the data with parameter p = 0.986 as shown in the right figure (On Mathworks Webpage on Smoothing Splines, they mention that p = 1 produces a cubic spline interpolant). The top line is not fitted well.

It is not necessary for me to fit all the points on the curve, but it should roughly follow the hypocycloid trajectory and be C2 continuous.

Any help or pointers would be greatly appreciated. (I'm sorry I don't have reputation enough to post more links or pictures to explain the question in detail.)

Line-Cuve-Line Data and Fitting Result Link

Edit: I have attached a picture with data fitting. I excluded some points around the joints in fitting. I gave more weights to points on line and lesser weight to those on the curve.

Question-3: The picture in the second link also shows the 1st and 2nd derivates along the fitted spline. They are both continuous. Can I assume that the resultant smoothed fit curve is both C1 and C2 continuous (because both the derivatives are continuous). As cubic spline is c1 and c2 continuous?

New Fitted Plot with 1st and 2nd Derivates of Smoothed Fit

Thank you.

1

There are 1 best solutions below

5
On BEST ANSWER

Connecting an astroid to a straight line by preserving

(a) $\Delta^1$ (geometric) continuity is possible.

(b) $\Delta^2$ (geometric) continuity is impossible (unless you are at a vertex...).

You see I make a distinction between geometric continuity $\Delta^k$ and parameterized curve continuity $C^k$.

For (a), you need only select a point on the astroid through its parameterization, e.g. with $\theta=\pi/3$ : $P(1/8,3\sqrt{3}/8)$, then compute the speed vector, which is naturally a tangent vector, by taking derivatives at the given point :

$$(-3 \sin \theta \cos^2 \theta \ , \ 3 \cos \theta \sin^2 \theta)=\dfrac{3}{2}sin(2\theta)(-\cos \theta \ , \ \sin \theta)$$

for $\theta=\pi/3$, then find the equation of the straight line passing through point $P$ with such a directing vector (taking $(-\cos \theta \ , \ \sin \theta)$ suffices). Thats' all. In particular, you don't need to parameterize your straight line in order that there is a $C^1$ continuity unless you have cinematic reasons for doing so.

For (b): Roughly, a second derivative is linked to curvature. You cannot have a second order connection because, at the junction, there exist a curvature discontinuity : the astroid has a nonzero curvature ; a straight line has a zero curvature.

EDIT1, following your commentary.

1) What is the point where you want to connect the astroid and its tangent line ? If it is an ordinary point like the one mentionned : $P(1/8,3\sqrt{3}/8)$ (for $\theta=\pi/3$ )? Or is it a vertex (like $(0;1)$ ?). And why an astroid more than any other curve ?

2) If you need a connecting curve, you could have a look at the so-called transition curves as described for example in

textofvideo.nptel.iitm.ac.in/105107123/lec17.pdf

which are curves that connect a finite curvature to a null curvature (they were needed in railroads as early as the XIXth century).