POV-Ray : Newsgroups : povray.advanced-users : For the math minded people Server Time
19 Oct 2026 12:52:34 EDT (-0400)
  For the math minded people (Message 1 to 16 of 16)  
From: Fabien Hénon
Subject: For the math minded people
Date: 10 Jul 2000 13:56:43
Message: <396A0D89.699D3985@club-internet.fr>
Hi you all.

To make a smooth animation, I'd like to measure the distance between two
points ( ie : distance between <2,3,4> and <7,-8,3>)

Does anyone know the formulae to calculate it?

Thanks

Fabien Hénon


Post a reply to this message

From: Oded
Subject: Re: For the math minded people
Date: 10 Jul 2000 14:05:50
Message: <396a107e@news.povray.org>
of course:
distance(<x,y,z> to <x1,y1,z1>) =
   __________________________
  /            2                  2                   2
\/ (x - x1)   +  (y  - y1)  +    (z  -  z1)



Fabien Hénon <ffj### [at] club-internetfr> wrote in message
news:396A0D89.699D3985@club-internet.fr...
> Hi you all.
>
> To make a smooth animation, I'd like to measure the distance between two
> points ( ie : distance between <2,3,4> and <7,-8,3>)
>
> Does anyone know the formulae to calculate it?
>
> Thanks
>
> Fabien Hénon
>
>


Post a reply to this message

From: Ron Parker
Subject: Re: For the math minded people
Date: 10 Jul 2000 14:06:34
Message: <slrn8mk4vs.pm2.ron.parker@linux.parkerr.fwi.com>
On Mon, 10 Jul 2000 19:53:13 +0200, Fabien Hénon wrote:
>Hi you all.
>
>To make a smooth animation, I'd like to measure the distance between two
>points ( ie : distance between <2,3,4> and <7,-8,3>)
>
>Does anyone know the formulae to calculate it?

The simple way, in POV script, is vlength(A-B) where A and B are the vectors
you want the distance between.  The formula actually used is

sqrt( (A.x-B.x)*(A.x-B.x)+(A.y-B.y)*(A.y-B.y)+(A.z-B.z)*(A.z-B.z))

which is from the Pythagorean Theorem in three dimensions.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: How Camp
Subject: Re: For the math minded people
Date: 10 Jul 2000 14:07:58
Message: <396a10fe@news.povray.org>
The scalar distance between two points can be found by:

sqrt( (x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2 )

where <x1, y1, z1> is your first point, and <x2, y2, z2> is your second
point.

So, in your example:

sqrt( (7 - 2)^2 + (-8 - 3)^2 + (3 - 4)^2 )

= sqrt( 5^2 + (-5)^2 + (-1)^2 )

= sqrt( 25 + 25 + 1)

= sqrt(51)

= 7.14 (approximately)


- How


Fabien Hénon <ffj### [at] club-internetfr> wrote in message
news:396A0D89.699D3985@club-internet.fr...
> Hi you all.
>
> To make a smooth animation, I'd like to measure the distance between two
> points ( ie : distance between <2,3,4> and <7,-8,3>)
>
> Does anyone know the formulae to calculate it?
>
> Thanks
>
> Fabien Hénon
>
>


Post a reply to this message

From: David Fontaine
Subject: Re: For the math minded people
Date: 10 Jul 2000 14:55:14
Message: <396A1A62.15B3629C@faricy.net>
Oded wrote:

> of course:
> distance(<x,y,z> to <x1,y1,z1>) =
>    __________________________
>   /            2                  2                   2
> \/ (x - x1)   +  (y  - y1)  +    (z  -  z1)

Gee, that looks nice in the variable-length font, but maybe you should've
aligned to the fixed-width font... :)

--
David Fontaine     <dav### [at] faricynet>     ICQ 55354965
Please visit my website: http://www.faricy.net/~davidf/


Post a reply to this message

