------------------------------------------------------------------------------ Given a scalar value v, return an RGBA color value from lookup table.
| 765 | //------------------------------------------------------------------------------ |
| 766 | // Given a scalar value v, return an RGBA color value from lookup table. |
| 767 | const unsigned char* vtkLookupTable::MapValue(double v) |
| 768 | { |
| 769 | vtkIdType index = this->GetIndex(v); |
| 770 | if (index < 0) |
| 771 | { |
| 772 | return this->GetNanColorAsUnsignedChars(); |
| 773 | } |
| 774 | else if (index == 0) |
| 775 | { |
| 776 | if (this->UseBelowRangeColor && v < this->TableRange[0]) |
| 777 | { |
| 778 | this->GetColorAsUnsignedChars(this->GetBelowRangeColor(), this->RGBABytes); |
| 779 | return this->RGBABytes; |
| 780 | } |
| 781 | } |
| 782 | else if (index == this->NumberOfColors - 1) |
| 783 | { |
| 784 | if (this->UseAboveRangeColor && v > this->TableRange[1]) |
| 785 | { |
| 786 | this->GetColorAsUnsignedChars(this->GetAboveRangeColor(), this->RGBABytes); |
| 787 | return this->RGBABytes; |
| 788 | } |
| 789 | } |
| 790 | |
| 791 | return this->Table->GetPointer(0) + 4 * index; |
| 792 | } |
| 793 | VTK_ABI_NAMESPACE_END |
| 794 | |
| 795 | namespace |