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

Method SampleEdge

Filters/Modeling/vtkPolyDataPointSampler.cxx:244–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242 }
243
244 void SampleEdge(vtkIdType p0, vtkIdType p1) override
245 {
246 double x0[3], x1[3];
247 this->InPts->GetPoint(p0, x0);
248 this->InPts->GetPoint(p1, x1);
249 double len = vtkMath::Distance2BetweenPoints(x0, x1);
250 if (len > this->Distance2)
251 {
252 vtkIdType pId;
253 double t, x[3];
254 len = sqrt(len);
255 int npts = static_cast<int>(len / this->Distance) + 2;
256 for (vtkIdType id = 1; id < (npts - 1); id++)
257 {
258 t = static_cast<double>(id) / (npts - 1);
259 x[0] = x0[0] + t * (x1[0] - x0[0]);
260 x[1] = x0[1] + t * (x1[1] - x0[1]);
261 x[2] = x0[2] + t * (x1[2] - x0[2]);
262 pId = this->OutPts->InsertNextPoint(x);
263 if (this->InPD)
264 {
265 this->OutPD->InterpolateEdge(this->InPD, pId, p0, p1, t);
266 }
267 }
268 }
269 }
270
271 void SampleTriangle(const vtkIdType* pts) override
272 {

Callers 1

SamplePolygonMethod · 0.95

Calls 4

sqrtFunction · 0.50
GetPointMethod · 0.45
InsertNextPointMethod · 0.45
InterpolateEdgeMethod · 0.45

Tested by

no test coverage detected