Cómo calcular la distancia de un punto desde una línea dada

Entonces, si tenemos un vector [math] \ overrightarrow {p} [/ math] y un vector [math] \ overrightarrow {l} [/ math] con [math] \ overrightarrow {p} [/ math] el vector de un punto aleatorio en la línea hasta el punto distintivo y [math] \ overrightarrow {l} [/ math] el vector anotando la dirección de la línea, luego

[matemáticas] \ frac {|| \ overrightarrow {p} \ times \ overrightarrow {l} ||} {|| \ overrightarrow {l} ||} [/ math]

es igual a la distancia entre el punto y la línea.

Breve explicación:

La longitud del producto cruzado es igual al doble del área del triángulo con los dos vectores como lados.
Al igual que la longitud de la base por la altura del triángulo.

Entonces la altura del triángulo es igual a la longitud del producto transversal de dos de sus lados dividido por la longitud del lado base.

No dude en preguntar si algo no está claro.

La página wikipedia Distancia desde un punto a una línea ofrece varias formas de calcular esto. Esto incluye métodos basados ​​en vectores. Si el punto es [math] \ mathbf {p} [/ math] y la línea viene dada por

[math] \ mathbf {x} = \ mathbf {a} + t \, \ mathbf {n} [/ math]

entonces podemos escribir

[math] \ mathbf {p} = \ mathbf {a} + \ alpha \, \ mathbf {n} + \ mathbf {u} [/ math]

donde [math] \ mathbf {u} [/ math] es algún vector perpendicular a la línea. La distancia será la longitud de [math] \ mathbf {u} [/ math]. Para encontrar [math] \ alpha [/ math] podemos usar el producto punto. Esto tiene la característica de que [math] \ mathbf {a} \ cdot \ mathbf {b} = 0 [/ math] cuando [math] \ mathbf {a}, \ mathbf {b} [/ math] son ​​perpendiculares. Tomar

[matemáticas] (\ mathbf {p} – \ mathbf {a}) \ cdot \ mathbf {n} = \ alpha \, \ mathbf {n} \ cdot \ mathbf {n} + 0 [/ math]

Entonces

[matemática] \ alpha = \ frac {(\ mathbf {p} – \ mathbf {a}) \ cdot \ mathbf {n}} {\ mathbf {n} \ cdot \ mathbf {n}} [/ math]

Ahora sabemos [math] \ alpha [/ math] podemos encontrar [math] \ mathbf {u} [/ math]

[math] \ mathbf {u} = \ mathbf {p} – \ mathbf {a} – \ frac {(\ mathbf {p} – \ mathbf {a}) \ cdot \ mathbf {n}} {\ mathbf {n } \ cdot \ mathbf {n}} \ mathbf {n} [/ math]

La longitud de [math] \ mathbf {u} [/ math] se puede encontrar usando el producto punto nuevamente

[matemáticas] longitud (\ mathbf {u}) = | \ mathbf {u} | = \ sqrt {\ mathbf {u} \ \ cdot \ mathbf {u}} [/ math].