From ccd1d4c4b3d79205eed91f67c0ee3fdc9e4e39f3 Mon Sep 17 00:00:00 2001 From: treecity Date: Fri, 20 May 2011 21:45:17 +0000 Subject: [PATCH] =?utf8?q?[src]=20Fehler=20gefunde:=20Lag=20in=20den=20Gre?= =?utf8?q?nzen=20[src]=20neue=20=C3=9Cberpr=C3=BCfung=20f=C3=BCr=20die=20L?= =?utf8?q?age=20von=20parallenen=20Rechtecken?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: https://drops.fb12.tu-berlin.de/svn/bacc/trunk@27 26120e32-c555-405d-b3e1-1f783fb42516 --- src/SLPrecangle.cpp | 11 +++++ src/build_A.cpp | 108 ++++++++++++++++++++++++++++++++---------- src/build_A2.m | 26 ++++++---- src/surfDoubleQuad.m | 2 +- src/test_solveError.m | 21 ++++---- 5 files changed, 122 insertions(+), 46 deletions(-) diff --git a/src/SLPrecangle.cpp b/src/SLPrecangle.cpp index 4a67229..42b08e4 100644 --- a/src/SLPrecangle.cpp +++ b/src/SLPrecangle.cpp @@ -277,6 +277,17 @@ double quadInt( */ } +double quad0Int( + double(*f)(double, double, double, double, double, double, double), + double b, double d, double t, double v, double d1, double d2, double d3) { + + return f(b,d,t,v,d1,d2,d3)-f(b,d,t,0,d1,d2,d3)-f(b,d,0,v,d1,d2,d3)+f(b,d,0,0,d1,d2,d3) + -f(b,0,t,v,d1,d2,d3)+f(b,0,t,0,d1,d2,d3)+f(b,0,0,v,d1,d2,d3)-f(b,0,0,0,d1,d2,d3) + -f(0,d,t,v,d1,d2,d3)+f(0,d,t,0,d1,d2,d3)+f(0,d,0,v,d1,d2,d3)-f(0,d,0,0,d1,d2,d3) + +f(0,0,t,v,d1,d2,d3)-f(0,0,t,0,d1,d2,d3)-f(0,0,0,v,d1,d2,d3)+f(0,0,0,0,d1,d2,d3); + +} + diff --git a/src/build_A.cpp b/src/build_A.cpp index 6050480..ee198db 100644 --- a/src/build_A.cpp +++ b/src/build_A.cpp @@ -4,6 +4,9 @@ #include "mex.h" #include +//#include "tbb/parallel_for.h" + + #include "SLPrecangle.hpp" #define my_PI 3.141592653589793 @@ -12,6 +15,9 @@ using namespace std; void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { + + int i,j,k; + //sicherheitsabfragen zu Datengroessen if (nrhs != 2) mexErrMsgTxt("expected (coordinates(Nx3),elements(Mx3))"); @@ -38,20 +44,25 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { double * x2 = mxGetPr(mxCreateDoubleMatrix(3, 1, mxREAL)); double * x3 = mxGetPr(mxCreateDoubleMatrix(3, 1, mxREAL)); double * xn = mxGetPr(mxCreateDoubleMatrix(3, 1, mxREAL)); + double * xa = mxGetPr(mxCreateDoubleMatrix(3, 1, mxREAL)); + double * xb = mxGetPr(mxCreateDoubleMatrix(3, 1, mxREAL)); double * y1 = mxGetPr(mxCreateDoubleMatrix(3, 1, mxREAL)); double * y2 = mxGetPr(mxCreateDoubleMatrix(3, 1, mxREAL)); double * y3 = mxGetPr(mxCreateDoubleMatrix(3, 1, mxREAL)); double * yn = mxGetPr(mxCreateDoubleMatrix(3, 1, mxREAL)); + double * ya = mxGetPr(mxCreateDoubleMatrix(3, 1, mxREAL)); + double * yb = mxGetPr(mxCreateDoubleMatrix(3, 1, mxREAL)); double * d = mxGetPr(mxCreateDoubleMatrix(3, 1, mxREAL)); double tmp; - int rx, ry; + //LageInformationen + int rx, rxa, rxb, ry, rya, ryb; //Ausrechnen - for (int j = 0; j < em; ++j) { + for (j = 0; j < em; ++j) { x1[0] = C[(int) E[j] - 1]; x1[1] = C[cm + (int) E[j] - 1]; x1[2] = C[2 * cm + (int) E[j] - 1]; @@ -64,12 +75,18 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { x3[1] = C[cm + (int) E[2 * em + j] - 1]; x3[2] = C[2 * cm + (int) E[2 * em + j] - 1]; - xn[0] = (x2[1] - x1[1]) * (x3[2] - x1[2]) - (x2[2] - x1[2]) * (x3[1] - - x1[1]); - xn[1] = (x2[2] - x1[2]) * (x3[0] - x1[0]) - (x2[0] - x1[0]) * (x3[2] - - x1[2]); - xn[2] = (x2[0] - x1[0]) * (x3[1] - x1[1]) - (x2[1] - x1[1]) * (x3[0] - - x1[0]); + for (i = 0; i<3;++i) + xa[i] = x2[i] - x1[i]; + + for (i = 0; i<3;++i) + xb[i] = x3[i] - x1[i]; + + //Kreuzprodukt + xn[0] = (xa[1]) * (xb[2]) - (xa[2]) * (xb[1]); + xn[1] = (xa[2]) * (xb[0]) - (xa[0]) * (xb[2]); + xn[2] = (xa[0]) * (xb[1]) - (xa[1]) * (xb[0]); + + //if(xn[0]*xn[0]+xn[1]*xn[1]