POV-Ray : Newsgroups : povray.general : Units of Measure Server Time
16 Nov 2024 21:12:18 EST (-0500)
  Units of Measure (Message 1 to 10 of 32)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Alan Smith
Subject: Units of Measure
Date: 26 Aug 2003 10:03:22
Message: <3f4b68aa$1@news.povray.org>
Am I correct that POV-Ray does not support units of measurement
ie (mm, cm, m, km, in, ft etc)?

Wouldn't it be nice if POV allowed something like :-
box { <-2cm, -1cm, 10mm>,  <2cm, 1cm, 1cm> }

This would lead to more readable code, greater ease of 'real world' scene
modelling with mixed sizes of objects and, most importantly, greater scope
for sharing objects from other people who generously donate their source.

At the moment I achieve this by using suitable declares and coding as :-
box { <-2*cm, -1*cm, 10*mm>,  <2*cm, 1*cm, 1*cm> }


Which goes a long way to meeting my needs, but it still does not do anything
for supporting portability of coded objects between scene files.

This would surely be a simple modification to the parser and would still
leave the ability for people to work in a 'unit-less' fashion if they like?

Alan Smith.


Post a reply to this message

From: ABX
Subject: Re: Units of Measure
Date: 26 Aug 2003 10:09:29
Message: <mdqmkvcggpr45qkt3bbji5aj7igdgodrkg@4ax.com>
On Tue, 26 Aug 2003 15:03:21 +0100, "Alan Smith" <ala### [at] aurora-ukcom>
wrote:
> Wouldn't it be nice if POV allowed something like :-
> box { <-2cm, -1cm, 10mm>,  <2cm, 1cm, 1cm> }

That's possible with
http://www.imp.org/cgi-bin/viewcvs/viewcvs.cgi/*checkout*/escape/scenes/units.inc

ABX


Post a reply to this message

From: Alan Smith
Subject: Re: Units of Measure
Date: 26 Aug 2003 10:17:57
Message: <3f4b6c15$1@news.povray.org>
Many thanks for the link to the include file.   This is what I currently do
myself, however
I still make the point that it would be usefull to formalise it within
POV-Ray itself as this would
encourage its use and lead to greater code portabillity.

Alan Smith.

"ABX" <abx### [at] abxartpl> wrote in message
news:mdqmkvcggpr45qkt3bbji5aj7igdgodrkg@4ax.com...
> On Tue, 26 Aug 2003 15:03:21 +0100, "Alan Smith"
<ala### [at] aurora-ukcom>
> wrote:
> > Wouldn't it be nice if POV allowed something like :-
> > box { <-2cm, -1cm, 10mm>,  <2cm, 1cm, 1cm> }
>
> That's possible with
>
http://www.imp.org/cgi-bin/viewcvs/viewcvs.cgi/*checkout*/escape/scenes/units.inc
>
> ABX


Post a reply to this message

From: ABX
Subject: Re: Units of Measure
Date: 26 Aug 2003 10:26:24
Message: <d0rmkvk6ki62c2hq3h5frdkb1rbe1q5c1q@4ax.com>
On Tue, 26 Aug 2003 15:17:55 +0100, "Alan Smith" <ala### [at] aurora-ukcom>
wrote:
> Many thanks for the link to the include file.   This is what I currently do
> myself, however
> I still make the point that it would be usefull to formalise it within
> POV-Ray itself as this would
> encourage its use and lead to greater code portabillity.

Could you elaborate on "encourage its use" and "greater code portabillity" ?
Personally I do not see those benefits but I can blind for something. In
particular what could be done with '1cm' which can't be done with '1*cm' ?

ABX


Post a reply to this message

From: Alan Smith
Subject: Re: Units of Measure
Date: 26 Aug 2003 10:56:07
Message: <3f4b7507$1@news.povray.org>
By encourage its use I mean that if it is a formally accepted concept within
POV
then people are more likely to know its there and more likely to use it -
especially
when they see the benefits of re-using other peoples objects without any
re-scaling
required.    I did not know of the existence of Sonya Roberts "Units"
include file
until you pointed it out - what if someone else out there defined another
"Units" file
which other people used - the definition of mm,cm,m,ft & in might be totally
different -
standardisation has not been achieved nor generally portability of objects.
If I copy
an object from someone's scene using an alternative definition of the units
then it will
not just drop in to mine and work - yes I know I could scale it but that's
not the point.

lets say I have a scene with a toy train in it which you would like to copy
into your scene,
but I have defined

#declare in = 1
#declare ft = 12
#declare cm = 2.51
etc

