Equation of a Triangle
An ellipse can be expressed as the locus of points with orthogonal
coordinates (x,y) such that (x/a)^2 + (y/b)^2 = 1 for some constants
a,b. However, it's more difficult to give a succinct description
of a piece-wise linear curve, e.g., a triangle. We seek a function
f() such that f(x,y)=0 if and only if the point (x,y) is on the
perimeter of a given triangle. It's not hard to see that no such
function exists if we restrict ourselves to functions definable in
terms of a finite number of basic arithmetical operations, i.e.,
additions, subtractions, multiplications, and divisions.
This raises the question of what other operation could be adjoined
to the four basic operations that would enable us to define a
general polygon. One possibility is the familiar "absolute value"
function, defined as
/ x if x >= 0
|x| = (
\ -x if x < 0
This function permits us to express a square as |x| + |y| = 1. More
general quadralaterals can be expressed in the form
A|x| + Bx + C|y| + D = 1
Two of the four verticies of this quadralateral are on the x axis
at the points x=-1/(A-B) and x=1/(A+B), while the other two are on
the y axis at the points y=-1/(C-D) and y=1/(C+D). This NEARLY
enables us to define a triangle by setting one of these verticies
to zero; we can come arbitrarily close to zero using finite
coefficients, but we can't quite define a true triangle.
A brute force approach would be to define three rays through the
origin of the coordinate system:
y = ax y = bx y = cx
These divide the plane into six regions. We can then construct a
function that reduces to one of three lines, depending on the region.
The point (x,y) is above or below the line y = ax depending on whether
the sign of y - ax is positive or negative. Therefore, a Boolean
variable indicating whether (x,y) is above the line y=ax can be
expressed as
y - ax
1 + --------
|y - ax|
Q[a] = ----------------
2
Obviously the complement of this function
y - ax
1 - --------
|y - ax|
q[a] = ----------------
2
is a Boolean variable indicating whether (x,y) is BELOW the line y=ax.
However, these functions are undefined for points on the line, because
then |y - ax| = 0. One way of removing this ambiguity is to express
Q and q in terms of a function that is arguably even simpler than
the absolute value, namely, the sign function
/ +1 if x >= 0
sign(x) = (
\ -1 if x < 0
With this function we can define Q and q as
1 + sign(y-ax) 1 - sign(y-ax)
Q[a] = --------------- q[a] = ---------------
2 2
where now Q signifies that (x,y) is above OR ON the line y=ax.
Using these boolean operators we can construct a function that
reduces at any given point to the equation of one of the three
edgelines of a triangle, depending on the relation of that that
point to the other two edgelines. For example, consider a
triangle whose verticies fall on the three rays shown below
b |
\ | a
\ | /
\ | /
\ | /
\ | /
____________\|/_____________
/|
/ |
/ |
/ |
/ |
c |
The edgeline connecting the verticies on rays a and b should be
invoked whenever (x,y) is on or above the raylines a and b. The
edgeline connecting a and c should be invoked when (x,y) is BELOW
both of the raylines a and c. The edgeline connecting b and c
should be invoked when (x,y) is ON or ABOVE rayline c and BELOW
rayline b. Thus, if the equations for the individual edgelines
are A1x+B1y = 1, A2x+B2y=1, and A3x+B3y=1, then the overall
equation for the triangle can be expressed in the form
Q[a] Q[b] (A1x + B1y)
+ q[a] q[c] (A2x + B2y) (1)
+ q[a] Q[c] (A3x + B3y) = 1
To illustrate, if we take the triangle given by the rays
y = (1/5)x y = -(8/5)x y = 2x
with the edge lines
x/15 + y/6 = 1
x/6 - y/3 = 1
-x/3 - y/12 = 1
then equation (1) is satisfied by the points on the perimeter of
the triangle shown in Figure 1:
Figure 1
This figure assumes we have defined Q and q in terms of the "sign"
function. Another way of dealing with the singularity of the absolute
value versions of Q and q would be to multiply through equation (1)
by the factor 4|y-ax||y-bx||y-cx|. Letting R,S,T and r,s,t denote
respectively the values and the absolute values of y-ax, y-bx, and
y-cx, this gives the non-singular function
(R+r)(S+s)T (A1x + B1y)
(R-r)(T-t)S (A2x + B2y)
(S-s)(T+t)R (A3x + B3y) = 4
This is equivalent to (1) except that it is also satisfied by the
points on any of the three rays. Thus the solution of equation (2)
is as illustrated in Figure 2.
Figure 2
One interesting aspect of this "triangle function" is that we don't
need to restrict our attention to just the points (x,y) that satisfy
the equation. Instead, we can assign a color to every point on the
plane depending on how close it comes to satisfying the equation.
This results in some striking images, such as the "stealth fighter"
shown in Figure 3.
Figure 3
Return to MathPages Main Menu
Сайт управляется системой
uCoz