LineSegs¶
from acron.core import LineSegs
- class LineSegs¶
Bases:
Bases:
NamableEncapsulates creation of a series of connected or disconnected line segments or points, for drawing paths or rays. This class doesn’t attempt to be the smartest it could possibly be; it’s intended primarily as a visualization and editing tool.
Inheritance diagram
digraph inheritance93d781f894 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "LineSegs" [URL="acron.core.LineSegs.html#acron.core.LineSegs",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "Namable" -> "LineSegs" [arrowsize=0.75,style=""]; "Namable" [URL="acron.core.Namable.html#acron.core.Namable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "Namable" [arrowsize=0.75,style=""]; }- __init__()¶
Constructs a
LineSegsobject, which can be used to create any number of disconnected lines or points of various thicknesses and colors through the visible scene. After creating the object, callmove_to()anddraw_to()repeatedly to describe the path, then callcreate()to create aGeomNodewhich will render the described path.
- create()¶
Creates a new
GeomNodethat will render the series of line segments and points described via calls tomove_to()anddraw_to(). The lines and points are created with the color and thickness established by calls toset_color()andset_thickness().If dynamic is true, the line segments will be created with the dynamic Geom setting, optimizing them for runtime vertex animation.
Appends to an existing
GeomNodea new Geom that will render the series of line segments and points described via calls tomove_to()anddraw_to(). The lines and points are created with the color and thickness established by calls toset_color()andset_thickness().If dynamic is true, the line segments will be created with the dynamic Geom setting, optimizing them for runtime vertex animation.
- draw_to()¶
Draws a line segment from the pen’s last position (the last call to
move_to()or draw_to) to the indicated point.move_to()and draw_to() only update tables; the actual drawing is performed whencreate()is called.Draws a line segment from the pen’s last position (the last call to
move_to()or draw_to) to the indicated point.move_to()and draw_to() only update tables; the actual drawing is performed whencreate()is called.
- get_current_position()¶
Returns the pen’s current position. The next call to
draw_to()will draw a line segment from this point.
- get_num_vertices()¶
Functions to move the line vertices after they have been created.
Functions to move the line vertices after they have been created.
Functions to move the line vertices after they have been created.
Returns the total number of line segment and point vertices generated by the last call to
create(). The positions of these vertices may be read and adjusted throughget_vertex()andset_vertex().
- get_vertex()¶
Returns the nth point or vertex of the line segment sequence generated by the last call to
create(). The firstmove_to()generates vertex 0; subsequentmove_to()anddraw_to()calls generate consecutively higher vertex numbers.
- get_vertex_color()¶
Returns the color of the nth point or vertex.
- is_empty()¶
Returns true if
move_to()ordraw_to()have not been called since the lastreset()orcreate(), false otherwise.
- move_to()¶
Moves the pen to the given point without drawing a line. When followed by
draw_to(), this marks the first point of a line segment; when followed by move_to() orcreate(), this creates a single point.Moves the pen to the given point without drawing a line. When followed by
draw_to(), this marks the first point of a line segment; when followed by move_to() orcreate(), this creates a single point.
- reset()¶
Removes any lines in progress and resets to the initial empty state.
- set_color()¶
Establishes the color that will be assigned to all vertices created by future calls to
move_to()anddraw_to().Establishes the color that will be assigned to all vertices created by future calls to
move_to()anddraw_to().
- set_thickness()¶
Establishes the line thickness or point size in pixels that will be assigned to all lines and points created by future calls to
create().
- set_vertex()¶
Moves the nth point or vertex of the line segment sequence generated by the last call to
create(). The firstmove_to()generates vertex 0; subsequentmove_to()anddraw_to()calls generate consecutively higher vertex numbers.Moves the nth point or vertex of the line segment sequence generated by the last call to
create(). The firstmove_to()generates vertex 0; subsequentmove_to()anddraw_to()calls generate consecutively higher vertex numbers.
- set_vertex_color()¶
Changes the vertex color of the nth point or vertex. See
set_vertex().Changes the vertex color of the nth point or vertex. See
set_vertex().