How to make a semi-circular movement?

252 Views Asked by At

Suppose I have a car in position $P_0$ and I want to move it to position $P_1$, just like these 4 examples:

enter image description here

The linear distance between $P_0$ and $P_1$ is $d$ and the perpendicular maximum height the movement reaches is $d/3$. I want to simulate this clockwise semi-circular movement from $P_0$ to $P_1$.

Suppose $dir = P1 - P0$ is a vector of length $d$ and $perp$ is the vector (of length $d/3$) perpendicular to $dir$.

Suppose $t = 0$ is the beginning of the semi-circular movement and $t = 1$ is the end, how can I measure the angle and the position of the car at $t = i$?

1

There are 1 best solutions below

3
On BEST ANSWER

enter image description here

The radius $r$ of the arc and the sector angle $\alpha_0$ of the half arc can be obtained via

$$r^2=\left(\frac d2\right)^2 + \left(r-\frac13d\right)^2,\>\>\>\>\>\tan\alpha_0 = \frac{\frac d2}{r-\frac13d}$$

which yield $r=\frac{13}{24}d$ and $\alpha_0=-\tan^{-1}\frac{12}{5}$ .

Let the center of the arc be the origin, the angle of the position at $i$ can be expressed as, $$\alpha_i=\left(2i-1\right)\tan^{-1}\frac{12}{5}\tag{1}$$

Then, the position vector $\vec{P}_i$ is,

$$\vec{P}_i = r\sin\alpha_i\frac{\vec{dir}}{d} + r\cos\alpha_i\frac{\vec{perp}}{\frac d3} $$

$$= \frac{13}{24}\sin\alpha_i\>\vec{dir} + \frac{13}{8}\cos\alpha_i\>\vec{perp}$$

where $\alpha_i$ is given by (1).

Edit:

The position can also be expressed with $P_0$ as the origin, without resorting to the trig functions. It is,

$$\vec{P}_i = i \>\vec{dir} + \left[3\sqrt{\left(\frac{13}{24}\right)^2 - \left(i-\frac12\right)^2} - \frac{5}{8}\right]\> \vec{perp}$$

which is maybe more desirable.