POV-Ray : Newsgroups : povray.binaries.scene-files : RotateList.inc : RotateList.inc Server Time
2 Sep 2024 10:18:07 EDT (-0400)
  RotateList.inc  
From: Tom Bates
Date: 25 Nov 2001 04:24:05
Message: <3c00b8b5$1@news.povray.org>
As a result of frustration on my part and inspiration on
Bill DeWitt's part (see "Rotate list" in povray.general),
I've come up with a set of macros that allow easy
rotation of objects in arbitrary axis order.

The macros return a single rotation vector that will result
in the same object rotation as though you had used
multiple rotation statements.

I can turn this code:

object { MyObject
  rotate 30*y
  rotate <40,0,60>
}

Into this:

object { MyObject
  rotate yxz(30,40,60)
}

Admittedly, here it's not that big of an improvement.

However, when I wanted to store a rotation vector in a
variable to use later, it was prohibitively difficult to have
the rotations done in any order except x then y then z.

Now I can do this:

#declare ROT = yzx(20,30,40); // 20*y, 30*z then 40*z
//   ROT is now < 33.856616, -2.292945, 35.467006>
object { MyObject rotate ROT }


I mainly did these for myself, but thought others might
like them, too.  I hope some of you can find some use
out of these.

--
Tom Bates


Post a reply to this message


Attachments:
Download 'RotateList.inc.txt' (2 KB)

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