Finding a perpedicular segmet

52 Views Asked by At

Given two points $p_0 = (x_0, y_0), p_1 = (x_1, y_1) \in \mathbb{R}^2$, regarding the segment connecting the two points, call it $Q$, how can we find the perpendicular segment $P$ which contains the point $p_0$ at its middle and is $2d$ units long (by euclidean distance)?

The slope of $Q$ is given by $\frac{y_1-y_0}{x_1-x_0}$, hence the slope of $P$ is its negative inverse $\frac{x_0-x_1}{y_1-y_0}$. From here we can find the line with the slope of $P$ using the slope and the coordiates of $p_0$ though i'm not sure how to calculate the points on this line that are $d$ units away.

How can we find these points?

1

There are 1 best solutions below

2
On

Define the $x$-displacement $X$ between $p_0$ and $p_1$: $$ X = x_1 - x_0, $$ and similarly for $y$-displacement $Y$: $$ Y = y_1 - y_0. $$ By the Pythagorean theorem, $$ d^2 = X^2 + Y^2, $$ although we don't actually need to calculate $d$ explicitly.

Rotating the point $p_1$ counterclockwise by a right angle about the center $p_0$ yields the new point $$ p_+ = (x_0 - Y, y_0 + X), $$ and after a clockwise rotation, we get the new point $$ p_- = (x_0 + Y, y_0 - X). $$

You can verify that:

  1. Rotation point $p_0$ is the midpoint of $p_+$ and $p_-$.

  2. New points $p_+$ and $p_-$ are each $d$ units away from $p_0$.

  3. New segment $\overline{p_+p_-}$ is perpendicular to $\overline{p_0p_1}$.


Here's an interactive visualization to see this in action. You can drag the points themselves or modify their coordinates in the left margin. Drag the parameter $s$ to rotate the segments.