Compiled graphics object API¶
- ammolite.draw_cgo(cgo_list, name=None, pymol_instance=None)¶
Draw geometric shapes using Compiled Graphics Objects (CGOs).
Each CGO is represented by a list of floats, which can be obtained via the
get_xxx_cgo()
functions.- Parameters
- cgo_listlist of list of float
The CGOs to draw. It is recommended to use a
get_xxx_cgo()
function to obtain the elements for this list, if possible. Otherwise, shapes may be drawn incorrectly or omitted entirely, if a CGO is incorrectly formatted.- namestr, optional
The name of the newly created CGO object. If omitted, a unique name is generated.
- pymol_instancemodule or SingletonPyMOL or PyMOL, optional
If PyMOL is used in library mode, the
PyMOL
orSingletonPyMOL
object is given here. If otherwise PyMOL is used in GUI mode, thepymol
module is given. By default the currently used PyMOL instance (ammolite.pymol
) is used. If no PyMOL instance is currently running, PyMOL is started in library mode.
- ammolite.get_cylinder_cgo(start, end, radius, start_color, end_color)¶
Get the CGO for a cylinder.
- Parameters
- start, endarray-like, shape=(3,)
The start and end position of the cylinder.
- radiusfloat
The radius of the cylinder
- start_color, end_colorarray-like, shape=(3,)
The color at the start and end of the cylinder given as RGB values in the range (0, 1).
- ammolite.get_cone_cgo(start, end, start_radius, end_radius, start_color, end_color, start_cap, end_cap)¶
Get the CGO for a cone.
- Parameters
- start, endarray-like, shape=(3,)
The start and end position of the cone.
- start_radius, end_radiusfloat
The radius of the cone at the start and end.
- start_color, end_colorarray-like, shape=(3,)
The color at the start and end of the cone given as RGB values in the range (0, 1).
- start_cap, end_capbool
If true, a cap is drawn at the start or end of the cone. Otherwise the cone is displayed as open.
- ammolite.get_sphere_cgo(pos, radius, color)¶
Get the CGO for a sphere.
- Parameters
- posarray-like, shape=(3,)
The position of the sphere.
- radiusfloat
The radius of the sphere.
- colorarray-like, shape=(3,)
The color of the sphere given as RGB values in the range (0, 1).
- ammolite.draw_arrows(start, end, radius=0.1, head_radius=0.2, head_length=0.5, color=(0.5, 0.5, 0.5), head_color=None, name=None, pymol_instance=None)¶
Draw three-dimensional arrows using Compiled Graphics Objects (CGOs).
- Parameters
- start, endarray-like, shape=(n,3)
The start and end position of each arrow.
- radius, head_radius: float or array-like, shape=(n,), optional
The radius of the tail and head for each arrow. Uniform for all arrows, if a single value is given.
- head_length: float or array-like, shape=(n,), optional
The length of each arrow head. Uniform for all arrows, if a single value is given.
- color, head_colorarray-like, shape=(3,) or shape=(n,3), optional
The color of the tail and head for each arrow, given as RGB values in the range (0, 1). Uniform for all arrows, if a single value is given. If no head_color is given, the arrows are single-colored.
- namestr, optional
The name of the newly created CGO object. If omitted, a unique name is generated.
- pymol_instancemodule or SingletonPyMOL or PyMOL, optional
If PyMOL is used in library mode, the
PyMOL
orSingletonPyMOL
object is given here. If otherwise PyMOL is used in GUI mode, thepymol
module is given. By default the currently used PyMOL instance (ammolite.pymol
) is used. If no PyMOL instance is currently running, PyMOL is started in library mode.