Class Projection
java.lang.Object
smile.plot.swing.Projection
Projection provides methods to map logical coordinates to Java2D coordinates.
Both 2D and 3D logical coordinates are supported.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintheight()Returns the height of canvas.voidreset()Reset the base coordinates on Java2D screen.int[]screenProjection(double... coord) Project logical coordinates to Java2D coordinates.int[]screenProjectionBaseRatio(double... coord) Project logical coordinates in base ratio to Java2D coordinates.voidsetSize(int width, int height) Sets the canvas size.intwidth()Returns the width of canvas.
-
Constructor Details
-
Projection
-
-
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.
-