/* survey3d.h - Standard three dimensional survey information. * (C) Copyright 1999 by John Halleck * All Rights Reserved. */ /* Version of September 2nd, 1999 */ #ifndef SURVEY3D #define SURVEY3D 1 #include "errors.h" /* These routines use package standard error codes. */ typedef double coordinate[3]; /* Three dimensional coordinate, or change in coordinate. */ typedef double covariance[6]; /* Really storage for half of the symmetric * 3x3 matrix. */ /* Full three dimensional covariance matrix */ typedef double weight[6]; /* Also half a 3x3 symmetric matrix */ /* Full three dimensional weight */ #define X(mat) mat[0] #define XY(mat) mat[1] #define XZ(mat) mat[2] #define Y(mat) mat[3] #define YZ(mat) mat[4] #define Z(mat) mat[5] /* Load up matrices */ extern error loadcvr (covariance result, double a11, double a12, double a13, double a22, double a23, double a33); extern error loadwht (covariance result, double a11, double a12, double a13, double a22, double a23, double a33); /* Convert to regular matrixes. */ /* Matrix from weight */ extern error matfmwht (double result[3][3], weight given); /* Matrix from covariance */ extern error matfmcvr (double result[3][3], covariance given); /* identities */ extern error zerocoord (coordinate result); /* additive identity */ extern error cvrident (covariance result); /* multiplicitive identity */ extern error whtident (weight result); /* multiplicitive identity */ /* Add the basic entities */ extern error addcoord (coordinate result, coordinate a, coordinate b); extern error subcoord (coordinate result, coordinate a, coordinate b); extern error addcvr (covariance result, covariance a, covariance b); extern error addwht (weight result, weight a, weight b); /* Multiply coordinate by weight */ extern error wxcmult (coordinate result, weight a, coordinate b); /* inverses of the weights and covariances */ /* The two matrices MUST BE DISTINCT matrices. */ extern error cvrinv (covariance result, covariance given); extern error whtinv (weight result, weight given); /* convert between weights and covariances */ extern error wht2cvr (covariance result, weight given); extern error cvr2wht (weight result, covariance given); /* Scale weight or covariance (used for setting unit weight and covariance) */ extern error sclcvr (covariance result, covariance given, double reference); extern error sclwht (weight result, weight given, double reference); /* Magnitude (Determinant) of the matrices */ extern error detcvr (double *result, covariance given); extern error detwht (double *result, weight given); #endif