POV-Ray : Newsgroups : povray.newusers : Modify imported .obj in POV-Ray : Re: Modify imported .obj in POV-Ray Server Time
14 May 2024 23:19:24 EDT (-0400)
  Re: Modify imported .obj in POV-Ray  
From: Alain
Date: 1 Sep 2013 17:01:46
Message: <5223ab3a$1@news.povray.org>

> Hi, I'm new to POV-Ray so not good at it.
> I managed to import .obj into POV-Ray using PoseRay program but the imported
> object are so huge for my scene so I am trying to scale it down. I can't seem to
> find out how to scale the object down so it fit in my scene (since there like so
> much code in the geom.inc file). I tried to search around but can't seem to find
> anything. So could anyone guide me to scale/translate the imported .obj so I
> could use for my POV-Ray please?
>
> Thanks
>
>

To scale down, you use a fractional value.
Using a negative value will mirror your shape on that axis.

Be warned that ALL scale and rotate are performed relative to the 
origin: <0,0,0>.
If the object is NOT at/around the origin, scaling will move the object 
radialy, and a rotation will cause it to orbit the origin.

If you want to adjust the size of an object of unknown size and location 
to a known size and location, you can use:

#declare Min=min_extent(Object);
#declare Max=max_extent(Object);

to get the bounding box of Object.

Then, use:
#declare Object={Object translate -(Min+Max)/2}

to redefine your object around the origin.

Then:
#declare Max=max_extent(Object);
#declare Object={Object scale 1/Max}

to redefine your object to fit an unit box.

Now, Object fit exactly inside a box{<-1,-1,-1>,<1,1,1>}
You can now scale it to exactly the dimention you want.
Once properly scaled, you can rotate and translate it to where you 
need/want.


Alain


Post a reply to this message

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