#include #include "mex.h" #include "matrix.h" #include "geometry.h" void mexFunction (int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[]) { char str[256]; mxArray *sa; double *v1, *v2, *v3, p1[3], p2[3], p3[3], *pnt, *tri, *sa_p; int i1, i2, i3, npnt, ntri, i, on_triangle; if (nrhs==2) { /* the input consists of a vertex array and a triangle array */ if (mxGetN(prhs[0])!=3) mexErrMsgTxt ("Invalid dimension for input argument 1"); if (mxGetN(prhs[1])!=3) mexErrMsgTxt ("Invalid dimension for input argument 2"); npnt = mxGetM(prhs[0]); ntri = mxGetM(prhs[1]); pnt = mxGetData (prhs[0]); tri = mxGetData (prhs[1]); sa = mxCreateDoubleMatrix (ntri, 1, mxREAL); sa_p = mxGetData (sa); /* compute the solid angle for all triangles */ for (i=0; i