POV-Ray : Newsgroups : povray.advanced-users : Modifying the coordinate system in POV-Ray Server Time
1 Nov 2024 01:21:55 EDT (-0400)
  Modifying the coordinate system in POV-Ray (Message 1 to 4 of 4)  
From: Samour
Subject: Modifying the coordinate system in POV-Ray
Date: 18 Aug 2009 14:45:00
Message: <web.4a8af68815fa53864c007780@news.povray.org>
Okay.. here is what I'm trying to do. I'm trying to scale the height field to
make the default unit for the coordinate system to be 1 meter. So let's say for
simplicity that the 1 regular unit in POV-Ray is being scaled by about 1000. The
goal is to be able to use actual distances and sizes for translating and scaling
objects on the height field.

Now when initializing the height field and scaling it everything seems to work
fine. However, scaling and translating objects or moving a camera works
according to the original units, i.e. 1 unit along an axis corresponds to the
new 1000 correspondence of the height field. So using translate 1 moves a huge
distance rather than just moving 1 meter. Is there a recommended way to achieve
this objective?


Post a reply to this message

From: Chris B
Subject: Re: Modifying the coordinate system in POV-Ray
Date: 18 Aug 2009 15:10:44
Message: <4a8afcb4@news.povray.org>
"Samour" <nomail@nomail> wrote in message 
news:web.4a8af68815fa53864c007780@news.povray.org...
> Okay.. here is what I'm trying to do. I'm trying to scale the height field 
> to
> make the default unit for the coordinate system to be 1 meter. So let's 
> say for
> simplicity that the 1 regular unit in POV-Ray is being scaled by about 
> 1000. The
> goal is to be able to use actual distances and sizes for translating and 
> scaling
> objects on the height field.
>
> Now when initializing the height field and scaling it everything seems to 
> work
> fine. However, scaling and translating objects or moving a camera works
> according to the original units, i.e. 1 unit along an axis corresponds to 
> the
> new 1000 correspondence of the height field. So using translate 1 moves a 
> huge
> distance rather than just moving 1 meter. Is there a recommended way to 
> achieve
> this objective?
>

There's something a little unclear to me about your question.

When you incorporate add a height field it occupies a 1 POV-Ray unit cube. 
If the height field represents an area a kilometre square and you scale it 
so that height field occupies a square 1000 by 1000 up to a height of your 
choosing, lets say 100 to represent a maximum height of 100metres, then you 
are using a scale of 1 metre = 1 POV-Ray unit. Everything else can be added 
into the scene assuming this scale is being used. So, if you then move 
something by 20 POV-Ray units it's equivalent to moving it 20 metres.

In the following example a height field is scaled by 1000 in x and z and 100 
in y to represent a section of landscape 1km square with a maximum elevation 
of 100m. The red sphere would then represent a sphere of 2m radius 
positioned 100m in x and 100m in y at an elevation of 100m.

camera {location <0, 100,-1> look_at <500,4,500>}
light_source {<1,5,-1> color rgb 1}

height_field {"heightfieldimage.tga" pigment {rgb 1} scale <1000,100,1000>}
sphere {0,2 translate <100,100,100> pigment {rgb <1,0,0>}}

I don't therefore see why you say that scaling and translating works 
according to the 'original' units, because POV-Ray is really sort of 
'unit-neutral' - that is to say that a POV-Ray unit can be whatever you want 
it to be.

Regards,
Chris B.


Post a reply to this message

From: Reactor
Subject: Re: Modifying the coordinate system in POV-Ray
Date: 18 Aug 2009 15:55:00
Message: <web.4a8b0646aff104eecb8a33dc0@news.povray.org>
"Samour" <nomail@nomail> wrote:
> Okay.. here is what I'm trying to do. I'm trying to scale the height field to
> make the default unit for the coordinate system to be 1 meter. So let's say for
> simplicity that the 1 regular unit in POV-Ray is being scaled by about 1000. The
> goal is to be able to use actual distances and sizes for translating and scaling
> objects on the height field.
>
> Now when initializing the height field and scaling it everything seems to work
> fine. However, scaling and translating objects or moving a camera works
> according to the original units, i.e. 1 unit along an axis corresponds to the
> new 1000 correspondence of the height field. So using translate 1 moves a huge
> distance rather than just moving 1 meter. Is there a recommended way to achieve
> this objective?

It sounds like you are describing the way transformations behave in terms of
order - in POV-ray, the order in which a transformation is applied is
important.
Consider this example:
// This:
sphere{ <0,0,0>, 1
  texture{ MyTex }
  translate <1,1,1>
  scale <5,5,5>
}
// is quite different from this:
sphere{ <0,0,0>, 1
  texture{ MyTex }
  scale <5,5,5>
  translate <1,1,1>
}

The first sphere will be centered at <5,5,5> with a radius of 5, the second will
have the same radius, but will be located at <1,1,1>.  You can think of scaling
as multiplying all dimensions of the shape by the scale value - translations
included.

HTH,
-Reactor


Post a reply to this message

From: Alain
Subject: Re: Modifying the coordinate system in POV-Ray
Date: 18 Aug 2009 18:09:05
Message: <4a8b2681$1@news.povray.org>

> Okay.. here is what I'm trying to do. I'm trying to scale the height field to
> make the default unit for the coordinate system to be 1 meter. So let's say for
> simplicity that the 1 regular unit in POV-Ray is being scaled by about 1000. The
> goal is to be able to use actual distances and sizes for translating and scaling
> objects on the height field.
> 
> Now when initializing the height field and scaling it everything seems to work
> fine. However, scaling and translating objects or moving a camera works
> according to the original units, i.e. 1 unit along an axis corresponds to the
> new 1000 correspondence of the height field. So using translate 1 moves a huge
> distance rather than just moving 1 meter. Is there a recommended way to achieve
> this objective?
> 
> 
> 
> 
In POV-Ray, one unit is whatever you want it to be.

You apply your scaling to the hight field. You scale it by 1000 
horizontaly and 100 verticaly. You decide that 1 unit = 1m.

You next model and locate your objects acording to that scale. You DON'T 
scale from that point on.

One thing that you must remember: Don't scale after you translate your 
objects.


Alain


Post a reply to this message

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