POV-Ray : Newsgroups : povray.general : general geometry question Server Time
7 Aug 2024 21:25:53 EDT (-0400)
  general geometry question (Message 9 to 18 of 28)  
<<< Previous 8 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Ron Parker
Subject: Re: general geometry question
Date: 21 Aug 2001 17:18:37
Message: <slrn9o5k1f.i1c.ron.parker@fwi.com>
On Tue, 21 Aug 2001 17:03:15 -0400, Mark M. Wilson wrote:
>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.

Well, that's exactly what you have in the sequence of assignments I 
gave you; it's not actually a macro, it's just the math.

The truth is that there are really an infinite number of points that 
are equidistant from all three points.  The code I gave you computes
the one that happens to lie in the same plane.  Essentially, what it 
does is what you'd do with a compass and straightedge: draw the line 
segment from A to B and the line segment from B to C, construct the
perpendicular bisector of each segment, and the center is where the 
two perpendicular bisectors cross.  It's made somewhat more ugly by 
the fact that I did a basis transform to make the third step (finding
the intersection of the two bisectors) easier mathematically, but 
that's the basic idea.  I've tried to explain some of the math below.

(The rest of the points that are equidistant are of the form 
Center + m * Axis, for real values of m.  In other words, the axis of 
the uniquely-determined cylinder that all three points lie on.)

>>           #local Axis=vnormalize(vcross((C-A),(B-A)));

Axis is the direction of the line that is equidistant from all three
points.  We don't know its position in space yet, but we know which
direction it points.  It's also the third basis vector, but we don't
care about that so much.

>>           #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);

This is the basis transform and construction of perpendicular bisectors
rolled into one.  VA and VC are the bisectors, and VB and VD are their
offsets from point A (which is the origin in the alternate basis.)  They 
aren't much use, though, because the basis for these vectors is not x,y,z 
as with "normal" vectors.  In fact, note that the z component of all four 
vectors is zero.  That's why I chose this basis: it makes the next line a 
lot easier.

>>           #local Beta=((VD-VB).y*VA.x-(VD-VB).x*VA.y)/(VC.x*VA.y-VC.y*VA.x);

Beta is just an intermediate value.  It has physical significance, in that
it is the distance to the center along VC from the center to the line from
A to B (and also, of course, the distance along VA from the center to the
line from A to C) but it didn't really need to be separated out, except
to make the next line easier to read.  The mess above is just the solution
of two equations (the equations of the two bisectors) in two unknowns (the 
center of the circle in my alternate basis; z is known because it's zero.
Setting z to something besides zero would give you one of the other points
that's equidistant from all three points, conceptually, except that the
z component is ignored in the next line.)

>>           #local Center=A+VD.x*Base1+VD.y*Base2+Beta*(VC.x*Base1+VC.y*Base2);

In my alternate basis, the center is just VD+Beta*VC.  This line incorporates
that with the inverse basis transform to get back into x,y,z space.

>>           #local Radius=vlength(Center-A);

This line should be pretty obvious: if the center really is the center, then
the radius is the distance from the center to one of the points.  I picked
A because it's first.  I could have used B or C instead.

