.. default-domain:: lua .. highlight:: lua .. currentmodule:: Drawing Drawing ======= .. module:: Drawing Provides functionality for drawing objects in the flight scene, the map view, the editor and the tracking station. .. note:: For drawing and interacting with the user interface, see the UI service. Objects drawn by a client are removed when that client disconnects. .. staticmethod:: add_line(start, end, reference_frame, [visible = true]) Draw a line in the scene. :param Tuple start: Position of the start of the line. :param Tuple end: Position of the end of the line. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the positions are in. :param boolean visible: Whether the line is visible. :rtype: :class:`Drawing.Line` .. staticmethod:: add_direction(direction, reference_frame, [length = 1e+01], [visible = true]) Draw a direction vector in the scene, starting from the origin of the given reference frame. :param Tuple direction: Direction to draw the line in. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the direction is in and defines the start position. :param number length: The length of the line. :param boolean visible: Whether the line is visible. :rtype: :class:`Drawing.Line` .. staticmethod:: add_direction_from_com(direction, reference_frame, [length = 1e+01], [visible = true]) Draw a direction vector in the scene, from the center of mass of the active vessel. :param Tuple direction: Direction to draw the line in. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the direction is in. :param number length: The length of the line. :param boolean visible: Whether the line is visible. :rtype: :class:`Drawing.Line` .. staticmethod:: add_axes(reference_frame, [length = 1e+01], [visible = true]) Draw the axes of a reference frame in the scene, as arrows from its origin. :param SpaceCenter.ReferenceFrame reference_frame: The reference frame. :param number length: The length of each axis. :param boolean visible: Whether the axes are visible. :returns: The lines for the x, y and z axes, colored red, green and blue. :rtype: List .. staticmethod:: add_polygon(vertices, reference_frame, [visible = true]) Draw a polygon in the scene, defined by a list of vertices. :param List vertices: Vertices of the polygon. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the vertices are in. :param boolean visible: Whether the polygon is visible. :rtype: :class:`Drawing.Polygon` .. staticmethod:: add_polyline(vertices, reference_frame, [visible = true]) Draw an open line through a list of vertices in the scene. :param List vertices: Vertices of the line. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the vertices are in. :param boolean visible: Whether the line is visible. :rtype: :class:`Drawing.Polyline` .. staticmethod:: add_circle(center, normal, radius, reference_frame, [visible = true]) Draw a circle in the scene. :param Tuple center: Position of the center of the circle. :param Tuple normal: Normal of the plane of the circle. :param number radius: Radius of the circle, in meters. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the position and normal are in. :param boolean visible: Whether the circle is visible. :rtype: :class:`Drawing.Circle` .. note:: Throws an exception if the normal is zero. .. staticmethod:: add_arc(center, normal, start_direction, angle, radius, reference_frame, [visible = true]) Draw an arc of a circle in the scene. :param Tuple center: Position of the center of the arc. :param Tuple normal: Normal of the plane of the arc. :param Tuple start_direction: Direction from the center to the start of the arc. :param number angle: Angle of the arc, in radians. :param number radius: Radius of the arc, in meters. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the position and directions are in. :param boolean visible: Whether the arc is visible. :rtype: :class:`Drawing.Arc` .. note:: The arc turns counterclockwise about the normal, seen from the side it points to. Throws an exception if the normal is zero, or the start direction is parallel to it. .. staticmethod:: add_orbit(orbit, [visible = true]) Draw the path of an orbit in the scene. :param SpaceCenter.Orbit orbit: The orbit. :param boolean visible: Whether the path is visible. :rtype: :class:`Drawing.OrbitPath` .. note:: The path follows the orbit as it changes, and ends where the orbit leaves the sphere of influence of its body. .. staticmethod:: add_point(position, reference_frame, [visible = true]) Draw a point in the scene, as a dot that keeps its size on screen. :param Tuple position: Position of the point. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the position is in. :param boolean visible: Whether the point is visible. :rtype: :class:`Drawing.Point` .. staticmethod:: add_box(center, size, reference_frame, [rotation = {0.0, 0.0, 0.0, 1.0}], [visible = true]) Draw the edges of a box in the scene. :param Tuple center: Position of the center of the box. :param Tuple size: Lengths of the sides of the box along its x, y and z axes, in meters. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the position and rotation are in. :param Tuple rotation: Rotation of the box, as a quaternion. :param boolean visible: Whether the box is visible. :rtype: :class:`Drawing.Box` .. staticmethod:: add_sphere(center, radius, reference_frame, [visible = true]) Draw a solid sphere in the scene. :param Tuple center: Position of the center of the sphere. :param number radius: Radius of the sphere, in meters. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the position is in. :param boolean visible: Whether the sphere is visible. :rtype: :class:`Drawing.Sphere` .. staticmethod:: add_text(text, reference_frame, position, rotation, [visible = true]) Draw text in the scene. :param string text: The string to draw. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the text position is in. :param Tuple position: Position of the text. :param Tuple rotation: Rotation of the text, as a quaternion. :param boolean visible: Whether the text is visible. :rtype: :class:`Drawing.Text` .. staticmethod:: add_navball_marker(direction, reference_frame, [visible = true]) Draw a marker on the navball, pointing in the given direction. :param Tuple direction: Direction that the marker points in. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the direction is in. :param boolean visible: Whether the marker is visible. :rtype: :class:`Drawing.NavballMarker` .. staticmethod:: add_map_marker(position, reference_frame, [icon = Drawing.MapMarkerIcon.generic], [caption = ''], [visible = true]) Draw a marker in the map view, with one of the game's own map icons. :param Tuple position: Position of the marker. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the position is in. :param Drawing.MapMarkerIcon icon: The icon that the marker is drawn with. :param string caption: The caption shown when the mouse is over the marker. :param boolean visible: Whether the marker is visible. :rtype: :class:`Drawing.MapMarker` .. staticmethod:: add_image(data) Load an image that markers can be drawn with, from the contents of a PNG or JPEG file. The transparency of a PNG image is kept. :param string data: The contents of the image file. :rtype: :class:`Drawing.Image` .. note:: Throws an exception if the data is not a PNG or JPEG image. .. staticmethod:: clear([client_only = false]) Remove all objects being drawn. :param boolean client_only: If true, only remove objects created by the calling client.