Class TrailSmart

All Implemented Interfaces:
Drawable, Measurable

public class TrailSmart extends TrailBezier
TrailSmart adds points to a Bezier trail only if the new point deviates from a straight line. The smart trail algorithm minimizes the number of points drawn.
Version:
1.0
Author:
Wolfgang Christian
  • Constructor Details

    • TrailSmart

      public TrailSmart()
  • Method Details

    • setMaxError

      public void setMaxError(double max)
      Sets the maximum error.
      Parameters:
      max - double
    • addPoint

      public void addPoint(double x, double y)
      Adds a point to the trail.
      Overrides:
      addPoint in class TrailBezier
      Parameters:
      x - double
      y - double
    • drawPathEnd

      protected void drawPathEnd(DrawingPanel panel, Graphics2D g2)
      Draws the points that have not yet been added to the Bezier spline.
      Parameters:
      panel - DrawingPanel
      g2 - Graphics2D
    • getXMin

      public double getXMin()
      Gets the minimum x value in the trail.
      Specified by:
      getXMin in interface Measurable
      Overrides:
      getXMin in class TrailBezier
      Returns:
      double
    • getXMax

      public double getXMax()
      Gets the maximum x value in the trail.
      Specified by:
      getXMax in interface Measurable
      Overrides:
      getXMax in class TrailBezier
      Returns:
      double
    • getYMin

      public double getYMin()
      Gets the minimum y value in the trail.
      Specified by:
      getYMin in interface Measurable
      Overrides:
      getYMin in class TrailBezier
      Returns:
      double
    • getYMax

      public double getYMax()
      Gets the maximum y value in the trail.
      Specified by:
      getYMax in interface Measurable
      Overrides:
      getYMax in class TrailBezier
      Returns:
      double