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

Function GetInOutCell

Filters/ParallelDIY2/vtkProbeLineFilter.cxx:173–199  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Return the entry point and exit point of a given cell for the segment [p1,p2].

Source from the content-addressed store, hash-verified

171//------------------------------------------------------------------------------
172// Return the entry point and exit point of a given cell for the segment [p1,p2].
173HitCellInfo GetInOutCell(const vtkVector3d& p1, const vtkVector3d& p2, vtkIdType cellId,
174 vtkDataSet* input, double tolerance)
175{
176 HitCellInfo res;
177 res.CellId = cellId;
178
179 vtkCell* cell = input->GetCell(cellId);
180 double t;
181 int subId;
182 if (cell->IntersectWithLine(
183 p1.GetData(), p2.GetData(), tolerance, t, res.InPos.data(), res.InPCoords.data(), subId))
184 {
185 res.InT = t;
186 }
187 if (cell->IntersectWithLine(
188 p2.GetData(), p1.GetData(), tolerance, t, res.OutPos.data(), res.OutPCoords.data(), subId))
189 {
190 res.OutT = 1.0 - t;
191 }
192
193 if (vtkMathUtilities::FuzzyCompare(res.InT, res.OutT, tolerance))
194 {
195 res.InT = res.OutT = -1.0;
196 }
197
198 return res;
199}
200}
201
202VTK_ABI_NAMESPACE_BEGIN

Callers 1

IntersectCellsMethod · 0.85

Calls 5

FuzzyCompareFunction · 0.50
GetCellMethod · 0.45
IntersectWithLineMethod · 0.45
GetDataMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected