|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.ba_ravensburg.gdv.model.Triangle
public class Triangle
Instances of this class represent three dimensional triangles. The triangles are determined by three points in the coordinate space and their color.
Field Summary | |
---|---|
(package private) static Color |
DEFAULT_COLOR
The default color of a triangle. |
static int |
HORIZONTAL
Constant representing horizontal turns. |
static int |
VERTICAL
Constant representing vertical turns. |
Constructor Summary | |
---|---|
Triangle(double xA,
double yA,
double zA,
double xB,
double yB,
double zB,
double xC,
double yC,
double zC)
Constructs a new triangle by three given points. |
|
Triangle(double xA,
double yA,
double zA,
double xB,
double yB,
double zB,
double xC,
double yC,
double zC,
Color theColor)
Constructs a new triangle by three given points and given color. |
Method Summary | |
---|---|
double |
getAngleOfA(int direction)
Get the spherical coordinate angle of point A. |
double |
getAngleOfB(int direction)
Get the spherical coordinate angle of point B. |
double |
getAngleOfC(int direction)
Get the spherical coordinate angle of point C. |
Color |
getColor()
Get the current color of the triangle. |
double |
getDistance()
Get the weighted distance of the triangle from the camera. |
double[] |
getPointA()
Get point A of the triangle. |
double[] |
getPointB()
Get point B of the triangle. |
double[] |
getPointC()
Get point C of the triangle. |
(package private) void |
move(double step,
int direction)
Move the triangle by given amount step into direction. |
void |
setColor(Color theColor)
Set new color of the triangle. |
void |
setPointA(double x,
double y,
double z)
Set point A of the triangle. |
void |
setPointB(double x,
double y,
double z)
Set point B of the triangle. |
void |
setPointC(double x,
double y,
double z)
Set point C of the triangle. |
(package private) void |
turn(double angle,
int plane)
Turn the triangle by given angle in given plane around the camera position. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final Color DEFAULT_COLOR
public static final int HORIZONTAL
public static final int VERTICAL
Constructor Detail |
---|
public Triangle(double xA, double yA, double zA, double xB, double yB, double zB, double xC, double yC, double zC) throws IllegalArgumentException
xA
- x-coordinate of point A.yA
- y-coordinate of point A.zA
- z-coordinate of point A.xB
- x-coordinate of point B.yB
- y-coordinate of point B.zB
- z-coordinate of point B.xC
- x-coordinate of point C.yC
- y-coordinate of point C.zC
- z-coordinate of point C.
IllegalArgumentException
- if at least two of the three points are
equal.public Triangle(double xA, double yA, double zA, double xB, double yB, double zB, double xC, double yC, double zC, Color theColor) throws IllegalArgumentException
xA
- x-coordinate of point A.yA
- y-coordinate of point A.zA
- z-coordinate of point A.xB
- x-coordinate of point B.yB
- y-coordinate of point B.zB
- z-coordinate of point B.xC
- x-coordinate of point C.yC
- y-coordinate of point C.zC
- z-coordinate of point C.theColor
- a color.
IllegalArgumentException
- if at least two of the three points are
equal.Method Detail |
---|
public double getAngleOfA(int direction) throws IllegalArgumentException
Pre: | direction is either HORIZONTAL or VERTICAL. |
Post: | the spherical coordinate angle (HORIZONTAL or VERTICAL) is returned. |
direction
- the direction of the angle.
IllegalArgumentException
- if direction is neither
HORIZONTAL nor VERTICAL.public double getAngleOfB(int direction) throws IllegalArgumentException
Pre: | direction is either HORIZONTAL or VERTICAL. |
Post: | the spherical coordinate angle (HORIZONTAL or VERTICAL) is returned. |
direction
- the direction of the angle.
IllegalArgumentException
- if direction is neither
HORIZONTAL nor VERTICAL.public double getAngleOfC(int direction) throws IllegalArgumentException
Pre: | direction is either HORIZONTAL or VERTICAL. |
Post: | the spherical coordinate angle (HORIZONTAL or VERTICAL) is returned. |
direction
- the direction of the angle.
IllegalArgumentException
- if direction is neither
HORIZONTAL nor VERTICAL.public Color getColor()
Pre: | true |
Post: | true |
public double getDistance()
public double[] getPointA()
Pre: | true |
Post: | true |
public double[] getPointB()
Pre: | true |
Post: | true |
public double[] getPointC()
Pre: | true |
Post: | true |
void move(double step, int direction) throws IllegalArgumentException
Pre: | true |
Post: | the triangle is moved step units into direction direction. |
step
- how far to move the triangle.direction
- axis along which the triangle should be moved.
IllegalArgumentException
- if direction is neither of
X, Y or Z.public void setColor(Color theColor)
Pre: | true |
Post: | true |
theColor
- new color to set.public void setPointA(double x, double y, double z)
Pre: | true |
Post: | pointA is (x;y;z) |
x
- x-coordinate of point A.y
- y-coordinate of point A.z
- z-coordinate of point A.public void setPointB(double x, double y, double z)
Pre: | true |
Post: | pointB is (x;y;z) |
x
- x-coordinate of point B.y
- y-coordinate of point B.z
- z-coordinate of point B.public void setPointC(double x, double y, double z)
Pre: | true |
Post: | pointC is (x;y;z) |
x
- x-coordinate of point C.y
- y-coordinate of point C.z
- z-coordinate of point C.void turn(double angle, int plane) throws IllegalArgumentException
Pre: | true |
Post: | the triangle is turned by angle degree. |
angle
- an angle.plane
- plane in which the triangle should be turned.
IllegalArgumentException
- if plane is neither UPDOWN
nor LEFTRIGHT.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |