|
![](/i/fill.gif) |
"Mark M. Wilson" <mmw### [at] ncsl dcr state nc us> wrote in message
news:3B82C002.E75037D3@ncsl.dcr.state.nc.us...
> I have a couple of questions, actually. The second is dependent on the
> first.
> 1) It's been a LOOONNNNGGGGGG time since high school geometry, but it
> seems to me it should be possible to scribe a circle given any three
> (coplanar) points. Am I right?
Right. Constructing the circle with compass and straightedge is easy.
1) draw a line segment between each pair of points
2) construct perpindicular bisectors to each segment
3) the point where the three bisectors meet is the center. Set the compass
at the center, the radius to the distance from center to any of the points,
and draw.
you really only need two perp bisectors to make this work.
>
> 2) if the premise in #1 is correct, does anyone know of any macros for
> Povray that will calculate the coordinates of the center of such a
> circle?
Hmmm,
#macro LineThroughPointWithSlope(M,P1,B)
// Find intercept B given slope M and point to pass through P1
#declare B=P1.y-(M*P1.x);
#end
#macro LineThroughTwoPoints(P1,P2,M,B)
// Given two points in a plane, find
// slope m and intercept b of line
// through both lines
#declare M=(P2.y-P1.y)/(P2.x-P1.x);
LineThroughPointWithSlope(M,P1,B)
#end
#macro PerpendicularBisector(P1,P2,M,B)
// Given two points in a plane, find
// slope m and intercept b of perpendicular
// bisector
#local M2=0;
LineThroughTwoPoints(P1,P2,M2,B)
#declare M=-1/M2;
LineThroughPointWithSlope(M,(P1+P2)/2,B)
#end
#macro FindIntersection(M1,B1,M2,B2,P)
// given two lines slopes and intercepts, find the intersecting point P
// M1*x+B1=M2*X+B2
// B1-B2=M2*x-M1*x
// (B1-B2)/(M2-M1)=x
// y=M1*x+B1
#local X=(B1-B2)/(M2-M1);
#local Y=M1*X+B1;
#declare P=<X,Y,0>
#end
#macro ThreePointCircle(P1,P2,P3,C,R)
#local M1=0;
#local M2=0;
#local B1=0;
#local B2=0;
PerpendicularBisector(P1,P2,M1,B1)
PerpendicularBisector(P2,P3,M2,B2)
#declare C=<0,0,0>;
FindIntersection(M1,B1,M2,B2,Center)
#declare R=vlength(Center-P1);
#end
#declare Point1=<1,2,0>;
#declare Point2=<3,4,0>;
#declare Point3=<2,-1,0>;
#declare Center=<0,0,0>;
#declare Radius=0;
ThreePointCircle(Point1,Point2,Point3,Center,Radius)
plane {
z,0
pigment {checker color rgb 1 color rgb 0}
}
sphere {
Point1,0.25
pigment {color rgb <1,0,0>}
}
sphere {
Point2,0.25
pigment {color rgb <0,1,0>}
}
sphere {
Point3,0.25
pigment {color rgb <0,0,1>}
}
torus {
Radius,0.125
rotate x*90
translate Center
pigment {color rgb <1,1,0>}
}
camera {
location <0,0,-15>
look_at <0,0,0>
}
light_source {
<2000,2000,-2000>
color 1.5
}
This only works in 2 dimensions, ie z1=z2=z3. Extending to 3 dimensions is a
more complicated problem than I care to think about now.
>
> TIA,
> Mark M. Wilson
Post a reply to this message
|
![](/i/fill.gif) |