|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectSciLib.Grp.Graphics2D
SciLib.Grp.Graphics3D
public class Graphics3D
This class contains some methods to draw a 3D graphics.
| Field Summary |
|---|
| Fields inherited from class SciLib.Grp.Graphics2D |
|---|
height, Pi, width |
| Constructor Summary | |
|---|---|
Graphics3D()
Constructor, set view to default |
|
| Method Summary | |
|---|---|
void |
box(java.awt.Graphics g,
double xmin,
double ymin,
double zmin,
double xmax,
double ymax,
double zmax)
Make a box for coordinate system |
void |
box(java.awt.Graphics g,
double xmin,
double ymin,
double zmin,
double xmax,
double ymax,
double zmax,
boolean coord)
Make a box for coordinate system |
void |
changeView(vector a,
vector f,
vector u,
double angle)
change 3D View |
void |
coord3D(java.awt.Graphics g,
double minx,
double miny,
double minz,
double maxx,
double maxy,
double maxz)
Make a 3D coordinate system |
void |
coord3D(java.awt.Graphics g,
vector left,
vector right)
Make a 3D coordinate system |
void |
defaultView()
set the view matrix to the default view |
double |
getAngle()
get the view angle |
vector |
getAt()
get the at point |
vector |
getFrom()
get the from point |
double |
getScale()
get scale factor |
vector |
getUp()
get the up point |
matrix |
getView3D()
Return the view matrix. |
void |
grid(java.awt.Graphics g,
double minx,
double miny,
double minz,
double maxx,
double maxy,
double maxz)
Draw the coordinate system |
void |
lineTo(java.awt.Graphics g,
double x,
double y,
double z)
draw line from the current position to a point (x,y, z) |
void |
moveTo(double x,
double y,
double z)
move pen to a real position (x, y, z) |
matrix |
rotation(double theta,
int n)
Make 3D rotation matrix by an angle Rotate the axes anti-clockwise through an angle theta |
matrix |
scale(double[] scaleVec)
Make 3D scale matrix by vector scaleVec |
void |
screenPos(java.awt.Point ip,
double x,
double y,
double z)
Compute the position on the screen, values are stored in ip |
void |
screenPos(java.awt.Point ip,
vector x)
Compute the position on the screen, values are stored in ip |
void |
SetAngle(double angle)
change the viewAngle |
void |
setEyes()
Compute transformations to make an eye coordinate system |
void |
setFrom(vector a)
set the "from" point to the new postion a |
void |
setScaleFactor(double s)
set a new scale factor |
void |
setView3D(matrix V)
Change the view matrix. |
void |
transform(double[] p,
matrix V,
double[] np)
Compute the eye coordinate system from a point p in a 3D space |
void |
transform(double x,
double y,
double z,
matrix V,
double[] np)
Compute the eye coordinate system from a point (x,y,z) in a 3D space |
vector |
transform(vector x,
matrix V)
Compute the eye coordinate system from a point x in a 3D space |
matrix |
translate(double[] transVec)
Make 3D translation matrix by vector transVec. |
static vector |
vecCross(vector a,
vector b)
Compute the cross product of the two vector in 3D space |
| Methods inherited from class SciLib.Grp.Graphics2D |
|---|
box, changeWindowSize, changeWindowSize, coord, coord2D, coord2D, coord2D, drawLine, getView2D, halfGrid, lineTo, moveTo, rotation, screenPos, setView2D, setView2D |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Graphics3D()
| Method Detail |
|---|
public matrix getView3D()
public void setView3D(matrix V)
V - the new view matrixpublic void defaultView()
public void SetAngle(double angle)
angle - the new viewAngle in degreespublic void setFrom(vector a)
a - the new "from" point
public static vector vecCross(vector a,
vector b)
a - a vectorb - a vector
public void setEyes()
public void transform(double x,
double y,
double z,
matrix V,
double[] np)
x - the x-coordinate of the pointy - the y-coordinate of the pointz - the z-coordinate of the pointV - the view matrixnp - an array that contains the eye coordinates
public void transform(double[] p,
matrix V,
double[] np)
p - the point in a 3D sapceV - the view matrixnp - an array that contains the eye coordinates
public vector transform(vector x,
matrix V)
x - the point in a 3D sapceV - the view matrix
public void coord3D(java.awt.Graphics g,
double minx,
double miny,
double minz,
double maxx,
double maxy,
double maxz)
g - the Graphics objectminx - the minimum x-coordinateminy - the minimum y-coordinateminz - the minimum z-coordinatemaxx - the maximum x-coordinatemaxy - the maximum y-coordinatemaxz - the maximum z-coordinate
public void coord3D(java.awt.Graphics g,
vector left,
vector right)
g - the Graphics objectleft - the left point that contains the minimum coordinatesright - the right point that contains the maximum coordinates
public void screenPos(java.awt.Point ip,
double x,
double y,
double z)
ip - A Point objectx - The x-coordinatey - The y-coordinatez - The z-coordinate
public void screenPos(java.awt.Point ip,
vector x)
ip - A Point objectx - The point in a 3D space
public void moveTo(double x,
double y,
double z)
x - The x-coordinatey - The y-coordinatez - The z-coordinate
public void lineTo(java.awt.Graphics g,
double x,
double y,
double z)
g - Graphicsx - The x-coordinatey - The y-coordinatez - The z-coordinate
public void box(java.awt.Graphics g,
double xmin,
double ymin,
double zmin,
double xmax,
double ymax,
double zmax)
g - Graphicsxmin - The minimum of the x-coordinatesymin - The minimum of the y-coordinateszmin - The minimum of the z-coordinatesxmax - The maximum of the x-coordinatesymax - The maximum of the y-coordinateszmax - The maximum of the z-coordinates
public void box(java.awt.Graphics g,
double xmin,
double ymin,
double zmin,
double xmax,
double ymax,
double zmax,
boolean coord)
g - Graphicsxmin - The minimum of the x-coordinatesymin - The minimum of the y-coordinateszmin - The minimum of the z-coordinatesxmax - The maximum of the x-coordinatesymax - The maximum of the y-coordinateszmax - The maximum of the z-coordinates
public void grid(java.awt.Graphics g,
double minx,
double miny,
double minz,
double maxx,
double maxy,
double maxz)
grid in class Graphics2Dg - Graphicsminx - the minimum x-coordinateminy - the minimum y-coordinateminz - the minimum z-coordinatemaxx - the maximum x-coordinatemaxy - the maximum y-coordinatemaxz - the maximum z-coordinate
public void changeView(vector a,
vector f,
vector u,
double angle)
a - A vector, the at pointf - A vector, the from pointu - A vector, the up pointangle - A double value, the view angle in degreespublic double getScale()
public void setScaleFactor(double s)
s - A double value, the new scale factorpublic vector getAt()
public vector getFrom()
public vector getUp()
public double getAngle()
public matrix translate(double[] transVec)
translate in class Graphics2DtransVec - the translate vectorpublic matrix scale(double[] scaleVec)
scale in class Graphics2DscaleVec - the scale vector
public matrix rotation(double theta,
int n)
theta - the rotation angle in degreesn - An integer value, n=1 : rotate about x-axis, n = 2 -->y-axis og n = 3 -->z-axis
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||