9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] globe
@ 2004-10-02 11:11 Steve Simon
  2004-10-02 15:18 ` andrey mirtchovski
  2004-10-04 17:08 ` Axel Belinfante
  0 siblings, 2 replies; 14+ messages in thread
From: Steve Simon @ 2004-10-02 11:11 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 119 bytes --]

Ok,

After hassle from many 9fans I have rewritten globe to
work properly - though it is now C (attached).

-Steve

[-- Attachment #2: globe.c --]
[-- Type: text/plain, Size: 530 bytes --]

#include <u.h>
#include <libc.h>

/*
 * globe.c - calculate the rotation of
 * the earth as viewed from the sun
 *
 * usage: 
 *	map orthographic -o `{globe} | plot
 */
void
main()
{
	enum {
		declination = 23.47,
		degperhour = 15.0
	};
	Tm*tm;
	double roll, pitch, yaw;

	tm = gmtime(time(nil));
	roll = -(cos((tm->yday+284) * PI/182.5)) * declination;
	pitch = (sin((tm->yday+284) * PI/182.5)) * declination;
	yaw = (tm->hour+ (tm->min/60) -12) * degperhour;

	print("%f %f %f\n", pitch, yaw, roll);
}

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] globe
  2004-10-02 11:11 [9fans] globe Steve Simon
@ 2004-10-02 15:18 ` andrey mirtchovski
  2004-10-03 18:25   ` Jack Johnson
  2004-10-04 17:08 ` Axel Belinfante
  1 sibling, 1 reply; 14+ messages in thread
From: andrey mirtchovski @ 2004-10-02 15:18 UTC (permalink / raw)
  To: 9fans

ouch, running 'map' with the output of the new globe hung my
machine. now i have to go to the university to reboot it and see why...

:(

On Sat, 2 Oct 2004, Steve Simon wrote:

> Ok,
>
> After hassle from many 9fans I have rewritten globe to
> work properly - though it is now C (attached).
>
> -Steve


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] globe
  2004-10-02 15:18 ` andrey mirtchovski
@ 2004-10-03 18:25   ` Jack Johnson
  2004-10-04 15:59     ` andrey mirtchovski
  0 siblings, 1 reply; 14+ messages in thread
From: Jack Johnson @ 2004-10-03 18:25 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Sat, 2 Oct 2004 09:18:20 -0600 (MDT), andrey mirtchovski
<mirtchov@cpsc.ucalgary.ca> wrote:
> ouch, running 'map' with the output of the new globe hung my
> machine. now i have to go to the university to reboot it and see why...

Look on the bright side.  You're on the same continent as your university.

-Jack


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] globe
  2004-10-03 18:25   ` Jack Johnson
@ 2004-10-04 15:59     ` andrey mirtchovski
  0 siblings, 0 replies; 14+ messages in thread
From: andrey mirtchovski @ 2004-10-04 15:59 UTC (permalink / raw)
  To: 9fans


> Look on the bright side.  You're on the same continent as your university.
> 
> -Jack

you're right...  on the other hand the fact that i can run to the
university and reboot the machine every time i crash it is no excuse
for being stupid.  this time it hung because it simply ran out of
processes calling the same script over and over again recursively.
this morning i faced a terminal spewing 'no procs' messages over and
over.

signed: silly



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] globe
  2004-10-02 11:11 [9fans] globe Steve Simon
  2004-10-02 15:18 ` andrey mirtchovski
@ 2004-10-04 17:08 ` Axel Belinfante
  1 sibling, 0 replies; 14+ messages in thread
From: Axel Belinfante @ 2004-10-04 17:08 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 530 bytes --]

I tried to make a 'globeloop' that continously updates the globe
in the same plot (I used mapdemo for inspiration).

I found one little thing in globe.c:

> 	yaw = (tm->hour+ (tm->min/60) -12) * degperhour;
 	yaw = (tm->hour+ (tm->min/60.0) -12) * degperhour;

(without the .0 in 60.0 yaw would change once per hour on the hour)

