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

Method DrawSegment3D

Imaging/Sources/vtkImageCanvasSource2D.cxx:1073–1108  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Draw a Segment from point a to point b. No clipping or bounds checking.

Source from the content-addressed store, hash-verified

1071// Draw a Segment from point a to point b.
1072// No clipping or bounds checking.
1073void vtkImageCanvasSource2D::DrawSegment3D(double* a, double* b)
1074{
1075 void* ptr;
1076 int a0, a1, a2;
1077
1078 // Pre-multiply coords if needed
1079 if (this->Ratio[0] != 1.0)
1080 {
1081 a[0] = static_cast<int>(a[0] * this->Ratio[0]);
1082 b[0] = static_cast<int>(b[0] * this->Ratio[0]);
1083 }
1084 if (this->Ratio[1] != 1.0)
1085 {
1086 a[1] = static_cast<int>(a[1] * this->Ratio[1]);
1087 b[1] = static_cast<int>(b[1] * this->Ratio[1]);
1088 }
1089 if (this->Ratio[2] != 1.0)
1090 {
1091 a[2] = static_cast<int>(a[2] * this->Ratio[2]);
1092 b[2] = static_cast<int>(b[2] * this->Ratio[2]);
1093 }
1094
1095 ptr = this->ImageData->GetScalarPointer(static_cast<int>(floor(b[0] + 0.5)),
1096 static_cast<int>(floor(b[1] + 0.5)), static_cast<int>(floor(b[2] + 0.5)));
1097 a0 = static_cast<int>(floor(a[0] - b[0] + 0.5));
1098 a1 = static_cast<int>(floor(a[1] - b[1] + 0.5));
1099 a2 = static_cast<int>(floor(a[2] - b[2] + 0.5));
1100 switch (this->ImageData->GetScalarType())
1101 {
1102 vtkTemplateMacro(vtkImageCanvasSource2DDrawSegment3D(
1103 this->ImageData, this->DrawColor, static_cast<VTK_TT*>(ptr), a0, a1, a2));
1104 default:
1105 vtkErrorMacro(<< "DrawSegment3D: Cannot handle ScalarType.");
1106 }
1107 this->Modified();
1108}
1109
1110//------------------------------------------------------------------------------
1111template <class T>

Callers 2

DrawSegment3DFunction · 0.80

Calls 5

GetScalarPointerMethod · 0.80
floorFunction · 0.50
GetScalarTypeMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected