POV-Ray : Newsgroups : povray.general : vrotate question Server Time
22 Dec 2024 01:18:08 EST (-0500)
  vrotate question (Message 1 to 8 of 8)  
From: jr
Subject: vrotate question
Date: 21 Jul 2022 10:30:00
Message: <web.62d961bff5740dfe1be3cd4b6cde94f1@news.povray.org>
hi,

reading the reference for 'vrotate()'[*], I understood that all components of
'B' are used to rotate the point.  yet, with the code below, both points are
identical for a given 'i_'.  I expected different values of 'B' to result in
different "orbits", so, what am I doing wrong?

[*] <https://wiki.povray.org/content/Reference:Vector_Expressions#Functions>


regards, jr.

-----<snip>-----
#version 3.7;

global_settings {assumed_gamma 1}
box {0,1}

#for (i_,0,359)
  #local p1_ = vrotate(<5,0,0>,<0,i_,45>);
  #local p2_ = vrotate(<5,0,0>,<45,i_,45>);
  #debug concat("#",str(i_,0,0)," p1 <",vstr(3,p1_,",",0,6),">.\n")
  #debug concat("#",str(i_,0,0)," p2 <",vstr(3,p2_,",",0,6),">.\n")
#end
-----<snip>-----


Post a reply to this message

From: m@b
Subject: Re: vrotate question
Date: 21 Jul 2022 11:52:05
Message: <62d97625$1@news.povray.org>
On 21/07/2022 3:25 pm, jr wrote:
> hi,
> 
> reading the reference for 'vrotate()'[*], I understood that all components of
> 'B' are used to rotate the point.  yet, with the code below, both points are
> identical for a given 'i_'.  I expected different values of 'B' to result in
> different "orbits", so, what am I doing wrong?
> 
> [*] <https://wiki.povray.org/content/Reference:Vector_Expressions#Functions>
> 
> 
> regards, jr.
> 
> -----<snip>-----
> #version 3.7;
> 
> global_settings {assumed_gamma 1}
> box {0,1}
> 
> #for (i_,0,359)
>    #local p1_ = vrotate(<5,0,0>,<0,i_,45>);
>    #local p2_ = vrotate(<5,0,0>,<45,i_,45>);
>    #debug concat("#",str(i_,0,0)," p1 <",vstr(3,p1_,",",0,6),">.\n")
>    #debug concat("#",str(i_,0,0)," p2 <",vstr(3,p2_,",",0,6),">.\n")
> #end
> -----<snip>-----
> 

vrotate(<5,0,0>,<45,i_,45>);

You moved the point along the x axis then rotated it by 45 degrees in x.
The 45 degree rotation has no effect as the point is still at y = 0, z = 0


Post a reply to this message

From: jr
Subject: Re: vrotate question
Date: 21 Jul 2022 13:15:00
Message: <web.62d98877132fa4421be3cd4b6cde94f1@news.povray.org>
hi,

"m@b" <sai### [at] googlemailcom> wrote:

(thanks for swift reply)


> You moved the point along the x axis then rotated it by 45 degrees in x.
> The 45 degree rotation has no effect as the point is still at y = 0, z = 0

no visible effect for the first point, agree, but I thought the rotation would
(should!) still exist and propagate when subsequent points are calculated.

the next question, then, is how to specify a point <5,0,0> and corresponding
vrotate()s to give me two separate X-axis rotations (as I tried with the two
rotation vectors)?  do I have to pre-compute some point not-on-axis beforehand,
or is there a "clean" way?


regards, jr.


Post a reply to this message

From: m@b
Subject: Re: vrotate question
Date: 21 Jul 2022 15:09:21
Message: <62d9a461@news.povray.org>
On 21/07/2022 6:10 pm, jr wrote:
> hi,
> 
> "m@b" <sai### [at] googlemailcom> wrote:
> 
> (thanks for swift reply)
> 
> 
>> You moved the point along the x axis then rotated it by 45 degrees in x.
>> The 45 degree rotation has no effect as the point is still at y = 0, z = 0
> 
> no visible effect for the first point, agree, but I thought the rotation would
> (should!) still exist and propagate when subsequent points are calculated.
> 
> the next question, then, is how to specify a point <5,0,0> and corresponding
> vrotate()s to give me two separate X-axis rotations (as I tried with the two
> rotation vectors)?  do I have to pre-compute some point not-on-axis beforehand,
> or is there a "clean" way?
> 
> 
> regards, jr.
> 


