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

Method FillTube

Imaging/Sources/vtkImageCanvasSource2D.cxx:398–433  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Fill a tube (thick line for initial 2D implementation).

Source from the content-addressed store, hash-verified

396//------------------------------------------------------------------------------
397// Fill a tube (thick line for initial 2D implementation).
398void vtkImageCanvasSource2D::FillTube(int a0, int a1, int b0, int b1, double radius)
399{
400 void* ptr;
401 int z = this->DefaultZ;
402 int* extent = this->ImageData->GetExtent();
403
404 // Pre-multiply coords if needed
405 if (this->Ratio[0] != 1.0)
406 {
407 a0 = int(double(a0) * this->Ratio[0]);
408 b0 = int(double(b0) * this->Ratio[0]);
409 radius = int(radius * this->Ratio[0]);
410 }
411 if (this->Ratio[1] != 1.0)
412 {
413 a1 = int(double(a1) * this->Ratio[1]);
414 b1 = int(double(b1) * this->Ratio[1]);
415 }
416 if (this->Ratio[2] != 1.0)
417 {
418 z = int(double(z) * this->Ratio[2]);
419 }
420
421 z = (z < extent[4]) ? extent[4] : z;
422 z = (z > extent[5]) ? extent[5] : z;
423
424 ptr = this->ImageData->GetScalarPointer(extent[0], extent[2], z);
425 switch (this->ImageData->GetScalarType())
426 {
427 vtkTemplateMacro(vtkImageCanvasSource2DFillTube(
428 this->ImageData, this->DrawColor, static_cast<VTK_TT*>(ptr), a0, a1, b0, b1, radius));
429 default:
430 vtkErrorMacro(<< "FillTube: Cannot handle ScalarType.");
431 }
432 this->Modified();
433}
434
435//------------------------------------------------------------------------------
436// Fill a triangle (rasterize)

Callers 3

TestSkeleton2D.pyFile · 0.80

Calls 5

GetScalarPointerMethod · 0.80
GetExtentMethod · 0.45
GetScalarTypeMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected