POV-Ray : Newsgroups : povray.newusers : how to move an object to position <0,0,0> Server Time
25 Nov 2024 03:26:05 EST (-0500)
  how to move an object to position <0,0,0> (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Nostromo
Subject: how to move an object to position <0,0,0>
Date: 8 Sep 2006 04:35:00
Message: <web.45012a4161ac9985800aa0230@news.povray.org>
Hi,

I created a simple object that looks like a Rubics cube (a big cube
consisting of 27 smaller cubes). Then I show this object and want to rotate
it (animation). Unfortunately it doesn't rotate around the middle of the
object (big cube) but one of the corners of the big cube. Because object in
POVray always rotate around the origin it seems, that my object isn't
exactly centerd. But how do I center the object? I tried the function
"Center_Trans" but it didn't work, so it didn't get better. Does anone have
some suggestions what I do wrong or what I can do better?
Thanks in advance.


Post a reply to this message

From: kurtz le pirate
Subject: Re: how to move an object to position <0,0,0>
Date: 8 Sep 2006 04:51:54
Message: <kurtzlepirate-6F6783.10515508092006@news.povray.org>
In article <web.45012a4161ac9985800aa0230@news.povray.org>,
 "Nostromo" <nomail@nomail> wrote:

> Hi,
> 
> I created a simple object that looks like a Rubics cube (a big cube
> consisting of 27 smaller cubes). Then I show this object and want to rotate
> it (animation). Unfortunately it doesn't rotate around the middle of the
> object (big cube) but one of the corners of the big cube. Because object in
> POVray always rotate around the origin it seems, that my object isn't
> exactly centerd. But how do I center the object? I tried the function
> "Center_Trans" but it didn't work, so it didn't get better. Does anone have
> some suggestions what I do wrong or what I can do better?
> Thanks in advance.


move your "rubrics cube" by adding "translate -0.50*full_cube_size"



-- 
klp


Post a reply to this message

From: Roman Reiner
Subject: Re: how to move an object to position <0,0,0>
Date: 8 Sep 2006 05:25:00
Message: <web.450136bb1e67056d3e732b9a0@news.povray.org>
kurtz le pirate <kur### [at] yahoofr> wrote:
> move your "rubrics cube" by adding "translate -0.50*full_cube_size"

This applies if your object rotates _exactly_ around that corner. In any
other case the following should work as long as the object is not too
complicated:

translate -0.50*(min_extent(myObject)+max_extent(myObject))

this actually centers the bounding box of the object but that should be
calculated correctly for a cube-ish structure

Hope this helps
Regards Roman


Post a reply to this message

From: Warp
Subject: Re: how to move an object to position <0,0,0>
Date: 8 Sep 2006 06:03:35
Message: <45013ff7@news.povray.org>
kurtz le pirate <kur### [at] yahoofr> wrote:
> move your "rubrics cube" by adding "translate -0.50*full_cube_size"

  Just curious: What's the second 0 for?

-- 
                                                          - Warp


Post a reply to this message

From: Nostromo
Subject: Re: how to move an object to position <0,0,0>
Date: 8 Sep 2006 06:05:00
Message: <web.4501400e1e67056d800aa0230@news.povray.org>
"Roman Reiner" <lim### [at] gmxde> wrote:
> kurtz le pirate <kur### [at] yahoofr> wrote:
> > move your "rubrics cube" by adding "translate -0.50*full_cube_size"
>
> This applies if your object rotates _exactly_ around that corner. In any
> other case the following should work as long as the object is not too
> complicated:
>
> translate -0.50*(min_extent(myObject)+max_extent(myObject))
>
> this actually centers the bounding box of the object but that should be
> calculated correctly for a cube-ish structure
>
> Hope this helps
> Regards Roman

Thanks for your answer. Unfortunately the cube still doesn't rotate around
the middle, maybe the bounding box of my cube is somewhere odd. Any other
suggestions?


Post a reply to this message

From: Warp
Subject: Re: how to move an object to position <0,0,0>
Date: 8 Sep 2006 06:41:00
Message: <450148bc@news.povray.org>
Nostromo <nomail@nomail> wrote:
> Thanks for your answer. Unfortunately the cube still doesn't rotate around
> the middle, maybe the bounding box of my cube is somewhere odd. Any other
> suggestions?

  Well, do you know the actual limits of the cube? If you do, just
substitute them in the given formula.

-- 
                                                          - Warp


Post a reply to this message

From: Penelope20k
Subject: Re: how to move an object to position <0,0,0>
Date: 8 Sep 2006 06:58:00
Message: <45014cb8@news.povray.org>
Nostromo do a little mistake its in fact

translate      + 0.50*(min_extent(myObject)+max_extent(myObject))






news:web.4501400e1e67056d800aa0230@news.povray.org...
> "Roman Reiner" <lim### [at] gmxde> wrote:
> > kurtz le pirate <kur### [at] yahoofr> wrote:
> > > move your "rubrics cube" by adding "translate -0.50*full_cube_size"
> >
> > This applies if your object rotates _exactly_ around that corner. In any
> > other case the following should work as long as the object is not too
> > complicated:
> >
> > translate -0.50*(min_extent(myObject)+max_extent(myObject))
> >
> > this actually centers the bounding box of the object but that should be
> > calculated correctly for a cube-ish structure
> >
> > Hope this helps
> > Regards Roman
>
> Thanks for your answer. Unfortunately the cube still doesn't rotate around
> the middle, maybe the bounding box of my cube is somewhere odd. Any other
> suggestions?
>
>


Post a reply to this message

From: Penelope20k
Subject: Re: how to move an object to position <0,0,0>
Date: 8 Sep 2006 07:00:39
Message: <45014d57@news.povray.org>
Forget it, its not nostromo mistake ,, should be mine




news:45014cb8@news.povray.org...
> Nostromo do a little mistake its in fact
>
> translate      + 0.50*(min_extent(myObject)+max_extent(myObject))
>
>
>
>
>

> news:web.4501400e1e67056d800aa0230@news.povray.org...
> > "Roman Reiner" <lim### [at] gmxde> wrote:
> > > kurtz le pirate <kur### [at] yahoofr> wrote:
> > > > move your "rubrics cube" by adding "translate -0.50*full_cube_size"
> > >
> > > This applies if your object rotates _exactly_ around that corner. In
any
> > > other case the following should work as long as the object is not too
> > > complicated:
> > >
> > > translate -0.50*(min_extent(myObject)+max_extent(myObject))
> > >
> > > this actually centers the bounding box of the object but that should
be
> > > calculated correctly for a cube-ish structure
> > >
> > > Hope this helps
> > > Regards Roman
> >
> > Thanks for your answer. Unfortunately the cube still doesn't rotate
around
> > the middle, maybe the bounding box of my cube is somewhere odd. Any
other
> > suggestions?
> >
> >
>
>


Post a reply to this message

From: Nostromo
Subject: Re: how to move an object to position <0,0,0>
Date: 8 Sep 2006 07:15:00
Message: <web.450150251e67056d800aa0230@news.povray.org>
Thanks for your help, but it still won't rotate around the middle of thebig
cube. Maybe someone can have a look at my code and tell me what's wrong?

Here's the POV file

-------------------------------------------

#include "colors.inc"
#include "textures.inc"
#include "shapes.inc"
#include "glass.inc"
#include "metals.inc"
#include "woods.inc"
#include "functions.inc"

#declare Count = 3 ;
#declare Gap = 0.2 ;

global_settings {
                ambient_light rgb <1, 1, 1>
}

background { rgb <1,1,1> }

#declare Rubics = union {
 #declare z_axis = 0 ;

 #while ( z_axis < Count )
  #declare y_axis = 0 ;

  #while ( y_axis < Count )
   #declare x_axis = 0 ;

   #while (x_axis < Count)
    superellipsoid { <0.25, 0.25>
     translate <(2+Gap)*x_axis, (2+Gap)*y_axis, (2+Gap)*z_axis>
    }

    #declare x_axis = x_axis + 1 ;
   #end

   #declare y_axis = y_axis + 1 ;
  #end

  #declare z_axis = z_axis + 1 ;
 #end
}

