Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Could you please explain how the math behind the first answer to this stack overflow questions works:


share|cite|improve this question
up vote 4 down vote accepted

Let's take the image from the anwer:

You can think of the red line as a two dimensional plane, where $4x − 3y + 2 = 0$ is it's coordinate equation with some normal vector

$$\vec{n} = \begin{pmatrix} 4 \\ -3 \end{pmatrix}$$

that is orthogonal to the line.

Now, by substituting a point into the equation, you get the distance of point and line along $\vec{n}$ (see. Hesse's normal form). While we don't actually care for the distance itself, we do care for it's sign. Positive sign indicates the point's lying on the side $\vec{n}$ points to, a negative one indicates the opposite side.

Now, if all the values have the same sign, all triangle points lie on the same side of the line, i.e. there are no intersections. With different signs, the triangle must hit the line.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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