Interface Shape
public interface Shape
Shapes aren't the big boys here - shapes are a lower-level form of zones, which are the components that actually go into maps.
If you'd like to create a new zone, or if you'd like to create a new map, or if you'd like to modify an existing map, you should go check out the zones class instead of this one.
- Since:
- 0.1.0
- Author:
- Colin Robertson
-
Method Summary
Modifier and Type Method Description intgetComponents()Get how many components make up the shape.booleanisLineInShape(Line line)Check whether or not a given line is inside the shape.booleanisPointInShape(Point point)Check whether or not a given point is inside the shape.
-
Method Details
-
getComponents
int getComponents()Get how many components make up the shape.Components are loosely defined as anything smaller than a shape - in the case of a rectangle, for example, there would be the following components:
- Line
- Point
- Point
- Line
- Point
- Point
- Line
- Point
- Point
- Line
- Point
- Point
- Returns:
- how many components make up the shape.
-
isPointInShape
Check whether or not a given point is inside the shape.Different shapes have different methods of checking whether or not there's a point inside of the shape. For example, determining if a point is contained in a rectangle is significantly more expensive than determining if a point is contained inside of a circle.
For that reason, repeated calls to check for points being in a shape are not suggested. Unless you really need to, checking for shape to shape collisions might be a better idea.
- Parameters:
point- the point to check.- Returns:
- whether or not the point is in the shape.
-
isLineInShape
Check whether or not a given line is inside the shape.Line-checks are the most expensive operation for a shape to perform, aside, of course, from initialization. Unless you have a very strong reason to use this method, the
isPointInShape(Point)method is significantly more effective.- Parameters:
line- the line to check.- Returns:
- whether or not the line intersects with the shape.
-