Package schrodinger :: Package graphics3d :: Module arrow :: Class Arrow
[hide private]
[frames] | no frames]

Class Arrow

      object --+        
               |        
common.Primitive --+    
                   |    
           ArrowCore --+
                       |
                      Arrow


Class for drawing a 3D arrow in OpenGL.  Will be drawn
in the current OpenGL drawable.  This includes the ability
to draw into Maestro's Workspace.  It just needs to be
the current drawable.

See doc string for __init__ for details on instantiation

Arrows should be added to a Group and drawing done via the Group.
See the graphics3d.common.Group documentation.

API Example
-----------
import schrodinger.maestro.maestro as maestro
import schrodinger.graphics3d.common as common
import schrodinger.graphics3d.arrow as arrow

arrow_grp = common.Group()
st = maestro.workspace_get()
for bond in st.bond:
    ar = arrow.Arrow(
        xhead=bond.atom2.x, yhead=bond.atom2.y, zhead=bond.atom2.z,
        xtail=bond.atom1.x, ytail=bond.atom1.y, ztail=bond.atom1.z,
        color='red',
        radius=0.15,
        opacity=0.8,
        resolution=50
    )
    # Add the primative to the container.
    arrow_grp.add(ar)

# Add the draw callback.
maestro.workspace_draw_function_add(arrow_grp.draw)

# Hide the markers.
arrow_grp.hide()

# Remove the markers and the callback.
arrow_grp.clear()
maestro.workspace_draw_function_remove(arrow_grp.draw)

Instance Methods [hide private]
 
__init__(self, xhead=None, yhead=None, zhead=None, xtail=None, ytail=None, ztail=None, color=None, r=0.0, g=1.0, b=0.0, radius=0.15, transparency=None, opacity=OPACITY_DEFAULT, resolution=RESOLUTION_DEFAULT)
Constructor requires:
 
_drawCylinder(self, xtail, ytail, ztail, rtop, xhead, yhead, zhead, rbase, distance)
Draw out a cylinder, which could be a cone depending on the settings you specify.
 
_draw(self)
Private method to draw out the 3D arrow with the current settings.

Inherited from ArrowCore (private): _calculateBoundingBox

Inherited from common.Primitive: __del__, groupHidden, groupShown, hide, isGroupShown, isShown, setEntryID, show

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
_glSetup()
Private method to set up the GL state for arrows
 
_glReset()
Private method to reset the GL state for arrows
Class Variables [hide private]
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, xhead=None, yhead=None, zhead=None, xtail=None, ytail=None, ztail=None, color=None, r=0.0, g=1.0, b=0.0, radius=0.15, transparency=None, opacity=OPACITY_DEFAULT, resolution=RESOLUTION_DEFAULT)
(Constructor)

 

Constructor requires:

xhead, yhead, zhead: corrdinate of the head position
xtail, ytail, ztail: coordinate of the tail position

color:    One of:
            Color object (Color class)
            Color name (string)
            Tuple of (R, G, B) (each a float in range 0.0-1.0)

Optional arguments:

radius:   radius of the arrow in Angstroms
          Default: .15
opacity:  0.0 (invisible) through 1.0 (opaque)
               Default: 0.0
resolution:    Ranges from ?? to ??.  Default: ??
          

Overrides: object.__init__

_drawCylinder(self, xtail, ytail, ztail, rtop, xhead, yhead, zhead, rbase, distance)

 

Draw out a cylinder, which could be a cone depending on the settings you specify. Assumes you've set the materials, color, etc. already

_draw(self)

 

Private method to draw out the 3D arrow with the current settings. A 3D arrow is a cone atop a cylinder. This should only be called by a Group.