Changeset 209 for trunk/VUT/GtpVisibilityPreprocessor/src
- Timestamp:
- 08/07/05 20:16:30 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor/src
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.cpp
r191 r209 1470 1470 float &minDistance, 1471 1471 float &maxDistance 1472 ) const1472 ) const 1473 1473 { 1474 1474 … … 1503 1503 minDistance = sumMin; 1504 1504 maxDistance = sumMax; 1505 1506 1507 1505 } 1508 1506 -
trunk/VUT/GtpVisibilityPreprocessor/src/Makefile
r191 r209 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (1.07a) (Qt 3.3.2) on: T ue Aug 02 22:47:0920053 # Generated by qmake (1.07a) (Qt 3.3.2) on: Thu Aug 04 20:06:06 2005 4 4 # Project: preprocessor.pro 5 5 # Template: app … … 63 63 Pvs.cpp \ 64 64 MutualVisibility.cpp \ 65 Triangle3.cpp 65 Triangle3.cpp \ 66 Rectangle3.cpp \ 67 Plane3.cpp 66 68 OBJECTS = Preprocessor.obj \ 67 69 SamplingPreprocessor.obj \ … … 87 89 Pvs.obj \ 88 90 MutualVisibility.obj \ 89 Triangle3.obj 91 Triangle3.obj \ 92 Rectangle3.obj \ 93 Plane3.obj 90 94 FORMS = 91 95 UICDECLS = … … 173 177 -$(DEL_FILE) MutualVisibility.obj 174 178 -$(DEL_FILE) Triangle3.obj 179 -$(DEL_FILE) Rectangle3.obj 180 -$(DEL_FILE) Plane3.obj 175 181 176 182 … … 221 227 common.h \ 222 228 Ray.h \ 229 Pvs.h \ 223 230 Preprocessor.h \ 224 231 Mesh.h \ … … 226 233 Intersectable.h \ 227 234 Material.h \ 228 Pvs.h \229 235 Exporter.h \ 230 236 … … 396 402 Mesh.h \ 397 403 MeshKdTree.h \ 404 Triangle3.h \ 398 405 Matrix4x4.h \ 399 406 Vector3.h \ … … 427 434 Plane3.h \ 428 435 Containers.h \ 429 Intersectable.h \430 Material.h \431 Pvs.h \436 Pvs.h \ 437 Intersectable.h \ 438 Material.h \ 432 439 433 440 … … 476 483 Ray.h \ 477 484 MutualVisibility.h \ 478 Containers.h \ 479 Rectangle3.h \ 480 Matrix4x4.h \ 481 Vector3.h \ 482 Plane3.h \ 483 common.h \ 485 Exporter.h \ 486 Mesh.h \ 487 Triangle3.h \ 488 Containers.h \ 489 Pvs.h \ 490 Rectangle3.h \ 491 Matrix4x4.h \ 492 Vector3.h \ 493 Plane3.h \ 494 common.h \ 495 Material.h \ 496 Intersectable.h \ 484 497 485 498 … … 490 503 491 504 505 Rectangle3.obj: Rectangle3.cpp \ 506 Rectangle3.h \ 507 Vector3.h \ 508 common.h \ 509 510 511 Plane3.obj: Plane3.cpp \ 512 Plane3.h \ 513 Vector3.h \ 514 common.h \ 515 516 492 517 ####### Install 493 518 -
trunk/VUT/GtpVisibilityPreprocessor/src/Matrix4x4.cpp
r176 r209 7 7 8 8 9 Matrix4x4::Matrix4x4(const Vector3 &a, const Vector3 &b, const Vector3 &c) 10 { 11 // first index is column [x], the second is row [y] 12 x[0][0] = a.x; 13 x[1][0] = a.y; 14 x[2][0] = a.z; 15 x[3][0] = 0.0f; 16 17 x[0][1] = b.x; 18 x[1][1] = b.y; 19 x[2][1] = b.z; 20 x[3][1] = 0.0f; 21 22 x[0][2] = c.x; 23 x[1][2] = c.y; 24 x[2][2] = c.z; 25 x[3][2] = 0.0f; 26 27 x[0][3] = 0.0f; 28 x[1][3] = 0.0f; 29 x[2][3] = 0.0f; 30 x[3][3] = 1.0f; 31 } 32 33 void 34 Matrix4x4::SetColumns(const Vector3 &a, const Vector3 &b, const Vector3 &c) 35 { 36 // first index is column [x], the second is row [y] 37 x[0][0] = a.x; 38 x[1][0] = b.x; 39 x[2][0] = c.x; 40 x[3][0] = 0.0f; 41 42 x[0][1] = a.y; 43 x[1][1] = b.y; 44 x[2][1] = c.y; 45 x[3][1] = 0.0f; 46 47 x[0][2] = a.z; 48 x[1][2] = b.z; 49 x[2][2] = c.z; 50 x[3][2] = 0.0f; 51 52 x[0][3] = 0.0f; 53 x[1][3] = 0.0f; 54 x[2][3] = 0.0f; 55 x[3][3] = 1.0f; 56 } 9 57 10 58 // full constructor … … 14 62 float x41, float x42, float x43, float x44) 15 63 { 16 // first index is column [x], the second is row [y]64 // first index is column [x], the second is row [y] 17 65 x[0][0] = x11; 18 66 x[1][0] = x12; -
trunk/VUT/GtpVisibilityPreprocessor/src/Matrix4x4.h
r176 r209 21 21 float x31, float x32, float x33, float x34, 22 22 float x41, float x42, float x43, float x44); 23 23 24 Matrix4x4(const Vector3 &a, const Vector3 &b, const Vector3 &c); 25 24 26 25 27 // Assignment operators … … 32 34 int Invert(); // Invert the matrix .. returns 0 = regular 33 35 void Transpose(); // Transpose the matrix 36 37 void 38 SetColumns(const Vector3 &a, const Vector3 &b, const Vector3 &c); 39 40 float Det3x3() const { 41 return (x[0][0]*x[1][1]*x[2][2] + \ 42 x[1][0]*x[2][1]*x[0][2] + \ 43 x[2][0]*x[0][1]*x[1][2] - \ 44 x[2][0]*x[1][1]*x[0][2] - \ 45 x[0][0]*x[2][1]*x[1][2] - \ 46 x[1][0]*x[0][1]*x[2][2]); 47 } 48 49 34 50 friend Matrix4x4 Invert(const Matrix4x4 &M); // Invert a given matrix 35 51 friend Matrix4x4 Transpose(const Matrix4x4 &M); // Transpose a given matrix … … 76 92 // Construct rotation description according VRML'97 specification 77 93 // const CVector4D SFRotation(void) const; 94 78 95 96 79 97 // Overloaded output operator. 80 98 friend ostream& operator<< (ostream &s, const Matrix4x4 &M); -
trunk/VUT/GtpVisibilityPreprocessor/src/Mesh.cpp
r191 r209 334 334 } 335 335 336 336 337 void 337 338 Mesh::AddTriangle(const Triangle3 &triangle) … … 345 346 AddFace(new Face(index + 0, index + 1, index + 2) ); 346 347 } 348 349 void 350 Mesh::AddRectangle(const Rectangle3 &rect) 351 { 352 int index = mVertices.size(); 353 354 for (int i=0; i < 4; i++) { 355 mVertices.push_back(rect.mVertices[i]); 356 } 357 358 AddFace(new Face(index + 0, index + 1, index + 2, index + 3) ); 359 } -
trunk/VUT/GtpVisibilityPreprocessor/src/Mesh.h
r191 r209 10 10 #include "Material.h" 11 11 12 classTriangle3;12 struct Triangle3; 13 13 class MeshInstance; 14 14 class MeshKdTree; … … 75 75 76 76 void AddTriangle(const Triangle3 &triangle); 77 void AddRectangle(const Rectangle3 &triangle); 77 78 78 79 void AddFace(Face *face) -
trunk/VUT/GtpVisibilityPreprocessor/src/MutualVisibility.cpp
r191 r209 1 #include <assert.h> 1 2 #include <stack> 2 3 using namespace std; … … 5 6 #include "Ray.h" 6 7 #include "MutualVisibility.h" 7 8 9 void 10 TriangleSample::Init( 11 const Triangle3 &source, 12 const Triangle3 &target) 8 #include "Exporter.h" 9 #include "Mesh.h" 10 #include "Triangle3.h" 11 12 void 13 RayShaft::Init( 14 const Rectangle3 &source, 15 const Rectangle3 &target) 13 16 { 14 17 mDepth = 0; … … 19 22 20 23 Vector3 21 TriangleSample::GetIntersectionPoint(const int rayIndex,22 24 RayShaft::GetIntersectionPoint(const int rayIndex, 25 const int depth) const 23 26 { 24 27 Vector3 origin, direction; … … 28 31 29 32 void 30 TriangleSample::GetRay(const int rayIndex, 31 Vector3 &origin, 32 Vector3 &direction) const 33 { 34 const int indices[][2] = { 35 {0,0}, {0,1}, {0,2}, 36 {1,0}, {1,1}, {1,2}, 37 {2,0}, {2,1}, {2,2} 38 }; 39 40 origin = mSource.mVertices[indices[rayIndex][0]]; 41 direction = mTarget.mVertices[indices[rayIndex][1]] - origin; 33 RayShaft::GetRay(const int rayIndex, 34 Vector3 &origin, 35 Vector3 &direction) const 36 { 37 38 assert(rayIndex < 4); 39 40 origin = mSource.mVertices[rayIndex]; 41 direction = mTarget.mVertices[rayIndex] - origin; 42 42 } 43 43 44 44 void 45 45 MutualVisibilitySampler::PerformSplit( 46 const TriangleSample&sample,46 const RayShaft &sample, 47 47 const bool splitSource, 48 const int edge, 49 const Vector3 &splitPoint, 50 const Ray &ray, 51 TriangleSample &sample1, 52 TriangleSample &sample2 48 const int axis, 49 RayShaft &sample1, 50 RayShaft &sample2 53 51 ) 54 52 { 55 56 57 const Triangle3 *triangle; 58 Triangle3 *triangle1, *triangle2; 53 54 59 55 // split the triangles 56 60 57 if (splitSource) { 61 58 sample1.mTarget = sample.mTarget; 62 59 sample2.mTarget = sample.mTarget; 63 triangle1 = &sample1.mSource; 64 triangle2 = &sample2.mSource; 65 triangle = &sample.mSource; 60 sample.mSource.Split( 61 axis, 62 sample1.mSource, 63 sample2.mSource); 66 64 } else { 65 67 66 sample1.mSource = sample.mSource; 68 67 sample2.mSource = sample.mSource; 69 triangle1 = &sample1.mTarget; 70 triangle2 = &sample2.mTarget; 71 triangle = &sample.mTarget; 68 69 sample.mTarget.Split( 70 axis, 71 sample1.mTarget, 72 sample2.mTarget); 72 73 } 73 74 74 75 // split the intersections 75 switch ( edge) {76 switch (axis) { 76 77 case 0: 77 78 sample1.mIntersections[0] = sample.mIntersections[0]; 78 sample1.mIntersections[1] = sample.mIntersections[1]; 79 triangle1->mVertices[0] = triangle->mVertices[0]; 80 triangle1->mVertices[1] = triangle->mVertices[1]; 81 82 sample2.mIntersections[0] = sample.mIntersections[2]; 83 sample2.mIntersections[1] = sample.mIntersections[0]; 84 triangle2->mVertices[0] = triangle->mVertices[2]; 85 triangle2->mVertices[1] = triangle->mVertices[0]; 79 sample1.mIntersections[3] = sample.mIntersections[3]; 80 81 sample2.mIntersections[1] = sample.mIntersections[1]; 82 sample2.mIntersections[2] = sample.mIntersections[2]; 86 83 break; 87 84 … … 89 86 sample1.mIntersections[0] = sample.mIntersections[0]; 90 87 sample1.mIntersections[1] = sample.mIntersections[1]; 91 triangle1->mVertices[0] = triangle->mVertices[0]; 92 triangle1->mVertices[1] = triangle->mVertices[1]; 93 94 sample2.mIntersections[0] = sample.mIntersections[1]; 95 sample2.mIntersections[1] = sample.mIntersections[2]; 96 triangle2->mVertices[0] = triangle->mVertices[1]; 97 triangle2->mVertices[1] = triangle->mVertices[2]; 88 89 sample2.mIntersections[2] = sample.mIntersections[2]; 90 sample2.mIntersections[2] = sample.mIntersections[3]; 98 91 break; 99 100 case 2: 101 sample1.mIntersections[0] = sample.mIntersections[2]; 102 sample1.mIntersections[1] = sample.mIntersections[0]; 103 triangle1->mVertices[0] = triangle->mVertices[2]; 104 triangle1->mVertices[1] = triangle->mVertices[0]; 105 106 sample2.mIntersections[0] = sample.mIntersections[1]; 107 sample2.mIntersections[1] = sample.mIntersections[2]; 108 triangle2->mVertices[0] = triangle->mVertices[1]; 109 triangle2->mVertices[1] = triangle->mVertices[2]; 110 break; 111 } 112 113 // the new sample 114 sample1.mIntersections[2] = ray.intersections; 115 sample2.mIntersections[2] = ray.intersections; 116 triangle1->mVertices[2] = splitPoint; 117 triangle2->mVertices[2] = splitPoint; 118 119 // establish the new samples 92 } 93 94 // the intersections for the new shaft rays will be established 95 // later 120 96 sample1.mDepth = sample2.mDepth = sample.mDepth+1; 121 97 } 122 98 123 99 float 124 MutualVisibilitySampler::GetSpatialAngle(const TriangleSample&sample,100 MutualVisibilitySampler::GetSpatialAngle(const RayShaft &sample, 125 101 const Vector3 &point 126 102 ) 127 103 { 128 const int sampleIndices[][3]={ 129 (0,0,0), 130 (0,1,0), 131 (-1,-1,-1) 104 const int sampleIndices[][2]={ 105 (0,1,2), 106 (0,2,3) 132 107 }; 133 108 … … 135 110 int i; 136 111 137 for (i=0; i < 10; i++) {112 for (i=0; i < 2; i++) { 138 113 Triangle3 triangle(sample.GetIntersectionPoint(sampleIndices[i][0], 0), 139 sample.GetIntersectionPoint(sampleIndices[i][1], 0), 140 sample.GetIntersectionPoint(sampleIndices[i][2], 0)); 141 114 sample.GetIntersectionPoint(sampleIndices[i][1], 0), 115 sample.GetIntersectionPoint(sampleIndices[i][2], 0)); 142 116 sum += triangle.GetSpatialAngle(point); 143 117 } 118 144 119 return sum; 145 120 } … … 147 122 148 123 void 149 MutualVisibilitySampler::ComputeError( TriangleSample&sample)124 MutualVisibilitySampler::ComputeError(RayShaft &sample) 150 125 { 151 126 // evaluate minimal error which can be achieved by more precise evaluation … … 166 141 167 142 168 169 170 171 143 void 172 144 MutualVisibilitySampler::ConstructInitialSamples( 173 145 const AxisAlignedBox3 &source, 174 146 const AxisAlignedBox3 &target, 175 vector< TriangleSample*> &samples147 vector<RayShaft *> &samples 176 148 ) 177 149 { 178 // get all rectangles potentially visible from the source box 150 Vector3 normal = target.Center() - source.Center(); 151 152 Plane3 sourcePlane(normal, source.GetVertex(0)); 179 153 int i; 180 int sourceMask = 0; 181 for (i=0; i < 8; i++) 182 sourceMask |= source.GetFaceVisibilityMask(target.GetVertex(i)); 183 184 // now for each visble source face find all visible target faces 185 for (i=0; i < 6; i++) { 186 Rectangle3 sourceFace = source.GetFace(i); 187 if ( sourceMask &(1<<i) ) { 188 int mask = target.GetFaceVisibilityMask(sourceFace); 189 // construct triangle samples for all visible rectangles 190 for (int j=0; j < 6; j++) 191 if (mask & (1<<j)) { 192 AddInitialSamples(sourceFace, target.GetFace(j), samples); 193 } 194 } 195 } 154 for (i=1; i < 8; i++) { 155 Vector3 v = source.GetVertex(i); 156 if (sourcePlane.Distance(v) > 0) 157 sourcePlane = Plane3(normal, v); 158 } 159 160 Plane3 targetPlane(-normal, target.GetVertex(0)); 161 for (i=1; i < 8; i++) { 162 Vector3 v = target.GetVertex(i); 163 if (targetPlane.Distance(v) > 0) 164 targetPlane = Plane3(-normal, v); 165 } 166 167 168 Vector3 xBasis = CrossProd(Vector3(0,1,0), normal); 169 170 if (Magnitude(xBasis) > 1e-6) 171 xBasis.Normalize(); 172 else { 173 xBasis = CrossProd(Vector3(0,0,1), normal); 174 } 175 176 Vector3 yBasis = Normalize( CrossProd(normal, xBasis) ); 177 178 Plane3 bottomPlane(xBasis, source.Center()); 179 Plane3 sidePlane(yBasis, source.Center()); 180 181 // cast rays between corresponding vertices of the boxes 182 for (i=0; i < 8; i++) { 183 184 185 } 186 187 // AddInitialSamples(sourceRectangle, targetRectangle, samples); 196 188 } 197 189 … … 200 192 const Rectangle3 &sourceRect, 201 193 const Rectangle3 &targetRect, 202 vector< TriangleSample*> &samples194 vector<RayShaft *> &samples 203 195 ) 204 196 { 205 Triangle3 sourceTriangles[2]; 206 Triangle3 targetTriangles[2]; 207 208 sourceTriangles[0].Init(sourceRect.mVertices[0], 209 sourceRect.mVertices[1], 210 sourceRect.mVertices[2]); 211 212 sourceTriangles[1].Init(sourceRect.mVertices[0], 213 sourceRect.mVertices[2], 214 sourceRect.mVertices[3]); 215 216 targetTriangles[0].Init(targetRect.mVertices[0], 217 targetRect.mVertices[1], 218 targetRect.mVertices[2]); 219 220 targetTriangles[1].Init(targetRect.mVertices[0], 221 targetRect.mVertices[2], 222 targetRect.mVertices[3]); 223 int i, j; 224 for (i=0; i < 2; i++) 225 for (j=0; j < 2; j++) { 226 TriangleSample *sample = new TriangleSample(sourceTriangles[i], 227 targetTriangles[j]); 228 samples.push_back(sample); 197 198 RayShaft *sample = new RayShaft(sourceRect, 199 targetRect); 200 samples.push_back(sample); 201 } 202 203 204 void 205 MutualVisibilitySampler::ExportSamples(vector<RayShaft *> &samples) 206 { 207 static int id = 0; 208 char filename[64]; 209 if (id > 20) 210 return; 211 212 for (int i=0; i < samples.size(); i++) { 213 sprintf(filename, "samples%04d-%02d.x3d", id++, i); 214 Exporter *exporter = Exporter::GetExporter(filename); 215 exporter->SetFilled(); 216 217 218 RayShaft *sample = samples[i]; 219 Mesh *mesh = new Mesh; 220 mesh->AddRectangle(sample->mSource); 221 mesh->AddRectangle(sample->mTarget); 222 vector<Ray> rays; 223 for (int j=0; j < 4; j++) { 224 Vector3 origin, direction; 225 sample->GetRay(j, origin, direction); 226 Ray ray(origin, direction, Ray::LINE_SEGMENT); 227 rays.push_back(ray); 229 228 } 229 230 Material m = RandomMaterial(); 231 exporter->SetForcedMaterial(m); 232 MeshInstance mi(mesh); 233 exporter->ExportIntersectable(&mi); 234 exporter->ExportRays(rays, -1.0f, m.mDiffuseColor); 235 delete exporter; 236 } 230 237 } 231 238 … … 233 240 MutualVisibilitySampler::ComputeVisibility() 234 241 { 235 stack<TriangleSample *> sampleStack; 242 243 vector<RayShaft *> samples; 244 ConstructInitialSamples(mSource, mTarget, samples); 245 ExportSamples(samples); 246 247 stack<RayShaft *> sampleStack; 248 249 236 250 237 251 Ray ray; 238 252 // now process the samples as long as we have something to do 239 253 while (!sampleStack.empty()) { 240 TriangleSample*sample = sampleStack.top();254 RayShaft *sample = sampleStack.top(); 241 255 sampleStack.pop(); 242 256 … … 248 262 249 263 // // generate 2 new samples 250 // TriangleSamplenewSamples[2];264 // RayShaft newSamples[2]; 251 265 // sample.Split(triangleSplitEdge, ray, newSamples[0], newSamples[1]); 252 266 // for (i=0; i < 2; i++) { … … 258 272 // } 259 273 } 274 275 for (int i=0; i < samples.size(); i++) 276 delete samples[i]; 260 277 return INVISIBLE; 261 278 } … … 281 298 MutualVisibilitySampler sampler(kdTree, source, target, solidAngleThreshold); 282 299 300 283 301 int visibility = sampler.ComputeVisibility(); 284 302 -
trunk/VUT/GtpVisibilityPreprocessor/src/MutualVisibility.h
r191 r209 4 4 #include "Vector3.h" 5 5 #include "Ray.h" 6 #include "Triangle3.h"7 6 8 7 class Intersectable; 9 8 class AxisAlignedBox3; 10 11 12 13 9 14 10 struct SimpleRay { … … 18 14 19 15 20 struct TriangleSample{16 struct RayShaft { 21 17 public: 22 18 /// evaluted sampling error … … 25 21 int mDepth; 26 22 /// The source triangle 27 Triangle3 mSource;23 Rectangle3 mSource; 28 24 /// The target triangle 29 Triangle3 mTarget;25 Rectangle3 mTarget; 30 26 31 27 /// intersections with the scene 32 vector<Ray::Intersection> mIntersections[ 9];28 vector<Ray::Intersection> mIntersections[4]; 33 29 34 30 void ComputeError(); 35 31 36 TriangleSample() {}32 RayShaft () {} 37 33 38 TriangleSample(39 const Triangle3 &source,40 const Triangle3 &target)34 RayShaft ( 35 const Rectangle3 &source, 36 const Rectangle3 &target) 41 37 { 42 38 Init(source, target); 43 39 } 44 40 45 41 // initial triangle sample 46 42 void Init( 47 const Triangle3 &source,48 const Triangle3 &target);43 const Rectangle3 &source, 44 const Rectangle3 &target); 49 45 50 46 Vector3 51 47 GetIntersectionPoint(const int rayIndex, 52 48 const int depth) const; 53 49 54 50 void GetRay(const int rayIndex, 55 51 Vector3 &origin, 56 52 Vector3 &direction) const; 57 58 53 }; 59 54 … … 80 75 const AxisAlignedBox3 &source, 81 76 const AxisAlignedBox3 &target, 82 vector< TriangleSample*> &samples77 vector<RayShaft *> &samples 83 78 ); 84 79 … … 87 82 const Rectangle3 &sourceRect, 88 83 const Rectangle3 &targetRect, 89 vector< TriangleSample*> &samples84 vector<RayShaft *> &samples 90 85 ); 91 86 … … 94 89 bool 95 90 SplitSample( 96 const TriangleSample&source,97 TriangleSample&sample1,98 TriangleSample&sample291 const RayShaft &source, 92 RayShaft &sample1, 93 RayShaft &sample2 99 94 ); 100 95 void 101 96 PerformSplit( 102 const TriangleSample&sample,97 const RayShaft &sample, 103 98 const bool splitSource, 104 const int edge, 105 const Vector3 &splitPoint, 106 const Ray &ray, 107 TriangleSample &sample1, 108 TriangleSample &sample2 99 const int axis, 100 RayShaft &sample1, 101 RayShaft &sample2 109 102 ); 110 103 … … 112 105 bool 113 106 SampleTerminationCriteriaMet( 114 const TriangleSample&sample);107 const RayShaft &sample); 115 108 116 109 float 117 GetSpatialAngle(const TriangleSample&sample,110 GetSpatialAngle(const RayShaft &sample, 118 111 const Vector3 &point 119 112 ); 120 113 121 114 void 122 ComputeError(TriangleSample &sample); 115 ComputeError(RayShaft &sample); 116 117 void 118 ExportSamples(vector<RayShaft *> &samples); 123 119 124 120 -
trunk/VUT/GtpVisibilityPreprocessor/src/Plane3.h
r177 r209 20 20 mNormal = Normalize(CrossProd(v2,v1)); 21 21 mD = -DotProd(b, mNormal); 22 } 22 23 24 Plane3(const Vector3 &normal, 25 const Vector3 &point 26 ):mNormal(normal) 27 { 28 mD = -DotProd(normal, point); 23 29 } 24 30 … … 30 36 return signum(Distance(v), threshold); 31 37 } 38 39 Vector3 FindIntersection(const Vector3 &a, 40 const Vector3 &b, 41 float *t = NULL, 42 bool *coplanar = NULL 43 ) const; 44 45 friend bool 46 PlaneIntersection(const Plane3 &a, const Plane3 &b, const Plane3 &c, Vector3 &result); 32 47 33 48 friend ostream &operator<<(ostream &s, const Plane3 p) { … … 36 51 } 37 52 53 38 54 }; 39 55 -
trunk/VUT/GtpVisibilityPreprocessor/src/Ray.h
r191 r209 21 21 { 22 22 public: 23 enum RayType { LOCAL_RAY, GLOBAL_RAY };23 enum RayType { LOCAL_RAY, GLOBAL_RAY, LINE_SEGMENT }; 24 24 25 25 enum { NO_INTERSECTION=0, INTERSECTION_OUT_OF_LIMITS, INTERSECTION }; … … 66 66 const void *_originCell = NULL) { 67 67 loc = wherefrom; 68 dir = Normalize(whichdir); 68 if (_type == LINE_SEGMENT) 69 dir = whichdir; 70 else 71 dir = Normalize(whichdir); 69 72 mType = _type; 70 73 depth = 0; -
trunk/VUT/GtpVisibilityPreprocessor/src/Rectangle3.h
r191 r209 4 4 #include "Vector3.h" 5 5 6 /// rectangle vertices 7 // 3 2 8 // 0 1 6 9 class Rectangle3 { 7 10 public: 8 11 Vector3 mVertices[4]; 9 12 13 Rectangle3() {} 14 10 15 Rectangle3(const Vector3 &v0, 11 16 const Vector3 &v1, … … 28 33 } 29 34 35 36 void 37 Split(const int axis, 38 Rectangle3 &r1, 39 Rectangle3 &r2 40 ) const; 41 42 30 43 31 44 }; -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r191 r209 124 124 } 125 125 126 if (0 && pvsSize && pass == 100 ) {126 if (0 && pvsSize && pass == 50 ) { 127 127 // mail all nodes from the pvs 128 128 Intersectable::NewMail(); … … 147 147 148 148 } 149 150 151 149 // now rank all the neighbors according to probability that a new 152 150 // sample creates some contribution -
trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp
r191 r209 36 36 stream<<"</Appearance>"<<endl; 37 37 38 stream<<"<IndexedLineSet c cw=\"TRUE\" coordIndex=\""<<endl;38 stream<<"<IndexedLineSet coordIndex=\""<<endl; 39 39 40 40 int index = 0; -
trunk/VUT/GtpVisibilityPreprocessor/src/default.env
r191 r209 8 8 # filename glasgow1.x3d 9 9 # filename vienna.x3d 10 # filenameatlanta2.x3d11 # filename soda.dat12 filenamesoda5.dat10 filename ../data/atlanta/atlanta2.x3d 11 # filename ../data/soda/soda.dat 12 # filename ../data/soda/soda5.dat 13 13 14 14 } -
trunk/VUT/GtpVisibilityPreprocessor/src/preprocessor.pro
r191 r209 32 32 Matrix4x4.cpp Vector3.cpp AxisAlignedBox3.cpp Ray.cpp main.cpp Mesh.cpp \ 33 33 Exporter.cpp Camera.cpp X3dParser.cpp MeshKdTree.cpp Pvs.cpp \ 34 MutualVisibility.cpp Triangle3.cpp 34 MutualVisibility.cpp Triangle3.cpp Rectangle3.cpp Plane3.cpp 35 35 36 36
Note: See TracChangeset
for help on using the changeset viewer.