POV-Ray : Newsgroups : povray.advanced-users : Average of vectors? : Re: Average of vectors? Server Time
29 Jul 2024 20:22:40 EDT (-0400)
  Re: Average of vectors?  
From: Josh English
Date: 8 Jan 2001 08:00:11
Message: <3A59BA2F.D5B3D8CC@spiritone.com>
I just tackled this problem myself:

given vectors v0, v1 (I assume they are at the origin)
#declare vn = vnormalize(vcross(v0,v1));
#declare v2 =
vaxis_rotate(v0,vn,clock*degrees(acos(vdot(vo,v1)/(vlength(v0)*vlength(v1)))));

v2 is in the right direction, so normalize it and adjust the length normally.

Josh

Rune wrote:

> Imagine two vectors, A and B.
> C is a regular weighted average of the two vectors, say clock*A +
> (1-clock)*B.
>
> With this type of average the vector-point is linearly "interpolated", but
> the rotation and length of the vector is not.
>
> To make the length of C linearly interpolated is easy, but how do I linearly
> interpolate the "rotation"?
>
> I need a general method that can average not just two, but multiple vectors.
> How can I do this?
>
> Rune
> --
> \ Include files, tutorials, 3D images, raytracing jokes,
> / The POV Desktop Theme, and The POV-Ray Logo Contest can
> \ all be found at http://rsj.mobilixnet.dk (updated January 6)
> / Also visit http://www.povrayusers.org

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


Post a reply to this message

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