Intereting Posts

prove that $x^2 + y^2 = z^4$ has infinitely many solutions with $(x,y,z)=1$
For what values $\alpha$ for complex z $\ln(z^{\alpha}) = \alpha \ln(z)$?
Proving replacement theorem?
Probability of Random number repeating
Prove $\int_0^{\infty}\! \frac{\mathbb{d}x}{1+x^n}=\frac{\pi}{n \sin\frac{\pi}{n}}$ using real analysis techniques only
Show that the group is cyclic.
what simple extensions can be naturally embedded into Conway's algebraic closure of $\mathbb{F}_2$?
Irreducibility of Polynomials in $k$
List of powers of Natural Numbers
Is a totally ordered set well-ordered, provided that its countable subsets are?
Simply connectedness in $R^3$ with a spherical hole?
More Generating Functions problems
How do we know what natural numbers are?
If $f$ is integrable and bounded over $$ for all $\delta \in (0,1]$ then is $f$ integrable over all of $$ $?$
Product of Consecutive Integers is Not a Power

I’m trying to check if a line hits a rectangle, and for that, I found this nice solution:

Line triangle intersection

The problem is that, having forgot almost all I ever knew about math, I don’t know how to obtain that equation of a line which they use there: $4x − 3y + 2 = 0$

- Point reflection across a line
- How to determine if arbitrary point lies inside or outside a conic
- Formula for curve parallel to a parabola
- Applied ODEs in trajectory problem
- Calculate Third Point of Triangle
- Is there an equation to describe regular polygons?

I know a line’s equation is $y = mx + b$. But the above form and how can I obtain it is a mystery to me. Can somebody please bring a flashlight? ::- D.

- Why are these geometric problems so hard?
- Geometric Proof, Tournament of Towns Fall 2015 Junior A-Level
- Can I represent groups geometrically?
- Alternate proof for $a^2+b^2+c^2\le 9R^2$
- the 8 queens conjecture: the next level (or dimension)
- Is there a geometrical method to prove $x<\frac{\sin x +\tan x}{2}$?
- calculating angle in circle
- How to prove there are exactly eight convex deltahedra?
- rectangularizing the square
- Correspondence between eigenvalues and eigenvectors in ellipsoids

If you know two points on the line, $(x_1,y_1)$ and $(x_2,y_2)$, then the vector $\langle x_2-x_1,y_2-y_1\rangle$ is in the direction of the line and the vector $\vec{n}=\langle y_1-y_2, x_2-x_1\rangle$ (swap the components, take the opposite of one component) is orthogonal (perpendicular) to the line. For any point $(\pmb{x},\pmb{y})$ on the line, the vector $\langle \pmb{x}-x_1,\pmb{y}-y_1\rangle=\langle \pmb{x},\pmb{y}\rangle-\langle x_1,y_1\rangle$ is in the direction of the line, so it is also orthogonal to $\vec{n}$, so its dot product with $\vec{n}$ is $0$: $$\begin{align}

\vec{n}\cdot\langle \pmb{x}-x_1,\pmb{y}-y_2\rangle&=0

\\

\vec{n}\cdot\left(\langle \pmb{x},\pmb{y}\rangle-\langle x_1,y_1\rangle\right)&=0

\\

\vec{n}\cdot\langle \pmb{x},\pmb{y}\rangle-\vec{n}\cdot\langle x_1,y_1\rangle&=0

\\

\langle y_1-y_2, x_2-x_1\rangle\cdot\langle \pmb{x},\pmb{y}\rangle-\langle y_1-y_2, x_2-x_1\rangle\cdot\langle x_1,y_1\rangle&=0

\\

(y_1-y_2)\pmb{x}+(x_2-x_1)\pmb{y}-\left((y_1-y_2)x_1+(x_2-x_1)y_1\right)&=0

\\

(y_1-y_2)\pmb{x}+(x_2-x_1)\pmb{y}+\left(-(y_1-y_2)x_1-(x_2-x_1)y_1\right)&=0

\\

(y_1-y_2)\pmb{x}+(x_2-x_1)\pmb{y}+\left((y_2-y_1)x_1-(x_2-x_1)y_1\right)&=0

\end{align}$$

You can transform the given equation to make it explicit in $y$ to obtain the form that you are familiar with:

$$

\begin{align}

4x – 3y + 2 =& 0 \\

4 x + 2 =& 3y \\

\frac{4}{3}x + \frac{2}{3} =& y \\

y =& \frac{4}{3}x + \frac{2}{3}

\end{align}

$$

From this you can tell that the line crosses the $y$-axis at $\frac{2}{3}$ and that the slope of the line is $\frac{4}{3}$: when $x$ increases by 1, $y$ increases by $\frac{4}{3}$.

Borrowing from Homogeneous coordinates I set $A=y_2-y_1$, $B=x_1-x_2$ and $C=x_2 y_1-x_1 y_2$ such that $[A,B,C]\cdot[x,y,1]=A x + B y + C = 0$ is the equation of the line.

The distance of a vertex $P=(x_P, y_P)$ from the line is

$$ d = \frac{A x_P+B y_P + C}{\sqrt{A^2+B^2}} $$

and the closest point $Q$ on the line from point $P$ lies in

$$ \begin{bmatrix} x_Q \\ y_Q \end{bmatrix} = \frac{1}{A^2+B^2}

\begin{bmatrix} B^2 \,x_P – A B \;y_P \\ A^2 \,y_P – A B \;x_P \end{bmatrix} $$

**Edit:**

Homogeneous coordinates (HC) are a way to represent points, planes and lines for computer graphics methods. A point $(x,y)$ is represented by three coordinates $[x,y,1]$ and every scalar multiple of it, such as $[2x,2y,2]$. To get the point back from the 3 coordinates $[a,b,c]$ divide by the last value $(x,y)=(a/c,b/c)$.

The equation of the line through two points is derived from the line coordinates

$$ L = [y_2-y_1, x_1-x_2, x_2 y_1-x_1 y_2] $$ in a way that when the dot-product with a point is zero that point falls on the line. So any point with coordinates $[x,y,1]$ that lies on the line has

$$ [x,y,1]\cdot[y_2-y_1, x_1-x_2, x_2 y_1-x_1 y_2]=0 $$

$$ x(y_2-y_1)-y(x_2-x_1)+( x_2 y_1-x_1 y_2)=0 $$

which is the equation of the line in $Ax+By+C=0$ form. As a function the line is $y =-(A/B) x-(C/B)$

- If $a$ and $b$ are integers such that $9$ divides $a^2 + ab + b^2$ then $3$ divides both $a$ and $b$.
- Structure sheaf consists of noetherian rings
- Proof that if $Z$ is standard normal, then $Z^2$ is distributed Chi-Square (1).
- Why does the antipodal map on $S^2$ have degree $-1$?
- Finding constant to make integrals converge
- A question related to Pigeonhole Principle
- Convergence, Integrals, and Limits question
- Maximum edges in a square free graph
- Prove that an algebra is finitely generated iff it is isomorphic to the quotient ring $R/I$
- Good way to learn Ramsey Theory
- on $\mathbb{R}$ such that $f$ and $f'$ has no common $0$ in $$,
- Understanding second derivatives
- Possible areas for convex regions partitioning a plane and containing each a vertex of a square lattice.
- The number of orbits of a (normal) subgroup
- Products of quotient topology same as quotient of product topology