POV-Ray : Newsgroups : povray.newusers : Rollercoaster type maths (not possible in povray?) : Re: Rollercoaster type maths (not possible in povray?) Server Time
29 Jul 2024 04:17:25 EDT (-0400)
  Re: Rollercoaster type maths (not possible in povray?)  
From: Mike Sobers
Date: 1 Aug 2006 15:00:01
Message: <web.44cfa486d4496aa8d5f7071c0@news.povray.org>
"CdeathJd" <nomail@nomail> wrote:
> i have no
> idea how to make it work, because pov-ray doesn't move objects relative to
> their rotation.
>
> i thought i would probably need to move the next track piece, to the old
> ones, then
> rotate it, then move it "forward" from that position relative to its new
> rotation, but as i've
> said a lot, pov-ray cant move objects relative to their current rotation.
>

Rather than complain that POV can't do something, why not try to understand
the problem better?  You want to work in a local reference frame instead of
a global one - fine, then just write a macro to move your track pieces
around:

///Begin code
camera {
   location <0, 0, -3>
   look_at <0,1, 0>
   }
light_source { <0,10, -10>
  color rgb <1,1,1>}

#declare track =
box{ <-0.2,0,-0.5>, <0.2,0.1,0.5>
  pigment {rgb <1,1,1>}
  }

#macro Move_Rotate_Relative (A, B, R)
  translate -A
  rotate R
  translate A+B
#end

#declare A = <-1,0,0>;
#declare B = <0.9,0.5,0>;
#declare R = <0,0,20>;
object {track translate A }
object {track translate A Move_Rotate_Relative(A,B,R)}
#declare A = A + B;
#declare B = <1,0.3,0>;
#declare R = R + <0,0,-10>;
object {track translate A Move_Rotate_Relative(A,B,R)}

//// End code

Each track is placed relative to the previous one, just update the current
track piece location, and give new position and rotation.

> Any more tips? i do apreciate the help, even if its not helping me!

Well, believe it or not, the previous suggestions are much simpler and
easier to implement than the technique you described (unless, of course,
you're trying to port some existing code over to POVray, in which case a
simple macro should do the trick). Don't be too quick to put down software
you don't fully understand, and people will be more likely to help you
solve your problem.

Mike


Post a reply to this message

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