in this scenario you would need to apply scaling to my object when you use
it, all I'm saying
is that if the system was formalised into the parser then a) it would be
more readable and b)
more people would use it as you could simply incorporate other peoples
objects without
having to do anything other than cut and paste.

Alan Smith.

"ABX" <abx### [at] abxartpl> wrote in message
news:d0rmkvk6ki62c2hq3h5frdkb1rbe1q5c1q@4ax.com...
> On Tue, 26 Aug 2003 15:17:55 +0100, "Alan Smith"
<ala### [at] aurora-ukcom>
> wrote:
> > Many thanks for the link to the include file.   This is what I currently
do
> > myself, however
> > I still make the point that it would be usefull to formalise it within
> > POV-Ray itself as this would
> > encourage its use and lead to greater code portabillity.
>
> Could you elaborate on "encourage its use" and "greater code portabillity"
?
> Personally I do not see those benefits but I can blind for something. In
> particular what could be done with '1cm' which can't be done with '1*cm' ?
>
> ABX


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: Units of Measure
Date: 26 Aug 2003 11:10:48
Message: <Xns93E3AEB96FD90raf256com@204.213.191.226>
ala### [at] aurora-ukcom news:3f4b68aa$1@news.povray.org

> Am I correct that POV-Ray does not support units of measurement
> ie (mm, cm, m, km, in, ft etc)?
> 
> Wouldn't it be nice if POV allowed something like :-
> box { <-2cm, -1cm, 10mm>,  <2cm, 1cm, 1cm> }

I just assume at begin of file that i.e. 

// file ... by ...
// 1 unit = 1 cm
// 1 m = 100 units




-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: ABX
Subject: Re: Units of Measure
Date: 26 Aug 2003 11:17:37
Message: <d1umkv8cb5ictbfnknmuumcl0mnoks54hk@4ax.com>
On Tue, 26 Aug 2003 15:56:04 +0100, "Alan Smith" <ala### [at] aurora-ukcom>
wrote:
> By encourage its use I mean that if it is a formally accepted concept within POV
> then people are more likely to know its there and more likely to use it - especially
> when they see the benefits of re-using other peoples objects without any re-scaling
> required.

But on the other hand for many works you do not need units at all so they are
unnecessary typing. Do you need units to draw graph? POV-Ray is known to be a
tool in scientific works to visualize processess. Some sciences operates on on
units, some not. And soon you incorporate units into language you will receive
complaining why other units are not supported. It is easier to change
units.inc than povray.exe

> I did not know of the existence of Sonya Roberts "Units" include file
> until you pointed it out - what if someone else out there defined another "Units"
file
> which other people used - the definition of mm,cm,m,ft & in might be totally
different -
> standardisation has not been achieved nor generally portability of objects.
> If I copy an object from someone's scene using an alternative definition of the
units
> then it will not just drop in to mine and work - yes I know I could scale it but
that's
> not the point.

There is no difference between various units.inc - as long as they use the
same letters for naming units and they preserve the same relations they are
compatible regardless base unit.

ABX


Post a reply to this message

From: Alan Smith
Subject: Re: Units of Measure
Date: 26 Aug 2003 12:06:26
Message: <3f4b8582$1@news.povray.org>
As I said in my original posting, I would not want to force people to
have to use units on dimensions - it would be optional.
Quote - "This would surely be a simple modification to the parser and
would still leave the ability for people to work in a 'unit-less' fashion if
they like?"

You said there is no difference between various units.inc - I beg to differ.
Sonya Roberts "Units" include file is not deployed with the POV Ray
installation as
far as I know, so tomorrow (lets say) I'm going to release onto the Web my
own
comprehensive version of units.inc which contains :-

#declare in = 1
#declare ft = 12
#declare cm = 2.51
etc etc etc

A box{ <0cm,0cm,0cm>,<1cm,1cm,1cm>} written against Sonya Roberts include
file will
translate into a 1 unit cube by povray and under my Units.inc it would
translate into a 2.51
units cube within Povray.    Therefore any object taken from a scene written
using the former
include file will need scaling if incorporated into one using the second.
The situation is made
worse if someone has not even used any units in the first place.   Or
someone may have defined
their own unit declarations.

All I'm saying it that -

a) It would be nice if people were encouraged to use (but optional)
dimensional units
in 'real world' modelling and in a standardised way.
b) The above would be encouraged by formalising the concept into Povray so
everyone knows
and works of the same definitions.
c) It would lead to greater readability of the source file.
d) It would mean it is easier to cut and paste objects from other peoples
files.

Alan Smith.



