Class Polygon
java.lang.Object
org.chsrobotics.lib.math.geometry.Polygon
Represents a closed shape with a definite number of sides in 2-dimensional space.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanpointLiesWithin(Vector2D point) Returns whether a point is inside (not on the edge of) a polygon.
-
Constructor Details
-
Polygon
Constructs a Polygon.- Parameters:
vertices- An ordered set of vectors with endpoints representing the vertices of the polygon. Lines will be connected between these vertices in accordance with the order of them in this constructor. The last edge is connected automatically.
-
-
Method Details
-
pointLiesWithin
Returns whether a point is inside (not on the edge of) a polygon.- Parameters:
point- A vector with endpoint representing the point.- Returns:
- Whether the point lies within the bounds of the polygon.
-