Package com.marswars.geometry
Class PolygonRegion
java.lang.Object
com.marswars.geometry.Region
com.marswars.geometry.PolygonRegion
This class models a region of the field. It is defined by its vertices Credit to frc-3061 for
base code
-
Constructor Summary
ConstructorsConstructorDescriptionPolygonRegion(Translation2d[] points, String regionName) Create a Region2d, a polygon, from an array of Translation2d specifying vertices of a polygon. -
Method Summary
Modifier and TypeMethodDescriptionvoidConstructs the region and prepares it for logging.booleanReturns true if the region contains a given Pose2d.getName()Returns the name of the region for logging purposes.Get the points that define the polygon regionvoidLog the bounding points of the region.Methods inherited from class com.marswars.geometry.Region
willContain
-
Constructor Details
-
PolygonRegion
Create a Region2d, a polygon, from an array of Translation2d specifying vertices of a polygon. The polygon is created using the even-odd winding rule.- Parameters:
points- the array of Translation2d that define the vertices of the region.regionName- the name of the region that is used for logging
-
-
Method Details
-
constructRegion
public void constructRegion()Description copied from class:RegionConstructs the region and prepares it for logging.- Specified by:
constructRegionin classRegion
-
logPoints
public void logPoints()Log the bounding points of the region. These can be visualized using AdvantageScope to confirm that the regions are properly defined. -
contains
Returns true if the region contains a given Pose2d. -
getName
Description copied from class:RegionReturns the name of the region for logging purposes. -
getPoints
Get the points that define the polygon region- Returns:
- the points of the polygon region
-