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

Method AddToPointEdgeMap

Filters/General/vtkIntersectionPolyDataFilter.cxx:1217–1254  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1215
1216//------------------------------------------------------------------------------
1217int vtkIntersectionPolyDataFilter::Impl ::AddToPointEdgeMap(int index, vtkIdType ptId, double x[3],
1218 vtkPolyData* mesh, vtkIdType cellId, vtkIdType edgeId, vtkIdType lineId,
1219 const vtkIdType triPtIds[3])
1220{
1221 int value = -1;
1222 vtkIdType edgePtId0 = triPtIds[edgeId];
1223 vtkIdType edgePtId1 = triPtIds[(edgeId + 1) % 3];
1224 double pt0[3], pt1[3];
1225
1226 mesh->GetPoint(edgePtId0, pt0);
1227 mesh->GetPoint(edgePtId1, pt1);
1228
1229 // Check to see if this point-cell combo is already in the list
1230 PointEdgeMapIteratorType iterLower = this->PointEdgeMap[index]->lower_bound(ptId);
1231 PointEdgeMapIteratorType iterUpper = this->PointEdgeMap[index]->upper_bound(ptId);
1232
1233 while (iterLower != iterUpper)
1234 {
1235 if (iterLower->second.CellId == cellId)
1236 {
1237 return iterLower->second.EdgeId;
1238 }
1239 ++iterLower;
1240 }
1241
1242 double t, dist, closestPt[3];
1243 dist = vtkLine::DistanceToLine(x, pt0, pt1, t, closestPt);
1244 if (fabs(dist) < pow(this->Tolerance, 3) && t >= 0.0 && t <= 1.0)
1245 {
1246 CellEdgeLineType cellEdgeLine;
1247 cellEdgeLine.CellId = cellId;
1248 cellEdgeLine.EdgeId = edgeId;
1249 cellEdgeLine.LineId = lineId;
1250 this->PointEdgeMap[index]->insert(std::make_pair(ptId, cellEdgeLine));
1251 value = edgeId;
1252 }
1253 return value;
1254}
1255
1256//------------------------------------------------------------------------------
1257

Callers 1

Calls 4

lower_boundMethod · 0.80
powFunction · 0.50
GetPointMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected