/*  -- translated by f2c (version 20090411).
   You must link the resulting object file with libf2c:
	on Microsoft Windows system, link with libf2c.lib;
	on Linux or Unix systems, link with .../path/to/libf2c.a -lm
	or, if you install libf2c.a in a standard place, with -lf2c -lm
	-- in that order, at the end of the command line, as in
		cc *.o -lf2c -lm
	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,

		http://www.netlib.org/f2c/libf2c.zip
*/

#include "libtinyf2c.h"

/* Table of constant values */

static integer c__9 = 9;
static integer c__1 = 1;
static integer c__3 = 3;
static real c_b9 = 0.f;
static real c_b10 = 360.f;
static real c_b11 = -90.f;
static real c_b12 = 90.f;
static real c_b13 = .3f;
static real c_b14 = .9f;
static integer c__2 = 2;
static real c_b21 = -.8f;
static real c_b24 = .5f;
static real c_b26 = .4f;
static real c_b28 = 10.f;
static real c_b29 = 60.f;
static real c_b38 = 30.f;
static real c_b48 = .8f;
static real c_b52 = .6f;
static logical c_false = FALSE_;
static real c_b66 = .1f;
static integer c__2999 = 2999;
static integer c__9999 = 9999;

/* ----------------------------------------------------------------------- */
/*     Copyright (C) 2000-2004 GFD Dennou Club. All rights reserved. */
/* ----------------------------------------------------------------------- */
/* Main program */ int MAIN__(void)
{
    /* System generated locals */
    real r__1;

    /* Builtin functions */
    double sin(doublereal), sqrt(doublereal), cos(doublereal);
    integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
	    e_wsle(void), s_rsle(cilist *), e_rsle(void);

    /* Local variables */
    static integer i__, j;
    static real p[1369]	/* was [37][37] */, xp[3], yp[3], zp[3];
    static integer iws;
    static real alat[37], alon[37], slat;
    extern /* Subroutine */ int sgcls_(void), sgfrm_(void), sgopn_(integer *),
	     szl3cl_(void), szt3cl_(void), szl3op_(integer *), szt3op_(
	    integer *, integer *), szl3zu_(integer *, real *, real *, real *),
	     szt3zu_(real *, real *, real *), scsobj_(real *, real *, real *),
	     scslog_(logical *, logical *, logical *), scseye_(real *, real *,
	     real *), scswnd_(real *, real *, real *, real *, real *, real *),
	     scspln_(integer *, integer *, real *), scsprj_(void), sgswnd_(
	    real *, real *, real *, real *), scstrf_(void), sgstrf_(void), 
	    scstrn_(integer *), uxaxdv_(char *, real *, real *, ftnlen), 
	    sgstrn_(integer *), sgpwsn_(void), uyaxdv_(char *, real *, real *,
	     ftnlen), uzinit_(void), scsvpt_(real *, real *, real *, real *, 
	    real *, real *), sgsvpt_(real *, real *, real *, real *), uzlset_(
	    char *, logical *, ftnlen), uxsttl_(char *, char *, real *, 
	    ftnlen, ftnlen), uysttl_(char *, char *, real *, ftnlen, ftnlen);

    /* Fortran I/O blocks */
    static cilist io___7 = { 0, 6, 0, 0, 0 };
    static cilist io___8 = { 0, 5, 0, 0, 0 };


    for (i__ = 1; i__ <= 37; ++i__) {
	alon[i__ - 1] = (i__ - 1) * 360.f / 36 + 0.f;
/* L10: */
    }
    for (j = 1; j <= 37; ++j) {
	alat[j - 1] = (j - 1) * 180.f / 36 - 90.f;
/* L20: */
    }
    for (j = 1; j <= 37; ++j) {
	slat = sin(alat[j - 1] * .017453277777777776f);
	for (i__ = 1; i__ <= 37; ++i__) {
/* Computing 2nd power */
	    r__1 = slat;
	    p[i__ + j * 37 - 38] = sqrt(1 - r__1 * r__1) * slat * cos(alon[
		    i__ - 1] * .017453277777777776f);
/* L30: */
	}
    }
    s_wsle(&io___7);
    do_lio(&c__9, &c__1, " WORKSTATION ID (I) ? ;", (ftnlen)23);
    e_wsle();
    sgpwsn_();
    s_rsle(&io___8);
    do_lio(&c__3, &c__1, (char *)&iws, (ftnlen)sizeof(integer));
    e_rsle();
    sgopn_(&iws);
    sgfrm_();
/* -- X-Y PLAIN ---- */
    sgswnd_(&c_b9, &c_b10, &c_b11, &c_b12);
    sgsvpt_(&c_b13, &c_b14, &c_b13, &c_b14);
    sgstrn_(&c__1);
    sgstrf_();
    scspln_(&c__1, &c__2, &c_b13);
    scseye_(&c_b21, &c_b21, &c_b14);
    scsobj_(&c_b24, &c_b24, &c_b26);
    scsprj_();
    uxaxdv_("B", &c_b28, &c_b29, (ftnlen)1);
    uxaxdv_("T", &c_b28, &c_b29, (ftnlen)1);
    uxsttl_("B", "LONGITUDE", &c_b9, (ftnlen)1, (ftnlen)9);
    uyaxdv_("L", &c_b28, &c_b38, (ftnlen)1);
    uyaxdv_("R", &c_b28, &c_b38, (ftnlen)1);
    uysttl_("L", "LATITUDE", &c_b9, (ftnlen)1, (ftnlen)8);
/* -- X-Z PLAIN ---- */
    sgswnd_(&c_b9, &c_b10, &c_b21, &c_b48);
    sgsvpt_(&c_b13, &c_b14, &c_b13, &c_b52);
    sgstrn_(&c__1);
    sgstrf_();
    scspln_(&c__1, &c__3, &c_b14);
    scsprj_();
    uzinit_();
    uxaxdv_("T", &c_b28, &c_b29, (ftnlen)1);
    uzlset_("LABELXB", &c_false, (ftnlen)7);
    uxaxdv_("B", &c_b28, &c_b29, (ftnlen)1);
    uyaxdv_("L", &c_b66, &c_b24, (ftnlen)1);
    uyaxdv_("R", &c_b66, &c_b24, (ftnlen)1);
    uysttl_("L", "AMPLITUDE", &c_b9, (ftnlen)1, (ftnlen)9);
/* -- Y-Z PLAIN ---- */
    sgswnd_(&c_b11, &c_b12, &c_b21, &c_b48);
    sgsvpt_(&c_b13, &c_b14, &c_b13, &c_b52);
    sgstrn_(&c__1);
    sgstrf_();
    scspln_(&c__2, &c__3, &c_b14);
    scsprj_();
    uzinit_();
    uxaxdv_("T", &c_b28, &c_b38, (ftnlen)1);
    uxaxdv_("B", &c_b28, &c_b38, (ftnlen)1);
    uzlset_("LABELYL", &c_false, (ftnlen)7);
    uyaxdv_("L", &c_b66, &c_b24, (ftnlen)1);
    uyaxdv_("R", &c_b66, &c_b24, (ftnlen)1);
/* ---------------- 3-D ------------------ */
    scsvpt_(&c_b13, &c_b14, &c_b13, &c_b14, &c_b13, &c_b52);
    scswnd_(&c_b9, &c_b10, &c_b11, &c_b12, &c_b21, &c_b48);
    scslog_(&c_false, &c_false, &c_false);
    scstrn_(&c__1);
    scstrf_();
    szl3op_(&c__1);
    szt3op_(&c__2999, &c__9999);
    for (j = 36; j >= 1; --j) {
	for (i__ = 36; i__ >= 1; --i__) {
	    xp[0] = alon[i__ - 1];
	    yp[0] = alat[j - 1];
	    zp[0] = p[i__ + j * 37 - 38];
	    xp[1] = alon[i__ - 1];
	    yp[1] = alat[j];
	    zp[1] = p[i__ + (j + 1) * 37 - 38];
	    xp[2] = alon[i__];
	    yp[2] = alat[j];
	    zp[2] = p[i__ + 1 + (j + 1) * 37 - 38];
	    szt3zu_(xp, yp, zp);
	    szl3zu_(&c__3, xp, yp, zp);
	    xp[0] = alon[i__];
	    yp[0] = alat[j];
	    zp[0] = p[i__ + 1 + (j + 1) * 37 - 38];
	    xp[1] = alon[i__];
	    yp[1] = alat[j - 1];
	    zp[1] = p[i__ + 1 + j * 37 - 38];
	    xp[2] = alon[i__ - 1];
	    yp[2] = alat[j - 1];
	    zp[2] = p[i__ + j * 37 - 38];
	    szt3zu_(xp, yp, zp);
	    szl3zu_(&c__3, xp, yp, zp);
/* L40: */
	}
    }
    szl3cl_();
    szt3cl_();
    sgcls_();
    return 0;
} /* MAIN__ */

/* Main program alias */ int scpkt5_ () { MAIN__ (); return 0; }
