MCPcopy Create free account
hub / github.com/Kitware/VTK / test_TriangleStrip

Function test_TriangleStrip

Common/DataModel/Testing/Cxx/otherCellPosition.cxx:207–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207void test_TriangleStrip(ostream& strm)
208{
209 double dist2;
210 int subId;
211
212 vtkNew<vtkTriangleStrip> triangleStrip;
213 double triangleStripCoords[3], triangleStripWeights[4], triangleStripPosition[3];
214 double triangleStripPoint[5][3] = { { 10.0, 10.0, 10.0 }, { 12.0, 10.0, 10.0 },
215 { 11.0, 12.0, 10.0 }, { 13, 10, 10 }, { 11, 11, 10 } };
216 double triangleStripClosest[3];
217
218 triangleStrip->GetPointIds()->SetNumberOfIds(4);
219 triangleStrip->GetPointIds()->SetId(0, 0);
220 triangleStrip->GetPointIds()->SetId(1, 1);
221 triangleStrip->GetPointIds()->SetId(2, 2);
222 triangleStrip->GetPointIds()->SetId(3, 3);
223
224 triangleStrip->GetPoints()->SetNumberOfPoints(4);
225 triangleStrip->GetPoints()->SetPoint(0, 10.0, 10.0, 10.0);
226 triangleStrip->GetPoints()->SetPoint(1, 12.0, 10.0, 10.0);
227 triangleStrip->GetPoints()->SetPoint(2, 11.0, 12.0, 10.0);
228 triangleStrip->GetPoints()->SetPoint(3, 13.0, 10.0, 10.0);
229
230 int n = sizeof(triangleStripPoint) / (3 * sizeof(double));
231 for (int j = 0; j < n; j++)
232 {
233 triangleStrip->EvaluatePosition(&triangleStripPoint[j][0], &triangleStripClosest[0], subId,
234 &triangleStripCoords[0], dist2, &triangleStripWeights[0]);
235 strm << "vtkTriangleStrip (" << triangleStripPoint[j][0] << ", " << triangleStripPoint[j][1]
236 << ", " << triangleStripPoint[j][2] << ")" << std::endl;
237 strm << "\tclosest: " << triangleStripClosest[0] << ", " << triangleStripClosest[1] << ", "
238 << triangleStripClosest[2] << std::endl;
239 strm << "\tcoords: " << triangleStripCoords[0] << ", " << triangleStripCoords[1] << ", "
240 << triangleStripCoords[2] << std::endl;
241 strm << "\tweights: " << triangleStripWeights[0] << ", " << triangleStripWeights[1] << ", "
242 << triangleStripWeights[2] << std::endl;
243 strm << "\tsubid: " << subId << std::endl;
244 strm << "\tdist2: " << dist2 << std::endl;
245 triangleStrip->EvaluateLocation(
246 subId, triangleStripCoords, triangleStripPosition, triangleStripWeights);
247 strm << "\tposition: " << triangleStripPosition[0] << ", " << triangleStripPosition[1] << ", "
248 << triangleStripPosition[2] << std::endl;
249 strm << std::endl;
250 }
251}
252
253void test_Quad(ostream& strm)
254{

Callers 1

TestOCPFunction · 0.85

Calls 8

SetNumberOfIdsMethod · 0.80
GetPointIdsMethod · 0.45
SetIdMethod · 0.45
SetNumberOfPointsMethod · 0.45
GetPointsMethod · 0.45
SetPointMethod · 0.45
EvaluatePositionMethod · 0.45
EvaluateLocationMethod · 0.45

Tested by

no test coverage detected