[futurebasic] Re: Coordinate geometry.

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: tedd <sperling@...>
Date: Wed, 17 Dec 1997 08:44:45 -0500
This may be a little late, but I couldn't help it.

---
>Does anyone know the answer to these two geometry questions?
>
>1. The formula for finding the intersection point of two lines.

Hi Lazo (or it is JC? -> it's not clear who is asking the question):

In any event: The formula depends upon the equations of each line. In other
words, you solve for x and y via two expressions. For example, let's say
you have one line that is defined as x = 2y (in other words, for every x, y
is twice that). And, the other line is x + 2 = y (in other words, for every
y, x is 2 greater). The intersection of these two lines would be where both
equations are solved with identical x's and y's.

Let's graph the equations:

In the first equation (x=2y), let's see what happens when we make x = 0.
When we do, then we find that y is equal to 0 as well. Therefore, we know
the line passes through (i.e., 0,0). When we make x = 1, then y = 2 (i.e.,
1,2). If we line a draw through those two known points, then we have the
solution sets for all equation sets along that line.

In the second equation (x+2=y), if we make x = 0, then y = 2 (i.e., 0,2).
If we make x = 1 then y = 3 (i.e., 1,3). Thus, we now know that the
equation passes through (0,2) and (1,3).

Now the problem. What solves both equations? Well... we have to do a little
rearrangement of the variables, such as:

    x = 2y is the same as: x - 2y = 0

AND

    x + 2 = y is the same as: x - y = -2

Then we have to solve for both equations, by:

   First eq:       x - 2y =  0
   Second eq:      x -  y = -2

This is a matrix problem. However, we can do it as folows:

First, solve for x: Multiply second equation by -1 and add both equations.

   First eq:       x - 2y =  0
   Second eq:     -x +  y = +2
                  _____________
                       -y = 2   (same as y = -2)

Second, solve for y: Multiply second equation by -2 and add both equations.

   First eq:       x - 2y =  0
   Second eq:    -2x + 2y = +4
                _______________
                  -x      = +4  (same as x = -4)

So, the solution is x = -4 and y = -2 (i.e., (-4,-2)).

Now how do you do this with a computer? You first have to have a
standardized way of entering equations. In other words, you have to keep
your x, y, and constants in order and in the form of |x|y|C|. Then you must
use a matrix solution (The above was simply a matrix operation).

I have some matrix solutions around here somewhere, but I think that they
are in the old QuickBASIC. In fact, I seem to recall a company named
Clearwater Research (or something like that) which produced some add-on
matrix functions. But, they don't work with FB.

Does anyone on this list have any matrix functions?

Another approach might be to allow the toolbox to solve the problem for
you. If you set one of your equations to be a region (using CALL LINETO's)
and the other to be another region (again using LINETO's) then calling
DIFFRGN will give you the intersection. Also, using DIFFRGN will tell you
if the lines cross.

---

>2. Given the coordinates of three points that lie on the arc of a circle,
>how do you find the radius and centre of that circle.

Again, this is a solution set for a set of equations. If the three points
are on the arc (circumference) of a circle, then they must all have a
common point (center of the circle) that is equal distant (same radius)
from each.

A easy way to do this on paper is to draw a line between each point to the
next adjacent point (i.e., A-B-C). These lines become cords. Then just
bisect each cord and draw a perpendicular to each cord. Where the
perpendicular's cross, is the center of the circle.

Now, if you do a little thinking, you can see that the above is another set
of lines (equations) that must be solved by a solution set. You get there
by determining the equation for each line, which are the coordinates for
the end points of each cord. Then a perpendicular line is nothing more than
another equation in which the slope is reversed. Then you solve for the
common point of both perpendicular line equations (like the previous
problem).

I leave the programming to you. It would be nice if you published your
solutions.

tedd

_____________________________________________________________________
tedd f. sperling                       <mailto:sperling@...>
                                     http://www.sojourn.com/sperling/