"ABX" <abx### [at] abxartpl> wrote in message
news:d1umkv8cb5ictbfnknmuumcl0mnoks54hk@4ax.com...
> On Tue, 26 Aug 2003 15:56:04 +0100, "Alan Smith"
<ala### [at] aurora-ukcom>
> wrote:
> > By encourage its use I mean that if it is a formally accepted concept
within POV
> > then people are more likely to know its there and more likely to use
it - especially
> > when they see the benefits of re-using other peoples objects without any
re-scaling
> > required.
>
> But on the other hand for many works you do not need units at all so they
are
> unnecessary typing. Do you need units to draw graph? POV-Ray is known to
be a
> tool in scientific works to visualize processess. Some sciences operates
on on
> units, some not. And soon you incorporate units into language you will
receive
> complaining why other units are not supported. It is easier to change
> units.inc than povray.exe
>
> > I did not know of the existence of Sonya Roberts "Units" include file
> > until you pointed it out - what if someone else out there defined
another "Units" file
> > which other people used - the definition of mm,cm,m,ft & in might be
totally different -
> > standardisation has not been achieved nor generally portability of
objects.
> > If I copy an object from someone's scene using an alternative definition
of the units
> > then it will not just drop in to mine and work - yes I know I could
scale it but that's
> > not the point.
>
> There is no difference between various units.inc - as long as they use the
> same letters for naming units and they preserve the same relations they
are
> compatible regardless base unit.
>
> ABX


Post a reply to this message

From: Alan Smith
Subject: Re: Units of Measure
Date: 26 Aug 2003 12:24:03
Message: <3f4b89a3$1@news.povray.org>
Yes,  but not everyone makes that assumption. Some people "assume"
that 1 unit is 1 inch and all their modelling is in feet and inches, or
if say modelling a room of a house, others might choose to assume that
1 unit was 1m others may prefer to work in cm.

It would be nice if people were encoraged to work off the same system,
and this would mean objects could be copied in an instant with a cut
and paste between files.   It's also more readable in my view.

Alan Smith.

"Rafal 'Raf256' Maj" <spa### [at] raf256com> wrote in message
news:Xns### [at] 204213191226...
> ala### [at] aurora-ukcom news:3f4b68aa$1@news.povray.org
>
> > Am I correct that POV-Ray does not support units of measurement
> > ie (mm, cm, m, km, in, ft etc)?
> >
> > Wouldn't it be nice if POV allowed something like :-
> > box { <-2cm, -1cm, 10mm>,  <2cm, 1cm, 1cm> }
>
> I just assume at begin of file that i.e.
>
> // file ... by ...
> // 1 unit = 1 cm
> // 1 m = 100 units
>
>
>
>
> -- 
> #macro
g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
> pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local
l=mod(c,100
> );g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end
light_source{
> y 2}sphere{z*20
9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: ABX
Subject: Re: Units of Measure
Date: 26 Aug 2003 12:37:38
Message: <gq1nkvsldnbj4ui2he626l1vto6t7qfb3k@4ax.com>
On Tue, 26 Aug 2003 17:06:21 +0100, "Alan Smith" <ala### [at] aurora-ukcom>
wrote:
> As I said in my original posting, I would not want to force people to
> have to use units on dimensions - it would be optional.
> Quote - "This would surely be a simple modification to the parser and
> would still leave the ability for people to work in a 'unit-less' fashion if
> they like?"

From what experience "surely" in that quote come? This is exactly my
opportunity. There is probably much work and the only benefit is that you
don't have to type "*" because "cm" still have to be typed. But some people
will complain that they do not want "1cm" - they want "1 cm" or "1 CM" or
"1centimeter". Moreover more possibilities, and making this unit optional
makes parser only more complicated internally and increases parsing time.

> You said there is no difference between various units.inc - I beg to differ.

Then you do not understand that text is translated into floats during _final_
parsing, not during posting scene or object via mailer. Simple, imagine you
have units.inc:

  #declare cm=0.75;
  #declare m=100*cm;
  #declare km=1000*m;

and a scene:

  #version 3.5;
  global_settings{assumed_gamma 1.0}
  camera{
    up 1*cm 
    right (image_width/image_height)*cm 
    direction z*1*cm
    location -10*z*cm
    look_at 0
  }
  light_source{90*m rgb 1}
  sphere{ 0 1*km pigment{agate scale .5*km}}

render it to image1.png. Now send it to your friend and ask to write own
units.inc. The only requirement is that it has to define cm, m, km in correct
_relation_. Now ask him for rendering to image2.png. Then compare result. Note
he don't have to cm as base. He can for example made his units.inc as:

  #declare m=12*76.13/143;
  #declare cm=.1*m;
  #declare km=1000*m;

And now tell me. Is result different ? :-)

ABX


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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