Record Class Arc

java.lang.Object
java.lang.Record
org.jhotdraw8.geom.biarc.Arc
Record Components:
c - Center point.
r - Radius.
startAngle - Start angle in radian.
sweepAngle - Sweep angle in radian.
p1 - Start point of the arc.
p2 - End point of the arc.

public record Arc(@NonNull Point2D.Double c, double r, double startAngle, double sweepAngle, @NonNull Point2D.Double p1, @NonNull Point2D.Double p2) extends Record
Definition of an Arc. It contains redundant information.
  • Constructor Details

    • Arc

      public Arc(@NonNull Point2D.Double c, double r, double startAngle, double sweepAngle, @NonNull Point2D.Double p1, @NonNull Point2D.Double p2)
      Creates an instance of a Arc record class.
      Parameters:
      c - the value for the c record component
      r - the value for the r record component
      startAngle - the value for the startAngle record component
      sweepAngle - the value for the sweepAngle record component
      p1 - the value for the p1 record component
      p2 - the value for the p2 record component
  • Method Details

    • isClockwise

      public boolean isClockwise()
      Orientation of the arc.
    • pointAt

      public Point2D.Double pointAt(double t)
      Implements the parametric equation.
      Parameters:
      t - Parameter of the curve. Must be in [0,1]
      Returns:
      the point at t
    • length

      public double length()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • c

      Returns the value of the c record component.
      Returns:
      the value of the c record component
    • r

      public double r()
      Returns the value of the r record component.
      Returns:
      the value of the r record component
    • startAngle

      public double startAngle()
      Returns the value of the startAngle record component.
      Returns:
      the value of the startAngle record component
    • sweepAngle

      public double sweepAngle()
      Returns the value of the sweepAngle record component.
      Returns:
      the value of the sweepAngle record component
    • p1

      public @NonNull Point2D.Double p1()
      Returns the value of the p1 record component.
      Returns:
      the value of the p1 record component
    • p2

      public @NonNull Point2D.Double p2()
      Returns the value of the p2 record component.
      Returns:
      the value of the p2 record component