steric_1.11
|
Makefile,
Makefile.sgi,
README.steric,
contplot,
craig.c,
craig.h,
crystal.c,
crystal.h,
integrat.c,
integrat.h,
leach.c,
leach.h,
long_steric,
makeit,
mapcont,
mapcont.c,
mapprof,
mapprof.c,
profplot,
proja.c,
proja.h,
ryan.c,
ryan.h,
ryan_perm.c,
ryan_perm.h,
ryan_quad.c,
ryan_quad.h,
steraid.c,
steraid.h,
stercalc.c,
stercalc.h,
stercomm.c,
stercomm.h,
sterdefn.h,
stererr.h,
sterfile.c,
sterfile.h,
stergrap.c,
stergrap.h,
stergrp.c,
stergrp.h,
steric,
steric.TeX,
steric.err,
steric.grp,
steric.hlp,
steric.ini,
steric.par,
stermain.c,
stermem.c,
stermem.h,
sterover.c,
sterover.h,
sterplot,
stertext.c,
stertext.h,
test.bgf,
test.inp,
vectors.c,
vectors.h,
|
|
|
/* program to translate cylindrical coords to cartesian coords */
#include
#include
#include
#define CART 1 /* convert to true cartesian */
#define PERS 2 /* use perspective mode as output by steric */
#define ROTA 0.0 /* default rotation about phi to perform */
#ifndef PI
#define PI 3.14159265358979323846
#endif
#ifndef PI_2
#define PI_2 1.57079632679489661923
#endif
int main(int argc, char *argv[])
{
char line[255];
double x,y,z;
double xo=0.0,yo=0.0,zo=-1000.0;
double phi,theta;
double rotation=ROTA;
char mode=CART;
int i;
for(i=1;i2*PI) rotation=ROTA;
do
{
if(fgets(line,254,stdin)==NULL) break;
if(line[0]=='q') break;
if(strlen(line)>4)
{
if(sscanf(line,"%lf%lf%lf",&z,&phi,&theta)==3)
{
phi+=rotation;
if(mode!=CART)
{
x=sin(theta)*cos(phi);
y=sin(theta)*sin(phi);
}
else
{
x=z*tan(theta)*cos(phi);
y=z*tan(theta)*sin(phi);
}
if(z!=zo)
{
if(zo>-1000.0) fprintf(stdout,"%10.6f %10.6f %10.6f\n\n",xo,yo,zo);
xo=x; yo=y; zo=z;
}
fprintf(stdout,"%10.6f %10.6f %10.6f\n",x,y,z);
}
}
} while(!feof(stdin));
if(zo>-1000.0) fprintf(stdout,"%10.6f %10.6f %10.6f\n",xo,yo,zo);
return(1);
}
|