Changeset 8489:ba51f9c9e806 in orange


Ignore:
Timestamp:
07/27/11 17:23:39 (3 years ago)
Author:
matejd <matejd@…>
Branch:
default
Convert:
5b946b2f6ee4c28c4e7f9dfd66a97b1cc8fd8e7e
Message:

Considerably sped up data uploading with caching normals computation

Location:
orange/OrangeWidgets/plot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/plot/owplot3d.py

    r8487 r8489  
    784784                                    position[1], 
    785785                                    position[2], 
    786                                     axis_map[key], font=self.labels_font) 
     786                                    axis_map[key], font=self._theme.labels_font) 
    787787 
    788788        def draw_values(axis, coord_index, normal, axis_map, sub=10): 
     
    987987            triangles = get_symbol_data(symbol) 
    988988            ss = size*0.1 
    989             for (v1, v2, v3) in triangles: 
    990                 n = normal_from_points(v1, v2, v3) 
    991                 vertices.extend([x,y,z, ai, ss*v1[0],ss*v1[1],ss*v1[2], r,g,b,a, n[0],n[1],n[2]]) 
    992                 vertices.extend([x,y,z, ai, ss*v2[0],ss*v2[1],ss*v2[2], r,g,b,a, n[0],n[1],n[2]]) 
    993                 vertices.extend([x,y,z, ai, ss*v3[0],ss*v3[1],ss*v3[2], r,g,b,a, n[0],n[1],n[2]]) 
     989            for v0, v1, v2, n0, n1, n2 in triangles: 
     990                vertices.extend([x,y,z, ai, ss*v0[0],ss*v0[1],ss*v0[2], r,g,b,a, n0,n1,n2, 
     991                                 x,y,z, ai, ss*v1[0],ss*v1[1],ss*v1[2], r,g,b,a, n0,n1,n2, 
     992                                 x,y,z, ai, ss*v2[0],ss*v2[1],ss*v2[2], r,g,b,a, n0,n1,n2]) 
    994993 
    995994        # Build Vertex Buffer + Vertex Array Object. 
  • orange/OrangeWidgets/plot/owprimitives3d.py

    r8484 r8489  
    11import os 
    2 from owplot3d import Symbol 
     2from owplot3d import Symbol, normal_from_points 
    33 
    44symbol_map = { 
     
    1515} 
    1616 
    17 symbol_data = {} 
     17symbol_data = {} # Cache: contains triangles + their normals for each needed symbol. 
    1818 
    1919def get_symbol_data(symbol): 
     
    3131                  vertices[face[1]-1], 
    3232                  vertices[face[2]-1]] for face in faces] 
     33    for triangle in triangles: 
     34        triangle.extend(normal_from_points(*triangle)) 
    3335    symbol_data[symbol] = triangles 
    3436    return triangles 
Note: See TracChangeset for help on using the changeset viewer.