camera {
 location <25, 20, -25>
 look_at <8, 6, 0>
}

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

object { Rubics
         pigment { color Green }   //Col_Glass_Vicksbottle }
  finish {
                        phong 1
                        reflection 0.15
                        ambient 0.2
                        diffuse 0.9
                }
  interior { I_Glass }
  scale <3,3,3>
  rotate <clock, clock*2, clock*4>
  translate +0.50*(min_extent(Rubics)+max_extent(Rubics))
}

-----------------------------------------------

When I animate this I want the cube to rotate around it's center, but it's
rotating around some point near one of the corners.

Thanks a lot in advance.


Post a reply to this message

From: Stephen
Subject: Re: how to move an object to position <0,0,0>
Date: 8 Sep 2006 08:45:00
Message: <web.4501659b1e67056df1cb1e660@news.povray.org>
"Nostromo" <nomail@nomail> wrote:
> Thanks for your help, but it still won't rotate around the middle of thebig
> cube. Maybe someone can have a look at my code and tell me what's wrong?
>
> Here's the POV file
>
[snip]



> object { Rubics
>          pigment { color Green }   //Col_Glass_Vicksbottle }
>   finish {
>                         phong 1
>                         reflection 0.15
>                         ambient 0.2
>                         diffuse 0.9
>                 }
>   interior { I_Glass }
>   scale <3,3,3>
>   rotate <clock, clock*2, clock*4>
>   translate +0.50*(min_extent(Rubics)+max_extent(Rubics))
> }
>
> -----------------------------------------------
>
> When I animate this I want the cube to rotate around it's center, but it's
> rotating around some point near one of the corners.
>
> Thanks a lot in advance.

Nostromo
You should translate to the origin before rotating

Stephen


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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