POV-Ray : Newsgroups : povray.newusers : rotate object around its center Server Time
28 Jul 2024 14:22:52 EDT (-0400)
  rotate object around its center (Message 1 to 3 of 3)  
From: Chrisir
Subject: rotate object around its center
Date: 19 May 2008 12:55:00
Message: <web.4831b0126dd87b108d9dd5710@news.povray.org>
Hello!

How can I rotate an object around its center?

I currently use

Rotate_Around_Trans( < 0, 90 , 0 >, < x1, 0.4, y1 > )

with

#include "transforms.inc"

but I don't think it's working.

Does the expression
< 0, 90 , 0 >
mean rotate around y for 90 degrees (and leave x and z as is)?

Because that's what I want to do.

Please tell me whete my current code is wrong or
how to do it.

Thanks!

Greetings,

Chris


Post a reply to this message

From: Jim Holsenback
Subject: Re: rotate object around its center
Date: 19 May 2008 13:10:51
Message: <4831b49b@news.povray.org>
"Chrisir" <nomail@nomail> wrote in message 
news:web.4831b0126dd87b108d9dd5710@news.povray.org...
> How can I rotate an object around its center?

i think it's fairly common practice to build an object centered at <0,0,0>
from the camera's point of view you'd prefer a view of let's say the 
opposite side of the object without moving the camera. i'd first rotate the 
object using rotate y*180 then translate to the position in the scene .... 
does that answer your question?

Jim


Post a reply to this message

From: Alain
Subject: Re: rotate object around its center
Date: 19 May 2008 15:13:40
Message: <4831d164$1@news.povray.org>
Chrisir nous illumina en ce 2008-05-19 12:51 -->
> 
> Hello!
> 
> How can I rotate an object around its center?
> 
> I currently use
> 
> Rotate_Around_Trans( < 0, 90 , 0 >, < x1, 0.4, y1 > )
> 
> with
> 
> #include "transforms.inc"
> 
> but I don't think it's working.
> 
> Does the expression
> < 0, 90 , 0 >
> mean rotate around y for 90 degrees (and leave x and z as is)?
> 
> Because that's what I want to do.
> 
> Please tell me whete my current code is wrong or
> how to do it.
> 
> Thanks!
> 
> Greetings,
> 
> Chris
> 
> 
> 
> 
Acording to the documentation, you are correct.
That macro operate by translating the object by -1*< x1, 0.4, y1 >, rotate it by 
the amount wanted, then translate it back to it's original location.
If the point provided is outside the object, then the object will orbit that point.

As Jim mentioned, it's usualy way easier to create all your objects around the 
origin, apply any desired scaling and rotation, then to translate them to the 
desired location.

Depending on the orientation of the camera and the location of your object(s), 
it's possible that the applied rotation don't look like what you expect, even if 
it did exactly what it should.

-- 
Alain
-------------------------------------------------
I hope our wisdom will grow with our power, and teach us, that the less we
use our power the greater it will be.
Thomas Jefferson


Post a reply to this message

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