|
![](/i/fill.gif) |
On Tue, 21 Aug 2001 16:09:38 -0400, Mark M. Wilson wrote:
>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?
>
>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?
1) Correct.
2) My torus spline macro at http://www2.fwi.com/~parkerr/traces.html has
the equations you need in it, but you'll have to do a little work to extract
them. Here's the relevant part:
#local Axis=vnormalize(vcross((C-A),(B-A)));
#local Base1=vnormalize(C-A);
#local Base2=vnormalize(vcross(Axis,Base1));
#local VB=<0.5*vlength(C-A),0,0>;
#local VA=vcross(VB,z);
#local VD=.5*<vdot(B-A,Base1),vdot(B-A,Base2),0>;
#local VC=vcross(VD,z);
#local Beta=((VD-VB).y*VA.x-(VD-VB).x*VA.y)/(VC.x*VA.y-VC.y*VA.x);
#local Center=A+VD.x*Base1+VD.y*Base2+Beta*(VC.x*Base1+VC.y*Base2);
#local Radius=vlength(Center-A);
There might be an easier way, but this one works for coplanar (but not
collinear) vectors A, B, and C. The results are in the variables Axis,
Center, and Radius. If you didn't need the axis, some of this could be
simplified a bit.
--
#macro R(L P)sphere{L __}cylinder{L P __}#end#macro P(_1)union{R(z+_ z)R(-z _-z)
R(_-z*3_+z)torus{1__ clipped_by{plane{_ 0}}}translate z+_1}#end#macro S(_)9-(_1-
_)*(_1-_)#end#macro Z(_1 _ __)union{P(_)P(-_)R(y-z-1_)translate.1*_1-y*8pigment{
rgb<S(7)S(5)S(3)>}}#if(_1)Z(_1-__,_,__)#end#end Z(10x*-2,.2)camera{rotate x*90}
Post a reply to this message
|
![](/i/fill.gif) |