This is hurting my brain a bit.

Reading the docs, the rotations are around the origin (<0,0,0>) so

   #local p2_ = vrotate(<5,0,0>,<45,i_,45>);
   sphere{p2_, 1}

is equivalent to:

   sphere{<0,0,0>, 1 translate<5,0,0> rotate<45,i_,45>}

Not quite sure what you want to achieve.

m@


Post a reply to this message

From: jr
Subject: Re: vrotate question
Date: 21 Jul 2022 15:25:00
Message: <web.62d9a772132fa4421be3cd4b6cde94f1@news.povray.org>
hi,

"m@b" <sai### [at] googlemailcom> wrote:
> ...

oops, replied to the email, sorry.


regards, jr.


Post a reply to this message

From: m@b
Subject: Re: vrotate question
Date: 21 Jul 2022 16:05:22
Message: <62d9b182@news.povray.org>
On 21/07/2022 8:22 pm, jr wrote:
> hi,
> 
> "m@b" <sai### [at] googlemailcom> wrote:
>> ...
> 
> oops, replied to the email, sorry.

My fault - I meant to reply on here, hit the wrong button.
> 
> 
> regards, jr



thanks for yr interest.  so, point at <5,0,0>, I want to "orbit",
around Y, at an incline of 45°.  rotating that amount in Z gives me
that, but the point/sphere crosses the Z axis in two places.  adding a
rotation of +-X _should_ to my thinking, incline the orbit such that
it goes "over" +Z and "under" -Z, or vice versa.  so I try to have
multiple orbits around origin, without them crossing/touching the
respective axis.  (hope that makes sense)  cheers.

I think what you want is this:

   sphere{0, 1 translate<5,0,0> rotate<0,i_,45> rotate<45,0,0>}

i.e. apply the x rotation after the i_ thing. I don't think it is 
possible using vrotate.

If you need to define the points in advance you could try this:

   #local p2_ = transform {translate<5,0,0> rotate<0,i_,45> rotate<45,0,0>};
   sphere{0, 1 transform p2_ }

??????


--


Post a reply to this message

From: jr
Subject: Re: vrotate question
Date: 21 Jul 2022 16:40:00
Message: <web.62d9b858132fa4421be3cd4b6cde94f1@news.povray.org>
hi,

"m@b" <sai### [at] googlemailcom> wrote:
> ...
> I think what you want is this:
>
>    sphere{0, 1 translate<5,0,0> rotate<0,i_,45> rotate<45,0,0>}
>
> i.e. apply the x rotation after the i_ thing. I don't think it is
> possible using vrotate.

ah, ok, need separate rotations.  (the "i_ thing" was just a placeholder for
frame_number)


> If you need to define the points in advance you could try this:
>
>    #local p2_ = transform {translate<5,0,0> rotate<0,i_,45> rotate<45,0,0>};
>    sphere{0, 1 transform p2_ }

thank you for the 'transform' reminder!  I currently write 'sphere
{vrotate(...),...}' in the scene, so need to re-organise the sphere centres etc.
 think I can make the transform into a macro :-).  cheers.


regards, jr.


Post a reply to this message

From: jr
Subject: Re: vrotate question
Date: 21 Jul 2022 18:20:00
Message: <web.62d9d086132fa4421be3cd4b6cde94f1@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> "m@b" <sai### [at] googlemailcom> wrote:
> > ...
> > i.e. apply the x rotation after the i_ thing. I don't think it is
> > possible using vrotate.
>
> ah, ok, need separate rotations.  ...

works as envisaged.  thanks again.


regards, jr.


Post a reply to this message

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