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

Method GetTable

Rendering/Core/vtkColorTransferFunction.cxx:782–1272  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Returns a table of RGB colors at regular intervals along the function

Source from the content-addressed store, hash-verified

780//------------------------------------------------------------------------------
781// Returns a table of RGB colors at regular intervals along the function
782void vtkColorTransferFunction::GetTable(double xStart, double xEnd, int size, double* table)
783{
784 int i, j;
785
786 // Special case: If either the start or end is a NaN, then all any
787 // interpolation done on them is also a NaN. Therefore, fill the table with
788 // the NaN color.
789 if (vtkMath::IsNan(xStart) || vtkMath::IsNan(xEnd))
790 {
791 double* tableEntry = table;
792 for (i = 0; i < size; i++)
793 {
794 tableEntry[0] = this->NanColor[0];
795 tableEntry[1] = this->NanColor[1];
796 tableEntry[2] = this->NanColor[2];
797 tableEntry += 3;
798 }
799 return;
800 }
801
802 int idx = 0;
803 int numNodes = static_cast<int>(this->Internal->Nodes.size());
804
805 // Need to keep track of the last value so that
806 // we can fill in table locations past this with
807 // this value if Clamping is On.
808 double lastR = 0.0;
809 double lastG = 0.0;
810 double lastB = 0.0;
811 if (numNodes != 0)
812 {
813 lastR = this->Internal->Nodes[numNodes - 1]->R;
814 lastG = this->Internal->Nodes[numNodes - 1]->G;
815 lastB = this->Internal->Nodes[numNodes - 1]->B;
816 }
817
818 double* tptr = nullptr;
819 double x = 0.0;
820 double x1 = 0.0;
821 double x2 = 0.0;
822 double rgb1[3] = { 0.0, 0.0, 0.0 };
823 double rgb2[3] = { 0.0, 0.0, 0.0 };
824 double midpoint = 0.0;
825 double sharpness = 0.0;
826
827 // If the scale is logarithmic, make sure the range is valid.
828 bool usingLogScale = this->Scale == VTK_CTF_LOG10;
829 if (usingLogScale)
830 {
831 // Note: This requires range[0] <= range[1].
832 usingLogScale = this->Range[0] > 0.0;
833 }
834
835 double logStart = 0.0;
836 double logEnd = 0.0;
837 double logX = 0.0;
838 if (usingLogScale)
839 {

Callers 15

GetColorMethod · 0.95
BuildScaleTableMethod · 0.45
BuildOpacityTableMethod · 0.45
InternalUpdateMethod · 0.45
InternalUpdateMethod · 0.45
InternalUpdateMethod · 0.45

Calls 15

IsNanFunction · 0.85
IsInfFunction · 0.85
HSVToRGBFunction · 0.85
RGBToLabFunction · 0.85
LabToRGBFunction · 0.85
RGBToProLabFunction · 0.85
ProLabToRGBFunction · 0.85
log10Function · 0.50
powFunction · 0.50
maxFunction · 0.50

Tested by 1