Package schrodinger :: Package graphics3d :: Module sphere :: Class Sphere
[hide private]
[frames] | no frames]

Class Sphere

      object --+        
               |        
common.Primitive --+    
                   |    
          SphereCore --+
                       |
                      Sphere


Class to draw a 3D sphere 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.

Spheres should be added to a SphereGroup and drawing done via
SphereGroup.  See SphereGroup documentation.

This class draws the sphere directly using OpenGL.

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

sphere_grp = common.Group()
st = maestro.workspace_get()
for at in st.atom:
    sph = sphere.Sphere(
        x=at.x,
        y=at.y,
        z=at.z,
        radius=1.0,
        resolution=20,
        opacity=0.8,
        color='red'
    )
    # Add the primative to the container.
    sphere_grp.add(sph)

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

# Hide the markers.
sphere_grp.hide()

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

Instance Methods [hide private]
 
__init__(self, x=None, y=None, z=None, color=None, r=None, g=None, b=None, radius=None, transparency=None, opacity=1.0, resolution=16)
Constructor requires:
 
_draw(self)
Private method to draw out the sphere with the current settings.

Inherited from SphereCore (private): _calculateBoundingBox

Inherited from common.Primitive: __del__, groupHidden, groupShown, hide, isGroupShown, isShown, setEntryID, setGlowColor, setIsGlowing, setRightClickOnGObject, 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 spheres.
 
_glReset()
Private method to reset the GL state for spheres.
Class Variables [hide private]
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, x=None, y=None, z=None, color=None, r=None, g=None, b=None, radius=None, transparency=None, opacity=1.0, resolution=16)
(Constructor)

 

Constructor requires:

x, y, z:  coordinate specifying center of sphere in Angstroms.

color:    One of:
            Color object
            Color name (string)
            Tuble of (R, G, B) (each 0.0-1.0)

radius:   radius of the sphere in Angstroms


Optional arguments:

opacity:  0.0 (transparent) through 1.0 (opaque)
               Defaults to 1.0
resolution:    4 to 50
               Defaults to 16
          

Overrides: object.__init__

_draw(self)

 

Private method to draw out the sphere with the current settings. This should only be called by SphereGroup.