I attached my current globeloop script; it assumes that
globe.c has been installed as games/globeangle .

I don't script in rc very often (guess it shows; feedback welcome)

Axel.



[-- Attachment #2: Type: text/plain, Size: 681 bytes --]

#!/bin/rc

rfork en
{
	delay='?'
	while() {
		date=`{date}
		angle=`{games/globeangle}
		if (~ $"oangle $"angle)
			color=b
		if not
			color=r
		if (~ $delay '?')
		{
			ndate=$date
			oangle=$angle
		}
		{
			echo o
			echo ra -8192 -8492 8192 8492
			echo e
			echo m -8192 8192
			echo co $color
			echo t $date -- $angle
			echo m -8192 -8192
			echo co b
			echo t $ndate -- $oangle -- delay $delay
			map orthographic -o $angle  -s  -d 25
		}
		ndate=`{date}
		delay=`{echo $ndate | awk -F'[ :]+' '{print 65 - $6}'}
		echo m -8192 -8192
		echo co b
		echo t $ndate -- $angle -- delay $delay

		oangle=$angle
		sleep $delay
	}
} | plot

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] globe
  2004-10-04  7:51 ` Gorka Guardiola Múzquiz
@ 2004-10-04  8:32   ` Tiit Lankots
  0 siblings, 0 replies; 14+ messages in thread
From: Tiit Lankots @ 2004-10-04  8:32 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

>> All that's needed for it to work locally is:
>>
>> timezone=`{cat /adm/timezone/GMT}
>>
>
> I don't get it. Do you mean
> timezone=`{cat /adm/timezone/local}

Your variant is a no-op. Think about how the timezone stuff works.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] globe
       [not found] <mailman.216.1096875876.5045.9fans@cse.psu.edu>
@ 2004-10-04  7:51 ` Gorka Guardiola Múzquiz
  2004-10-04  8:32   ` Tiit Lankots
  0 siblings, 1 reply; 14+ messages in thread
From: Gorka Guardiola Múzquiz @ 2004-10-04  7:51 UTC (permalink / raw)
  To: 9fans


> All that's needed for it to work locally is:
> 
> timezone=`{cat /adm/timezone/GMT}
> 

I don't get it. Do you mean 
timezone=`{cat /adm/timezone/local}
?




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] globe
  2004-10-01 17:10     ` Steve Simon
@ 2004-10-01 20:12       ` Rob Pike
  0 siblings, 0 replies; 14+ messages in thread
From: Rob Pike @ 2004-10-01 20:12 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

All that's needed for it to work locally is:

timezone=`{cat /adm/timezone/GMT}


-rob


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] globe
  2004-10-01 15:53   ` andrey mirtchovski
@ 2004-10-01 17:10     ` Steve Simon
  2004-10-01 20:12       ` Rob Pike
  0 siblings, 1 reply; 14+ messages in thread
From: Steve Simon @ 2004-10-01 17:10 UTC (permalink / raw)
  To: 9fans

> please add a '-u' to the date to work for other time zones:

Quite right,

I had a -u but  must have deleted it when I
"tidied it up" prior to posting (Ugh).

-Steve


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] globe
  2004-10-01 15:44 ` andrey mirtchovski
@ 2004-10-01 15:53   ` andrey mirtchovski
  2004-10-01 17:10     ` Steve Simon
  0 siblings, 1 reply; 14+ messages in thread
From: andrey mirtchovski @ 2004-10-01 15:53 UTC (permalink / raw)
  To: 9fans

>    http://pages.cpsc.ucalgary.ca/~mirtchov/screenshtos/globe-u.gif
>    http://pages.cpsc.ucalgary.ca/~mirtchov/screenshtos/globe.gif

oops, s/shtos/shots/

my bad...


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] globe
  2004-10-01 15:25 ` rog
