3D Line Plot - Qwt3DLine¶
Qwt3DLine is a 3D plot item for drawing polylines (curves) through 3D space. It accepts a series of QwtPoint3D samples and renders them as a connected curve, with three rendering styles ranging from a thin GL line to a lit solid tube.
For an overview of the 3D module see 3D Plot Introduction. Qwt3DLine is a Qwt3DPlotItem and follows the same attach/draw/hull contract as Qwt3DSurface.
Key Features¶
-
Three styles:
Tube(default, lit solid),Lines(thin GL line),Dots(point markers) -
Tube geometry: the polyline is swept with a circular cross-section using parallel-transport framing (stable on straight segments, unlike Frenet frames), with Blinn-Phong lighting
-
Auto tube radius: 0.5% of the hull diagonal when not set; ring tessellation is tunable
-
Per-vertex coloring: colormap along the curve (e.g. by position/arc-length) or solid color
-
Point-marker overlay: optional markers on top of the
Lines/Tubestyles -
Theme integration: picked up by
Qwt3DTheme::applyToItem()
Basic Concepts¶
Line Styles¶
| Style | Description |
|---|---|
Qwt3DLine::Tube |
Lit solid tube swept along the polyline (default). True 3D thickness. |
Qwt3DLine::Lines |
Thin GL line strip (1px). Reliable, but width not adjustable in Core profile. |
Qwt3DLine::Dots |
Per-sample point markers with configurable point size. |
Note β Why Tube?
OpenGL Core profile does not support
glLineWidth > 1reliably. For visibly thick 3D curves (trajectories, streamlines), use theTubestyle, which builds real geometry.
Architecture¶
classDiagram
class Qwt3DPlotItem {
<<abstract>>
+attach(plot)
+draw()*
+hull()*
+itemChanged()
}
class Qwt3DLine {
+setSamples()
+setLineStyle()
+setTubeRadius()/setTubeSegments()
+setPointSize()/setPointVisible()
+setColor()/setDataColor()
+invalidateColors()
}
Qwt3DPlotItem <|-- Qwt3DLine
The Tube style reuses the lit surface shader; Lines/Dots reuse the shared lineShader()/pointShader() exposed by Qwt3DPlot. Data is stored as a QwtSeriesData<QwtPoint3D> (the core module's QwtPoint3DSeriesData).
Usage¶
The 3D line plot example is located at: examples/3D/line3D.
1. Basic Tube Curve (helix)¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
2. Setting Data¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
3. Line Styles¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
4. Coloring¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
5. Point Markers Overlay¶
Draw point markers on top of the Lines or Tube style:
1 2 3 4 5 | |
6. Theme & Coordinate System¶
1 2 3 | |
Core Methods Summary¶
| Method | Description |
|---|---|
setSamples(...) |
Set the 3D point series (multiple overloads, see above) |
data() / dataSize() |
Access the series / sample count |
setLineStyle(LineStyle) |
Lines / Tube / Dots |
setLineWidth(w) |
GL line width (Lines style; > 1 not guaranteed in Core) |
setTubeRadius(r) / setTubeSegments(n) |
Tube cross-section (<= 0 = auto; min 3) |
setPointSize(s) / setPointVisible(bool) |
Point markers (Dots, or overlay on Lines/Tube) |
setColor(RGBA) / setDataColor(Qwt3DColor*) |
Solid or per-vertex color functor |
dataColor() / invalidateColors() |
Color functor access / rebuild trigger |
hull() / draw() / populateLegendColors() |
Qwt3DPlotItem interface |
Tip
For trajectories/streamlines prefer
Tubewith lighting on.Increase
setTubeSegmentsfor smoother tubes (cost: more vertices).If the curve bends sharply, raise the sample density so the tube stays smooth.
Use
setPointVisible(true)on aTubeto mark sample points.Example β Related Examples
3D line plot:
examples/3D/line3DFor a live sliding-window of many traces see 3D Waterfall (
Qwt3DWaterfall), demoed byexamples/3D/waterfall3D