Suppose I have 3 points in space, $A$, $B$ and $C$.
Suppose there is a segment between $A$ and $B$ and in the middle of this segment, there is a perpendicular line where C is, just like that:
What I want is basically to create a function $curve(t)$ that represents the green curve, that is:
- $curve(0) = A$
- $curve(0.5) = C$
- $curve(1) = B$
and the other $t$ values represent points of the curve in the space.
How can I build such function?
If $A$ and $B$ were at the same height, I was using $curve(t) = ( A.x + t * (B.x – A.x),\; A.x + h * sin\left(t * \dfrac{\pi}{2}\right),\; A.z + t * (B.z – A.z))$
But this constraint doesn't exist so I don't know how to do yet.
Best Answer
Let consider for $t\in[0,1]$, then
the mid point $M$ between $A$ and $B$ is
finally we need to add a term to reach $C$, that is for example
$$\operatorname{curve}(t)=A+t(B-A)+4t(t-1)(C-M)$$
with