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

Function test_PolyLine

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

Source from the content-addressed store, hash-verified

126}
127
128void test_PolyLine(ostream& strm)
129{
130 double dist2;
131 int subId;
132
133 vtkNew<vtkPolyLine> polyLine;
134 double polyLineCoords[3], polyLineWeights[3];
135 double polyLinePoint[4][3] = { { 10.0, 20.0, 30.0 }, { 10.0, 30.0, 30.0 }, { 10.0, 30.0, 40.0 },
136 { 0, 0, 0 } };
137 double polyLineClosest[3];
138
139 polyLine->GetPointIds()->SetNumberOfIds(3);
140 polyLine->GetPointIds()->SetId(0, 0);
141 polyLine->GetPointIds()->SetId(1, 1);
142 polyLine->GetPointIds()->SetId(2, 2);
143
144 polyLine->GetPoints()->SetNumberOfPoints(3);
145 polyLine->GetPoints()->SetPoint(0, 10.0, 20.0, 30.0);
146 polyLine->GetPoints()->SetPoint(1, 10.0, 30.0, 30.0);
147 polyLine->GetPoints()->SetPoint(2, 10.0, 30.0, 40.0);
148
149 int n = sizeof(polyLinePoint) / (3 * sizeof(double));
150 for (int j = 0; j < n; j++)
151 {
152 polyLine->EvaluatePosition(&polyLinePoint[j][0], &polyLineClosest[0], subId, &polyLineCoords[0],
153 dist2, &polyLineWeights[0]);
154 strm << "vtkPolyLine (" << polyLinePoint[j][0] << ", " << polyLinePoint[j][1] << ", "
155 << polyLinePoint[j][2] << ")" << std::endl;
156 strm << "\tclosest: " << polyLineClosest[0] << ", " << polyLineClosest[1] << ", "
157 << polyLineClosest[2] << std::endl;
158 strm << "\tcoords: " << polyLineCoords[0] << std::endl;
159 strm << "\tweights: " << polyLineWeights[0] << std::endl;
160 strm << "\tsubid: " << subId << std::endl;
161 strm << "\tdist2: " << dist2 << std::endl;
162 strm << std::endl;
163 }
164}
165
166void test_Triangle(ostream& strm)
167{

Callers 1

TestOCPFunction · 0.85

Calls 7

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

Tested by

no test coverage detected