POV-Ray : Newsgroups : povray.newusers : Translating question Server Time
25 Nov 2024 15:34:16 EST (-0500)
  Translating question (Message 1 to 3 of 3)  
From: Oleguer Vilella
Subject: Translating question
Date: 25 Jun 2005 06:27:29
Message: <42bd3191$1@news.povray.org>
Hi all,

First of all my code:
======================================
//---------------------------Camera--------------------
camera {
  location  <7, 25, -10>
  look_at   <5, 3.0,  0.0> }

light_source { <-100, 200, -100> colour rgb 1 }
background { White }
//-------------------------------------------------------
//---------------------Object---------------------------
#declare Wsc4 = function { f_rounded_box(x, y, z, .1, 10, .2, .3) }
isosurface {
function { Wsc4(x, y, z) }
max_gradient 2
contained_by { sphere { 0, 4 } }
pigment { gradient x
pigment_map { [.15 rgb <0, 1, 0>]
[.15 rgb <1, 0, 0>]
[.85 rgb <1, 0, 0>]
[.85 rgb <0, 0, 1>]
}
translate <-0.5, 0, 0>
scale 3*3
//translate <2, 0, 0>
}
scale 2
rotate z*(-40)
rotate y*80
translate <5, 0, 0>
}
//--------------------------------------------------------
I'm trying to move this object along the z axis, but when I write "translate 
<5, 0, 9>", it also moves along the y axis.
I've rotated on the z and y axis. Could be there the problem?

One thing I could do is if I translate it along the z axis 9 units, move it 
in the same time -9 units along the y axis.

Thanks in advance,
Oleguer


Post a reply to this message

From: Mike Williams
Subject: Re: Translating question
Date: 25 Jun 2005 06:58:15
Message: <jEOr+CA5iTvCFw+h@econym.demon.co.uk>
Wasn't it Oleguer Vilella who wrote:
>I'm trying to move this object along the z axis, but when I write "translate 
><5, 0, 9>", it also moves along the y axis.
>I've rotated on the z and y axis. Could be there the problem?
>
>One thing I could do is if I translate it along the z axis 9 units, move it 
>in the same time -9 units along the y axis.

The object is moving along the actual z axis. The only odd thing is that
you've placed the camera high overhead, so you're getting an overhead
view, and the z axis is up the screen.

If that's not clear to you, try temporarily adding a visual
representation of the three axes to the scene
  cylinder {-x*15,x*15 0.3 pigment {rgb <1,0,0>}}
  cone     {x*15,0.6, x*18,0 pigment {rgb <1,0,0>}}
  cylinder {-y*15,y*15 0.3 pigment {rgb <0,1,0>}}
  cone     {y*15,0.6, y*18,0 pigment {rgb <0,1,0>}}
  cylinder {-z*15,z*15 0.3 pigment {rgb <0,0,1>}}
  cone     {z*15,0.6, z*18,0 pigment {rgb <0,0,1>}}
and you'll see that a motion along the z axis is in the direction of the
z-axis arrow (blue) which is in a sort of nort-north-west direction on
the screen.


If you change your camera position to something more usual, like 
  camera { location  <7, 3, -10> look_at   <5, 3, 0> }
then motion in the z direction moves away from the camera.


If you want to retain your current camera position and move the object
away from the camera then you can calculate the camera view direction
like this

  #declare Direction =  vnormalize(<5, 3.0,  0.0> - <7, 25, -10>); 

And then add a movement in that direction to the translate.

  translate <5, 0, 0> + Direction*9

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Oleguer Vilella
Subject: Re: Translating question
Date: 25 Jun 2005 09:11:59
Message: <42bd581f$1@news.povray.org>
Hi Mike,

Yeah, I understand it.

The directive that you've used is to find to director vector between two 
points (A and B).

On the documentation they say that:
"Returns a unit length vector that is the same direction as A."

Thank you very much for the answer.

Regards,
Oleguer




news:jEOr+CA5iTvCFw+h### [at] econymdemoncouk...
> Wasn't it Oleguer Vilella who wrote:
>>I'm trying to move this object along the z axis, but when I write 
>>"translate
>><5, 0, 9>", it also moves along the y axis.
>>I've rotated on the z and y axis. Could be there the problem?
>>
>>One thing I could do is if I translate it along the z axis 9 units, move 
>>it
>>in the same time -9 units along the y axis.
>
> The object is moving along the actual z axis. The only odd thing is that
> you've placed the camera high overhead, so you're getting an overhead
> view, and the z axis is up the screen.
>
> If that's not clear to you, try temporarily adding a visual
> representation of the three axes to the scene
>  cylinder {-x*15,x*15 0.3 pigment {rgb <1,0,0>}}
>  cone     {x*15,0.6, x*18,0 pigment {rgb <1,0,0>}}
>  cylinder {-y*15,y*15 0.3 pigment {rgb <0,1,0>}}
>  cone     {y*15,0.6, y*18,0 pigment {rgb <0,1,0>}}
>  cylinder {-z*15,z*15 0.3 pigment {rgb <0,0,1>}}
>  cone     {z*15,0.6, z*18,0 pigment {rgb <0,0,1>}}
> and you'll see that a motion along the z axis is in the direction of the
> z-axis arrow (blue) which is in a sort of nort-north-west direction on
> the screen.
>
>
> If you change your camera position to something more usual, like
>  camera { location  <7, 3, -10> look_at   <5, 3, 0> }
> then motion in the z direction moves away from the camera.
>
>
> If you want to retain your current camera position and move the object
> away from the camera then you can calculate the camera view direction
> like this
>
>  #declare Direction =  vnormalize(<5, 3.0,  0.0> - <7, 25, -10>);
>
> And then add a movement in that direction to the translate.
>
>  translate <5, 0, 0> + Direction*9
>
> -- 
> Mike Williams
> Gentleman of Leisure


Post a reply to this message

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