X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=common.c;h=62b981efa930fd19bbb3eab3bb94dd0ba0d14d69;hb=802d7ffd6900d7c17335caa957f1a3752d3f5ccb;hp=ba61341dc9bc45c457feba0ba87b112190df3c6a;hpb=eac31a20dbcedaad053f36c6b0de450325ecff0c;p=moebius2.git diff --git a/common.c b/common.c index ba61341..62b981e 100644 --- a/common.c +++ b/common.c @@ -43,6 +43,13 @@ void xprod(double r[D3], const double a[D3], const double b[D3]) { r[2]= a[0]*b[1] - a[1]*b[0]; } +double dotprod(const double a[D3], const double b[D3]) { + int k; + double result= 0; + K result += a[k] * b[k]; + return result; +} + void libdie(const char *lib, int l, const char *str) { fprintf(stderr,"%s library call failed, line %d: %s\n", lib, l, str); } @@ -54,4 +61,5 @@ void gsldie(int l, const char *what, int status) { } void diee(const char *what) { perror(what); exit(16); } +void fail(const char *emsg) { fputs(emsg,stderr); exit(12); } void flushoutput(void) { if (fflush(stdout)||ferror(stdout)) diee("stdout"); }