00001
00002
00003
00004
00005 #include <stdio.h>
00006 #include <stdlib.h>
00007 #include "cg3d.h"
00008 #include "volume_planes.h"
00009 using namespace cg3d;
00010
00011
00012
00013 double test_vol_planes(const PointSet3d *ps,const Tet3d &A,const Tet3d &B)
00014 {
00015 const int nDir=4;
00016 const int nDim=3;
00017 const int rowSize=nDim+1;
00018 double planes[2*nDir*rowSize];
00019
00020 for (int dir=0;dir<nDir;dir++) {
00021 CkHalfspace3d Ah=A.getHalfspace(dir);
00022 CkHalfspace3d Bh=B.getHalfspace(dir);
00023 for (int i=0;i<nDim;i++) {
00024 planes[ dir *rowSize+i]=-Ah.n[i];
00025 planes[(dir+nDir)*rowSize+i]=-Bh.n[i];
00026 }
00027 planes[ dir *rowSize+nDim]=Ah.d;
00028 planes[(dir+nDir)*rowSize+nDim]=Bh.d;
00029 }
00030
00031 double vol=computeVolumePlanes(planes,2*nDir);
00032
00033 return vol;
00034 }
00035