Graphics Documentation

colors

class Colors

Convenience class pre-defining some colors to use with our mesh objects.

Attributes: red (numpy.array): Color red. blue (numpy.array): Color blue. green (numpy.array): Color green. white (numpy.array): Color white. black (numpy.array): Color black. yellow (numpy.array): Color yellow. orange (numpy.array): Color orange. purple (numpy.array): Color purple. pink (numpy.array): Color pink.

Mesh

class MeshObject(vertexes=None, indices=None, *args, **kwds)

Interface to pyqtgraph’s GLMeshItem that allows us to scale and rotate the vertices. .. attribute:: opts

Dictionary containing majority of the class’ variables. At one point this was necessary due to passing some kwargs to a parent class, but is now pointless. vertexes: Array of vertexes in world coordinates. model_verts: Array of vertexes in model coordinates indices: Indices of the faces. position: World position rot_vec: Current rotation in the vector form. rot_quat: Current rotation in quaternion form scale: Scale of the model smooth: I forget. computeNormals: Do we compute normals? Nah. No lighting no need. drawEdges: Do we draw edges? drawFaces: Do we draw faces? shader: Custom shader - Deprecated. color: Color of the mesh. edgeColor: Color of the edges of the mesh.

type:dict
get_faces()

Returns an array of face indices.

get_vertices()

Returns an array of vertexes in world coordinates.

set_indices(i, update=True)

Sets the array of indices and optionally triggers an update of the vertices.

Parameters: i (list): List of the vertex indices used to define the faces of the mesh. update (boolean): True/False for whether to update the graphics card. Useful for bulking together GPU changes instead of switching contexts a bunch.

set_position(pos, update=True)

Sets the position and optionally triggers an update of the vertices.

Parameters: pos (vec3): 3 dimensional vector representing the new position of the object. update (boolean): True/False for whether to update the graphics card. Useful for bulking together GPU changes instead of switching contexts a bunch.

set_rotation(o, update=True)

Sets the rotation and optionally triggers an update of the vertices.

Parameters: o (vec3): Vector3 representing the new orientation/rotation of the object. update (boolean): True/False for whether to update the graphics card. Useful for bulking together GPU changes instead of switching contexts a bunch.

set_scale(s, update=True)

Sets the scale and optionally triggers an update of the vertices.

Parameters: update (boolean): True/False for whether to update the graphics card. Useful for bulking together GPU changes instead of switching contexts a bunch.

set_vertexes(v, update=True)

Sets the array of vertexes and optionally triggers an update of the vertices.

Parameters: v (list): List of vertices to use in the mesh. update (boolean): True/False for whether to update the graphics card. Useful for bulking together GPU changes instead of switching contexts a bunch.

update_vertices()

Updates the world vertices with the current scale/translation/rotation.

OrbitalObject

Pipe

class Pipe(start: glm.vec3 = None, end: glm.vec3 = None, rotation=vec3( 0, 0, 0 ))

This class is a subclass of MeshObject and implements utility method for generating Pipe meshes.

SpatialObject

class SpatialObject

This class encapsulates an object’s transformation data & related methods.

Attributes: model_matrix (mat4): Model matrix representing the model’s rotation, scale, and transform. position (vec3): Vector representing an object’s position. current_scale(vec3): Vector representing how to scale an object’s model. rotation (Rotation): scipy.spatial.transform.Rotation representing the object’s rotation.

generate_model_matrix()

Generates 2/3 of the object’s model matrix. Using translation & scale matrices, but missing rotation.

Return: mat4: Model matrix without the rotation.

get_position()

Returns the position of the object.

Return: vec3: Position of the object.

get_rotation()

Gets the rotation data.

Return: scipy.spatial.transform.Rotation: Object’s rotation.

rotate(rotation)

Applies a rotation to the model’s current rotation.

Parameters: rotation (vec3): Rotational vector to apply to each axis of the model’s rotation. (Radians)

scale(s)

Applies a scale to the model’s current scale multiplicatively.

Parameters: s (vec3): Vector representing the scale to apply the model.

set_position(pos)

Sets the position of the object.

Parameters: pos (vec3): Vector representing the object’s new position.

set_rotation(rotation)

Sets the rotation of the model.

Parameters: rotation (vec3): Rotational vector to apply to each axis of the model’s rotation. (Radians)

set_scale(s)

Sets the scale of the model.

Parameters: s (vec3): The vector reprsenting the scale to apply to the model.

translate(offset, relative=True)

Translates/moves the object in world space.

Parameters: offset (vec3): Vector of the translation/move to apply to the object. relative (bool): Boolean for whether to apply this move relative to the object(ex. y applied based on the object’s own up vector)

Square