Package frc.lib.math

Class Circle

java.lang.Object
frc.lib.math.Circle
All Implemented Interfaces:
ConvexShape, Drawable

public class Circle extends Object implements ConvexShape, Drawable
Represents a circle with a known center and radius.
  • Field Details

  • Constructor Details

    • Circle

      public Circle(String name, Translation2d center, double radius)
      Represents a circle with a known center and radius.
  • Method Details

    • drawImpl

      public void drawImpl()
      Description copied from interface: Drawable
      Draw to AdvantageScope unconditionally.
      Specified by:
      drawImpl in interface Drawable
    • getAxes

      public Axis[] getAxes()
      Description copied from interface: ConvexShape
      Get the axes of this ConvexShape.
      Specified by:
      getAxes in interface ConvexShape
    • project

      public Interval project(Axis axis)
      Description copied from interface: ConvexShape
      Get the Interval of this ConvexShape projected onto the given Axis.
      Specified by:
      project in interface ConvexShape
    • getCenter

      public Translation2d getCenter()
      Description copied from interface: ConvexShape
      Get the center of this ConvexShape.
      Specified by:
      getCenter in interface ConvexShape
    • setCenter

      public void setCenter(Translation2d center)
      Set the circle's center
    • getRadius

      public double getRadius()
      Get the circle's radius
    • setRadius

      public void setRadius(double radius)
      Set the circle's radius
    • contains

      public boolean contains(Translation2d pt)
      Get if a point is within the boundary of the circle.
    • sdf

      public double sdf(Translation2d pt)
      Get the signed distance of a point with respect to the circle.
    • getAngle

      public Rotation2d getAngle(Translation2d pt)
      Get angle of a point with respect to the circle's center.
    • getVertex

      public Translation2d getVertex(Rotation2d rotation)
      Get point on the circle with a given angle.
    • getVertex

      public Translation2d getVertex(Rotation2d rotation, double extra)
      Get point on the circle with a given angle and extra radius.
    • circleTangentAngles

      public RotationInterval circleTangentAngles(Translation2d p)
      Get angles for points that are both tangent to the circle and colinear with a given point.