POV-Ray : Newsgroups : povray.newusers : Where is my object? Server Time
13 Nov 2024 05:17:41 EST (-0500)
  Where is my object? (Message 1 to 6 of 6)  
From: Spock
Subject: Where is my object?
Date: 8 Feb 2001 16:21:06
Message: <3a830dc2$1@news.povray.org>
I have been working on a macro to connect any two points with a flexible
hose... just high school trig but I am happy with it.

Now that it works I want to connect a couple of objects in my scene... but I
don't know where they are.  Since the objects can move around in the scene
in a variety of ways it is not really practical to work out the various
transformations and try to compute the object location.

I found the min_extent patch in MegaPOV, but I'm not exactly sure how to use
it (or if it is appropriate) for objects that undergo multiple
transformations.  In particular I would like to attach my hose to a specific
point on the surface of my object, so this isn't exactly right.

To pinpoint the exact location I added a small object to the union that
makes up my big object, and it moves in accordance with the transformations
applied to the union.  But how do I find out where it ended up?  Any
thoughts?


Post a reply to this message

From: Ron Parker
Subject: Re: Where is my object?
Date: 8 Feb 2001 16:37:55
Message: <slrn9864dl.653.ron.parker@fwi.com>
On Thu, 8 Feb 2001 16:21:04 -0500, Spock wrote:
>Now that it works I want to connect a couple of objects in my scene... but I
>don't know where they are.  Since the objects can move around in the scene
>in a variety of ways it is not really practical to work out the various
>transformations and try to compute the object location.

You could vtransform() a point as you transform the object

>To pinpoint the exact location I added a small object to the union that
>makes up my big object, and it moves in accordance with the transformations
>applied to the union.  But how do I find out where it ended up?  Any
>thoughts?

If you make the small object a sphere centered on the point you're trying to
follow, the center of its bounding box will be on the transformed point.
But min_extent and max_extent work with #declared objects, which means they
won't work with a piece of a CSG as you want.  I know there was some talk
of being able to extract the transformation matrix from an object, but I 
don't know if anyone ever wrote that patch.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Spock
Subject: Re: Where is my object?
Date: 8 Feb 2001 18:26:44
Message: <3a832b34$1@news.povray.org>
Thank you.  Unfortunately I am too dense to get vtransfrom to run... let
alone interpret the results.

To re-phrase my original question (Ron, I think you understood me but in
case others had trouble with my prose...):

    "Where is the small sphere in this picture?"

or more accurately,

    "How can this file be changed to identify the location of the small
sphere?"

Many thanks to anyone willing to try a hand at a solution...

================================

light_source { < 1000, 1000, -1000 > color rgb < 1, 1, 1 > }

camera
{
    location < 0, 0, -50 >
    look_at < 0, 0, 0 >
}

object
{
 union
 {
  object
  {
   sphere { < 30, 19, 12 > 2 }
  }
  object
  {
   sphere { < 9, 9, 9 > 1 }
  }
 }
 pigment { rgb < 1, 1, 1 > }
 rotate 30 * x
}

================================

"Ron Parker" <ron### [at] povrayorg> wrote in message
news:slr### [at] fwicom...
> On Thu, 8 Feb 2001 16:21:04 -0500, Spock wrote:
> >Now that it works I want to connect a couple of objects in my scene...
but I
> >don't know where they are.  Since the objects can move around in the
scene
> >in a variety of ways it is not really practical to work out the various
> >transformations and try to compute the object location.
>
> You could vtransform() a point as you transform the object
>
> >To pinpoint the exact location I added a small object to the union that
> >makes up my big object, and it moves in accordance with the
transformations
> >applied to the union.  But how do I find out where it ended up?  Any
> >thoughts?
>
> If you make the small object a sphere centered on the point you're trying
to
> follow, the center of its bounding box will be on the transformed point.
> But min_extent and max_extent work with #declared objects, which means
they
> won't work with a piece of a CSG as you want.  I know there was some talk
> of being able to extract the transformation matrix from an object, but I
> don't know if anyone ever wrote that patch.
>
> --
> Ron Parker   http://www2.fwi.com/~parkerr/traces.html
> My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Chris Huff
Subject: Re: Where is my object?
Date: 8 Feb 2001 21:16:48
Message: <chrishuff-F2EDCF.21173208022001@news.povray.org>
In article <3a832b34$1@news.povray.org>, "Spock" <spo### [at] nospamcom> 
wrote:

> Thank you.  Unfortunately I am too dense to get vtransfrom to run... let
> alone interpret the results.

The vtransform() function just lets you apply transformations (like 
translate, rotate, scale, and matrix) to a vector. You use like this:
#declare TransformedPt = vtransform(Pt, rotate...scale...etc);

In your case, it might be easier to declare the transformation ahead of 
time:

#declare MyTrans = transform {rotate x*30}
#declare Loc = < 9, 9, 9>;

union {
    sphere {< 30, 19, 12>, 2}
    sphere {Loc, 1}

    pigment {rgb < 1, 1, 1>}
    transform {MyTrans}
    #declare Loc = vtransform(Loc, transform {MyTrans});
}

BTW, a couple things: the "object {}" blocks in your code were not 
necessary, and your spheres were missing the comma between the position 
and the radius. The first one will work fine, it's just more typing, but 
the second one could cause trouble, and is harder to read anyway.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Spock
Subject: Re: Where is my object?
Date: 8 Feb 2001 21:47:43
Message: <3a835a4f$1@news.povray.org>
This looks like a winner.  I tried your code and it works as expected, so
now all I need to do is retrofit it into my scene.

Thanks for the other pointers.  I think I was getting frustrated and made a
few typos in my sample that I don't normally make in my scene files, but I
will double check just in case.

Thanks again!

"Chris Huff" <chr### [at] maccom> wrote in message
news:chrishuff-F2EDCF.21173208022001@news.povray.org...
> In article <3a832b34$1@news.povray.org>, "Spock" <spo### [at] nospamcom>
> wrote:
>
> > Thank you.  Unfortunately I am too dense to get vtransfrom to run... let
> > alone interpret the results.
>
> The vtransform() function just lets you apply transformations (like
> translate, rotate, scale, and matrix) to a vector. You use like this:
> #declare TransformedPt = vtransform(Pt, rotate...scale...etc);
>
> In your case, it might be easier to declare the transformation ahead of
> time:
>
> #declare MyTrans = transform {rotate x*30}
> #declare Loc = < 9, 9, 9>;
>
> union {
>     sphere {< 30, 19, 12>, 2}
>     sphere {Loc, 1}
>
>     pigment {rgb < 1, 1, 1>}
>     transform {MyTrans}
>     #declare Loc = vtransform(Loc, transform {MyTrans});
> }
>
> BTW, a couple things: the "object {}" blocks in your code were not
> necessary, and your spheres were missing the comma between the position
> and the radius. The first one will work fine, it's just more typing, but
> the second one could cause trouble, and is harder to read anyway.
>
> --
> Christopher James Huff
> Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
> TAG: chr### [at] tagpovrayorg, http://tag.povray.org/
>
> <><


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Where is my object?
Date: 11 Feb 2001 12:01:57
Message: <3a86c585@news.povray.org>
Spock wrote:

> Now that it works I want to connect a couple of objects in my scene... but I
> don't know where they are.

#declare Imhere=min_extent(YourObject)/2+max_extent(YourObject)/2;

#debug str(Imhere.x,6,3)

#debug str(Imhere.y,6,3)

#debug str(Imhere.z,6,3)
#debug "\n"
// camera {location <0,0,-100> look_at Imhere }



Post a reply to this message

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