POV-Ray : Newsgroups : povray.general : Req: a #macro to reorient a vector : Re: Req: a #macro to reorient a vector Server Time
12 Aug 2024 17:17:05 EDT (-0400)
  Re: Req: a #macro to reorient a vector  
From: Jerry Anning
Date: 28 Jan 1999 23:49:04
Message: <36B13DBB.1993787F@dhol.com>
Peter Popov wrote:
> So, if you
> can please tweak it so that it takes as parameters not T, but three
> vectors - axis1, axis2 and point, axis1 and axis2 being H(T) and
> H(T+dT), and point being A(T), you will do me a great favor.

Try the following.

Jerry Anning
cle### [at] dholcom

//Begin POV code

#macro Vreorient2(axis1, axis2, point)
  #local Vx2 = vnormalize (axis2 - axis1);
  #local Vx1 = <0, 1, 0>;
  #local Vy = vnormalize(vcross(Vx2, Vx1);
  #local Vz1 = vnormalize(vcross(Vy, Vx1);
  #local Vz2 = vnormalize(vcross(Vy, Vx2);
  #local A1 = vdot(point, Vx1);
  #local A2 = vdot(point, Vy);
  #local A3 = vdot(point, Vz1);
  #local Apos = <vdot(point, Vx1), vdot(point, Vy), vdot(point, Vz1)>;
  #local B1 = <Vx2.x, Vy.x, Vz2.x>;
  #local B2 = <Vx2.y, Vy.y, Vz2.y>;
  #local B3 = <Vx2.z, Vy.z, Vz2.z>;
  <vdot(Apos, B1), vdot(Apos, B2), vdot(Apos, B3)> + axis1
#end

// End POV code


Post a reply to this message

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