POV-Ray : Newsgroups : povray.general : general geometry question : Re: general geometry question Server Time
7 Aug 2024 15:17:29 EDT (-0400)
  Re: general geometry question  
From: Mark M  Wilson
Date: 21 Aug 2001 16:55:19
Message: <3B82CC93.2063EBB2@ncsl.dcr.state.nc.us>
Thanks! I'll look into it.  (BTW, I hope I was clear that I meant that
all three points should be along the full arc of the circle in
question.)  
Since I'm a POVray newbie, now all I have to do is figure out how to use
macros!
Maybe what I SHOULD have asked is, how to do the raw math myself to
figure out where to place the center of whatever torus or circle I
decide to place in my scene...  That would be, how to find the vector
for the ONE point which is equidistant from all three points.

(Macros are probably fine once you know what the heck you're doing, but
I just want to get started placing my objects in my project scene!)

Thanks again,
Mark

Ron Parker wrote:
> 
> 
> 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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.