#NEWLINE# def get_value( self , scalar ) : #NEWLINE# #INDENT# 'get_value(scalar): returns the opacity and color\n        linearly interpolated at the value. Useful for\n        adding knots.' #NEWLINE# ix = 0 #NEWLINE# while ( ( ix < len ( self . _pts ) ) and ( self . _pts [ ix ] [ 0 ] > scalar ) ) : #NEWLINE# #INDENT# ix += 1 #NEWLINE# #UNINDENT# if ( ix == 0 ) : #NEWLINE# #INDENT# return ( self . _pts [ 0 ] [ 1 ] , self . _pts [ 0 ] [ 2 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ix == len ( self . _pts ) ) : #NEWLINE# #INDENT# return ( self . _pts [ ( - 1 ) ] [ 1 ] , self . _pts [ ( - 1 ) ] [ 2 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# u = ( ( self . _pts [ ix ] [ 0 ] - scalar ) / ( self . _pts [ ix ] [ 0 ] - self . _pts [ ( ix - 1 ) ] [ 0 ] ) ) #NEWLINE# do = ( self . _pts [ ix ] [ 1 ] - self . _pts [ ( ix - 1 ) ] [ 1 ] ) #NEWLINE# dr = ( self . _pts [ ix ] [ 2 ] [ 0 ] - self . _pts [ ( ix - 1 ) ] [ 2 ] [ 0 ] ) #NEWLINE# dg = ( self . _pts [ ix ] [ 2 ] [ 1 ] - self . _pts [ ( ix - 1 ) ] [ 2 ] [ 1 ] ) #NEWLINE# db = ( self . _pts [ ix ] [ 2 ] [ 2 ] - self . _pts [ ( ix - 1 ) ] [ 2 ] [ 2 ] ) #NEWLINE# return ( ( self . _pts [ ( ix - 1 ) ] [ 1 ] + ( u * do ) ) , ( ( self . _pts [ ( ix - 1 ) ] [ 2 ] [ 0 ] + ( u * dr ) ) , ( self . _pts [ ( ix - 1 ) ] [ 2 ] [ 1 ] + ( u * dg ) ) , ( self . _pts [ ( ix - 1 ) ] [ 2 ] [ 2 ] + ( u * db ) ) ) )