Changeset 242 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Jan 26, 2011 9:38:41 AM (14 years ago)
Author:
vondreele
Message:

refactor polygon search & rendering to eliminate internal "faces". Polygon search now in FindBonds? and Faces put at end of drawAtom array. Much faster rendering of complex polygons

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/GSASIIplot.py

    r240 r242  
    17691769        for iat,atom in enumerate(drawingData['Atoms']):
    17701770            x,y,z = atom[cx:cx+3]
    1771             Bonds = atom[-1]
     1771            Bonds = atom[-2]
     1772            Faces = atom[-1]
    17721773            try:
    17731774                atNum = generalData['AtomTypes'].index(atom[ct])
     
    17801781            radius = 0.5
    17811782            if atom[cs] != '':
    1782                 glLoadName(atom[-2])
     1783                glLoadName(atom[-3])                   
    17831784            if 'balls' in atom[cs]:
    17841785                vdwScale = drawingData['vdwScale']
     
    18291830                RenderBonds(x,y,z,Bonds,bondR,color)
    18301831            elif atom[cs] == 'polyhedra':
    1831                 if len(Bonds) > 2:
    1832                     FaceGen = G2lat.uniqueCombinations(Bonds,3)     #N.B. this is a generator
    1833                     Faces = []
    1834                     for face in FaceGen:
    1835                         vol = nl.det(face)
    1836                         if abs(vol) > 1. or len(Bonds) == 3:
    1837                             if vol < 0.:
    1838                                 face = [face[0],face[2],face[1]]
    1839                             norm = np.cross(face[1]-face[0],face[2]-face[0])
    1840                             norm /= np.sqrt(np.sum(norm**2))
    1841                             Faces.append([face,norm])
    1842                     RenderPolyhedra(x,y,z,Faces,color)
     1832                RenderPolyhedra(x,y,z,Faces,color)
    18431833            elif atom[cs] == 'backbone':
    18441834                if atom[ct-1].split()[0] in ['C','N']:
Note: See TracChangeset for help on using the changeset viewer.