|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectSciLib.Grp.Graphics2D
public class Graphics2D
This class contains some methods to draw a 2D graphics.
| Field Summary | |
|---|---|
protected static int |
height
|
static double |
Pi
The constant value Pi = 3.141592 |
protected static int |
width
|
| Constructor Summary | |
|---|---|
Graphics2D()
|
|
| Method Summary | |
|---|---|
void |
box(java.awt.Graphics g,
double minx,
double miny,
double maxx,
double maxy)
Plot a rectangle. |
void |
changeWindowSize(java.awt.Dimension d)
change graphics window size |
void |
changeWindowSize(int w,
int h)
change graphics window size |
void |
coord(java.awt.Graphics g,
double minx,
double miny,
double maxx,
double maxy)
Draw a 2D coordinate system in a frame window. |
void |
coord2D(java.awt.Graphics g,
double minx,
double miny,
double maxx,
double maxy)
Make a 2D coordinate system without drawing it in a frame window. |
void |
coord2D(java.awt.Graphics g,
vector xv,
vector yv)
Make a 2D coordinate system and plot it in a frame window. |
void |
coord2D(java.awt.Graphics g,
vector xv,
vector yv,
java.lang.String specific)
Make a 2D coordinate system and plot it in a frame window with a specific |
void |
drawLine(java.awt.Graphics g,
double x1,
double y1,
double x2,
double y2)
draw a line from (x1,y1) to (x2,y2) |
matrix |
getView2D()
Return the view matrix. |
void |
grid(java.awt.Graphics g,
double minx,
double miny,
double maxx,
double maxy,
double oX,
double oY)
Draw a 2D grid coordinate system in a frame window. |
void |
halfGrid(java.awt.Graphics g,
double minx,
double miny,
double maxx,
double maxy,
double oX,
double oY)
Draw a 2D halfGrid coordinate system in a frame window. |
void |
lineTo(java.awt.Graphics g,
double x,
double y)
draw line from the current position to a point (x,y) |
void |
moveTo(double x,
double y)
move pen to a real position (x, y) |
matrix |
rotation(double theta)
Make 2D rotation matrix by an angle |
matrix |
scale(double[] scaleVec)
Make 2D scale matrix by vector scaleVec |
void |
screenPos(java.awt.Point p,
double x,
double y)
Compute the position on the screen, values are stored in p |
void |
setView2D(double xLen,
double yLen)
generate 2D view matrix |
void |
setView2D(matrix v)
generate 2D view matrix form a matrix v |
matrix |
translate(double[] transVec)
Make 2D translation matrix by vector transVec |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double Pi
protected static int width
protected static int height
| Constructor Detail |
|---|
public Graphics2D()
| Method Detail |
|---|
public matrix getView2D()
public void setView2D(double xLen,
double yLen)
xLen - The length of x-AxisyLen - The length of y-Axispublic void setView2D(matrix v)
v - A 3 x 3 matrix
public void screenPos(java.awt.Point p,
double x,
double y)
p - A Point objectx - The x-coordinatey - The y-coordinate
public void moveTo(double x,
double y)
x - The x-coordinatey - The y-coordinate
public void lineTo(java.awt.Graphics g,
double x,
double y)
g - Graphicsx - The x-coordinatey - The y-coordinatepublic void changeWindowSize(java.awt.Dimension d)
d - New Dimension
public void changeWindowSize(int w,
int h)
w - An integer, the widthh - An integer, the height
public void drawLine(java.awt.Graphics g,
double x1,
double y1,
double x2,
double y2)
g - Graphicsx1 - The x-coordinate of the first pointy1 - The y-coordinate of the first pointx2 - The x-coordinate of the second pointy2 - The y-coordinate of the first point
public void box(java.awt.Graphics g,
double minx,
double miny,
double maxx,
double maxy)
g - Graphicsminx - The x-coordinate of the down-left pointminy - The y-coordinate of the down-left pointmaxx - The x-coordinate of the up-right pointmaxy - The y-coordinate of the up-right point
public void coord(java.awt.Graphics g,
double minx,
double miny,
double maxx,
double maxy)
g - Graphicsminx - The x-coordinate of the down-left pointminy - The y-coordinate of the down-left pointmaxx - The x-coordinate of the up-right pointmaxy - The y-coordinate of the up-right point
public void halfGrid(java.awt.Graphics g,
double minx,
double miny,
double maxx,
double maxy,
double oX,
double oY)
g - Graphicsminx - The x-coordinate of the down-left pointminy - The y-coordinate of the down-left pointmaxx - The x-coordinate of the up-right pointmaxy - The y-coordinate of the up-right pointoX - The origin x-coordinateoY - The origin y-coordinate
public void grid(java.awt.Graphics g,
double minx,
double miny,
double maxx,
double maxy,
double oX,
double oY)
g - Graphicsminx - The x-coordinate of the down-left pointminy - The y-coordinate of the down-left pointmaxx - The x-coordinate of the up-right pointmaxy - The y-coordinate of the up-right pointoX - The origin x-coordinateoY - The origin y-coordinate
public void coord2D(java.awt.Graphics g,
double minx,
double miny,
double maxx,
double maxy)
g - Graphicsminx - The x-coordinate of the down-left pointminy - The y-coordinate of the down-left pointmaxx - The x-coordinate of the up-right pointmaxy - The y-coordinate of the up-right point
public void coord2D(java.awt.Graphics g,
vector xv,
vector yv)
g - Graphicsxv - A vector that contains x-coordinatesyv - A vector that contains y-coordinates
public void coord2D(java.awt.Graphics g,
vector xv,
vector yv,
java.lang.String specific)
g - Graphicsxv - A vector that contains x-coordinatesyv - A vector that contains y-coordinatesspecific - A String that can have some values as "grid", "coord", "box" or emptypublic matrix translate(double[] transVec)
transVec - the translate vectorpublic matrix scale(double[] scaleVec)
scaleVec - the scale vectorpublic matrix rotation(double theta)
theta - the rotation angle in degrees
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||