Math in Unity : Intersections (Part I)

A + vt = B + us

To simplify it, we remove points A and B and replace them with a Vector.

vt = B - A + us

Let’s go further: we know that B - A generates another Vector, C, which will be the distance between B and A.

vt = c + us

Now, since we don’t know neither s nor t, we have to approach the problem from another point of view : the 2D PERP VECTOR.

(3 * -8) + (8 * 3) = -24 + 24 = 0

This same formula can be expressed like this:

v perp Dot u = (3 * 2) + (8 * 4) = 6 + 32 = 38

Now, applying the inverse formula, if the perpendicular of v is (3, 8), this means that the values of v will be (8, -3)
And for u (2, 4), the perpendicular will be (-4, 2)

-u perp Dot v = (8 * 4) + (-2 * -3) = 32 + 6 = 38

As we can see, we have the same result.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Matteo Lo Piccolo

Matteo Lo Piccolo

Always in love with programming, even if late (I'm already 39 years old) I decided to follow my dream! We will see how far my passion will take me!