POV-Ray : Newsgroups : povray.general : joining objects for latter manipulation Server Time
31 Oct 2024 16:14:27 EDT (-0400)
  joining objects for latter manipulation (Message 1 to 8 of 8)  
From: Andrej
Subject: joining objects for latter manipulation
Date: 15 Jun 2005 10:22:49
Message: <42b039b9$1@news.povray.org>
I would like to join spheres into a single object for easier manipulation 
(rotation for example):


OBJECT {BALLS =
{
 #declare Count=0;
 #while (Count < 5)
  sphere { <(-2+Count), Count, Count>, 1
   pigment {  color rgb <0.4 0.8 0.8>}
  }
  #declare Count=Count+1;
 #end
}
}; ROTATE BALLS <0 90 45>


Post a reply to this message

From: Mike Raiford
Subject: Re: joining objects for latter manipulation
Date: 15 Jun 2005 10:39:41
Message: <42b03dad$1@news.povray.org>
Andrej wrote:
> I would like to join spheres into a single object for easier manipulation 
> (rotation for example):
> 
> 
> OBJECT {BALLS =
> {
>  #declare Count=0;
>  #while (Count < 5)
>   sphere { <(-2+Count), Count, Count>, 1
>    pigment {  color rgb <0.4 0.8 0.8>}
>   }
>   #declare Count=Count+1;
>  #end
> }
> }; ROTATE BALLS <0 90 45> 
> 
> 

#declare BALLS = union
{
   #declare Count=0;
   #while (Count < 5)
    sphere { <(-2+Count), Count, Count>, 1
     pigment {  color rgb <0.4 0.8 0.8>}
    }
    #declare Count=Count+1;
   #end
}

object { BALLS rotate  <0 90 45> }
-- 
~Mike

Things! Billions of them!


Post a reply to this message

From: Andrej
Subject: Re: joining objects for latter manipulation
Date: 15 Jun 2005 11:16:14
Message: <42b0463e@news.povray.org>
> object { BALLS rotate  <0 90 45> }

Can you then multiply this object and position them into different places 
(translation, repositioning)?

Like:

BALLS Bplanes[5];

#declare Count=0;
#while (Count < 5)
 Bplanes[Count]
 {
  NEWPOSITION <Count 0 0>
  rotate  <0 20*Count 45>
 }
 #declare Count=Count+1;
#end


Post a reply to this message

From: Andrej
Subject: Re: joining objects for latter manipulation
Date: 15 Jun 2005 11:45:52
Message: <42b04d30$1@news.povray.org>
> Can you then multiply this object and position them into different places 
> (translation, repositioning)?

OK, i've found this one: object { BALLS translate x*20 }.

Still searching for multiplication, like:
> BALLS Bplanes[5];


Post a reply to this message

From: Mike Raiford
Subject: Re: joining objects for latter manipulation
Date: 15 Jun 2005 11:59:47
Message: <42b05073$1@news.povray.org>
Andrej wrote:
>>object { BALLS rotate  <0 90 45> }
> 
> 
> Can you then multiply this object and position them into different places 
> (translation, repositioning)?
> 
> Like:
> 
> BALLS Bplanes[5];
> 
> #declare Count=0;
> #while (Count < 5)
>  Bplanes[Count]
>  {
>   NEWPOSITION <Count 0 0>
>   rotate  <0 20*Count 45>
>  }
>  #declare Count=Count+1;
> #end 
> 
> 

Just:

  #declare Count=0;
  #while (Count < 5)
    object { BALLS rotate <0 20*Count 45> }
    #declare Count=Count+1;
  #end

-- 
~Mike

Things! Billions of them!


Post a reply to this message

From: Andrej
Subject: Re: joining objects for latter manipulation
Date: 15 Jun 2005 12:42:58
Message: <42b05a92$1@news.povray.org>
Thank you.

Can you move the reference point (coordinate system) for the rotation?
I translate the object <0 0 10>. From there I would like to rotate <0 90 0>.
Right now, I still rotate from <0 0 0> so the object is also translated.


Post a reply to this message

From: Mike Williams
Subject: Re: joining objects for latter manipulation
Date: 15 Jun 2005 13:01:40
Message: <6CYNfDAs7FsCFwlR@econym.demon.co.uk>
Wasn't it Andrej who wrote:
>Thank you.
>
>Can you move the reference point (coordinate system) for the rotation?
>I translate the object <0 0 10>. From there I would like to rotate <0 90 0>.
>Right now, I still rotate from <0 0 0> so the object is also translated. 

You have to translate the object to the origin, rotate it there and
translate it back. Or you could use Rotate_Around_Trans() which does
exactly those operations.

#include "transforms.inc"
object {BALLS
  transform { Rotate_Around_Trans(<0,90,0>, <0,0,10>) }
}

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Warp
Subject: Re: joining objects for latter manipulation
Date: 15 Jun 2005 14:08:17
Message: <42b06e91@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> object {BALLS
>   transform { Rotate_Around_Trans(<0,90,0>, <0,0,10>) }

  I don't think the 'transform' is strictly necessary there.

  And by the way, you can also do it like this (which is actually how
that macro does it):

translate -LocalOrigo
rotate whatever
translate LocalOrigo

-- 
                                                          - Warp


Post a reply to this message

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