POV-Ray : Newsgroups : povray.advanced-users : Locating an Object Server Time
30 Jul 2024 06:27:01 EDT (-0400)
  Locating an Object (Message 1 to 6 of 6)  
From: Peter Houston
Subject: Locating an Object
Date: 29 Mar 2000 09:46:49
Message: <38e21759@news.povray.org>
Is there a way to determine the location of an object after it has been
transformed.

I have objects that are chained together and are each rotated individually
then they are all rotated and translated together.  What I am trying to
determine is the vector of the end of the chain.

The only way I can think of doing it is to reverse all of the
transformations, but I don't really want to do that if I can help it :)

Any help would be appreciated.

Regards,

Peter H.


Post a reply to this message

From: Warp
Subject: Re: Locating an Object
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

From: Greg M  Johnson
Subject: Re: Locating an Object
Date: 4 Apr 2000 10:11:52
Message: <38E9F726.3F322014@my-dejanews.com>
Easy, cinch,  unless your object is a BLOB!

#declare MyObject =  .....................

#declare location= <0,0,0>+max_extent(MyObject)/2+min_extent(MyObject)/2;

Tada!  Won't work with blobs.

Peter Houston wrote:

> Is there a way to determine the location of an object after it has been
> transformed.
>
> I have objects that are chained together and are each rotated individually
> then they are all rotated and translated together.  What I am trying to
> determine is the vector of the end of the chain.
>
> The only way I can think of doing it is to reverse all of the
> transformations, but I don't really want to do that if I can help it :)
>
> Any help would be appreciated.
>
> Regards,
>
> Peter H.


Post a reply to this message

From: Margus Ramst
Subject: Re: Locating an Object
Date: 5 Apr 2000 07:35:19
Message: <38EB1745.79E68F56@peak.edu.ee>
"Greg M. Johnson" wrote:
> 
> Easy, cinch,  unless your object is a BLOB!
> 
> #declare MyObject =  .....................
> 
> #declare location= <0,0,0>+max_extent(MyObject)/2+min_extent(MyObject)/2;
> 
> Tada!  Won't work with blobs.
> 

min/max_extent only give the limits of the object's bounding box, and thus are
not foolproof with complex CSG either, most notably intersection.
Vector functions are the surest way to go, since every object transformation can
be represented with a vector function.
Furthermore, in MegaPov there is now a vtransform() function, the vector
equivalent of transform. This makes the required operation easy:

#declare T=transform{rotate ... translate ... etc}
#declare Object=sphere{<0,1,0>,1 transform T}
#declare Location=vtransform(<0,1,0>, T);

-- 
Margus Ramst

Personal e-mail: mar### [at] peakeduee
TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Locating an Object
Date: 5 Apr 2000 09:08:06
Message: <38EB39AB.5A59BDC6@my-dejanews.com>
wicked.

Margus Ramst wrote:

> min/max_extent only give the limits of the object's bounding box, and thus are
> not foolproof with complex CSG either, most notably intersection.
> Vector functions are the surest way to go, since every object transformation can
> be represented with a vector function.
> Furthermore, in MegaPov there is now a vtransform() function, the vector
> equivalent of transform. This makes the required operation easy:
>
> #declare T=transform{rotate ... translate ... etc}
> #declare Object=sphere{<0,1,0>,1 transform T}
> #declare Location=vtransform(<0,1,0>, T);
>
> --
> Margus Ramst
>
> Personal e-mail: mar### [at] peakeduee
> TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg


Post a reply to this message

From: Vaclav Cermak
Subject: Re: Locating an Object
Date: 7 Apr 2000 07:07:31
Message: <38EDC11E.DFF95D13@itam.cas.cz>
In MegaPOV you can trace line and find its intersection
with any object (it returns point of intersection and
normal vector of objects surface).

Regards

Disnel

Peter Houston wrote:
> 
> Is there a way to determine the location of an object after it has been
> transformed.
> 
> I have objects that are chained together and are each rotated individually
> then they are all rotated and translated together.  What I am trying to
> determine is the vector of the end of the chain.
> 
> The only way I can think of doing it is to reverse all of the
> transformations, but I don't really want to do that if I can help it :)
> 
> Any help would be appreciated.
> 
> Regards,
> 
> Peter H.


Post a reply to this message

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