POV-Ray : Newsgroups : povray.general : Vector calculation/rotation problem : Re: Vector calculation/rotation problem Server Time
31 Jul 2024 00:25:15 EDT (-0400)
  Re: Vector calculation/rotation problem  
From: Tor Olav Kristensen
Date: 16 Feb 2008 22:30:58
Message: <47b7aa72$1@news.povray.org>
Tor Olav Kristensen wrote:
> Severi Salminen wrote:
>> Severi Salminen wrote:
>>
>>> Let's have a vector V which is random vector inside a hemisphere which
>>> has a pole at 0,1,0 (just like the northern hemisphere of Earth). I want
>>> to orient the vector inside a hemishere which has a pole pointing at
>>> vector N. How do I do this? 
>>
>> Example:
>>
>> V = (0.71, 0.71, 0) //The random vector in "northern hemishpere")
>> N = (-1,0,0) //The pole I want to orientate the random vectors to)
>>
>> The result is
>>
>> Vnew = (-0.71, 0.71, 0)
...

> I don't have time to test this, but I think this will work:
> 
>   #include "transforms.inc"
>   #declare P = <0, 1, 1>;
>   #declare N = <-1, 0, 0>;
>   #declare V = <0.71, 0.71, 0>;
>   #declare Vnew = vtransform(V, Reorient_Trans(P, N));
...

Hmmm... I wonder where I got the <0, 1, 1> vector from.
This is what I should have written:

   #include "transforms.inc"
   #declare P = <0, 1, 0>;
   #declare N = <-1, 0, 0>;
   #declare V = <0.71, 0.71, 0>;
   #declare Vnew = vtransform(V, Reorient_Trans(P, N));

-- 
Tor Olav
http://subcube.com


Post a reply to this message

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