POV-Ray : Newsgroups : povray.general : alignment again. : Re: alignment again. Server Time
10 Aug 2024 07:16:58 EDT (-0400)
  Re: alignment again.  
From: Mark Wagner
Date: 20 Feb 2000 01:03:14
Message: <38af83a2@news.povray.org>

>hi all!
>I have to align a three point object (with point1 in <0,0,0>, point2 in
><x,0,0>, and point3 in <x,y,0>), with an identical three point object in
>space (with known xyz coordinates for the three points). is there an
>easy way to do it (like the reorient macro in the vansickle page)? or a
>not so simple one?
>thanx,
>sa


If you are using the MegaPatch, the following will work:
#declare V1 = point2-point1; /* These are the points of the object */
#declare V2 = point3-point1;

#declare New1 = NewPoint2 - NewPoint1; /* NewPoint1, NewPoint2, NewPoint3
are the positions you want to move the object to */
#declare New2 = NewPoint3 - NewPoint2;

object{MyObject
  REORIENT(V1, New1) /* This is VanSickle's Reorient macro, or anyone else's
reorient macro */
  REORIENT(vtransform(V2,_REORIENT(V1, New1)), New2)
}

This will also work without the MegaPatch, but you will need to figure out
the math for the vtransform function yourself.

Mark


Post a reply to this message

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