POV-Ray : Newsgroups : povray.advanced-users : Vector Math : Re: Vector Math Server Time
30 Jul 2024 06:20:05 EDT (-0400)
  Re: Vector Math  
From: Josh English
Date: 12 Jan 2000 12:26:23
Message: <387CB932.CE4C734@spiritone.com>
I had three orientation macros but I can only find two of them:

#macro Orient_X(v1,v2)
  #local nx = vnormalize(v2 - v1);
  #local nz = vnormalize(vcross(nx,y));
  #local ny = vcross(nz,nx);
  matrix <nx.x,nx.y,nx.z,
          ny.x,ny.y,ny.z,
          nz.x,nz.y,nz.z,
          v1.x,v1.y,v1.z>
#end

#macro Orient_Z(v1,v2)
  #local nz = vnormalize(v2 - v1);
  #local nx = vnormalize(vcross(nz,y));
  #local ny = vcross(nz,nx);
  matrix <nx.x,nx.y,nx.z,
          ny.x,ny.y,ny.z,
          nz.x,nz.y,nz.z,
          v1.x,v1.y,v1.z>
#end

I have no idea what happened to Orient_Y
I think if you use
   #local ny = vnormalize(v2 - v1);
  #local nz = vnormalize(vcross(x,nz));
  #local nx = vcross(nz,ny);

it will work. Instead of x you can use any vector that you want to be "to
the right of" the object before it gets adjusted.

This is what I use.

Darcy Johnston wrote:

> Say I have a cylinder which goes from 0, to <0, h, 0> and I want to
> transform it so that it runs from <a,b,c> to <x,y,z>. How do I go about
> figuring out that transformation?
>
> Thanks,
> Darcy

--

Josh English
eng### [at] spiritonecom
ICQ: 1946299
"Stress is when you wake up screaming and realize you haven't fallen
asleep yet."


Post a reply to this message

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