POV-Ray : Newsgroups : povray.advanced-users : Locating an Object : Re: Locating an Object Server Time
2 Nov 2024 05:22:44 EDT (-0400)
  Re: Locating an Object  
From: Warp
Date: 29 Mar 2000 11:00:34
Message: <38e228a2@news.povray.org>
Peter Houston <hou### [at] inamecom> wrote:
: Is there a way to determine the location of an object after it has been
: transformed.

  This isn't as unambiguous as one would think.
  How do you define the location of an object? Is defined by the
transformations applied to it? Is defined by the location of its center?
Both?
  Suppose that you have this object:

box
{ <1,1,1>, <3,3,3>
  translate <5,5,5>
}

  Now, where is this box located? Is it located at <5,5,5> because we have
translated it so? Is it located at <2,2,2>+<5,5,5> = <7,7,7> (ie. the
geometrical center of the object plus the translation)?
  One would think that the later one is more correct than the first one.
However, here we have a problem: What is the center of an object?
  For simple primitives like spheres and boxes it is easy to define. But for
more complex primitives it may be hard to calculate or even unambiguous
(for example the center of a triangle depends on how you define it; is it
at equal distances from the vertices, at equal distances from the sides,
at half angles of the vertex angles, something else?).
  Calculating the inverse of the transformations applied to an object would
be much easier, but it requires that you define the objects with their center
(chosen by you) at the origin.
  Currently there's no support for getting the transformations applied to
an object (and less the inverse transformations), so you will have to
apply the same transformations to vectors as you do to objects in order to
get their locations.
  And let's review the rules:

#declare Location=<0,0,0>;

translate Somewhere;
#declare Location = Location+Somewhere;

rotate SomeAngle;
#declare Location = vrotate(Location, SomeAngle);

scale SomeScale;
#declare Location = Location*SomeScale;

  Of course transforming a group of vectors instead of just one vector is
less trivial.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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