Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 014743a
  • /
  • tests
  • /
  • gnomonic.c
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:d934589f5cff7c7b90edd6e81b60a42fd976d48d
directory badge
swh:1:dir:ff34cc3dea9a447422f32d6bdb7bcd0e31c54a79

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
gnomonic.c
/*
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 *
 *<LicenseText>
 *
 * CitcomS by Louis Moresi, Shijie Zhong, Lijie Han, Eh Tan,
 * Clint Conrad, Michael Gurnis, and Eun-seo Choi.
 * Copyright (C) 1994-2005, California Institute of Technology.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *</LicenseText>
 *
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */


/* Compile by: mpicc gnomonic.c -lCitcomS -L../lib -lz */

#include <math.h>
#include <stdio.h>

void spherical_to_uv2(double center[2], int len,
                      double *theta, double *phi,
                      double *u, double *v);
void uv_to_spherical(double center[2], int len,
                     double *u, double *v,
                     double *theta, double *phi);

/* test for gnomonic projection and its inverse */


int main(int argc, char **argv)
{
    #define len   6
    int i;

    double u[len], v[len];
    double center[2] = {M_PI / 2, 0};
    double theta[len] = {0.1, 0.2, 0.3, 0.3, center[0], M_PI/4};
    double phi[len] = {0.1, 0.1, 0.3, 0.4, center[1], M_PI/4};

    spherical_to_uv2(center, len, theta, phi, u, v);

    for(i=0; i<len; i++) {
        fprintf(stderr, "(%.15e, %.15e) -> (%.15e, %.15e)\n",
                theta[i], phi[i], u[i], v[i]);
    }
    fprintf(stderr, "\n\n");

    uv_to_spherical(center, len, u, v, theta, phi);

    for(i=0; i<len; i++) {
        fprintf(stderr, "(%.15e, %.15e) <- (%.15e, %.15e)\n",
                theta[i], phi[i], u[i], v[i]);
    }

    return 0;
}

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API