schrodinger.graphics3d.polyhedron module¶
The polyhedron module allows creation and drawing of polyhedra.The body of the polyhedron is composed of faces that are composed of vertices.
Control over the vertices, faces, color, and opacity of a box are provided. However, please note that the current implementation does not ensure the passed in vertices and faces will enclose to form a volume. This must be determined in the subclass.
To draw any number of polyhedra, create the Polyhedron instances, add them to a Group instance then invoke the Group’s draw() method.
Copyright Schrodinger, LLC. All rights reserved.
- schrodinger.graphics3d.polyhedron.origin_to_point(vertices, center)¶
Takes a set of vertices that have been created around the origin and translates them to the be centered around the x, y, z coordinates supplied in
center
.- Parameters
vertices (list of lists (e.g. [[x1,y1,z1],[x2,y2,z2],...]) – The list of vertices around the origin
center (list of floats) – The x, y, and z coordinates to center the
vertices
on
- schrodinger.graphics3d.polyhedron.scale_vertices(vertices, scale)¶
Scale a set of vertices.
- Parameters
vertices (list of lists (e.g. [[x1,y1,z1],[x2,y2,z2],...]) – The list of vertices around the origin
scale (float) – The scale to apply to the vertices
- class schrodinger.graphics3d.polyhedron.MaestroPolyhedronCore(center, mode, length=None, radius=None, volume=None, color='red', opacity=1.0, style=1)¶
Bases:
schrodinger.graphics3d.common._MaestroPrimitiveMixin
,schrodinger.graphics3d.common.Primitive
- __init__(center, mode, length=None, radius=None, volume=None, color='red', opacity=1.0, style=1)¶
Create a polyhedron centered at
center
. Note that one of length, radius, or volume is needed to create the shape.- Parameters
center (list(float)) – List of 3 Angstrom values indicating the center coordinate of the tetrahedron.
length (float) – Length in Angstroms of each of the edges of the tetrahedron.
radius (float) – Circumsphere radius in Angstroms from center of tetrahedron.
volume (float) – Volume in cubed Angstroms of the object.
color – One of - Color object, Color name (string), or Tuple of (R, G, B) (each 0.0-1.0)
opacity (float) – 0.0 (invisible) through 1.0 (opaque). Defaults to 1.0
style (int) – LINE or FILL. Default is FILL.
- Raises
RuntimeError – If a single option from
length
,radius
, andvolume
does not have a value.ValueError – If the size parameter (
length
,radius
, orvolume
) is not a float.NotImplementedError – If the initiating subclass does not have a
getVertices
orgetFaces
method.
- property r¶
- property g¶
- property b¶
- property opacity¶
- update(vertices, faces)¶
Update the polyhedron’s shape.
- Parameters
vertices (list of lists) – List of vertices. Each member of list should be a list of 3 coords, [x,y,z]
faces (list of lists) – List of faces comprising the polyhedron. Each face should be a list of at least 3 vertices.
- See
Tetrahedron.updateVertices
for an example of usage
- setStyle(style)¶
Sets the polyhedron’s drawing style.
- Parameters
style (Choice, FILL or LINE) – Whether to fill the polyhedron in or to leave it as lines connecting vertices.
- getVertices()¶
Abstract method, defined by convention only
- getIndices()¶
Abstract method, defined by convention only
- getFaces(vertices)¶
- Parameters
vertices (list of lists) – List of vertices. Each member of list should be a list of 3 coords, [x,y,z]
- updateVertices(center, length=None, radius=None, volume=None)¶
Update the vertices given a new
center
and size parameter. The changes will be seen the next time the object is drawn.- Parameters
center (list(float, float, float)) – List of 3 Angstrom values indicating the center coordinate of the tetrahedron.
length (float) – Length in Angstroms of each of the edges of the tetrahedron.
radius (float) – Circumsphere radius in Angstroms from center of tetrahedron.
volume (float) – Volume in cubed Angstroms of the object.
- Raises
RuntimeError – If a single option from
length
,radius
, andvolume
does not have a value.ValueError – If the size parameter (
length
,radius
, orvolume
) is not a float.
See
Polyhedron.update
- 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.
- property material¶
- property persistent_name¶
- property pick_category¶
- property pick_id¶
- setColors()¶
- 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.
- setRGBColors(r, g, b, a=None)¶
- 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
- class schrodinger.graphics3d.polyhedron.MaestroCube(center, mode, length=None, radius=None, volume=None, color='red', opacity=1.0, style=1)¶
Bases:
schrodinger.graphics3d.polyhedron.MaestroPolyhedronCore
Class to draw a 3D cube in Maestro’s Workspace.
Cubes should be added to a graphics3d.common.Group, or CubeGroup, and drawing done via the Group. See the
graphics3d.common.Group
documentation.API Example:
import schrodinger.maestro.maestro as maestro import schrodinger.graphics3d.polyhedron as polyhedron cube_group = polyhedron.Group() st = maestro.workspace_get() # Here, st is methane. for atom in st.atom: if atom.element == 'C': center = atom.xyz cube = polyhedron.Cube( center = center, mode = polyhedron.MODE_MAESTRO, length = 1.828, # length between Hs color = 'goldenrod', opacity = 1.0, style = polyhedron.LINE ) # Add the primative to the container. cube_group.add(cube) # Show the markers cube.show() cube_group.show() # Hide the markers. cube_group.hide() # Remove the markers and the callback. cube_group.clear()
- __init__(center, mode, length=None, radius=None, volume=None, color='red', opacity=1.0, style=1)¶
- getVertices(center, length=None, radius=None, volume=None)¶
Get a list of vertices. If the center coordinates are considered the origin the vertices will have a base on the y-plane, a vertex on the x-axis and a vertex directly in the +z-axis from the
center
.- Parameters
center (list(float, float, float)) – List of 3 Angstrom values indicating the center coordinate of the tetrahedron.
length (float) – Length in Angstroms of each of the sides of the tetrahedron. Note:
length
orradius
must be specified to create tetrahedron.radius (float) – Circumsphere radius in Angstroms from center of tetrahedron. Note:
length
orradius
must be specified to create tetrahedron.volume (float) – Volume in cubed Angstroms of the object.
- getIndices()¶
:return The indices of the faces
- property b¶
- property g¶
- getFaces(vertices)¶
- Parameters
vertices (list of lists) – List of vertices. Each member of list should be a list of 3 coords, [x,y,z]
- 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.
- property material¶
- property opacity¶
- property persistent_name¶
- property pick_category¶
- property pick_id¶
- property r¶
- setColors()¶
- 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.
- setRGBColors(r, g, b, a=None)¶
- 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
- setStyle(style)¶
Sets the polyhedron’s drawing style.
- Parameters
style (Choice, FILL or LINE) – Whether to fill the polyhedron in or to leave it as lines connecting vertices.
- show()¶
Display this object, if it was hidden
- update(vertices, faces)¶
Update the polyhedron’s shape.
- Parameters
vertices (list of lists) – List of vertices. Each member of list should be a list of 3 coords, [x,y,z]
faces (list of lists) – List of faces comprising the polyhedron. Each face should be a list of at least 3 vertices.
- See
Tetrahedron.updateVertices
for an example of usage
- updateVertices(center, length=None, radius=None, volume=None)¶
Update the vertices given a new
center
and size parameter. The changes will be seen the next time the object is drawn.- Parameters
center (list(float, float, float)) – List of 3 Angstrom values indicating the center coordinate of the tetrahedron.
length (float) – Length in Angstroms of each of the edges of the tetrahedron.
radius (float) – Circumsphere radius in Angstroms from center of tetrahedron.
volume (float) – Volume in cubed Angstroms of the object.
- Raises
RuntimeError – If a single option from
length
,radius
, andvolume
does not have a value.ValueError – If the size parameter (
length
,radius
, orvolume
) is not a float.
See
Polyhedron.update
- class schrodinger.graphics3d.polyhedron.MaestroTetrahedron(center, mode, length=None, radius=None, volume=None, color='red', opacity=1.0, style=1)¶
Bases:
schrodinger.graphics3d.polyhedron.MaestroPolyhedronCore
Class to draw a 3D tetrahedron in Maestro’s Workspace.
Tetrahedrons should be added to a graphics3d.common.Group, or TetrahedronGroup, and drawing done via the Group. See the
graphics3d.common.Group
documentation.API Example:
import schrodinger.maestro.maestro as maestro import schrodinger.graphics3d.polyhedron as polyhedron tetrahedron_grp = polyhedron.Group() st = maestro.workspace_get() # Here, st is methane. for atom in st.atom: if atom.element == 'C': center = atoms.xyz tetra = polyhedron.Tetrahedron( center = center, length = 1.828, # length between Hs color = 'goldenrod', opacity = 1.0, style = tetrahedron.LINE ) # Add the primative to the container. tetrahedron_grp.add(tetra) # Hide the markers. tetrahedron_grp.hide() # Remove the markers tetrahedron_grp.clear()
- __init__(center, mode, length=None, radius=None, volume=None, color='red', opacity=1.0, style=1)¶
- getVertices(center, length=None, radius=None, volume=None)¶
Get a list of vertices. If the center coordinates are considered the origin the vertices will have a base on the y-plane, a vertex on the x-axis and a vertex directly in the +z-axis from the
center
.- Parameters
center (list(float, float, float)) – List of 3 Angstrom values indicating the center coordinate of the tetrahedron.
length (float) – Length in Angstroms of each of the sides of the tetrahedron. Note:
length
orradius
must be specified to create tetrahedron.radius (float) – Circumsphere radius in Angstroms from center of tetrahedron. Note:
length
orradius
must be specified to create tetrahedron.volume (float) – Volume in cubed Angstroms of the object.
- getIndices()¶
:return The indices of the faces
- property b¶
- property g¶
- getFaces(vertices)¶
- Parameters
vertices (list of lists) – List of vertices. Each member of list should be a list of 3 coords, [x,y,z]
- 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.
- property material¶
- property opacity¶
- property persistent_name¶
- property pick_category¶
- property pick_id¶
- property r¶
- setColors()¶
- 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.
- setRGBColors(r, g, b, a=None)¶
- 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
- setStyle(style)¶
Sets the polyhedron’s drawing style.
- Parameters
style (Choice, FILL or LINE) – Whether to fill the polyhedron in or to leave it as lines connecting vertices.
- show()¶
Display this object, if it was hidden
- update(vertices, faces)¶
Update the polyhedron’s shape.
- Parameters
vertices (list of lists) – List of vertices. Each member of list should be a list of 3 coords, [x,y,z]
faces (list of lists) – List of faces comprising the polyhedron. Each face should be a list of at least 3 vertices.
- See
Tetrahedron.updateVertices
for an example of usage
- updateVertices(center, length=None, radius=None, volume=None)¶
Update the vertices given a new
center
and size parameter. The changes will be seen the next time the object is drawn.- Parameters
center (list(float, float, float)) – List of 3 Angstrom values indicating the center coordinate of the tetrahedron.
length (float) – Length in Angstroms of each of the edges of the tetrahedron.
radius (float) – Circumsphere radius in Angstroms from center of tetrahedron.
volume (float) – Volume in cubed Angstroms of the object.
- Raises
RuntimeError – If a single option from
length
,radius
, andvolume
does not have a value.ValueError – If the size parameter (
length
,radius
, orvolume
) is not a float.
See
Polyhedron.update
- class schrodinger.graphics3d.polyhedron.MaestroOctahedron(center, mode, length=None, radius=None, volume=None, color='red', opacity=1.0, style=1)¶
Bases:
schrodinger.graphics3d.polyhedron.MaestroPolyhedronCore
Class to draw a 3D octahedron in Maestro’s Workspace.
See
Tetrahedron
doc string for more details.- __init__(center, mode, length=None, radius=None, volume=None, color='red', opacity=1.0, style=1)¶
- getVertices(center, length=None, radius=None, volume=None)¶
Get a list of vertices. If the center coordinates are considered the origin the vertices will have a base on the y-plane, a vertex on the x-axis and a vertex directly in the +z-axis from the
center
.- Parameters
center (list(float, float, float)) – List of 3 Angstrom values indicating the center coordinate of the tetrahedron.
length (float) – Length in Angstroms of each of the sides of the tetrahedron. Note:
length
orradius
must be specified to create tetrahedron.radius (float) – Circumsphere radius in Angstroms from center of tetrahedron. Note:
length
orradius
must be specified to create tetrahedron.volume (float) – Volume in cubed Angstroms of the object.
- getIndices()¶
:return The indices of the faces
- property b¶
- property g¶
- getFaces(vertices)¶
- Parameters
vertices (list of lists) – List of vertices. Each member of list should be a list of 3 coords, [x,y,z]
- 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.
- property material¶
- property opacity¶
- property persistent_name¶
- property pick_category¶
- property pick_id¶
- property r¶
- setColors()¶
- 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.
- setRGBColors(r, g, b, a=None)¶
- 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
- setStyle(style)¶
Sets the polyhedron’s drawing style.
- Parameters
style (Choice, FILL or LINE) – Whether to fill the polyhedron in or to leave it as lines connecting vertices.
- show()¶
Display this object, if it was hidden
- update(vertices, faces)¶
Update the polyhedron’s shape.
- Parameters
vertices (list of lists) – List of vertices. Each member of list should be a list of 3 coords, [x,y,z]
faces (list of lists) – List of faces comprising the polyhedron. Each face should be a list of at least 3 vertices.
- See
Tetrahedron.updateVertices
for an example of usage
- updateVertices(center, length=None, radius=None, volume=None)¶
Update the vertices given a new
center
and size parameter. The changes will be seen the next time the object is drawn.- Parameters
center (list(float, float, float)) – List of 3 Angstrom values indicating the center coordinate of the tetrahedron.
length (float) – Length in Angstroms of each of the edges of the tetrahedron.
radius (float) – Circumsphere radius in Angstroms from center of tetrahedron.
volume (float) – Volume in cubed Angstroms of the object.
- Raises
RuntimeError – If a single option from
length
,radius
, andvolume
does not have a value.ValueError – If the size parameter (
length
,radius
, orvolume
) is not a float.
See
Polyhedron.update
- class schrodinger.graphics3d.polyhedron.MaestroDodecahedron(center, mode, length=None, radius=None, volume=None, color='red', opacity=1.0, style=1)¶
Bases:
schrodinger.graphics3d.polyhedron.MaestroPolyhedronCore
Class to draw a 3D dodecahedron in Maestro’s Workspace.
See
Tetrahedron
doc string for more details.- __init__(center, mode, length=None, radius=None, volume=None, color='red', opacity=1.0, style=1)¶
- getVertices(center, length=None, radius=None, volume=None)¶
Get a list of vertices. If the center coordinates are considered the origin the vertices will have a base on the y-plane, a vertex on the x-axis and a vertex directly in the +z-axis from the
center
.- Parameters
center (list(float, float, float)) – List of 3 Angstrom values indicating the center coordinate of the dodecahedron.
length (float) – Length in Angstroms of each of the sides of the dodecahedron. Note:
length
orradius
must be specified to create dodecahedron.radius (float) – Circumsphere radius in Angstroms from center of dodecahedron. Note:
length
orradius
must be specified to create dodecahedron.volume (float) – Volume in cubed Angstroms of the object.
- getIndices()¶
:return The indices of the faces
- property b¶
- property g¶
- getFaces(vertices)¶
- Parameters
vertices (list of lists) – List of vertices. Each member of list should be a list of 3 coords, [x,y,z]
- 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.
- property material¶
- property opacity¶
- property persistent_name¶
- property pick_category¶
- property pick_id¶
- property r¶
- setColors()¶
- 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.
- setRGBColors(r, g, b, a=None)¶
- 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
- setStyle(style)¶
Sets the polyhedron’s drawing style.
- Parameters
style (Choice, FILL or LINE) – Whether to fill the polyhedron in or to leave it as lines connecting vertices.
- show()¶
Display this object, if it was hidden
- update(vertices, faces)¶
Update the polyhedron’s shape.
- Parameters
vertices (list of lists) – List of vertices. Each member of list should be a list of 3 coords, [x,y,z]
faces (list of lists) – List of faces comprising the polyhedron. Each face should be a list of at least 3 vertices.
- See
Tetrahedron.updateVertices
for an example of usage
- updateVertices(center, length=None, radius=None, volume=None)¶
Update the vertices given a new
center
and size parameter. The changes will be seen the next time the object is drawn.- Parameters
center (list(float, float, float)) – List of 3 Angstrom values indicating the center coordinate of the tetrahedron.
length (float) – Length in Angstroms of each of the edges of the tetrahedron.
radius (float) – Circumsphere radius in Angstroms from center of tetrahedron.
volume (float) – Volume in cubed Angstroms of the object.
- Raises
RuntimeError – If a single option from
length
,radius
, andvolume
does not have a value.ValueError – If the size parameter (
length
,radius
, orvolume
) is not a float.
See
Polyhedron.update
- class schrodinger.graphics3d.polyhedron.MaestroIcosahedron(center, mode, length=None, radius=None, volume=None, color='red', opacity=1.0, style=1)¶
Bases:
schrodinger.graphics3d.polyhedron.MaestroPolyhedronCore
Class to draw a 3D icosahedron in Maestro’s Workspace.
See
Tetrahedron
doc string for more details.- __init__(center, mode, length=None, radius=None, volume=None, color='red', opacity=1.0, style=1)¶
- property b¶
- property g¶
- getFaces(vertices)¶
- Parameters
vertices (list of lists) – List of vertices. Each member of list should be a list of 3 coords, [x,y,z]
- getVertices(center, length=None, radius=None, volume=None)¶
Get a list of vertices. If the center coordinates are considered the origin the vertices will have a base on the y-plane, a vertex on the x-axis and a vertex directly in the +z-axis from the
center
.- Parameters
center (list(float, float, float)) – List of 3 Angstrom values indicating the center coordinate of the icosahedron.
length (float) – Length in Angstroms of each of the sides of the icosahedron. Note:
length
orradius
must be specified to create icosahedron.radius (float) – Circumsphere radius in Angstroms from center of icosahedron. Note:
length
orradius
must be specified to create icosahedron.volume (float) – Volume in cubed Angstroms of the object.
- 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.
- property material¶
- property opacity¶
- property persistent_name¶
- property pick_category¶
- property pick_id¶
- property r¶
- setColors()¶
- 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.
- setRGBColors(r, g, b, a=None)¶
- 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
- setStyle(style)¶
Sets the polyhedron’s drawing style.
- Parameters
style (Choice, FILL or LINE) – Whether to fill the polyhedron in or to leave it as lines connecting vertices.
- show()¶
Display this object, if it was hidden
- update(vertices, faces)¶
Update the polyhedron’s shape.
- Parameters
vertices (list of lists) – List of vertices. Each member of list should be a list of 3 coords, [x,y,z]
faces (list of lists) – List of faces comprising the polyhedron. Each face should be a list of at least 3 vertices.
- See
Tetrahedron.updateVertices
for an example of usage
- updateVertices(center, length=None, radius=None, volume=None)¶
Update the vertices given a new
center
and size parameter. The changes will be seen the next time the object is drawn.- Parameters
center (list(float, float, float)) – List of 3 Angstrom values indicating the center coordinate of the tetrahedron.
length (float) – Length in Angstroms of each of the edges of the tetrahedron.
radius (float) – Circumsphere radius in Angstroms from center of tetrahedron.
volume (float) – Volume in cubed Angstroms of the object.
- Raises
RuntimeError – If a single option from
length
,radius
, andvolume
does not have a value.ValueError – If the size parameter (
length
,radius
, orvolume
) is not a float.
See
Polyhedron.update
- getIndices()¶
:return The indices of the faces