Geometry:
The Intersection Point of a Quadrilateral
The Setup
We
are given four points, A, B, C, and D, as four Cartesian coordinates. We connect the four points, starting with A,
in a clockwise form to form a quadrilateral.
We will designate each points as the coordinates:
A: (ax, ay)
B: (bx, by)
C: (cx, cy)
D: (dx, dy)
Draw
a line from one corner to the opposite corner.
This results in two lines: AC and DB.
The two lines (show above in lime green) meet at point P. The goal is determine the coordinates of P.
Slope
We
know the equation of the line is y = m*x + b, where m is the slope and b is the
y-intercept. Note that:
y
= m*x + b
y
– m*x = b
In
geometry, the slope of a line containing two points is generally defined as:
m
= (change in y coordinates)/(change in x coordinates) = Δy/Δx = (y2 – y1)/(x2 –
x1)
The
slope of AC: SAC = (cy – ay)/(cx – ax)
The
slope of BD: SBD = (dy – by)/(dx –bx)
The
Intercept
We
can easily deduce that solving the general equation of the line y = m*x + b for
the intercept yields b = y – m*x. If
follows that:
The
intercept of AC: IAC = cy – SAC * cx =
ay – SAC *ax
The
intercept of BD: IBD = by – SBD * bx =
dy – IBD *dx
Finding
the Intersection Point
Now
that the slopes and intercepts are determined, we can form the following system
of equations:
(I)
y = SAC * x + IAC
(II)
y = SBD * x + IBD
Solving
for x and y will find our intersection point P (px, py). Subtracting (II) from (I) (see above):
0
= (SAC – SBD) * x + (IAC – IBD)
We
can solve for x.
-(IAC
– IBD) = (SAC – SBD) * x
(-1*IAC
- -1*IBD) = (SAC – SBD) * x
(-IAC
+ IBD) = (SAC – SBD) * x
(IBD
– IAC) = (SAC – SBD) * x
Hence:
x = px = (IBD – IAC)/(SAC – SBD)
It
follows that we determine y by either equation (I) or (II):
y = py = SAC * px + IAC = SBD * px + IBD
Our
desired coordinates of point P are found.
Eddie
This
blog is property of Edward Shore, 2017.
x