POV-Ray : Newsgroups : povray.newusers : Stupid newbie Q #453653... : Re: Stupid newbie Q #453653... Server Time
6 Sep 2024 10:10:09 EDT (-0400)
  Re: Stupid newbie Q #453653...  
From: Johannes Hubert
Date: 19 Aug 1998 03:11:54
Message: <35da6caa.0@news.povray.org>
J.B Cattley wrote in message <35d9cd1d.0@news.povray.org>...

>
>I suppose I could put everything at <0,0,0> and then translate as
necessary,
>but this seems kludgy, somehow. I seem to be missing the point, but the
help
>isn't very clear on this.


Actually, it is recommendable to get into the habit of creating everything
around the origin at <0, 0, 0> (even the docs do recommand that
somewhere...)

The reason is, that rotation always works around the main axis:
If you have a cube that you want to rotate around its own center, and the
cube is not centered around the origin, then you have to go like this:
Translate the cube until the axis of rotation falls into one of the
main-axis, rotate it, translate it back into position.

Now, you can make your life easier if you create the cube already in a way,
that its intended "center" falls into the origin. You can then rotate it and
then translate it into position.

So the standard way of creating an object is:

1. Create it in a way, that the object's "center" lies in <0, 0, 0> (some
objects, like the torus, can't be created in any other way, others, like the
"box", can).
2. Scale it, so that it is sized and deformed like you want it.
3. Rotate it, so that it is aligned like you want it.
4. Translate it into its final position.

Of course, you won't need all steps for all objects all the time, but the
*order* of the steps should be the same.

(BTW: This is how Moray creates its objects...)

Note: For objects that are always created at the origin (like a torus) this
may have to be modified, if the "center" you want to use does not fall into
the "default-center" of the object:

1. Create the object (at the origin by default)
2. Translate it so that the "center" you want to use falls into the origin
3. Scale it correctly
4. Rotate it into the right alignment
5. Translate it into the right position

It may seem a bit of a bother at the beginning, but once you get into the
habit of using this procedure, it only has advantages.

Hope it helps a bit,
Johannes.


Post a reply to this message

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