Package smile.plot.swing
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 TypeMethodDescriptionint
height()
Returns the height of canvas.void
reset()
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.void
setSize
(int width, int height) Sets the canvas size.int
width()
Returns the width of canvas.
-
Constructor Details
-
Projection
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.
-