POV-Ray : Newsgroups : povray.advanced-users : Average of vectors? : Re: Average of vectors? Server Time
29 Jul 2024 20:13:27 EDT (-0400)
  Re: Average of vectors?  
From: David Fontaine
Date: 7 Jan 2001 19:09:50
Message: <3A590430.7C55FB4B@faricy.net>
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?

Make normalized copies of the two vectors, a and b.
Find the angle, A, between them: 2*asin(vlength(b-a)/2).
The vector you want is (a+b)/2 + tan(-A/2+A*clock)*vlength((a+b)/2)*vnorm(b-a)
Where clock goes from 0 to 1 from vector a to vector b.

--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

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