POV-Ray : Newsgroups : povray.general : Re: Math help please. Server Time
6 Aug 2024 10:22:13 EDT (-0400)
  Re: Math help please. (Message 1 to 7 of 7)  
From: Andrew Cocker
Subject: Re: Math help please.
Date: 19 Apr 2002 07:12:16
Message: <3cbffb90@news.povray.org>
Apologies for posting a binary here... but it's only tiny. I hope that's
alright?

Andy Cocker


Post a reply to this message

From: TinCanMan
Subject: Re: Math help please.
Date: 19 Apr 2002 07:47:55
Message: <3cc003eb$1@news.povray.org>
> I almost feel embarassed for not knowing how to do this, but I have
> forgotten almost all the math I learnt at school. Anyway, here's my
> question:
>
> Please see the attatched image. If I know point A, and I know point C, and
> the length of A to B and B to C are always constant, how can I find point
B?
> Is it some Pythagorean thing? I am currently working in 2 dimensions.. all
> points are at x*0. Would any solution be different for 3 dimensions?
>

1.  You shouldn't post binaries AT ALL (no matter how small) here
2. I don't have the math solution at the moment but I can tell you the
following:

assume Lab=Lcb=L
a) if L<Lac then there is no solution
b) if L=Lac then there is one solution, the midway point between A and C
(this is easy to figure out)
c)  if L>Lac, in 2D there are two solutions, in 3D the solution lies
anywhere on a circle

think of it as two circles (or spheres in 3D) of radius L at A and C, B is
the intersecting point.

-tgq


Post a reply to this message

From: TinCanMan
Subject: Re: Math help please.
Date: 19 Apr 2002 07:53:08
Message: <3cc00524$1@news.povray.org>
oops...

> assume Lab=Lcb=L
> a) if 2*L<Lac then there is no solution
> b) if 2*L=Lac then there is one solution, the midway point between A and C
> (this is easy to figure out)
> c)  if 2*L>Lac, in 2D there are two solutions, in 3D the solution lies
> anywhere on a circle
>
> think of it as two circles (or spheres in 3D) of radius L at A and C, B is
> the intersecting point.
>
> -tgq
>
>


Post a reply to this message

From: Sir Charles W  Shults III
Subject: Re: Math help please.
Date: 19 Apr 2002 09:08:24
Message: <3cc016c8$1@news.povray.org>
You must know the angle in order to solve this.  Any triangle can be solved
knowing "side-angle-side" through simple trigonometry.  But the simpler approach
has nothing to do with any of this.  If you know point A and you know point C,
you have your answer through (as you guessed it) the Pythagorean theorem.  Let's
assume that point A is represented by (x1,y1) and point C is represented by (x2,
y2).  Then the distance from A to C is very simple:

    X = (x2-x1)
    Y = (y2-y1)
    D = sqrt((X*X) + (Y*Y))

    Since X may be negative or positive (and also the same is true for Y), you
may expect to take an absolute value or something, but this is not necessary.
Squaring the term automatically resolves it as a positive value.  The square
root of the sums of the squares gives the distance.

Cheers!

Chip Shults
My robotics, space and CGI web page - http://home.cfl.rr.com/aichip


Post a reply to this message

From: Florian Pesth
Subject: Re: Math help please.
Date: 19 Apr 2002 09:25:32
Message: <3cc01acc@news.povray.org>
Hi!
>     You must know the angle in order to solve this.  Any triangle can be
solved
Which angle? As TinCanMan pointed out, the problem has more than one
solution in 3d and all solutions lie on a circle. So if you want to
introduce an angle for that you must have a plane... Which plane do you want
to use?
Best regards,
Florian


Post a reply to this message

From: Andrew Cocker
Subject: Re: Math help please.
Date: 19 Apr 2002 09:58:15
Message: <3cc02277$1@news.povray.org>
Thanks guys. I figured it out now.

And once again, apologies for posting the binary. It'll not happen again.

All the best,
Andy Cocker


Post a reply to this message

From: TinCanMan
Subject: Re: Math help please.
Date: 19 Apr 2002 10:27:30
Message: <3cc02952$1@news.povray.org>
You may have figured it out but I'll post this any ways since I just
finished it, let me know if you have any questions.

Given Pts A & C and length D as well as pt P which lies on the desired plane
the macro calculates and returns B1 and B2, the two possible intersection
pts
note: if 2*L< Lac, you will get an error
also you need to initialize pts B1 and B2 for the macro to work

-tgq


//A = pt 1
//C = pt 2
//P = 3rd point on the desired plane
//L = distance from A & C to B
//B1, B2 = two possible points on the desired plane
//         predeclare B1 and B2 as anything (i.e. <0,0,0>)
//         they will be assigned approprite pts by the macro
#macro TwoPts (A,C,P,L,B1,B2)
  #local N=vnormalize(vcross(vcross(C-A,P-A),C-A));
  #local D=(A+C)/2;
  #local L2=sqrt(L^2-vlength(D-A));
  #local B1=D+N*L2;
  #local B2=D-N*L2;
#end




//sample scene illustrating the geometry
camera{
  location <5,5,-5>
  look_at  0
}

light_source{y*100  rgb 1}


#declare A=<0,0,0>;
#declare C=<1,1,1>;
#declare P=<-4,0,2>;
#declare L=2;

#declare B1=<0,0,0>;
#declare B2=<0,0,0>;

TwoPts (A,C,P,L,B1,B2)

sphere{A .1 pigment{rgb<1,0,0>}}
sphere{C .1 pigment{rgb<1,0,0>}}
sphere{P .1 pigment{rgb<0,1,0>}}


sphere{B1 .1 pigment{rgb<1,1,0>}}
sphere{B2 .1 pigment{rgb<1,1,0>}}

plane{
  vcross(C-A,P-A) 0
  pigment{
    object{
      union{
        difference{
          sphere{A L}
          sphere{A L*.99}
        }
        difference{
          sphere{C L}
          sphere{C L*.99}
        }
      }
      rgb 1, rgb 0
    }
  }
}
// end sample scene


Post a reply to this message

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