T.R | Title | User | Personal Name | Date | Lines |
---|
807.1 | Lots & lots of circles | ZFC::DERAMO | Frustrated personal name composer | Wed Dec 23 1987 16:34 | 5 |
| Two points by themselves do not uniquely determine a circle. Any
point on the perpendicular bisector of the segment joining the two
points could be used as the center.
Dan
|
807.2 | what if the radius was given also? ... | KEEPER::KOSTAS | He is great who confers the most benefits. | Wed Dec 23 1987 22:18 | 26 |
| what about the circle whose radius is the distance of the two points,
and the two points are on the circle.
Concider the figure
(x2,y2)
.
/
/
/
/ dy = y2 - y1
/ dx = x2 - x1
/ r = sqrt( sqr(dy) + sqr(dx) )
/
. For this example I am interested for a circle
(x1,y1) whose radius =r (given above) and the two points
(x1,y1) and (x2,y2) are on this circle. Also
there are only two possible circles. I am interested
on the one whose center is to the right of this
figure. Given all these can I find the center
of this circle?
/k
|
807.3 | more ... | KEEPER::KOSTAS | He is great who confers the most benefits. | Wed Dec 23 1987 22:28 | 20 |
|
What I was trying to say was given that I know (x1,y1) and (x2,y2)
and the distance between these two points r what are the two points
(denoted by a * in the figure bellow), where the two circles, one
with center at (x1,y1) and radius = r and the other at (x2,y2) with
same radius = r, intersect?
(x2,y2)
.
* /
/
/
/
/
/ *
/
.
(x1,y1)
|
807.4 | try this | MATRIX::ROTH | May you live in interesting times | Thu Dec 24 1987 06:46 | 7 |
| Let d^2 = (x2-x1)^2 + (y2-y1)^2, and h = sqrt(4*r^2/d^2-1)
Then
x0 = 0.5*((x1+x2) +/- (y2-y1)*h)
y0 = 0.5*((y1+y2) -/+ (x2-x1)*h)
- Jim
|
807.5 | Thanks it works ... | KEEPER::KOSTAS | He is great who confers the most benefits. | Thu Dec 24 1987 09:44 | 11 |
| re. .-1
Thanks Jim for your help. I have implemented your method and it
works. I have one more question on the same subject.
Now that I know the center of this new circle which is at (x0, y0)
can I find the angles (in degrees) of the (x1,y1) and (x2,y2) points
so I can draw an arc between them. This arc will be a portion of the
circle whose center is the point (x0,y0) and radius=r and the
starting angle is at the point (x1,y1) and the ending angle is at
the point (x2,y2).
|
807.6 | arctangent in C and ReGIS | SMURF::JMARTIN | Joseph A. Martin, ULTRIX kernel | Thu Dec 24 1987 10:38 | 17 |
| /* This is extracted from an arc routine which generates ReGIS output.
* It computes the angles of the segments from the center to the start
* and from the center to the end point of the arc, using the arctangent
* function. It then takes the difference of the two angles and
* converts to integral degrees for the benefit of ReGIS.
*/
#define PI 3.1415926536
#define TWOPI (2 * PI)
arc (x0,y0,x1,y1,x2,y2)
double x0,y0,x1,y1,x2,y2;
{
int ang; double theta;
theta = atan2(y2-y0, x2-x0) - atan2(y1-y0, x1-x0);
if (theta < 0.0) theta += TWOPI;
ang = (360./TWOPI) * theta + 0.5;
printf("P(B)[%d,%d]C(A%d)[%d,%d]P(E)",(int)x0,(int)y0,ang,(int)x1,(int)y1);
}
|
807.7 | Look Ma, no program... | CHOVAX::YOUNG | Back from the Shadows Again, | Sat Dec 26 1987 01:40 | 9 |
| Re .5:
This appears to be an equilateral traingle.
Therefore the angle(s) of any such arc(s) will always be 60�. (that
is, 60 degrees for those without multi-national character sets.)
-- Barry
|
807.8 | Yes, but .. | KEEPER::KOSTAS | He is great who confers the most benefits. | Sun Dec 27 1987 20:44 | 12 |
| re. .-1
Yes, I am aware that the triangle is an equilateral one but my question
was with respect to the new circle centered at (x0,y0). Once again
at what degree does the arc, from the point (x1,y1) to the point
(x2,y2), starts and ends respectively? The starting point is the
most important since as you suggested the ending point may be equal
to the starting point plus 60 degrees.
/Kostas
|
807.9 | Have three points on circumference, need center | PETERJ::JOHNSON | If we build it, they will come. | Tue Nov 06 1990 11:12 | 10 |
| This seems like a logical topic to append this to:
If I have three points in a cartesian coordinate system, how can I find the
coordinates of the center of the circle passing through those three points?
I should be able to derive this, but it has been a l-o-n-g time since I studied
this, and I could use the formula for some woodworking I'm doing.
Thanks,
Pete
|
807.10 | | GUESS::DERAMO | Dan D'Eramo | Tue Nov 06 1990 11:16 | 12 |
| A segment between two of the points would be a chord
of the circle. The perpendicular bisectors of any two
of the chords meet at the center of the circle. (If
the perpendicular bisectors are parallel, then the
points are collinear. You can think of the parallel
bisectors as "meeting" at the center of a "circle at
infinity".)
Does that give you enough to derive a formula? Or at
least to find the center on the wood?
Dan
|
807.11 | I'll work with that, but | PETERJ::JOHNSON | If we build it, they will come. | Tue Nov 06 1990 11:42 | 4 |
| re: -.1
Yes, that's a start and I'll start working with it - thanks! And I'm still
open to a short formula!
|
807.12 | Maybe this will help some | VMSDEV::HALLYB | The Smart Money was on Goliath | Tue Nov 06 1990 12:50 | 28 |
| if your 3 points are at (x0,y0), (x1,y1) and (x2,y2) then the line
segments joining them are also chords of the circle passing through
the 3 points. The equation of one chord is:
(y1-y0)
y - y0 = ------- (x - x0)
(x1-x0)
Which simplifies to y = mx + b, for constants b,m. I don't think
you'll need to calculate b. m is just (y1-y0)/(x1-x0).
The equation of the line perpendicular to "y = mx + b" at (x',y') is:
-1
y - y' = ---- (x - x')
m
So select (x',y') as the midpoint of the line (x0,y0) to (x1,y1) and
grind out the above equation. Choose (x",y") as the midpoint of the
line (x1,y1) to (x2,y2) and grind out the above formula again ("m" will
be different this time, (y2-y1)/(x2-x1), else points are collinear).
This gives you two equations in two unknowns. The solved value for
(x,y) will be the coordinates of the center of the circle.
If you have a symbolic math package it could give you the formula directly.
John
|
807.13 | Makes my pencil dull... | PETERJ::JOHNSON | If we build it, they will come. | Tue Nov 06 1990 13:08 | 25 |
| OK, here's what I figure I have to do, given 2 chords
For the first chord, find the midpoint [(x1-x2)/2, (y1-y2)/2]; this is where
the perpendicular bisector 'starts' ...
Find the slope of the chord ...
Take the negative reciprocal of that slope ... this is the slope of the
perpendicular bisector ...
Use the point-slope equation y-y1=m(x-x1) to find the equation of the
perpendicular bisector ...
Do all of the above the the second chord, too ...
Set the two equations equal and solve for "x", giving the x-coordinate of the
circle's center ...
Use the distance equation to find the radius r=((x2-x1)�-(y2-y1)�)**� ...
Whew!
Is there a more direct approach?
Pete
|
807.14 | | GUESS::DERAMO | Dan D'Eramo | Tue Nov 06 1990 13:34 | 9 |
| >> Is there a more direct approach?
Using your pencil and a yardstick, lightly draw in
two chords and their perpendicular bisectors on the
wood. Where the bisectors meet is the center of the
circle.
:-)
Dan
|
807.15 | I'll go with it | PETERJ::JOHNSON | If we build it, they will come. | Wed Nov 07 1990 08:21 | 1 |
| As it turns out, for my purposes -.1 is indeed the most reasonable approach.
|
807.16 | You got it | VMSDEV::HALLYB | The Smart Money was on Goliath | Wed Nov 07 1990 12:49 | 8 |
| > As it turns out, for my purposes -.1 is indeed the most reasonable approach.
But don't you at least feel better, having solved the math problem?
Short of coding up a program (or fetching one from netlib :-) I don't
think there is a "simpler way".
John
|
807.17 | Off to the H/W store | CIVAGE::LYNN | Lynn Yarbrough @WNP DTN 427-5663 | Wed Nov 07 1990 17:00 | 20 |
| You would do well to have a compass to help make the perpendicular
bisectors, but that's probably less effort than computing an exact solution:
Assuming the 3 points are (x0,y0), x1,y1), (x2, y2), the exact solution for
the center (xc, yc) is:
2 2 2 2 2 2 2 2
xc = 1/2 (x0 y1 - x0 y2 - y0 x1 + y0 x2 - y1 x2 + x1 y2 - y0 y2 + y0 y1
2 2 2 2
+ y1 y2 - y1 y2 - y0 y1 + y0 y2 )/
(x0 y1 - y0 x1 + x2 y0 - x2 y1 - y2 x0 + y2 x1)
2 2 2 2 2 2 2
yc = - 1/2 (- x0 x1 - x0 y1 + x0 x1 + y0 x1 - x2 x0 - x2 y0 + x2 x1
2 2 2 2 2
+ x2 y1 + x2 x0 - x2 x1 + y2 x0 - y2 x1)/
(x0 y1 - y0 x1 + x2 y0 - x2 y1 - y2 x0 + y2 x1)
|
807.18 | | GUESS::DERAMO | Dan D'Eramo | Wed Nov 07 1990 17:22 | 11 |
| >> Assuming the 3 points are (x0,y0), x1,y1), (x2, y2), the exact solution for
>> the center (xc, yc) is:
[...]
Quicky: does .-1 imply that the following is a quick
test for collinearity (i.e., compare the denominator
from .-1 to zero)?
(x0 y1 - y0 x1 + x2 y0 - x2 y1 - y2 x0 + y2 x1) == 0
Dan
|
807.19 | | ALLVAX::JROTH | It's a bush recording... | Wed Nov 07 1990 19:43 | 4 |
| That result could be written more perspicuously in terms of
determinants...
- Jim
|
807.20 | take it to visa::JoyOfLex | GUESS::DERAMO | Dan D'Eramo | Wed Nov 07 1990 20:10 | 8 |
| >> That result could be written more perspicuously in terms of
>> determinants...
I checked my dictionary to see if "perspicuously" or
"perspicaciously" was correct ... you used the correct
one there. :-)
Dan
|