POV-Ray : Newsgroups : povray.newusers : unexpected scale results : Re: unexpected scale results Server Time
28 Jul 2024 18:24:24 EDT (-0400)
  Re: unexpected scale results  
From: Warp
Date: 7 Dec 2007 20:33:00
Message: <4759f44c@news.povray.org>
jofg <jos### [at] yahoocom> wrote:
>     //// Please explain why these spheres where translated to a new location
> after being scaled, thanks

  Suppose you have this:

object { MyObject scale 2 }

  What do you expect happens to that object? It should be uniformly scaled
twice its size, no? The resulting object should look exactly the same as
the original one, just twice as large, no?

  Well, assume that MyObject is defined as follows:

#declare MyObject =
  union
  { sphere { <0, 0, 0>, 1 }
    sphere { <2, 0, 0>, 1 }
  };

  This is the union of two spheres which touch each other at a point
(more precisely, at <1, 0, 0>). After this object is instantiated and
scaled above, the result should still be a union of sphere which touch
at a point. A uniform scale should not and does not change this.

  In order for this to happen at least one of the spheres must change
position besides being scaled larger, so that the end result is two
spheres twice as large as the originals, which touch at one point.

  Since the object is scaled with respect to the origin, the first sphere
will not move, but the second sphere will move to <4, 0, 0>, and of course
their radiuses will double. (And thus the new point where they touch is
<2, 0, 0>.) The end result is an object which looks identical to the
original object, just twice as large.

  Well, what happens if instead of that we declare MyObject as:

#declare MyObject =
  sphere { <2, 0, 0>, 1 };

  Now it's the same object, except that the first sphere has been removed.

  What happens if we instantiate this object and scale it twice as large,
as above? Should the behavior of this sphere change in some way simply
because now it's alone and not in a union with another sphere?

  No. Objects are always scaled with respect to the origin. This lone
sphere will still be scaled in the same way regardless of whether it's
in a union with another sphere or not. The transformation is independent
of this. The end result is still a sphere centered at <4, 0, 0> (and
with radius 2).

  The point is, transformations don't know nor care about what is the
"center" of the object. Many object do not have a "center". The "center"
of the object is always the origin, nothing else, and all transformations
are done with respect to that.

-- 
                                                          - Warp


Post a reply to this message

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