@ 2004-10-01 15:50   ` andrey mirtchovski
  0 siblings, 0 replies; 14+ messages in thread
From: andrey mirtchovski @ 2004-10-01 15:50 UTC (permalink / raw)
  To: 9fans

for those of us in north america there's a similarly simple weather
monitoring service (it was very interesting to watch florida this
past month):

     http://pages.cpsc.ucalgary.ca/~mirtchov/p9/nasat/

meteorological analysis not included :)


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] globe
  2004-10-01 15:11 Steve Simon
  2004-10-01 15:25 ` rog
@ 2004-10-01 15:44 ` andrey mirtchovski
  2004-10-01 15:53   ` andrey mirtchovski
  1 sibling, 1 reply; 14+ messages in thread
From: andrey mirtchovski @ 2004-10-01 15:44 UTC (permalink / raw)
  To: 9fans

you guys and your proximity to GMT :)

globe won't work in canada, no matter how much i try to persuade it that
the great white north is still part of the colonies :)

please add a '-u' to the date to work for other time zones:

 	#!/bin/rc

 	gmt=`{date -u}
 	angle=`{echo $gmt | awk -F'[ :]' '{print (360*(($4*60+$5)/(24*60))-180)}'}
 	map orthographic -o 0 $angle 0 | plot

examples with and without '-u':

     http://pages.cpsc.ucalgary.ca/~mirtchov/screenshtos/globe-u.gif
     http://pages.cpsc.ucalgary.ca/~mirtchov/screenshtos/globe.gif

andrey


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] globe
  2004-10-01 15:11 Steve Simon
@ 2004-10-01 15:25 ` rog
  2004-10-01 15:50   ` andrey mirtchovski
  2004-10-01 15:44 ` andrey mirtchovski
  1 sibling, 1 reply; 14+ messages in thread
From: rog @ 2004-10-01 15:25 UTC (permalink / raw)
  To: 9fans

> Globe draws an map of the world rotated to present the
> the iluminated side, thus you can judge who is asleep and
> shouldn't be phoned ☺

care should be taken... it gets light at 5am in summer around here!

BTW we already had the same contents of /lib/map here
which people might wish to check before downloading wdbii.tar.gz



^ permalink raw reply	[flat|nested] 14+ messages in thread

* [9fans] globe
@ 2004-10-01 15:11 Steve Simon
  2004-10-01 15:25 ` rog
  2004-10-01 15:44 ` andrey mirtchovski
  0 siblings, 2 replies; 14+ messages in thread
From: Steve Simon @ 2004-10-01 15:11 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 410 bytes --]

Friday afternnon toy.

Globe draws an map of the world rotated to present the
the iluminated side, thus you can judge who is asleep and
shouldn't be phoned ☺

Credit to Jef Poskanzer for the idea (ascii map version).

Relies on Doug McIlroy's map databases, which can be downloaded via:

	mkdir /lib/map
	cd /lib/map
	hget http://www.cs.dartmouth.edu/~doug/wdbii.tar.gz | gunzip | tar x

-Steve

[-- Attachment #2: globe --]
[-- Type: text/plain, Size: 139 bytes --]

#!/bin/rc

gmt=`{date}
angle=`{echo $gmt | awk -F'[ :]' '{print (360*(($4*60+$5)/(24*60))-180)}'}
map orthographic -o 0 $angle 0 | plot

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-10-04 17:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-02 11:11 [9fans] globe Steve Simon
2004-10-02 15:18 ` andrey mirtchovski
2004-10-03 18:25   ` Jack Johnson
2004-10-04 15:59     ` andrey mirtchovski
2004-10-04 17:08 ` Axel Belinfante
     [not found] <mailman.216.1096875876.5045.9fans@cse.psu.edu>
2004-10-04  7:51 ` Gorka Guardiola Múzquiz
2004-10-04  8:32   ` Tiit Lankots
  -- strict thread matches above, loose matches on Subject: below --
2004-10-01 15:11 Steve Simon
2004-10-01 15:25 ` rog
2004-10-01 15:50   ` andrey mirtchovski
2004-10-01 15:44 ` andrey mirtchovski
2004-10-01 15:53   ` andrey mirtchovski
2004-10-01 17:10     ` Steve Simon
2004-10-01 20:12       ` Rob Pike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).