1
$\begingroup$

Let $P_1$ and $P_2$ be two points on a 3D plane. Let $A$ and $B$ be two points on the same plane, which define a line on said plane.

How can I check if $P_1$ and $P_2$ are on the same side of the line, or on opposite sides?

$\endgroup$
2
$\begingroup$

Let the line $AB$ be $\underline{r}=\underline{a}+\lambda\underline{b}$ where $\underline{a}$ is the position vector of $A$ and let $\underline{n}$ be the normal to the plane.

The signed distance from $P_1$ is $$\overrightarrow{AP_1}\cdot\frac{\underline{b}\times\underline{n}}{|\underline{b}\times\underline{n}|}$$

the corresponding calculation for $P_2$ will be of opposite sign if the points $P_1$ and $P_2$ are on opposite sides of the lines, otherwise they will have the same sign.

| cite | improve this answer | |
$\endgroup$
1
$\begingroup$

One way would be to consider the line $\lambda P_1 + (1 - \lambda P_2)$ for $\lambda \in (0, 1)$, and see if this line intersects the line defined by $A$ and $B$. If it does intersect, they are on opposite sides, and if it doesn't, they are on the same side. I'll leave it to you to decide how to count the situation when $P_1$ or $P_2$ lie on the line defined by $A$ and $B$.

| cite | improve this answer | |
$\endgroup$
1
$\begingroup$

Compute the cross products $(P_1-A)\times(B-A)$ and $(P_2-A)\times(B-A)$. If their components have the same pattern of signs, then they are on the same side of the line.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.