POV-Ray : Newsgroups : povray.advanced-users : vlength( ) : Re: vlength( ) Server Time
2 Nov 2024 03:15:38 EDT (-0400)
  Re: vlength( )  
From: Chris Colefax
Date: 9 Jun 2000 00:38:09
Message: <394074b1@news.povray.org>
SamuelT <STB### [at] aolcom> wrote:
> Does anybody know how vlength converts vectors to floats? I've use it,
> but I'm interested in knowing what the output is. Does it average the
> vector numbers to create one float? Thanks in advance.

I think you'll find it uses something more Pythagorean than a simple
average: the formula for the length of a vector (as shown in the POV-Ray
docs) is the square root of the sum of the squares of each of the vector's
components, ie:

   sqrt (vdot(V, V))

which equals:

   sqrt (V.x*V.x + V.y*V.y + V.z*V.z)

in the case, obviously, of a three dimensional vector.


Post a reply to this message

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