def color_by_height(self, axis=1, threshold=None, color=DEFAULT_COLORMAP): # pylint: disable=unused-argument
        '''
        Color each vertex by its height above the floor point.

        axis: The axis to use. 0 means x, 1 means y, 2 means z.
        threshold: The top of the range. Points at and above this height will
          be the same color.

        '''
        import numpy as np

        heights = self.v[:, axis] - self.floor_point[axis]

        if threshold:
            # height == 0  ->  saturation = 0.
            # height == threshold  ->  saturation = 1.
            color_weights = np.minimum(heights / threshold, 1.)
            color_weights = color_weights * color_weights
            self.set_vertex_colors_from_weights(color_weights, scale_to_range_1=False)
        else:
            self.set_vertex_colors_from_weights(heights)
def color_by_height ( self , axis = 1 , threshold = None , color = DEFAULT_COLORMAP ) : import numpy as np heights = self . v [ : , axis ] - self . floor_point [ axis ] if threshold : color_weights = np . minimum ( heights / threshold , 1. ) color_weights = color_weights * color_weights self . set_vertex_colors_from_weights ( color_weights , scale_to_range_1 = False ) else : self . set_vertex_colors_from_weights ( heights )
Color each vertex by its height above the floor point.

        axis: The axis to use. 0 means x, 1 means y, 2 means z.
        threshold: The top of the range. Points at and above this height will
          be the same color.