de.ba_ravensburg.gdv.controller
Class Triangle2D
java.lang.Object
java.awt.Polygon
de.ba_ravensburg.gdv.controller.Triangle2D
- All Implemented Interfaces:
- Shape, Serializable
public class Triangle2D
- extends Polygon
We need polygons with three points, that have a color, so we specialize
Polygon with these features.
- Author:
- Ansgar Wiechers
- See Also:
Polygon
,
Serialized Form
Constructor Summary |
Triangle2D(int[] xpoints,
int[] ypoints,
int npoints,
Color theColor)
Construct a new 2D triangle with given coordinates and given color. |
Method Summary |
Color |
getColor()
Get the color of this 2D triangle. |
Methods inherited from class java.awt.Polygon |
addPoint, contains, contains, contains, contains, contains, contains, getBoundingBox, getBounds, getBounds2D, getPathIterator, getPathIterator, inside, intersects, intersects, invalidate, reset, translate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Triangle2D
Triangle2D(int[] xpoints,
int[] ypoints,
int npoints,
Color theColor)
throws IllegalArgumentException
- Construct a new 2D triangle with given coordinates and given color.
- Parameters:
xpoints
- an array of x coordinates.ypoints
- an array of y coordinates.npoints
- the total number of points in the triangle.theColor
- the color of the triangle.
- Throws:
IllegalArgumentException
- if total number of points != 3.- See Also:
Polygon.Polygon(int[], int[], int)
getColor
public Color getColor()
- Get the color of this 2D triangle.
- Returns:
- the color of the 2D triangle.
Copyright © 2004 Max Schloss and Ansgar Wiechers. All Rights Reserved.