Class Projection

java.lang.Object
smile.plot.swing.Projection

public abstract class Projection extends Object
Projection provides methods to map logical coordinates to Java2D coordinates. Both 2D and 3D logical coordinates are supported.
  • Constructor Details

    • Projection

      public Projection(Figure figure)
      Constructor.
      Parameters:
      figure - the figure to project.
  • Method Details

    • reset

      public void reset()
      Reset the base coordinates on Java2D screen.
    • setSize

      public void setSize(int width, int height)
      Sets the canvas size.
      Parameters:
      width - the canvas width.
      height - the canvas height.
    • width

      public int width()
      Returns the width of canvas.
      Returns:
      the width of canvas.
    • height

      public int height()
      Returns the height of canvas.
      Returns:
      the height of canvas.
    • screenProjection

      public int[] screenProjection(double... coord)
      Project logical coordinates to Java2D coordinates.
      Parameters:
      coord - the logic coordinates.
      Returns:
      Java2D coordinates.
    • screenProjectionBaseRatio

      public int[] screenProjectionBaseRatio(double... coord)
      Project logical coordinates in base ratio to Java2D coordinates.
      Parameters:
      coord - the logic coordinates in base ratio.
      Returns:
      Java2D coordinates.