-- 
plane{-z,-3normal{crackle scale.2#local a=5;#while(a)warp{repeat x flip x}rotate
z*60#local a=a-1;#end translate-9*x}pigment{rgb 1}}light_source{-9red 1rotate 60
*z}light_source{-9rgb y rotate-z*60}light_source{9-z*18rgb z}text{ttf"arial.ttf"
"RP".01,0translate-<.6,.4,.02>pigment{bozo}}light_source{-z*3rgb-.2}//Ron Parker


Post a reply to this message

From: Ron Parker
Subject: Re: general geometry question
Date: 21 Aug 2001 17:24:26
Message: <slrn9o5kcd.i1c.ron.parker@fwi.com>
On Tue, 21 Aug 2001 14:02:43 -0700, Ben Chambers wrote:
>
>No, you're right - I was thinking sphere.  Sorry. :)

It's even worse with spheres: there are an infinite number of spheres that
go through any given two points.  In fact, there are an infinite number of
spheres that go through any given THREE points.  You need four points to
uniquely determine a sphere.

--
#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

From: Jamie Davison
Subject: Re: general geometry question
Date: 21 Aug 2001 17:54:37
Message: <MPG.15ece9a6d12411d69899c5@news.povray.org>
I have a question.  And please bear in mind that my maths is not the 
best.

How do you get a solution if all three points are in a perfectly straight 
line, e.g.:
<0,0,0>, <1,0,0>, <2,0,0>

Apart from using the limited accuracy of numerical values in POV, how do 
you draw a circle such that its circumference passes through all three 
points?

Or am I misunderstaning the original question?

Bye for now,
     Jamie.


Post a reply to this message

From: Bill DeWitt
Subject: Re: general geometry question
Date: 21 Aug 2001 17:55:49
Message: <3b82d8e5$1@news.povray.org>
"Ron Parker" <ron### [at] povrayorg> wrote in message
news:slr### [at] fwicom...
> On Tue, 21 Aug 2001 14:02:43 -0700, Ben Chambers wrote:
> >
> >No, you're right - I was thinking sphere.  Sorry. :)
>
> It's even worse with spheres:

    That's right, the infinte number of speres that intersect two points is
much larger than the infinite number of circles that intersect two points.


Post a reply to this message

From: Warp
Subject: Re: general geometry question
Date: 21 Aug 2001 18:14:08
Message: <3b82dd30@news.povray.org>
Jamie Davison <jam### [at] ntlworldcom> wrote:
: How do you get a solution if all three points are in a perfectly straight 
: line, e.g.:
: <0,0,0>, <1,0,0>, <2,0,0>

  There's no solution. Not finite one, that is.

  If you try to calculate it, you probably get a division by 0 or another
similar undefined result.

  Geometrically this is explained by thinking that the only solution is
a circle with infinite radius and the center being at infinity. That is,
the circumference is a straight line.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: Ron Parker
Subject: Re: general geometry question
Date: 21 Aug 2001 18:15:48
Message: <slrn9o5ncn.i39.ron.parker@fwi.com>
On Tue, 21 Aug 2001 17:55:49 -0400, Bill DeWitt wrote:
>
>"Ron Parker" <ron### [at] povrayorg> wrote in message
>news:slr### [at] fwicom...
>> On Tue, 21 Aug 2001 14:02:43 -0700, Ben Chambers wrote:
>> >
>> >No, you're right - I was thinking sphere.  Sorry. :)
>>
>> It's even worse with spheres:
>
>    That's right, the infinte number of speres that intersect two points is
>much larger than the infinite number of circles that intersect two points.

Let's not start that again.

-- 
plane{-z,-3normal{crackle scale.2#local a=5;#while(a)warp{repeat x flip x}rotate
z*60#local a=a-1;#end translate-9*x}pigment{rgb 1}}light_source{-9red 1rotate 60
*z}light_source{-9rgb y rotate-z*60}light_source{9-z*18rgb z}text{ttf"arial.ttf"
"RP".01,0translate-<.6,.4,.02>pigment{bozo}}light_source{-z*3rgb-.2}//Ron Parker


Post a reply to this message

From: Bill DeWitt
Subject: Re: general geometry question
Date: 21 Aug 2001 18:20:24
Message: <3b82dea8$1@news.povray.org>
"Jamie Davison" <jam### [at] ntlworldcom> wrote :
>
> Apart from using the limited accuracy of numerical values in POV, how do
> you draw a circle such that its circumference passes through all three
> points?

    I think the theorem or what ever goes something like, "For any three
points which are not on a line, there is one circle that intersects all
three points"


Post a reply to this message

From: Bill DeWitt
Subject: Re: general geometry question
Date: 21 Aug 2001 18:23:21
Message: <3b82df59$1@news.povray.org>
"Ron Parker" <ron### [at] povrayorg> wrote :
>
> Let's not start that again.

    I agree. We have already gone over it half an infinite number of times.


Post a reply to this message

From: Mark M  Wilson
Subject: Re: general geometry question
Date: 21 Aug 2001 18:23:55
Message: <3B82E079.6E533923@worldnet.att.net>
Sorry, Jamie --
I forgot to specify in my original question that the three points must
NOT be colinear, but SHOULD be coplanar (and anyone who knows geometry
knows that given any three points in 3D space, exactly one plane can
contain all three.)

I do in fact want to find the center point of the circle whose
circumference passes through the OTHER three points. :-)

--Mark

Jamie Davison wrote:
> 
> I have a question.  And please bear in mind that my maths is not the
> best.
> 
> How do you get a solution if all three points are in a perfectly straight
> line, e.g.:
> <0,0,0>, <1,0,0>, <2,0,0>
> 
> Apart from using the limited accuracy of numerical values in POV, how do
> you draw a circle such that its circumference passes through all three
> points?
> 
> Or am I misunderstaning the original question?
> 
> Bye for now,
>      Jamie.


Post a reply to this message

From: Mark M  Wilson
Subject: Re: general geometry question
Date: 21 Aug 2001 18:27:22
Message: <3B82E149.2280742B@worldnet.att.net>
Bill DeWitt wrote:
> 
> 
>     I think the theorem or what ever goes something like, "For any three
> points which are not on a line, there is one circle that intersects all
> three points"


THAT'S IT EXACTLY!!! And I'm trying to figure out how to find the vector
of the center of such a circle.

--Mark


Post a reply to this message

<<< Previous 8 Messages Goto Latest 10 Messages Next 10 Messages >>>

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