POV-Ray : Newsgroups : povray.general : sunpos.inc error Server Time
31 Jul 2024 04:23:50 EDT (-0400)
  sunpos.inc error (Message 1 to 4 of 4)  
From: Russell Towle
Subject: sunpos.inc error
Date: 14 Nov 2007 10:50:00
Message: <web.473b17ecad42e70858d2d5d80@news.povray.org>
I have used three different sun position methods in POV, and was pleased to find
that "sunpos.inc" was bundled with recent releases of POV. However, until today
I could never get it working properly.

Part of my problem arose from an error in the official documentation of this
macro, at

http://www.povray.org/documentation/view/3.6.1/498/

Here, a cylinder is (supposedly) aligned with the sun-vector, at noon (actually,
two minutes past noon) on June 21, 2000, Greenwich, England. The error occurs
because the cylinder
is improperly rotated. The documentation gives

cylinder{
      <-2,0,0>,<2,0,0>,0.1
      rotate <0, Az-90, Al>  //align cylinder with sun
      texture {...}
   }

but for the cylinder to align properly, one must use, instead,

cylinder{
      <-2,0,0>,<2,0,0>,0.1
      rotate <0, 0, Al>
      rotate <0, Az-90, 0>
   }

Thus, the problem seems to be the old non-commutative rotations in three
dimensions.

It would be nice to fix the documentation.

Cheers,

Russell


Post a reply to this message

From: Leef me
Subject: Re: sunpos.inc error
Date: 15 Nov 2007 20:25:00
Message: <web.473cf0144b194eb42a7b15450@news.povray.org>
"Russell Towle" <rto### [at] inreachcom> wrote:
> I have used three different sun position methods in POV, and was pleased to find
> that "sunpos.inc" was bundled with recent releases of POV. However, until today
> I could never get it working properly.
>
> Part of my problem arose from an error in the official documentation of this
> macro, at
>
> http://www.povray.org/documentation/view/3.6.1/498/
>
> Here, a cylinder is (supposedly) aligned with the sun-vector, at noon (actually,
> two minutes past noon) on June 21, 2000, Greenwich, England. The error occurs
> because the cylinder
> is improperly rotated. The documentation gives
>
> cylinder{
>       <-2,0,0>,<2,0,0>,0.1
>       rotate <0, Az-90, Al>  //align cylinder with sun
>       texture {...}
>    }
>
> but for the cylinder to align properly, one must use, instead,
>
> cylinder{
>       <-2,0,0>,<2,0,0>,0.1
>       rotate <0, 0, Al>
>       rotate <0, Az-90, 0>
>    }
>
> Thus, the problem seems to be the old non-commutative rotations in three
> dimensions.
>
> It would be nice to fix the documentation.
>
> Cheers,
>
> Russell



Hi Russell,

Wrong time, yes. But you get to the same angle either way ya go.

Try this code, it sure seems like the red and yellow cylinders are concentric.

Leef_me

//-----------
//start here


#version 3.6;

#include "colors.inc"
#include "sunpos.inc"

global_settings {
  assumed_gamma 1.0
}

// ----------------------------------------

   light_source {
      //Greenwich, noon on the longest day of 2000
      SunPos(2007, 10, 18, 12, 2, -8, 32.71, -117.15)
      rgb 1
   }

camera {

  location  <-3+.5,0,0>
  look_at   <0.0, 0.0,  0.0>
     rotate <0, 0, Al>
      rotate <0, Az-90, 0>
}

   cylinder{
      <-2,0,0>,<2,0,0>,0.1
      rotate <0, Az-90, Al>  //align cylinder with sun
    pigment { color Red }
   }

   cylinder{
      <-2-.01,0,0>,<2+.01,0,0>,0.05
//      <-2-.3,0,0>,<2,0,0>,0.03
     rotate <0, 0, Al>
      rotate <0, Az-90, 0>
    pigment { color Yellow }
   }


// ----------------------------------------

plane {
  y, -1
  pigment { color White }
}

light_source {
  <500,500,-500>       // light's position
  color rgb <1, 1, 1>  // light's color
}

