schrodinger.graphics3d.quadrilateral module¶
OpenGL quadrilaterals.
The quadrilateral module allows creation and drawing of quadrilaterals. Clients draw using Group instances not through Quadrilateral instances.
Drawing is done in whatever is the current GL rendering context and current GL window. So you must set those prior to drawing. If you are using this with Maestro’s drawing callback mechanism you need not worry about the above details. These are handled for you automatically.
Control over the vertices, color, and opacity of a quadrilateral are provided. See the Quadrilateral class for more info.
If you want to draw a number of quadrilaterals, then create multiple Quadrilateral instances and add them to a Group instance or create a single container instance of type Group and add all primatives to it. Then invoke the Group’s draw() method. In the future we hope to provide a QuadrilateralStrip class which would be optimized to draw a sequence of edge-connected quadrilaterals.
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.graphics3d.quadrilateral.
Quadrilateral
(vertices=None, color=None, opacity=1.0, style=1)¶ Bases:
schrodinger.graphics3d.common.Primitive
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.
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()
-
__init__
(vertices=None, color=None, opacity=1.0, style=1)¶ 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.
-
__class__
¶ alias of
builtins.type
-
__del__
(_hasattr=<built-in function hasattr>, _maestro=<module 'schrodinger.maestro.maestro' from '/scr/buildbot/savedbuilds/2018-4/NB/build-145/internal/lib/python3.6/site-packages/schrodinger/maestro/maestro.py'>)¶
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.graphics3d.quadrilateral', '__doc__': "\n Class to draw a 3D quadrilateral in OpenGL. Will be drawn in the current\n OpenGL drawable. This includes the ability to draw into Maestro's\n Workspace. It just needs to be the current drawable.\n\n Quadrilaterals should be added to a Group and drawing done via Group.\n\n Create Quadrilaterals and add them to a Group instance like in the\n following example::\n\n # One big list\n verts = [ 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,\n 1.0, 1.0, 0.0, 1.0, 0.0, 0.0 ]\n my_quadrilateral1 = quadrilateral.Quadrilateral(vertices=verts,\n opacity=0.5, r=1.0, g=0.0, b=0.0)\n\n # A list of vertices (each vertex is a list of x, y, z)\n v1 = [0.0, 0.0, 0.0]\n v2 = [0.0, 1.0, 0.0]\n v3 = [1.0, 1.0, 0.0]\n v4 = [1.0, 0.0, 0.0]\n my_quadrilateral2 = quadrilateral.Quadrilateral(\n vertices = [v1, v2, v3, v4],\n opacity=0.5, r=1.0, g=0.0, b=0.0)\n\n quadrilateral_group = quadrilateral.Group()\n quadrilateral_group.add(my_quadrilateral1)\n quadrilateral_group.add(my_quadrilateral2)\n\n # The draw invocation would likely be in a callback function\n quadrilateral_group.draw()\n\n ", '_blend': None, '_smooth_point': None, '_cull': None, '_lighting': None, '_lighting_model': None, '_shading_model': None, '_polygon_mode': None, '__init__': <function Quadrilateral.__init__>, '_checkVertexArgument': <function Quadrilateral._checkVertexArgument>, '_glSetup': <staticmethod object>, '_glReset': <staticmethod object>, '_draw': <function Quadrilateral._draw>, '_calculateBoundingBox': <function Quadrilateral._calculateBoundingBox>})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
¶ Return self<=value.
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.graphics3d.quadrilateral'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶ Return repr(self).
-
__setattr__
¶ Implement setattr(self, name, value).
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
groupHidden
()¶ Called when the group of this object is hidden. Hide the Maestro object(s).
-
groupShown
()¶ Called when the group of this object is shown. Show the Maestro object, if we are being shown.
-
hide
()¶ Hide the object. It will not be drawn when the group is drawn.
-
isGroupShown
()¶ Returns True if this object’s group is shown. False otherwise.
-
isShown
()¶ Returns True if this object shown. False otherwise.
-
setEntryID
(entry_id)¶ Sets entry ID for Maestro object (necessary to render in tile-by-entry mode.
Parameters: entry_id (str) – Object’s entry ID.
-
setGlowColor
(r, g, b)¶ Sets glow color for the object.
Parameters: - r (float) – Red component of glow color [0.0 .. 1.0]
- g (float) – Green component of glow color [0.0 .. 1.0]
- b (float) – Blue component of glow color [0.0 .. 1.0]
-
setIsGlowing
(is_glowing)¶ Enables or disables glow effect for the object.
Parameters: is_glowing (bool) – Whether the object is glowing.
-
setRightClickOnGObject
(pymodule, pyfunc)¶ Sets the python callback which should be called whenever given graphics object is right clicked.
Parameters: - pymodule (str) – Python module
- pyfunc (str) – Python function
-
show
()¶ Display this object, if it was hidden
-