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

Method FillTriangle

Imaging/Sources/vtkImageCanvasSource2D.cxx:563–595  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

561//------------------------------------------------------------------------------
562// Fill a tube (thick line for initial 2D implementation).
563void vtkImageCanvasSource2D::FillTriangle(int a0, int a1, int b0, int b1, int c0, int c1)
564{
565 void* ptr;
566 int z = this->DefaultZ;
567
568 // Pre-multiply coords if needed
569 if (this->Ratio[0] != 1.0)
570 {
571 a0 = static_cast<int>(static_cast<double>(a0) * this->Ratio[0]);
572 b0 = static_cast<int>(static_cast<double>(b0) * this->Ratio[0]);
573 c0 = static_cast<int>(static_cast<double>(c0) * this->Ratio[0]);
574 }
575 if (this->Ratio[1] != 1.0)
576 {
577 a1 = static_cast<int>(static_cast<double>(a1) * this->Ratio[1]);
578 b1 = static_cast<int>(static_cast<double>(b1) * this->Ratio[1]);
579 c1 = static_cast<int>(static_cast<double>(c1) * this->Ratio[1]);
580 }
581 if (this->Ratio[2] != 1.0)
582 {
583 z = static_cast<int>(static_cast<double>(z) * this->Ratio[2]);
584 }
585
586 ptr = this->ImageData->GetScalarPointer();
587 switch (this->ImageData->GetScalarType())
588 {
589 vtkTemplateMacro(vtkImageCanvasSource2DFillTriangle(
590 this->ImageData, this->DrawColor, static_cast<VTK_TT*>(ptr), a0, a1, b0, b1, c0, c1, z));
591 default:
592 vtkErrorMacro(<< "FillTriangle: Cannot handle ScalarType.");
593 }
594 this->Modified();
595}
596
597//------------------------------------------------------------------------------
598// Draw a point. Only implentented for 2D images.

Callers 3

TestCorrelation.pyFile · 0.80

Calls 4

GetScalarPointerMethod · 0.80
GetScalarTypeMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected