![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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)
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Thanks, great work. Just one comment:
#macro xyz(px,py,pz)
#local vx = vrotate(vrotate(vrotate(x,px*x),py*y),pz*z);
#local vy = vrotate(vrotate(vrotate(y,px*x),py*y),pz*z);
#local vz = vrotate(vrotate(vrotate(z,px*x),py*y),pz*z);
getrotation(vx,vy,vz)
#end
could be done somewhat shorter like this
#macro xyz(px,py,pz)
<px,py,pz>
#end
;-)
I imagine this is also faster, especially when used a lot.
Frits van Bommel
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Frits van Bommel wrote:
> Thanks, great work. Just one comment:
>
> #macro xyz(px,py,pz)
> #local vx = vrotate(vrotate(vrotate(x,px*x),py*y),pz*z);
> #local vy = vrotate(vrotate(vrotate(y,px*x),py*y),pz*z);
> #local vz = vrotate(vrotate(vrotate(z,px*x),py*y),pz*z);
> getrotation(vx,vy,vz)
> #end
>
> could be done somewhat shorter like this
>
> #macro xyz(px,py,pz)
> <px,py,pz>
> #end
>
> ;-)
> I imagine this is also faster, especially when used a lot.
>
> Frits van Bommel
>
You're absolutely right.
I guess I got caught up in the uniformity of it.
On the other hand, I guess I thought that particular one
wouldn't get used much, anyway.
At least when I'm doing rotations, if I want the order to
be x,y,z I just use a straight vector.
--
Tom Bates
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Tom Bates" <tho### [at] shaw ca> wrote in message
news:3c013b5c$1@news.povray.org...
> Frits van Bommel wrote:
[snip me explaining a shorter xyz]
> You're absolutely right.
> I guess I got caught up in the uniformity of it.
>
> On the other hand, I guess I thought that particular one
> wouldn't get used much, anyway.
> At least when I'm doing rotations, if I want the order to
> be x,y,z I just use a straight vector.
Well, it might be a good idea to use this one anyways, just to get used to
the macros...
Just a thought ofcourse.
Frits van Bommel
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hey, Tom,
[snip]
> I've come up with a set of macros that allow easy
> rotation of objects in arbitrary axis order.
Got a copy....will try it out....will post sample of use soonest...like
next week?
Thanx,
Brendan
--
Michael Brendan Hurley ShadowDancerEnterprizes, LTD.
POV Site: http://www.geocities.com/mbrendanh/indxx01.html
Family: http://www.saber.net/~mbhcgc/index.shtml
mbh### [at] saber net
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |