schrodinger.graphics3d.arrow module

OpenGL arrows.

The arrow module allows creation and drawing of arrows. Clients draw using graphics3d.common.Group instances, aliased here as ArrowGroup, not through Arrow 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 endpoints, radius, color, resolution and transparency of a arrow are provided. See the Arrow class for more info.

To draw any number of arrows create Arrow instances, add them to a Group instance, then invoke the Group’s draw() method.

Copyright Schrodinger LLC, All rights reserved.

class schrodinger.graphics3d.arrow.Arrow(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=1.0, resolution=16)

Bases: schrodinger.graphics3d.arrow.ArrowCore

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.

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)
class schrodinger.graphics3d.arrow.ArrowCore(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=1.0, resolution=16)

Bases: schrodinger.graphics3d.common.Primitive

Base class for drawing a 3D arrow

See doc string for __init__ for details on instantiation

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

class schrodinger.graphics3d.arrow.MaestroArrow(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=1.0, resolution=16, body_percentage=0.75, remove_endcaps=False)

Bases: schrodinger.graphics3d.arrow.ArrowCore

Class for creating a 3D arrow in Maestro

Arrows should be added to a Group and drawing done via the Group. See the 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.MaestroArrow(
        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)

# Unlike Arrow MaestroArrow simply needs to be shown to be drawn.
# No special callback like there is for Arrows is needed.
arrow_grp.show()

# Hide the markers.
arrow_grp.hide()

# Remove the markers and the callback.
arrow_grp.clear()
maestro.workspace_draw_function_remove(arrow_grp.draw)
b
calculateCoords(body_percentage=0.75)

Calculate the intermediate coordinate between head and body

g
material
opacity
pick_category
pick_id
r
radius
xhead
xtail
yhead
ytail
zhead
ztail
schrodinger.graphics3d.arrow.vector_cross(X, Y)

Returns the cross product of the len 3 vectors X and Y

schrodinger.graphics3d.arrow.vector_normalize(X)