Package breitband.game.board
Class Border
- java.lang.Object
-
- java.awt.Polygon
-
- breitband.game.board.Border
-
- All Implemented Interfaces:
java.awt.Shape
,java.io.Serializable
public class Border extends java.awt.Polygon
Class for polygons which have a method to check for lines intersecting with border- Author:
- Klara Schöbel
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Border(int[] xCoords, int[] yCoords, int numPoints, java.lang.String points)
constructs a new polygon with x-, y- coordinates and the number of points
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getPoints()
getter for pointsboolean
intersects(java.awt.geom.Line2D line)
tests if a line intersects with polygonboolean
intersects(java.awt.geom.Point2D point)
Tests if a point intersects the border's polygon
-
-
-
Constructor Detail
-
Border
public Border(int[] xCoords, int[] yCoords, int numPoints, java.lang.String points)
constructs a new polygon with x-, y- coordinates and the number of points- Parameters:
xCoords
- array of x coordinatesyCoords
- array of y coordinatesnumPoints
- number of points in polygonpoints
- space separated list of comma separated coordinates
-
-
Method Detail
-
intersects
public boolean intersects(java.awt.geom.Line2D line)
tests if a line intersects with polygon- Parameters:
line
- to be tested for intersecting with polygon- Returns:
- if the line intersects with the borders of this polygon
-
intersects
public boolean intersects(java.awt.geom.Point2D point)
Tests if a point intersects the border's polygon- Parameters:
point
- to be tested for intersecting with polygon- Returns:
- if the line intersects with the borders of this polygon
-
getPoints
public java.lang.String getPoints()
getter for points- Returns:
- a space separated list of comma separated coordinates
-
-