POV-Ray : Newsgroups : povray.animations : CSG tree of Unions : Re: CSG tree of Unions Server Time
17 May 2024 06:04:05 EDT (-0400)
  Re: CSG tree of Unions  
From: Chris B
Date: 4 Feb 2008 05:21:31
Message: <47a6e72b$1@news.povray.org>
"melo" <mel### [at] coxnet> wrote in message 
news:web.47a6d01895eefef63c0d56f20@news.povray.org...
> Well I have a hierarchically structured CSG tree. Different parts of the 
> tree at
> different levels represent different body parts.
>
> #declare Humanoid =
>  union { // trunk
>    cone{ ..}
>    sphere{ ...}
>    union{  // right arm
>      sphere{..} // shoulder
>      cone{..}   // upperarm
>      union{ // lower right arm
>        sphere{..} // elbow
>        cone{..} // lowerarm
>        union{
>           sphere{..} wrist
>           object{ right_hand }
>           }
>        }
>    }
>
> This structuring allows me to animate by rotating about joints/spheres. 
> After
> rotating a number of body parts, the coordinates of the sphere, cone 
> objects
> that make up Humanoid object change.
>
> Now questions:
> 1. Do those changes get reflected back in the POV-RAY SDL variable 
> Humanoid?

Once the parser has read the definition in your SDL the internal 
representation of the variable Humanoid will end up holding an internal 
representation of the shapes resulting from the application of the 
transformations to the objects. You won't be able to access that internal 
representation from further down in your SDL other than by referencing the 
variable 'Humanoid'. That is to say that POV-Ray doesn't expose the internal 
representation.

It's different from the way things like HTML and VRML have evolved with 
their separation between the DOM and scripting to support interrogation of 
the current DOM hierarchy from the scripting language.

> 2. Is it possible to traverse my CSG Unioned tree object and figure out 
> where
> the limbs of my virtual guy have ended up at? [I need to be able to do 
> this so
> I can put my Humanoid into the pose he was at the end of the prev stage, 
> at the
> beginning of the new stage.)

No. You won't be able to traverse the elements of the composite CSG object 
as you've currently got it defined. The only access you subsequently have to 
it is through the variable 'Humanoid'. There are some functions that give 
you specific pieces of information about it, such as the min_extents() and 
max_extents() vector functions, but the information returned is for the 
whole object, not for individual components.

The simplest solution is likely to be to store away the information you will 
need later as you go through building up your object definition. You will 
find arrays handy for this as they can store all sorts of things, including 
vectors for positions and rotations, but also entire transformations. 
Transformations assigned to an identifier can subsequently be applied to 
position vectors using the 'vtransform' macro.

Regards,
Chris B.


Post a reply to this message

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