light_source {
  <-500,500,-500>       // light's position
  color rgb <1, 1, 1>  // light's color
}

#if(1)
sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

#end


Post a reply to this message

From: Russell Towle
Subject: Re: sunpos.inc error
Date: 27 Nov 2007 12:35:01
Message: <web.474c53804b194eb4ca8cf1740@news.povray.org>
"Leef_me" <nomail@nomail> wrote:

> Hi Russell,
>
> Wrong time, yes. But you get to the same angle either way ya go.
>
> Try this code, it sure seems like the red and yellow cylinders are concentric.


Nope, it's all wrong. They are concentric but for the wrong reasons. Note that
the sunpos.inc macro requires its arguments to be {year, month, day, hours,
minutes, ***central meridian of time zone***, latitude, longitude}. So, say you
live at latitude -117.15 degrees. The time zone meridian you must use will be
some multiple of fifteen degrees. Say, if you are eight hours behind Greenwich
time, then 8*15=120; and -120 degrees will be your central meridian. Hence I
change your example to

SunPos(2007, 10, 18, 12, 2, -120, 32.71, -117.15),

but this would be incorrect if you are in the Mountain zone, rather than the
Pacific
zone.

This will show the differing orientation of the cylinders:

//begin example

#version 3.6;

#include "colors.inc"
#include "sunpos.inc"

global_settings {
  assumed_gamma 1.0
}

// ----------------------------------------

   light_source {
     //a point at longitude -117.15, latitude 32.71
      SunPos(2007, 10, 18, 12, 2, -120, 32.71, -117.15)
      rgb 1
   }

camera {
location  <2,5,-1>
 look_at   0
 }

   cylinder{
      <-2,0,0>,<2,0,0>,0.1
      rotate <0, Az-90, Al>  //align cylinder with sun: wrong!!!
    pigment { color Red }
   }

   cylinder{
      <-2-.01,0,0>,<2+.01,0,0>,0.05
      <-2-.3,0,0>,<2,0,0>,0.03
     rotate <0, 0, Al>
     rotate <0, Az-90, 0>
    pigment { color Yellow }
   }


// ----------------------------------------

plane {
  y, -1
  pigment { color White }
}

//end example


Post a reply to this message

From: Leef me
Subject: Re: sunpos.inc error
Date: 29 Nov 2007 00:30:01
Message: <web.474e4e364b194eb4892adb1d0@news.povray.org>
"Russell Towle" <rto### [at] inreachcom> wrote:
> "Leef_me" <nomail@nomail> wrote:
>
> > Hi Russell,
> >
> > Wrong time, yes. But you get to the same angle either way ya go.
> >
> > Try this code, it sure seems like the red and yellow cylinders are concentric.
>
>
> Nope, it's all wrong. They are concentric but for the wrong reasons. Note that
> the sunpos.inc macro requires its arguments to be {year, month, day, hours,
> minutes, ***central meridian of time zone***, latitude, longitude}. So, say you
> live at latitude -117.15 degrees. The time zone meridian you must use will be
> some multiple of fifteen degrees. Say, if you are eight hours behind Greenwich
> time, then 8*15=120; and -120 degrees will be your central meridian. Hence I
> change your example to
>
> SunPos(2007, 10, 18, 12, 2, -120, 32.71, -117.15),
>
> but this would be incorrect if you are in the Mountain zone, rather than the
> Pacific
> zone.
>
> This will show the differing orientation of the cylinders:
>

Hi Russell,

Yeah, you're right. I copy/pasted that example, from where I don't recall.
The lat/long is of a location in Oklahoma, it's no where near Greenwich,
well it is the same planet ;)  So the meridian is wrong. I ran my example
again and the Messages window has this:

REMARK:
Longitude differs by more than 30 degrees from timezone meridian.
Local timezone meridian is:   -8
Longitude is: -117

My particular example seems to not show the particular problem with the
'rotate' function.  I should have tried a few more examples.

Sorry about my error.

Leef_me


Post a reply to this message

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