From: Andrea Ryan
Subject: Re: For the math minded people
Date: 10 Jul 2000 16:56:26
Message: <396A3622.FD698EE@global2000.net>
Does the formula give the "hypotenuse" of a shape that looks like a doorstop or
is it a different shape?
Brendan

Ron Parker wrote:

> On Mon, 10 Jul 2000 19:53:13 +0200, Fabien Hénon wrote:
> >Hi you all.
> >
> >To make a smooth animation, I'd like to measure the distance between two
> >points ( ie : distance between <2,3,4> and <7,-8,3>)
> >
> >Does anyone know the formulae to calculate it?
>
> The simple way, in POV script, is vlength(A-B) where A and B are the vectors
> you want the distance between.  The formula actually used is
>
> sqrt( (A.x-B.x)*(A.x-B.x)+(A.y-B.y)*(A.y-B.y)+(A.z-B.z)*(A.z-B.z))
>
> which is from the Pythagorean Theorem in three dimensions.
>
> --
> Ron Parker   http://www2.fwi.com/~parkerr/traces.html
> My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Warp
Subject: Re: For the math minded people
Date: 10 Jul 2000 17:09:38
Message: <396a3b92@news.povray.org>
Come on, it's povray. There's the easy way:

vlength(<2,3,4>-<7-8,3>)

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ron Parker
Subject: Re: For the math minded people
Date: 10 Jul 2000 17:12:34
Message: <slrn8mkfsm.po3.ron.parker@linux.parkerr.fwi.com>
On Mon, 10 Jul 2000 16:46:26 -0400, Andrea Ryan wrote:
>Does the formula give the "hypotenuse" of a shape that looks like a doorstop or
>is it a different shape?

It gives the length of the diagonal of the largest rectangular face on a 
solid that looks like a doorstop (assuming you mean a wedge-shaped doorstop.)
That happens to also be the straight line that connects the two points.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Ron Parker
Subject: Re: For the math minded people
Date: 10 Jul 2000 17:14:04
Message: <slrn8mkfvh.po3.ron.parker@linux.parkerr.fwi.com>
On 10 Jul 2000 17:09:38 -0400, Warp wrote:
>  Come on, it's povray. There's the easy way:
>
>vlength(<2,3,4>-<7-8,3>)

#macro DistanceBetweenPoints( A, B )
  vlength(<0,0,0>+A-B)
#end

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Chris Huff
Subject: Re: For the math minded people
Date: 10 Jul 2000 18:30:39
Message: <chrishuff-4F7800.17305910072000@news.povray.org>
In article <396### [at] global2000net>, Andrea Ryan 
<ary### [at] global2000net> wrote:

> Does the formula give the "hypotenuse" of a shape that looks like a 
> doorstop or is it a different shape?

It really just gives the hypotenuse of a 3D triangle...I sometimes think 
of it as the line between the front-left-bottom corner and the 
back-right-top corner of an axis-aligned box.

-- 
Christopher James Huff - Personal e-mail: chr### [at] maccom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://homepage.mac.com/chrishuff/
TAG Web page: http://tag.povray.org/


Post a reply to this message

From: Josh English
Subject: Re: For the math minded people
Date: 10 Jul 2000 18:42:21
Message: <396A5184.7D17EE41@spiritone.com>
Why add the <0,0,0>? It doesn't contribute anything.

Josh

Ron Parker wrote:

> On 10 Jul 2000 17:09:38 -0400, Warp wrote:
> >  Come on, it's povray. There's the easy way:
> >
> >vlength(<2,3,4>-<7-8,3>)
>
> #macro DistanceBetweenPoints( A, B )
>   vlength(<0,0,0>+A-B)
> #end
>
> --
> Ron Parker   http://www2.fwi.com/~parkerr/traces.html
> My opinions.  Mine.  Not anyone else's.

--
Josh English -- Lexiphanic Lethomaniac
eng### [at] spiritonecom
The POV-Ray Cyclopedia http://www.spiritone.com/~english/cyclopedia/


