LineSegs
from panda3d.core import LineSegs
- class LineSegs
Bases:
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
- __init__(name: str)
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, callmoveTo()
anddrawTo()
repeatedly to describe the path, then callcreate()
to create aGeomNode
which will render the described path.
- 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 tomoveTo()
anddrawTo()
. The lines and points are created with the color and thickness established by calls tosetColor()
andsetThickness()
.If dynamic is true, the line segments will be created with the dynamic Geom setting, optimizing them for runtime vertex animation.
- create(dynamic: bool) GeomNode
Creates a new
GeomNode
that will render the series of line segments and points described via calls tomoveTo()
anddrawTo()
. The lines and points are created with the color and thickness established by calls tosetColor()
andsetThickness()
.If dynamic is true, the line segments will be created with the dynamic Geom setting, optimizing them for runtime vertex animation.
- drawTo(v: LVecBase3)
Draws a line segment from the pen’s last position (the last call to
moveTo()
ordrawTo()
) to the indicated point.moveTo()
anddrawTo()
only update tables; the actual drawing is performed whencreate()
is called.
- drawTo(x: float, y: float, z: float)
Draws a line segment from the pen’s last position (the last call to
moveTo()
ordrawTo()
) to the indicated point.moveTo()
anddrawTo()
only update tables; the actual drawing is performed whencreate()
is called.
- getCurrentPosition() LVertex
Returns the pen’s current position. The next call to
drawTo()
will draw a line segment from this point.
- 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 throughgetVertex()
andsetVertex()
.
- getVertex(n: int) LVertex
Returns the nth point or vertex of the line segment sequence generated by the last call to
create()
. The firstmoveTo()
generates vertex 0; subsequentmoveTo()
anddrawTo()
calls generate consecutively higher vertex numbers.
- isEmpty() bool
Returns true if
moveTo()
ordrawTo()
have not been called since the lastreset()
orcreate()
, false otherwise.
- moveTo(v: LVecBase3)
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 bymoveTo()
orcreate()
, this creates a single point.
- moveTo(x: float, y: float, z: float)
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 bymoveTo()
orcreate()
, this creates a single point.
- reset()
Removes any lines in progress and resets to the initial empty state.
- setColor(color: LColor)
Establishes the color that will be assigned to all vertices created by future calls to
moveTo()
anddrawTo()
.
- setColor(r: float, g: float, b: float, a: float)
Establishes the color that will be assigned to all vertices created by future calls to
moveTo()
anddrawTo()
.
- setThickness(thick: float)
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(n: int, vert: LVertex)
Moves the nth point or vertex of the line segment sequence generated by the last call to
create()
. The firstmoveTo()
generates vertex 0; subsequentmoveTo()
anddrawTo()
calls generate consecutively higher vertex numbers.
- setVertex(vertex: int, x: float, y: float, z: float)
Moves the nth point or vertex of the line segment sequence generated by the last call to
create()
. The firstmoveTo()
generates vertex 0; subsequentmoveTo()
anddrawTo()
calls generate consecutively higher vertex numbers.
- setVertexColor(vertex: int, c: LColor)
Changes the vertex color of the nth point or vertex. See
setVertex()
.