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

Method InitWithPoints

Testing/GenericBridge/vtkBridgeCellIteratorOne.cxx:198–263  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Description: Used internally by vtkBridgeCell. Iterate on a boundary cell (defined by its points `pts' with coordinates `coords', dimension `dim' and unique id `cellid') of a cell. \pre coords_exist: coords!=0 \pre pts_exist: pts!=0 \pre valid_dim: dim>=0 && dim<=2 \pre valid_points: pts->GetNumberOfIds()>dim

Source from the content-addressed store, hash-verified

196// \pre valid_dim: dim>=0 && dim<=2
197// \pre valid_points: pts->GetNumberOfIds()>dim
198void vtkBridgeCellIteratorOne::InitWithPoints(
199 vtkPoints* coords, vtkIdList* pts, int dim, vtkIdType cellid)
200{
201 assert("pre: coords_exist" && coords != nullptr);
202 assert("pre: pts_exist" && pts != nullptr);
203 assert("pre: valid_dim" && dim >= 0 && dim <= 2);
204 assert("pre: valid_points" && pts->GetNumberOfIds() > dim);
205
206 if ((this->DataSet == nullptr) && (this->InternalCell == nullptr))
207 {
208 // previous mode was InitWithOneCell(vtkBridgeCell *c)
209 // this->Cell->Delete();
210 this->Cell = nullptr;
211 }
212
213 if (this->Cell == nullptr)
214 {
215 // first init or previous mode was InitWithOneCell(vtkBridgeCell *c)
216 this->Cell = vtkBridgeCell::New();
217 }
218
219 vtkCell* cell = nullptr;
220
221 switch (dim)
222 {
223 case 2:
224 if (pts->GetNumberOfIds() == 3)
225 {
226 cell = vtkTriangle::New();
227 }
228 else
229 {
230 cell = vtkPolygon::New();
231 }
232 break;
233 case 1:
234 // line or polyline
235 if (pts->GetNumberOfIds() == 2)
236 {
237 cell = vtkLine::New();
238 }
239 else
240 {
241 cell = vtkPolyLine::New();
242 }
243 break;
244 case 0:
245 // vertex polyvertex
246 if (pts->GetNumberOfIds() == 1)
247 {
248 cell = vtkVertex::New();
249 }
250 else
251 {
252 cell = vtkPolyVertex::New();
253 }
254 break;
255 }

Callers

nothing calls this directly

Calls 4

assertFunction · 0.50
NewFunction · 0.50
GetNumberOfIdsMethod · 0.45
InitWithCellMethod · 0.45

Tested by

no test coverage detected