# DF for a polygon

**URL:** <https://discourse.radiance-online.org/t/df-for-a-polygon/702>\
**Category:** radiance-general\
**Created:** [May 26, 2009, 12:09pm UTC](https://discourse.radiance-online.org/t/df-for-a-polygon/702 "2009-05-26T12:09:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Per\_Haugaard](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@Per\_Haugaard](https://discourse.radiance-online.org/u/Per_Haugaard)\
**Post date:** [May 26, 2009, 12:09pm UTC](https://discourse.radiance-online.org/t/df-for-a-polygon/702/1 "2009-05-26T12:09:46Z")

</div>

Dear users,

I am calculating DF for a polygon. My approach for this is to use cnt, rcalc and rtrace as described below.

cnt 3000 4351 | rcalc -e 'x=157-$1\*0.01; y=168.41-$2\*0.01; z=0.85; $1=x; $2=y; $3=z; $4=0; $5=0; $6=1' \> grids/grid\_level\_0.xyz

I then deleted the lines outside my polygon and initiated rtrace.

cat grids/grid\_level\_0.xyz | rtrace -I -ab 4 -aa 0.05 -ar 128 -ad 512 -as 256 -x 4351 -y 3000 -af ambfiles/df.amb -fac octrees/LSE\_DF.oct \> images/grid2illum\_level\_0.pic

which results the following error:

rtrace: fatal - unexpected EOF on input  
pfilt: truncated input (y=754)  
images/grid2illum\_level\_0\_resized.pic: read error  
\<stdin\>: read error (y==139)

Two of the errors occur when I start to work with the grid2illum\_level\_0.pic image. If I do not specify the picture size in the rtrace command I get the following error:

pfilt: bad picture size  
images/grid2illum\_level\_0\_resized.pic: bad picture size  
images/grid2illum\_level\_0\_resized\_df.pic: bad picture size

Does this error occur because i delete points in the plane and how do I get around this this?

Best regard

Per Haugaard,

> **···**
>
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Audi, Fiat, Peugeot, Skoda, Porsche, Toyota, Ford - Kelkoo har brugte biler til en hver smag! Klik her for at sammenligne priser.([http://dk.yahoo.com/r/pat/mmb](http://dk.yahoo.com/r/pat/mmb))

---

<div class="post-metadata">

**Author:** ![Andrew\_McNeil1](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@Andrew\_McNeil1](https://discourse.radiance-online.org/u/Andrew_McNeil1)\
**Post date:** [May 26, 2009, 3:30pm UTC](https://discourse.radiance-online.org/t/df-for-a-polygon/702/2 "2009-05-26T15:30:33Z")

</div>

Yes, your errors are most likely resulting from deleting some of rtrace  
points. Rtrace is expecting 4351\*3000 points and is getting fewer, hence  
the unexpected end of file error.

> From the rtrace manual page: ³If the direction vector is (0,0,0), a bogus

record is printed...² Instead of deleting you could change the vector to  
0 0 0¹ and then the area outside of your polygon would be comprised of  
bogus records (zeros). This method might not work if you are expecting  
legitimate zeros in your output.

> **···**
>
> On 5/26/09 5:09 AM, "Per Haugaard" \<perhaugaard@yahoo.dk\> wrote:
> 
> > Dear users,
> > 
> > I am calculating DF for a polygon. My approach for this is to use cnt, rcalc  
> > and rtrace as described below.
> > 
> > cnt 3000 4351 | rcalc -e 'x=157-$1\*0.01; y=168.41-$2\*0.01; z=0.85; $1=x; $2=y;  
> > $3=z; $4=0; $5=0; $6=1' \> grids/grid\_level\_0.xyz
> > 
> > I then deleted the lines outside my polygon and initiated rtrace.
> > 
> > cat grids/grid\_level\_0.xyz | rtrace -I -ab 4 -aa 0.05 -ar 128 -ad 512 -as 256  
> > -x 4351 -y 3000 -af ambfiles/df.amb -fac octrees/LSE\_DF.oct \>  
> > images/grid2illum\_level\_0.pic
> > 
> > which results the following error:
> > 
> > rtrace: fatal - unexpected EOF on input  
> > pfilt: truncated input (y=754)  
> > images/grid2illum\_level\_0\_resized.pic: read error  
> > \<stdin\>: read error (y==139)
> > 
> > Two of the errors occur when I start to work with the grid2illum\_level\_0.pic  
> > image. If I do not specify the picture size in the rtrace command I get the  
> > following error:
> > 
> > pfilt: bad picture size  
> > images/grid2illum\_level\_0\_resized.pic: bad picture size  
> > images/grid2illum\_level\_0\_resized\_df.pic: bad picture size
> > 
> > Does this error occur because i delete points in the plane and how do I get  
> > around this this?
> > 
> > Best regard
> > 
> > Per Haugaard,
> > 
> > Trænger du til at se det store billede? Kelkoo giver dig gode tilbud på LCD  
> > TV \<[http://dk.yahoo.com/r/pat/lcd&gt](http://dk.yahoo.com/r/pat/lcd&gt); !
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Radiance-general mailing list  
> > Radiance-general@radiance-online.org  
> > [http://www.radiance-online.org/mailman/listinfo/radiance-general](http://www.radiance-online.org/mailman/listinfo/radiance-general)
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Electronic mail messages entering and leaving Arup business  
> systems are scanned for acceptability of content and viruses

---

<div class="post-metadata">

**Author:** ![Per\_Haugaard](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@Per\_Haugaard](https://discourse.radiance-online.org/u/Per_Haugaard)\
**Post date:** [May 27, 2009, 7:23am UTC](https://discourse.radiance-online.org/t/df-for-a-polygon/702/3 "2009-05-27T07:23:07Z")

</div>

Hey Andrew,

Thank you for your help. I actually tried that after posting the message yesterday and it worked well. I got daylight factor equal to zero and a nice picture.

I am hoping to illustrate DF=0 with a black color instead of purple. Can I change the puple color (DF=0) to black and how can this be done?

Best regards

Per Haugaard,

> **···**
>
> Den tirs 26/5/09 skrev Andrew McNeil \<[andrew.mcneil@arup.com](mailto:andrew.mcneil@arup.com)\>:
> 
> Fra: Andrew McNeil \<[andrew.mcneil@arup.com](mailto:andrew.mcneil@arup.com)\>  
> Emne: Re: [Radiance-general] DF for a polygon  
> Til: perhaugaard@yahoo.dk, "Radiance general discussion" \<[radiance-general@radiance-online.org](mailto:radiance-general@radiance-online.org)\>  
> Dato: tirsdag 26. maj 2009 17.30
> 
> Re: [Radiance-general] DF for a polygon  
> Yes, your errors are most likely resulting from deleting some of rtrace points. Rtrace is expecting 4351\*3000 points and is getting fewer, hence the unexpected end of file error.
> 
> From the rtrace manual page: “If the direction vector is (0,0,0), a bogus record is printed...” Instead of deleting you could change the vector to ‘0 0 0’ and then the area outside of your polygon would be comprised of bogus records (zeros). This method might not work if you are expecting legitimate zeros in your output.
> 
> On 5/26/09 5:09 AM, "Per Haugaard" \<perhaugaard@yahoo.dk\> wrote:
> 
> Dear users,
> 
> I am calculating DF for a polygon. My approach for this is to use cnt, rcalc and rtrace as described below.
> 
> cnt 3000 4351 | rcalc -e 'x=157-$1\*0.01; y=168.41-$2\*0.01; z=0.85; $1=x; $2=y; $3=z; $4=0; $5=0; $6=1' \> grids/grid\_level\_0.xyz
> 
> I then deleted the lines outside my polygon and initiated rtrace.
> 
> cat grids/grid\_level\_0.xyz | rtrace -I -ab 4 -aa 0.05 -ar 128 -ad 512 -as 256 -x 4351 -y 3000 -af ambfiles/df.amb -fac octrees/LSE\_DF.oct \> images/grid2illum\_level\_0.pic
> 
> which results the following error:
> 
> rtrace: fatal - unexpected EOF on input
> 
> pfilt: truncated input (y=754)
> 
> images/grid2illum\_level\_0\_resized.pic: read error
> 
> \<stdin\>: read error (y==139)
> 
> Two of the errors occur when I start to work with the grid2illum\_level\_0..pic image. If I do not specify the picture size in the rtrace command I get the following error:
> 
> pfilt: bad picture size
> 
> images/grid2illum\_level\_0\_resized.pic: bad picture size
> 
> images/grid2illum\_level\_0\_resized\_df.pic: bad picture size
> 
> Does this error occur because i delete points in the plane and how do I get around this this?
> 
> Best regard
> 
> Per Haugaard,
> 
> Trænger du til at se det store billede? Kelkoo giver dig gode tilbud på LCD TV \<[http://dk.yahoo.com/r/pat/lcd](http://dk.yahoo.com/r/pat/lcd)\> !
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
> 
> Radiance-general mailing list
> 
> [Radiance-general@radiance-online.org](mailto:Radiance-general@radiance-online.org)
> 
> [http://www.radiance-online.org/mailman/listinfo/radiance-general](http://www.radiance-online.org/mailman/listinfo/radiance-general)
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Electronic mail messages entering and leaving Arup business  
> systems are scanned for acceptability of content and viruses
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Find din nye laptop på kelkoo.dk. Se de gode tilbud her - [http://dk.yahoo.com/r/pat/mm](http://dk.yahoo.com/r/pat/mm)

---

<div class="post-metadata">

**Author:** ![Greg\_Ward1](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/g/3be4f8/32.png) [@Greg\_Ward1](https://discourse.radiance-online.org/u/Greg_Ward1)\
**Post date:** [May 27, 2009, 3:37pm UTC](https://discourse.radiance-online.org/t/df-for-a-polygon/702/4 "2009-05-27T15:37:32Z")

</div>

Hi Per,

It's a bit non-standard, but you make a duplicate copy of the falsecolor script and customize the new one by altering some lines in there relating to the color scale. Change the line:

&nbsp;&nbsp;def\_redp(i):select(i,0.18848,0.05468174,  
to:  
&nbsp;&nbsp;def\_redp(i):select(i,0,0.05468174,

Similarly, change:

&nbsp;&nbsp;def\_grnp(i):select(i,0.0009766,2.35501e-05,  
to:  
&nbsp;&nbsp;def\_grnp(i):select(i,0,2.35501e-05,

and:

&nbsp;&nbsp;def\_blup(i):select(i,0.2666,0.3638662,0.4770437,  
to:  
&nbsp;&nbsp;def\_blup(i):select(i,0,0.3638662,0.4770437,

I'm thinking this should make the darkest values come out black.

Best,  
-Greg

> **···**
>
> > From: Per Haugaard \<perhaugaard@yahoo.dk\>  
> > Date: May 27, 2009 12:23:07 AM PDT
> > 
> > Hey Andrew,
> > 
> > Thank you for your help. I actually tried that after posting the message yesterday and it worked well.. I got daylight factor equal to zero and a nice picture.
> > 
> > I am hoping to illustrate DF=0 with a black color instead of purple. Can I change the puple color (DF=0) to black and how can this be done?
> > 
> > Best regards
> > 
> > Per Haugaard,

---

<div class="post-metadata">

**Author:** ![Andrew\_McNeil1](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@Andrew\_McNeil1](https://discourse.radiance-online.org/u/Andrew_McNeil1)\
**Post date:** [May 27, 2009, 4:51pm UTC](https://discourse.radiance-online.org/t/df-for-a-polygon/702/5 "2009-05-27T16:51:34Z")

</div>

Hi Greg,

A falsecolor scale that colors zero as black is actually very useful. I  
often use pcompos and image masks to achieve the same effect. A second  
version of falsecolor modified as you suggested is a major convenience for  
me. Thanks!

If others agree that it is useful, maybe it can be incorporated in  
falsecolor as an alternate color scale (similar to the -spec option)?

Thanks,  
Andy

> **···**
>
> On 5/27/09 8:37 AM, "Greg Ward" \<gward@lmi.net\> wrote:
> 
> > Hi Per,
> > 
> > It's a bit non-standard, but you make a duplicate copy of the  
> > falsecolor script and customize the new one by altering some lines in  
> > there relating to the color scale. Change the line:
> > 
> > def\_redp(i):select(i,0.18848,0.05468174,  
> > to:  
> > def\_redp(i):select(i,0,0.05468174,
> > 
> > Similarly, change:
> > 
> > def\_grnp(i):select(i,0.0009766,2.35501e-05,  
> > to:  
> > def\_grnp(i):select(i,0,2.35501e-05,
> > 
> > and:
> > 
> > def\_blup(i):select(i,0.2666,0.3638662,0.4770437,  
> > to:  
> > def\_blup(i):select(i,0,0.3638662,0.4770437,
> > 
> > I'm thinking this should make the darkest values come out black.
> > 
> > Best,  
> > -Greg
> > 
> > > From: Per Haugaard \<perhaugaard@yahoo.dk\>  
> > > Date: May 27, 2009 12:23:07 AM PDT
> > > 
> > > Hey Andrew,
> > > 
> > > Thank you for your help. I actually tried that after posting the  
> > > message yesterday and it worked well.. I got daylight factor equal  
> > > to zero and a nice picture.
> > > 
> > > I am hoping to illustrate DF=0 with a black color instead of  
> > > purple. Can I change the puple color (DF=0) to black and how can  
> > > this be done?
> > > 
> > > Best regards
> > > 
> > > Per Haugaard,
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Radiance-general mailing list  
> > Radiance-general@radiance-online.org  
> > [http://www.radiance-online.org/mailman/listinfo/radiance-general](http://www.radiance-online.org/mailman/listinfo/radiance-general)
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Electronic mail messages entering and leaving Arup business  
> systems are scanned for acceptability of content and viruses

---

<div class="post-metadata">

**Author:** ![Greg\_Ward1](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/g/3be4f8/32.png) [@Greg\_Ward1](https://discourse.radiance-online.org/u/Greg_Ward1)\
**Post date:** [May 27, 2009, 4:57pm UTC](https://discourse.radiance-online.org/t/df-for-a-polygon/702/6 "2009-05-27T16:57:06Z")

</div>

Hi Andy,

The trouble with such a scale is that it isn't compatible with the -cl and -cb options, since the lines disappear near the bottom end of the scale. That's why I decided against it in the first place.

Cheers,  
-Greg

> **···**
>
> > From: Andrew McNeil \<andrew.mcneil@arup.com\>  
> > Date: May 27, 2009 9:51:34 AM PDT
> > 
> > Hi Greg,
> > 
> > A falsecolor scale that colors zero as black is actually very useful. I  
> > often use pcompos and image masks to achieve the same effect. A second  
> > version of falsecolor modified as you suggested is a major convenience for  
> > me. Thanks!
> > 
> > If others agree that it is useful, maybe it can be incorporated in  
> > falsecolor as an alternate color scale (similar to the -spec option)?
> > 
> > Thanks,  
> > Andy
