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:
  • AbstractCompositeShape
  • SolidPolygon
  • Line
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Functional 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

    Constructors
    Constructor
    Description
    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.
    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 Type
    Method
    Description
    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.
    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.

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 domain
      xMax - maximum X value of the domain
      xStep - step size between grid points along X axis
      yMin - minimum Y value of the domain
      yMax - maximum Y value of the domain
      yStep - step size between grid points along Y axis
      function - the mathematical function z = f(x, y) to visualize
      surfaceColor - color of the surface polygons (use semi-transparent for see-through effect)
      gridColor - color of the wireframe grid lines
      lineWidth - width of grid lines in world units
      scale - scale factor applied to all generated vertices
      location - 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 plane
      function - the mathematical function z = f(x, y)
      color - the color of the intersection curve
      width - 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 plane
      function - the mathematical function z = f(x, y)
      color - the color of the intersection curve
      width - the line width