Post a reply to this message

From: Warp
Subject: Re: For the math minded people
Date: 10 Jul 2000 19:26:37
Message: <396a5bad@news.povray.org>
Josh English <eng### [at] spiritonecom> wrote:
: Why add the <0,0,0>? It doesn't contribute anything.

  It converts the parameter to a vector. The parameter may be a single number.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ron Parker
Subject: Re: For the math minded people
Date: 10 Jul 2000 21:36:35
Message: <slrn8mkvbs.pr2.ron.parker@linux.parkerr.fwi.com>
On 10 Jul 2000 19:26:37 -0400, Warp wrote:
>Josh English <eng### [at] spiritonecom> wrote:
>: Why add the <0,0,0>? It doesn't contribute anything.
>
>  It converts the parameter to a vector. The parameter may be a single number.

Come to think of it, it's not necessary.  If either parameter is a vector, the
expression will be promoted at the addition stage, and if both are floats, it
will be promoted prior to taking the length.  So it really doesn't contribute
anything.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Andrea Ryan
Subject: Re: For the math minded people
Date: 10 Jul 2000 23:07:18
Message: <396A8D10.543C1553@global2000.net>
Yes, that's the shape that I was thinking of.  Thanks.
Brendan

Ron Parker wrote:

> On Mon, 10 Jul 2000 16:46:26 -0400, Andrea Ryan wrote:
> >Does the formula give the "hypotenuse" of a shape that looks like a doorstop or
> >is it a different shape?
>
> It gives the length of the diagonal of the largest rectangular face on a
> solid that looks like a doorstop (assuming you mean a wedge-shaped doorstop.)
> That happens to also be the straight line that connects the two points.
>
> --
> Ron Parker   http://www2.fwi.com/~parkerr/traces.html
> My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Fabien Hénon
Subject: Re: For the math minded people
Date: 11 Jul 2000 16:50:45
Message: <396B880D.1D41BDF7@club-internet.fr>
Thanks for all your answers.

I'll use this one on Excel.

Cheers.

HF

How Camp a écrit :

> The scalar distance between two points can be found by:
>
> sqrt( (x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2 )
>
> where <x1, y1, z1> is your first point, and <x2, y2, z2> is your second
> point.
>
> So, in your example:
>
> sqrt( (7 - 2)^2 + (-8 - 3)^2 + (3 - 4)^2 )
>
> = sqrt( 5^2 + (-5)^2 + (-1)^2 )
>
> = sqrt( 25 + 25 + 1)
>
> = sqrt(51)
>
> = 7.14 (approximately)
>
> - How
>
> Fabien Hénon <ffj### [at] club-internetfr> wrote in message
> news:396A0D89.699D3985@club-internet.fr...
> > Hi you all.
> >
> > To make a smooth animation, I'd like to measure the distance between two
> > points ( ie : distance between <2,3,4> and <7,-8,3>)
> >
> > Does anyone know the formulae to calculate it?
> >
> > Thanks
> >
> > Fabien Hénon
> >
> >


Post a reply to this message

From: Don Barron
Subject: Re: For the math minded people
Date: 7 Aug 2000 15:43:01
Message: <398f1145@news.povray.org>
Sir,

You will find the answer to your question in the POV docs under "Float
functions' - vlength and then 'Vector Functions'.  It is then
straightforward to move a camera between the endpoints while looking_at
another point.

Yours sincerely,

Don Barron

"Fabien Hénon" <ffj### [at] club-internetfr> wrote in message
news:396A0D89.699D3985@club-internet.fr...
> Hi you all.
>
> To make a smooth animation, I'd like to measure the distance between two
> points ( ie : distance between <2,3,4> and <7,-8,3>)
>
> Does anyone know the formulae to calculate it?
>
> Thanks
>
> Fabien Hénon
>
>


Post a reply to this message

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