Class Contour
- java.lang.Object
-
- edu.wpi.first.wpilibj.geometry.Translation2d
-
- io.github.frc5024.lib5k.vision.types.Contour
-
- Direct Known Subclasses:
AxisAlignedBoundingBox
public abstract class Contour extends Translation2d
Contour is the base class for any type of computer-vision Contour
-
-
Field Summary
Fields Modifier and Type Field Description static Rotation2d
NO_ROTATION
-
Constructor Summary
Constructors Constructor Description Contour()
Create a Contour at 0,0Contour(double x, double y)
Create a contour with a positionContour(double x, double y, Rotation2d xRot, Rotation2d yRot)
Create a contour with a position and rotation from the camera
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
contains(Translation2d point)
Check if this contour contains a pointRotation2d
getXRotation()
Get the X angle from the cameraRotation2d
getYRotation()
Get the Y angle from the cameraabstract boolean
overlaps(AxisAlignedBoundingBox box)
Check if this contour overlaps with an AxisAlignedBoundingBox-
Methods inherited from class edu.wpi.first.wpilibj.geometry.Translation2d
div, equals, getDistance, getNorm, getX, getY, hashCode, minus, plus, rotateBy, times, toString, unaryMinus
-
-
-
-
Field Detail
-
NO_ROTATION
public static final Rotation2d NO_ROTATION
-
-
Constructor Detail
-
Contour
public Contour()
Create a Contour at 0,0
-
Contour
public Contour(double x, double y)
Create a contour with a position- Parameters:
x
- X offset expressed as a percentage of the frame from the center (top left is -1,1)y
- Y offset expressed as a percentage of the frame from the center (top left is -1,1)
-
Contour
public Contour(double x, double y, Rotation2d xRot, Rotation2d yRot)
Create a contour with a position and rotation from the camera- Parameters:
x
- X offset expressed as a percentage of the frame from the center (top left is -1,1)y
- Y offset expressed as a percentage of the frame from the center (top left is -1,1)xRot
- X angle from camerayRot
- Y angle from camera
-
-
Method Detail
-
getXRotation
public Rotation2d getXRotation()
Get the X angle from the camera- Returns:
- X angle
-
getYRotation
public Rotation2d getYRotation()
Get the Y angle from the camera- Returns:
- Y angle
-
contains
public abstract boolean contains(Translation2d point)
Check if this contour contains a point- Parameters:
point
- Point- Returns:
- Is the point in this contour?
-
overlaps
public abstract boolean overlaps(AxisAlignedBoundingBox box)
Check if this contour overlaps with an AxisAlignedBoundingBox- Parameters:
box
- AxisAlignedBoundingBox- Returns:
- Does it overlap?
-
-