Class SurfaceGraph3D
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.examples.graph_demo.SurfaceGraph3D
public class SurfaceGraph3D
extends eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
A 3D surface graph that visualizes mathematical functions of the form z = f(x, y).
The surface is rendered as a grid of quadrilaterals (split into triangles) with optional wireframe overlay. The surface color can be customized, and the wireframe lines are drawn in a contrasting color.
Usage example:
// Create a saddle surface: z = x^2 - y^2
SurfaceGraph3D saddle = new SurfaceGraph3D(
-5, 5, 0.5, // x range and step
-5, 5, 0.5, // y range and step
(x, y) -> x * x - y * y, // function z = f(x, y)
new Color(180, 180, 180, 200), // gray semi-transparent surface
new Color(255, 255, 255), // white grid lines
new Point3D(0, 0, 0) // position in 3D space
);
shapeCollection.addShape(saddle);
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface for 3D mathematical functions of the form z = f(x, y). -
Field Summary
Fields inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
mouseInteractionController -
Constructor Summary
ConstructorsConstructorDescriptionSurfaceGraph3D(double xMin, double xMax, double xStep, double yMin, double yMax, double yStep, SurfaceGraph3D.MathFunction3D function, eu.svjatoslav.sixth.e3d.renderer.raster.Color surfaceColor, eu.svjatoslav.sixth.e3d.renderer.raster.Color gridColor, double lineWidth, double scale, eu.svjatoslav.sixth.e3d.geometry.Point3D location) Creates a 3D surface graph at the specified location.SurfaceGraph3D(double xMin, double xMax, double xStep, double yMin, double yMax, double yStep, SurfaceGraph3D.MathFunction3D function, eu.svjatoslav.sixth.e3d.renderer.raster.Color surfaceColor, eu.svjatoslav.sixth.e3d.renderer.raster.Color gridColor, double scale, eu.svjatoslav.sixth.e3d.geometry.Point3D location) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddXIntersectionCurve(double xValue, SurfaceGraph3D.MathFunction3D function, eu.svjatoslav.sixth.e3d.renderer.raster.Color color, double width) Adds a curve highlighting the intersection of the surface with a vertical plane at constant X.voidaddYIntersectionCurve(double yValue, SurfaceGraph3D.MathFunction3D function, eu.svjatoslav.sixth.e3d.renderer.raster.Color color, double width) Adds a curve highlighting the intersection of the surface with a vertical plane at constant Y.Methods inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
addShape, addShape, beforeTransformHook, getGroup, getLocation, getOriginalSubShapes, getViewSpaceTracker, hideGroup, removeGroup, setBackfaceCulling, setColor, setGroupForUngrouped, setLightingManager, setMouseInteractionController, setShadingEnabled, setTransform, showGroup, transform
-
Constructor Details
-
SurfaceGraph3D
public SurfaceGraph3D(double xMin, double xMax, double xStep, double yMin, double yMax, double yStep, SurfaceGraph3D.MathFunction3D function, eu.svjatoslav.sixth.e3d.renderer.raster.Color surfaceColor, eu.svjatoslav.sixth.e3d.renderer.raster.Color gridColor, double lineWidth, double scale, eu.svjatoslav.sixth.e3d.geometry.Point3D location) Creates a 3D surface graph at the specified location.- Parameters:
xMin- minimum X value of the domainxMax- maximum X value of the domainxStep- step size between grid points along X axisyMin- minimum Y value of the domainyMax- maximum Y value of the domainyStep- step size between grid points along Y axisfunction- the mathematical function z = f(x, y) to visualizesurfaceColor- color of the surface polygons (use semi-transparent for see-through effect)gridColor- color of the wireframe grid lineslineWidth- width of grid lines in world unitsscale- scale factor applied to all generated verticeslocation- the 3D position of the graph's origin
-
SurfaceGraph3D
public SurfaceGraph3D(double xMin, double xMax, double xStep, double yMin, double yMax, double yStep, SurfaceGraph3D.MathFunction3D function, eu.svjatoslav.sixth.e3d.renderer.raster.Color surfaceColor, eu.svjatoslav.sixth.e3d.renderer.raster.Color gridColor, double scale, eu.svjatoslav.sixth.e3d.geometry.Point3D location)
-
-
Method Details
-
addXIntersectionCurve
public void addXIntersectionCurve(double xValue, SurfaceGraph3D.MathFunction3D function, eu.svjatoslav.sixth.e3d.renderer.raster.Color color, double width) Adds a curve highlighting the intersection of the surface with a vertical plane at constant X.- Parameters:
xValue- the X coordinate of the intersecting planefunction- the mathematical function z = f(x, y)color- the color of the intersection curvewidth- the line width
-
addYIntersectionCurve
public void addYIntersectionCurve(double yValue, SurfaceGraph3D.MathFunction3D function, eu.svjatoslav.sixth.e3d.renderer.raster.Color color, double width) Adds a curve highlighting the intersection of the surface with a vertical plane at constant Y.- Parameters:
yValue- the Y coordinate of the intersecting planefunction- the mathematical function z = f(x, y)color- the color of the intersection curvewidth- the line width
-