POV-Ray : Newsgroups : povray.newusers : how to move an object to position <0,0,0> Server Time
29 Jul 2024 08:10:37 EDT (-0400)
  how to move an object to position <0,0,0> (Message 3 to 12 of 12)  
<<< Previous 2 Messages Goto Initial 10 Messages
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

From: kurtz le pirate
Subject: Re: how to move an object to position <0,0,0>
Date: 8 Sep 2006 09:27:48
Message: <kurtzlepirate-669711.15274708092006@news.povray.org>
In article <web.450150251e67056d800aa0230@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?
> 
> ...
> 
> 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.


well, well... 

from your source whe can find that :

RMax = max_extent(Rubics) => <5.4, 5.4, 5.4>
RMin = min_extent(Rubics) => <-1, -1, -1>

translate the object with : translate -0.5*(RMax+RMin) give :

RMax = <3.2, 3.2, 3.2>
RMin = <-3.2, -3.2, -3.2>

Rubics is now perfectly center at the origin and rotations are ok. if 
not, there are somes others problems :
 - your are not looking at the origin.
 - in "rotation <clock, clock*2, clock*4>" don't forget that clock varie 
from 0 to 1 degrees


  
-- 
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 13:00:00
Message: <web.4501a0e91e67056d3e732b9a0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> 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

when writing my own code i'd actually leave the first 0 out as well. i just
wanted to clean it up a little and went over the top maybe ;)


Post a reply to this message

<<< Previous 2 Messages Goto Initial 10 Messages

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