| 164 | } |
| 165 | |
| 166 | void test_Triangle(ostream& strm) |
| 167 | { |
| 168 | double dist2; |
| 169 | int subId; |
| 170 | |
| 171 | vtkNew<vtkTriangle> triangle; |
| 172 | double triangleCoords[3], triangleWeights[3], trianglePosition[3]; |
| 173 | double trianglePoint[4][3] = { { 10.0, 10.0, 10.0 }, { 12.0, 10.0, 10.0 }, { 11.0, 12.0, 12.0 }, |
| 174 | { 11, 11, 11 } }; |
| 175 | double triangleClosest[3]; |
| 176 | |
| 177 | triangle->GetPointIds()->SetId(0, 0); |
| 178 | triangle->GetPointIds()->SetId(1, 1); |
| 179 | triangle->GetPointIds()->SetId(2, 2); |
| 180 | |
| 181 | triangle->GetPoints()->SetPoint(0, 10.0, 10.0, 10.0); |
| 182 | triangle->GetPoints()->SetPoint(1, 12.0, 10.0, 10.0); |
| 183 | triangle->GetPoints()->SetPoint(2, 11.0, 12.0, 12.0); |
| 184 | |
| 185 | int n = sizeof(trianglePoint) / (3 * sizeof(double)); |
| 186 | for (int j = 0; j < n; j++) |
| 187 | { |
| 188 | triangle->EvaluatePosition(&trianglePoint[j][0], &triangleClosest[0], subId, &triangleCoords[0], |
| 189 | dist2, &triangleWeights[0]); |
| 190 | strm << "vtkTriangle (" << trianglePoint[j][0] << ", " << trianglePoint[j][1] << ", " |
| 191 | << trianglePoint[j][2] << ")" << std::endl; |
| 192 | strm << "\tclosest: " << triangleClosest[0] << ", " << triangleClosest[1] << ", " |
| 193 | << triangleClosest[2] << std::endl; |
| 194 | strm << "\tcoords: " << triangleCoords[0] << ", " << triangleCoords[1] << ", " |
| 195 | << triangleCoords[2] << std::endl; |
| 196 | strm << "\tweights: " << triangleWeights[0] << ", " << triangleWeights[1] << ", " |
| 197 | << triangleWeights[2] << std::endl; |
| 198 | strm << "\tsubid: " << subId << std::endl; |
| 199 | strm << "\tdist2: " << dist2 << std::endl; |
| 200 | triangle->EvaluateLocation(subId, triangleCoords, trianglePosition, triangleWeights); |
| 201 | strm << "\tposition: " << trianglePosition[0] << ", " << trianglePosition[1] << ", " |
| 202 | << trianglePosition[2] << std::endl; |
| 203 | strm << std::endl; |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | void test_TriangleStrip(ostream& strm) |
| 208 | { |
no test coverage detected