Question
========

I need to get the **the point *Q* of a cubic (2d) bezier curve** *B(t)* where the line from point *Q* to another given point *P* **intersects perpendicular** with the bezier curve.

* I know: *P*, *B(t)*
* I look for: *Q* (basically I want to have the slope of *g* but I can easily calculate this when I know *Q*, but the slope of *g* is enough)

[![](https://i.stack.imgur.com/48mMf.jpg)](https://i.stack.imgur.com/48mMf.jpg)

---

What I did until now (you can skip this)
----------------------------------------

> 
> Note that I think this ansatz is wrong. This is only included for completeness.
> 
> 
> 

I tried to solve this with my (basic) knowledge of mathematics but I cannot finish it. This is what I have now (please don't too strict with the notation, I'm not very good in this):

The following formulas will be expressed as *y(x)* to get one result this has to be calculated for *y(x)* **and** *x(y)*. The point *P* is the control point, *Q* is the point where the line *g(x)* from *Q* to *P* is perpendicular on the bezier curve ***B**(t) = (x, y)T*. The expression for the line *g(x)* can be retrieved by

[![](https://i.stack.imgur.com/WcSF2.gif)](https://i.stack.imgur.com/WcSF2.gif)

where *B(x)* is the bezier curve in Cartesian coordinates, *B'(x)* the derivative (in Cartesian coordinates) and *k* is the intersection with the y axis. To get the slope of *g(x)* one has to solve

[![](https://i.stack.imgur.com/zM836.gif)](https://i.stack.imgur.com/zM836.gif)

To calculate *B(x)* one has to solve ***B**(t)* for *t* and then plugging it back in *B(t)*. So in each point on the bezier curve there is the relation

[![](https://i.stack.imgur.com/sXNC1.gif)](https://i.stack.imgur.com/sXNC1.gif)

which also applies for the derivative ***B**'(t)*.

The derivative of ***B**(t)* is (according to [wikipedia](https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B%C3%A9zier_curves))

[![](https://i.stack.imgur.com/zJROX.gif)](https://i.stack.imgur.com/zJROX.gif)

Solving this for t ([with wolfram alpha](https://www.wolframalpha.com/input/?i=x+%3D+3+*+%281-t%29%5E2+*+a_0+%2B+6+*+%281-t%29+*+t+*+a_1+%2B+3+*+t%5E2+*+a_2+solve+t)) results in

[![](https://i.stack.imgur.com/qRdru.gif)](https://i.stack.imgur.com/qRdru.gif)

where *a0 = (**P1** - **P0**)x*, *a1 = (**P2** - **P1**)x* and *a2 = (**P3** - **P2**)x*. Plugging the \*ti\*s back in ***B**(t)* results in ([wolfram alpha for *t1*](https://www.wolframalpha.com/input/?i=t%3D-%280.33333+%281.7321+sqrt%28-2+a_1+x+%2B+a_0+%28x+-+3+a_2%29+%2B+a_2+x+%2B+3+a_1%5E2%29+-+3+a_0+%2B+3+a_1%29%29%2F%28a_0+-+2+a_1+%2B+a_2%29+for+y+%3D+3+*+%281-t%29%5E2+*+a_0+%2B+6+*+%281-t%29+*+t+*+a_1+%2B+3+*+t%5E2+*+a_2), [wolfram alpha for *t2*](https://www.wolframalpha.com/input/?i=t%3D-%280.33333+%281.7321+sqrt%28-2+a_1+x+%2B+a_0+%28x+-+3+a_2%29+%2B+a_2+x+%2B+3+a_1%5E2%29+%2B+3+a_0+-+3+a_1%29%29%2F%28a_0+-+2+a_1+%2B+a_2%29+for+y+%3D+3+*+%281-t%29%5E2+*+a_0+%2B+6+*+%281-t%29+*+t+*+a_1+%2B+3+*+t%5E2+*+a_2), [wolfram alpha for *t3*](https://www.wolframalpha.com/input/?i=t+%3D+%28-6+a_1+%2B+3+a_2+%2B+x%29%2F%286+%28a_2+-+a_1%29%29+for+y+%3D+3+*+%281-t%29%5E2+*+a_0+%2B+6+*+%281-t%29+*+t+*+a_1+%2B+3+*+t%5E2+*+a_2))

[![](https://i.stack.imgur.com/RO4LG.gif)](https://i.stack.imgur.com/RO4LG.gif)

Now the next thing would be to use *y = B'(x)* and the second equation and eliminate *x* but I have no idea how and I don't even know if this is possible.