|
![](/i/fill.gif) |
"mysdn" <kam### [at] hotmail com> wrote in message
news:web.4a3b62de84d4e97f8813d5ca0@news.povray.org...
> Hello everybody,
> I'm new at this forum and very interested in ray tracing. Currently, I'm
> using
> Povray for ray tracing. But I have a huge problem understanding its
> rotation
> logic. Let's say I have 2 walls each 250 cm in length. Suppose we stand in
> front of 1st wall and 2nd wall is attached to 1st on the right side. Now
> rotate
> 2nd wall 45 degrees AND it loses position, no more their tips are attached
> like
> they should as an angled wall. The 2nd wall moves towards us and forward.
>
> Obviously I don't understand rotation in povray, I do use povray for many
> things
> for over a year but rotation always eluded me. I attached sample pov file
> at
> http://ompf.org/forum/viewtopic.php?f=6&t=1343
> If you take a look and show me some direction, I will be grateful. If you
> take a
> look at sample, you will see it's not just a simple matter of placing
> objects by
> just translate to <0,0,0> then rotate to .. then translate back to etc.
> Cause
> final translation values are assigned by 2D API Piccolo. Thank you very
> much.
>
> P:S This is for an app that writes SDL, so it's important.
> I also read a lot about povray rotate keyword but still dont get it and I
> can be
> considered pretty smart as the huge 2D-3D C# app I wrote will testify.
>
The standard 'rotate' operation rotates around the origin. In the case that
you describe I think you'd need to rotate around the near left corner of the
second wall (using that edge as a rotational axis). There is a macro in the
"transforms.inc" file that comes with POV-Ray that will do this for you. So
you'll need to add the line:
#include "transforms.inc"
Then you can use the "Rotate_Around_Trans(Rotation, Point)" macro in place
of the current set of translations and rotations that you have at the end of
your file 'rotation.pov'. You'll probably need something like the following
code:
#declare Axis = min_extent(ek_duvar12);
object {ek_duvar12 Axis_Rotate_Trans( 45*y,Axis)}
This assumes that the point on the wall object that is furthest in the -x
direction and the point the furthest in the -z direction adequately define
the corner that you need to rotate around. The y value doesn't really matter
if you're only rotating around y. However, if your wall has a rough surface,
or protrusions such as buttresses, you may need to adjust Axis before
passing it into the macro. You can do this by adding a vector to compensate
for these protrusions. For example:
#declare Axis = Axis+<0.01,0,0.02>;
Regards,
Chris B.
Post a reply to this message
|
![](/i/fill.gif) |