public abstract class LineTracer3D extends Object
There is no true 3d line plotting primitive available for a CubeSurface, so we have to do it by hand. To get the Z-stacking right it is necessary to plot non-tiny lines using a number of pixels or segments, each placed at the relevant Z coordinate (depth). This is not done very accurately, but it's hopefully good enough to look OK. It may also not be very efficient if there are lots of long lines criss-crossing the visible cube, but in that case even if it was done fast it would almost certainly be impossible to see anything useful.
Line segments may still be visible if the points they join are outside the visible cube. In general therefore non-visible points should still be submitted to this tracer for drawing. The code attempts to deal with them efficiently, avoiding painting where it is not required, and coping with points that are far from the visible region.
Modifier | Constructor and Description |
---|---|
protected |
LineTracer3D(PaperType3D paperType,
Paper paper,
CubeSurface surf)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addPoint(double[] dpos,
Color color)
Submits a point for drawing.
|
static LineTracer3D |
createTracer(PaperType3D paperType,
Paper paper,
CubeSurface surf,
int thickness,
int pixgap)
Creates a line tracer from a given line thickness and pixel gap.
|
static LineTracer3D |
createTracer(PaperType3D paperType,
Paper paper,
CubeSurface surf,
Stroke stroke)
Creats a line segment tracer from a given stroke.
|
protected LineTracer3D(PaperType3D paperType, Paper paper, CubeSurface surf)
paperType
- paper typepaper
- papersurf
- target surfacepublic void addPoint(double[] dpos, Color color)
dpos
- 3-element array giving the vertex position
in data coordinatescolor
- colour of line segmentpublic static LineTracer3D createTracer(PaperType3D paperType, Paper paper, CubeSurface surf, Stroke stroke)
paperType
- paper typepaper
- papersurf
- target surfacestroke
- line stroke - probably only line width is honouredpublic static LineTracer3D createTracer(PaperType3D paperType, Paper paper, CubeSurface surf, int thickness, int pixgap)
paperType
- paper typepaper
- papersurf
- target surfacethickness
- line thickness/marker size (minimum 1)pixgap
- nominal gap in pixels between markersCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.