Class Graph
java.lang.Object
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.Graph
A 2D graph visualization rendered in 3D space.
Plots a series of Point2D data points as a connected line graph, overlaid on a
grid with horizontal and vertical grid lines, axis labels, and a title. The graph is
rendered in the XY plane at the specified 3D location, with all dimensions scaled by
a configurable scale factor.
The graph uses the following default configuration:
- X-axis range:
0to20(world units before scaling) - Y-axis range:
-2to2 - Grid spacing:
0.5in both horizontal and vertical directions - Grid color: semi-transparent blue (
rgba(100, 100, 250, 100)) - Plot color: semi-transparent red (
rgba(255, 0, 0, 100))
Usage example:
// Prepare data points
List<Point2D> data = new ArrayList<>();
for (double x = 0; x <= 20; x += 0.1) {
data.add(new Point2D(x, Math.sin(x)));
}
// Create a graph at position (0, 0, 500) with scale factor 10
Graph graph = new Graph(10.0, data, "sin(x)", new Point3D(0, 0, 500));
// Add to the scene
shapeCollection.addShape(graph);
- See Also:
-
Field Summary
Fields inherited from class AbstractShape
cachedBoundingBox, mouseInteractionController -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class AbstractCompositeShape
addShape, addShape, beforeTransformHook, extractSolidPolygons, getBoundingBox, getGroup, getLocation, getSubShapesRegistry, getTransform, getViewSpaceTracker, hideGroup, intersect, removeGroup, setBackfaceCulling, setCacheNeedsRebuild, setColor, setGroupForUngrouped, setMouseInteractionController, setRootComposite, setShadingEnabled, setTransform, showGroup, subtract, transform, unionMethods inherited from class AbstractShape
invalidateBounds
-
Constructor Details
-
Graph
Creates a new graph visualization at the specified 3D location.The graph is constructed with grid lines, axis labels, plotted data, and a title label. All spatial dimensions are multiplied by the given scale factor.
- Parameters:
scale- the scale factor applied to all spatial dimensions of the graphdata- the list of 2D data points to plot; consecutive points are connected by lineslabel- the title text displayed above the graphlocation- the 3D position of the graph's origin in the scene
-