- Timestamp:
- 01/04/06 20:03:54 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/Makefile
r496 r499 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.0) on: st 4. I 1 5:01:5520063 # Generated by qmake (2.00a) (Qt 4.1.0) on: st 4. I 19:53:26 2006 4 4 # Project: preprocessor.pro 5 5 # Template: app -
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
r492 r499 56 56 ) 57 57 { 58 int hits = 0; 58 59 int hits = 0; 59 60 static Ray ray; 60 61 AxisAlignedBox3 box = mKdTree->GetBox(); … … 64 65 if (!sbox.IsInside(viewPoint)) 65 66 return 0; 66 67 67 68 SetupRay(ray, viewPoint, direction); 68 69 // cast ray to KD tree to find intersection with other objects … … 70 71 Vector3 pointA, pointB; 71 72 float bsize = Magnitude(box.Size()); 73 74 72 75 if (mKdTree->CastRay(ray)) { 73 76 objectA = ray.intersections[0].mObject; … … 77 80 // compute intersection with the scene bounding box 78 81 float tmin, tmax; 79 box.ComputeMinMaxT(ray, &tmin, &tmax); 80 if (tmax > bsize) { 81 // cerr<<"Warning: tmax > box size tmax="<<tmax<<" tmin="<<tmin<<" size="<<bsize<<endl; 82 // cerr<<"ray"<<ray<<endl; 83 } 84 pointA = ray.Extrap(tmax); 85 82 if (box.ComputeMinMaxT(ray, &tmin, &tmax) && tmin < tmax) 83 pointA = ray.Extrap(tmax); 84 else 85 return 0; 86 86 } 87 87 88 88 bool detectEmptyViewSpace = true; 89 89 90 90 if (detectEmptyViewSpace) { 91 91 SetupRay(ray, pointA, -direction); 92 92 } else 93 93 SetupRay(ray, viewPoint, -direction); 94 94 95 95 96 if (mKdTree->CastRay(ray)) { 96 97 97 objectB = ray.intersections[0].mObject; 98 98 pointB = ray.Extrap(ray.intersections[0].mT); 99 100 99 } else { 101 100 objectB = NULL; 102 101 float tmin, tmax; 103 box.ComputeMinMaxT(ray, &tmin, &tmax); 104 if (tmax > bsize) { 105 // cerr<<"Warning: tmax > box size tmax="<<tmax<<" tmin="<<tmin<<" size="<<bsize<<endl; 106 // cerr<<"ray"<<ray<<endl; 107 } 108 109 pointB = ray.Extrap(tmax); 110 } 111 102 if (box.ComputeMinMaxT(ray, &tmin, &tmax) && tmin < tmax) 103 pointB = ray.Extrap(tmax); 104 else 105 return 0; 106 } 107 108 // if (objectA == NULL && objectB != NULL) { 109 if (1) { 110 // cast again to ensure that there is no objectA 111 SetupRay(ray, pointB, direction); 112 if (mKdTree->CastRay(ray)) { 113 objectA = ray.intersections[0].mObject; 114 pointA = ray.Extrap(ray.intersections[0].mT); 115 } 116 } 117 118 112 119 VssRay *vssRay = NULL; 113 120 114 bool validSample = true; 115 if (detectEmptyViewSpace) { 121 bool validSample = (objectA != objectB); 122 if (0 && detectEmptyViewSpace) { // consider all samples valid 123 // check if the viewpoint lies on the line segment AB 116 124 if (Distance(pointA, pointB) < 117 125 Distance(viewPoint, pointA) + Distance(viewPoint, pointB) - Limits::Small) { … … 119 127 } 120 128 } 121 129 122 130 if (validSample) { 123 131 if (objectA) { … … 125 133 pointA, 126 134 objectB, 127 objectA); 135 objectA, 136 mPass 137 ); 128 138 vssRays.push_back(vssRay); 129 139 hits ++; 130 140 } 131 141 132 142 if (objectB) { 133 143 vssRay = new VssRay(pointA, 134 144 pointB, 135 145 objectA, 136 objectB); 146 objectB, 147 mPass 148 ); 137 149 vssRays.push_back(vssRay); 138 150 hits ++; 139 151 } 140 152 } 141 153 142 154 return hits; 143 155 }
Note: See TracChangeset
for help on using the changeset viewer.