Changeset 8730:377e191fafbf in orange


Ignore:
Timestamp:
08/18/11 11:27:04 (3 years ago)
Author:
matejd <matejd@…>
Branch:
default
Convert:
899c7f95dc7707c93f9f28b1b50b3330d18af3cb
Message:

Implemented jittering in geometry shader.

Location:
orange/OrangeWidgets
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Visualize Qt/OWScatterPlot3D.py

    r8727 r8730  
    1717import numpy 
    1818 
    19 TooltipKind = enum('NONE', 'VISIBLE', 'ALL') # Which attributes should be displayed in tooltips? 
     19TooltipKind = enum('NONE', 'VISIBLE', 'ALL') 
    2020 
    2121class ScatterPlotTheme(PlotTheme): 
     
    122122        self.set_shown_attributes_indices(x_index, y_index, z_index, 
    123123            color_index, symbol_index, size_index, label_index, 
    124             colors, num_symbols_used, data_scale, data_translation) 
     124            colors, num_symbols_used, 
     125            x_discrete, y_discrete, z_discrete, self.jitter_size, self.jitter_continuous, 
     126            data_scale, data_translation) 
    125127 
    126128        if self.show_legend: 
  • orange/OrangeWidgets/plot/generator.gs

    r8729 r8730  
    1212 
    1313uniform bool use_2d_symbols; 
     14 
     15uniform float seed; 
     16uniform float jitter_size; 
     17uniform bool jitter_continuous; 
     18uniform bool x_discrete; 
     19uniform bool y_discrete; 
     20uniform bool z_discrete; 
    1421 
    1522uniform samplerBuffer symbol_buffer; 
     
    3138out float out_index; 
    3239 
     40// http://stackoverflow.com/questions/4200224/random-noise-functions-for-glsl 
     41// Should return pseudo-random value [-0.5, 0.5] 
     42float rand(vec3 co){ 
     43    return fract(sin(dot(co.xyz, vec3(12.9898, 78.233, 42.42))) * 43758.5453) - 0.5; 
     44} 
     45 
    3346void main() 
    3447{ 
     
    4255                        texelFetch(data_buffer, index+y_index).x, 
    4356                        texelFetch(data_buffer, index+z_index).x); 
     57 
     58    if (x_discrete || jitter_continuous) 
     59        out_position.x += rand(out_position * out_index) * jitter_size / 100.; 
     60    if (y_discrete || jitter_continuous) 
     61        out_position.y += rand(out_position * out_index) * jitter_size / 100.; 
     62    if (z_discrete || jitter_continuous) 
     63        out_position.z += rand(out_position * out_index) * jitter_size / 100.; 
    4464 
    4565    int symbol = 0; 
  • orange/OrangeWidgets/plot/owplot3d.py

    r8729 r8730  
    4141 
    4242try: 
    43     from itertools import izip as zip # Python 3 zip == izip in Python 2.x 
     43    from itertools import izip as zip 
    4444    from itertools import chain 
    4545except: 
     
    926926            color_index, symbol_index, size_index, label_index, 
    927927            colors, num_symbols_used, 
     928            x_discrete, y_discrete, z_discrete, jitter_size, jitter_continuous, 
    928929            data_scale=array([1., 1., 1.]), data_translation=array([0., 0., 0.])): 
    929930        start = time.time() 
     
    945946        self.generating_program.setUniformValue('y_index', y_index) 
    946947        self.generating_program.setUniformValue('z_index', z_index) 
     948        self.generating_program.setUniformValue('seed', time.time()) 
     949        self.generating_program.setUniformValue('jitter_size', jitter_size) 
     950        self.generating_program.setUniformValue('jitter_continuous', jitter_continuous) 
     951        self.generating_program.setUniformValue('x_discrete', x_discrete) 
     952        self.generating_program.setUniformValue('y_discrete', y_discrete) 
     953        self.generating_program.setUniformValue('z_discrete', z_discrete) 
    947954        self.generating_program.setUniformValue('color_index', color_index) 
    948955        self.generating_program.setUniformValue('symbol_index', symbol_index) 
     
    10221029    def set_show_axis_title(self, axis_id, show): 
    10231030        if Axis.is_valid(axis_id) and axis_id != Axis.CUSTOM: 
    1024             setattr(self, 'show_' + Axis.to_str(axis_id).lower() + '_axis_title', title) 
     1031            setattr(self, 'show_' + Axis.to_str(axis_id).lower() + '_axis_title', show) 
    10251032 
    10261033    def set_new_zoom(self, x_min, x_max, y_min, y_max, z_min, z_max): 
Note: See TracChangeset for help on using the changeset viewer.