# LineSegs

from pandac.PandaModules import LineSegs

Class : LineSegs
Description : Encapsulates 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:

LineSegs: Namable
Namable:

## Methods of LineSegs:

create
drawTo
getCurrentPosition
getNumVertices
getVertex
getVertexColor
isEmpty
moveTo
reset
setColor
setThickness
setVertex
setVertexColor

## Methods of Namable:

clearName
getClassType
getName
hasName
operator =
output
setName

create GeomNode *LineSegs::create(bool dynamic = (0)); Description: Creates a new GeomNode that will render the series of line segments and points described via calls to move_to() and draw_to(). The lines and points are created with the color and thickness established by calls to set_color() and set_thick(). If dynamic is true, the line segments will be created with the dynamic Geom setting, optimizing them for runtime vertex animation. Description: Appends to an existing GeomNode a new Geom that will render the series of line segments and points described via calls to move_to() and draw_to(). The lines and points are created with the color and thickness established by calls to set_color() and set_thick().

drawTo void LineSegs::draw_to(float x, float y, float z); Description: 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 when create() is called.

getCurrentPosition LPoint3f const &LineSegs::get_current_position(void); Description: Returns the pen's current position. The next call to draw_to() will draw a line segment from this point.

getNumVertices int LineSegs::get_num_vertices(void) const; Functions to move the line vertices after they have been created. Description: 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 through get_vertex() and set_vertex().

getVertex LPoint3f LineSegs::get_vertex(int n) const; Description: Returns the nth point or vertex of the line segment sequence generated by the last call to create(). The first move_to() generates vertex 0; subsequent move_to() and draw_to() calls generate consecutively higher vertex numbers.

getVertexColor LVecBase4f LineSegs::get_vertex_color(int vertex) const; Description: Returns the color of the nth point or vertex.

isEmpty bool LineSegs::is_empty(void); Description: Returns true if move_to() or draw_to() have not been called since the last reset() or create(), false otherwise.

moveTo void LineSegs::move_to(float x, float y, float z); Description: 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() or create(), this creates a single point.

reset void LineSegs::reset(void); Description: Removes any lines in progress and resets to the initial empty state.

setColor void LineSegs::set_color(float r, float g, float b, float a = (1)); Description: Establishes the color that will be assigned to all vertices created by future calls to move_to() and draw_to().

setThickness void LineSegs::set_thickness(float thick); Description: Establishes the line thickness or point size in pixels that will be assigned to all lines and points created by future calls to create().

setVertex void LineSegs::set_vertex(int n, LPoint3f const &vert); Description: Moves the nth point or vertex of the line segment sequence generated by the last call to create(). The first move_to() generates vertex 0; subsequent move_to() and draw_to() calls generate consecutively higher vertex numbers.

setVertexColor void LineSegs::set_vertex_color(int vertex, LVecBase4f const &c); Description: Changes the vertex color of the nth point or vertex. See set_vertex().

clearName void Namable::clear_name(void); Description: Resets the Namable's name to empty.

getClassType static TypeHandle Namable::get_class_type(void); Undocumented function.

getName string const &Namable::get_name(void) const; Description:

hasName bool Namable::has_name(void) const; Description: Returns true if the Namable has a nonempty name set, false if the name is empty.

operator = Namable &Namable::operator =(Namable const &other); Description:

output void Namable::output(ostream &out) const; In the absence of any definition to the contrary, outputting a Namable will write out its name. Description: Outputs the Namable. This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.

setName void Namable::set_name(string const &name); Description: