Changeset 8836:4bc4c383b858 in orange


Ignore:
Timestamp:
08/29/11 21:58:26 (3 years ago)
Author:
matejd <matejd@…>
Branch:
default
Convert:
6ada813fd8698910c5417e4e8efc9a1033d8a2c2
Message:

Removed redundant value clamping

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orangeqt/plot3d.cpp

    r8835 r8836  
    3535        glDeleteBuffers(1, &vbo_edges_id); 
    3636    } 
    37 } 
    38  
    39 template<class T> 
    40 inline T clamp(T value, T min, T max) 
    41 { 
    42     if (value > max) 
    43         return max; 
    44     if (value < min) 
    45         return min; 
    46     return value; 
    4737} 
    4838 
     
    7060void Plot3D::set_data(quint64 array_address, int num_examples, int example_size) 
    7161{ 
    72     data_array = reinterpret_cast<float*>(array_address); // 32-bit systems, endianness? 
     62    data_array = reinterpret_cast<float*>(array_address); // TODO: this is dangerous, make a numpy.array type or something instead 
    7363    this->num_examples = num_examples; 
    7464    this->example_size = example_size; 
     
    9383void Plot3D::set_valid_data(quint64 valid_data_address) 
    9484{ 
    95     valid_data = reinterpret_cast<bool*>(valid_data_address); 
     85    valid_data = reinterpret_cast<bool*>(valid_data_address); // TODO: the same as the TODO above 
    9686} 
    9787 
     
    151141 
    152142        if (num_colors > 0) 
    153             color = colors[clamp(int(color_value * num_colors), 0, num_colors-1)]; // TODO: garbage values sometimes? 
     143            color = colors[int(color_value * num_colors)]; 
    154144        else if (color_index > -1) 
    155             color = QColor(0., 0., clamp(int(color_value*255), 0, 255)); 
     145            color = QColor(0., 0., int(color_value*255)); 
    156146        else 
    157147            color = QColor(0., 0., 0); 
     
    159149        float*& dest = selected_indices[index] ? dests : destu; 
    160150 
    161         // TODO: make sure symbol is in geometry map 
    162151        for (int i = 0; i < geometry[symbol].count(); i += 6) { 
    163152            if (selected_indices[index]) 
Note: See TracChangeset for help on using the changeset viewer.