Package schrodinger :: Package graphics3d :: Module quadrilateral :: Class Quadrilateral
[hide private]
[frames] | no frames]

Class Quadrilateral

      object --+    
               |    
common.Primitive --+
                   |
                  Quadrilateral


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

Quadrilaterals should be added to a Group and 
drawing done via Group. 

Create Quadrilaterals and add them to a Group instance 
like in the following.

Example:

   # One big list
   verts =  [ 0.0, 0.0, 0.0,   0.0, 1.0, 0.0,   
              1.0, 1.0, 0.0,   1.0, 0.0, 0.0 ]
   my_quadrilateral1 = quadrilateral.Quadrilateral(vertices=verts,
                opacity=0.5, r=1.0, g=0.0, b=0.0)

   # A list of vertices (each vertex is a list of x, y, z)
   v1 = [0.0, 0.0, 0.0]
   v2 = [0.0, 1.0, 0.0]
   v3 = [1.0, 1.0, 0.0]
   v4 = [1.0, 0.0, 0.0]   
   my_quadrilateral2 = quadrilateral.Quadrilateral(
                vertices = [v1, v2, v3, v4],
                opacity=0.5, r=1.0, g=0.0, b=0.0)

   quadrilateral_group = quadrilateral.Group()
   quadrilateral_group.add(my_quadrilateral1)
   quadrilateral_group.add(my_quadrilateral2)

   # The draw invocation would likely be in a callback function
   quadrilateral_group.draw()

Instance Methods [hide private]
 
__init__(self, vertices=None, color=None, opacity=1.0, style=1)
Constructor requires:
 
_checkVertexArgument(self, vertices)
Private method to check if the vertices are in the coorect format
 
_draw(self)
Private method to draw out the quadrilateral with the current settings.
 
_calculateBoundingBox(self, mat)

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 quadrilaterals
 
_glReset()
Private method to reset the GL state for quadrilaterals
Class Variables [hide private]
  _blend = None
hash(x)
  _smooth_point = None
hash(x)
  _cull = None
hash(x)
  _lighting = None
hash(x)
  _lighting_model = None
hash(x)
  _shading_model = None
hash(x)
  _polygon_mode = None
hash(x)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, vertices=None, color=None, opacity=1.0, style=1)
(Constructor)

 

Constructor requires:

vertices: List of 12 values: x1, y1, z1 ... x4, y4, z4 OR
          list of 4 vertex lists [x, y, z], ..., [x, y, z]

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

Optional arguments:

opacity:  0.0 (invisible) through 1.0 (opaque)
               Defaults to 1.0
          
style:         LINE or FILL.  Default is FILL.

Overrides: object.__init__

_draw(self)

 

Private method to draw out the quadrilateral with the current settings. This should only be called by Group instances.