panda3d.core.LineSegs

class LineSegs

Bases: Namable

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 diagram

Inheritance diagram of LineSegs

__init__(param0: LineSegs) → None
__init__(name: str) → None

Constructs a LineSegs object, 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, call moveTo() and drawTo() repeatedly to describe the path, then call create() to create a GeomNode which will render the described path.

reset() → None

Removes any lines in progress and resets to the initial empty state.

setColor(color: LColor) → None

Establishes the color that will be assigned to all vertices created by future calls to moveTo() and drawTo().

setColor(r: float, g: float, b: float, a: float) → None

Establishes the color that will be assigned to all vertices created by future calls to moveTo() and drawTo().

setThickness(thick: float) → None

Establishes the line thickness or point size in pixels that will be assigned to all lines and points created by future calls to create().

moveTo(v: LVecBase3) → None

Moves the pen to the given point without drawing a line. When followed by drawTo(), this marks the first point of a line segment; when followed by moveTo() or create(), this creates a single point.

moveTo(x: float, y: float, z: float) → None

Moves the pen to the given point without drawing a line. When followed by drawTo(), this marks the first point of a line segment; when followed by moveTo() or create(), this creates a single point.

drawTo(v: LVecBase3) → None

Draws a line segment from the pen’s last position (the last call to move_to or draw_to) to the indicated point. moveTo() and drawTo() only update tables; the actual drawing is performed when create() is called.

drawTo(x: float, y: float, z: float) → None

Draws a line segment from the pen’s last position (the last call to move_to or draw_to) to the indicated point. moveTo() and drawTo() only update tables; the actual drawing is performed when create() is called.

getCurrentPosition() → LVertex

Returns the pen’s current position. The next call to drawTo() will draw a line segment from this point.

Return type

LVertex

isEmpty() → bool

Returns true if moveTo() or drawTo() have not been called since the last reset() or create(), false otherwise.

create(previous: GeomNode, dynamic: bool) → GeomNode

Appends to an existing GeomNode a new Geom that will render the series of line segments and points described via calls to moveTo() and drawTo(). The lines and points are created with the color and thickness established by calls to setColor() and setThickness().

If dynamic is true, the line segments will be created with the dynamic Geom setting, optimizing them for runtime vertex animation.

Return type

GeomNode

create(dynamic: bool) → GeomNode

Creates a new GeomNode that will render the series of line segments and points described via calls to moveTo() and drawTo(). The lines and points are created with the color and thickness established by calls to setColor() and setThickness().

If dynamic is true, the line segments will be created with the dynamic Geom setting, optimizing them for runtime vertex animation.

Return type

GeomNode

getNumVertices() → int

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 getVertex() and setVertex().

getVertex(n: int) → LVertex

Returns the nth point or vertex of the line segment sequence generated by the last call to create(). The first moveTo() generates vertex 0; subsequent moveTo() and drawTo() calls generate consecutively higher vertex numbers.

Return type

LVertex

setVertex(n: int, vert: LVertex) → None

Moves the nth point or vertex of the line segment sequence generated by the last call to create(). The first moveTo() generates vertex 0; subsequent moveTo() and drawTo() calls generate consecutively higher vertex numbers.

setVertex(vertex: int, x: float, y: float, z: float) → None

Moves the nth point or vertex of the line segment sequence generated by the last call to create(). The first moveTo() generates vertex 0; subsequent moveTo() and drawTo() calls generate consecutively higher vertex numbers.

getVertexColor(vertex: int) → LColor

Returns the color of the nth point or vertex.

Return type

LColor

setVertexColor(vertex: int, c: LColor) → None

Changes the vertex color of the nth point or vertex. See setVertex().

setVertexColor(vertex: int, r: float, g: float, b: float, a: float) → None

Changes the vertex color of the nth point or vertex. See setVertex().

getVertices() → list
getVertexColors() → list