java.lang.Object
java.lang.Record
org.variantsync.diffdetective.show.engine.geom.Vec2

public record Vec2(double x, double y) extends Record
  • Field Details

    • x

      private final double x
      The field for the x record component.
    • y

      private final double y
      The field for the y record component.
  • Constructor Details

    • Vec2

      public Vec2(double x, double y)
      Creates an instance of a Vec2 record class.
      Parameters:
      x - the value for the x record component
      y - the value for the y record component
  • Method Details

    • all

      public static Vec2 all(double val)
    • from

      public static Vec2 from(Point2D p)
    • from

      public static Vec2 from(Dimension d)
    • toPoint2D

      public Point2D.Double toPoint2D()
    • scale

      public Vec2 scale(double s)
    • scale

      public Vec2 scale(Vec2 s)
    • dividedBy

      public Vec2 dividedBy(Vec2 divisor)
    • add

      public Vec2 add(Vec2 b)
    • add

      public Vec2 add(double x, double y)
    • flip

      public Vec2 flip()
    • minus

      public Vec2 minus(Vec2 b)
    • normalize

      public Vec2 normalize()
    • length

      public double length()
    • distanceTo

      public double distanceTo(Vec2 b)
    • rotate90DegreesClockwise

      public Vec2 rotate90DegreesClockwise()
    • rotate90DegreesCounterClockwise

      public Vec2 rotate90DegreesCounterClockwise()
    • transform

      public Vec2 transform(AffineTransform t)
    • deltaTransform

      public Vec2 deltaTransform(AffineTransform t)
    • toString

      public 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. All components in this record class 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.
    • x

      public double x()
      Returns the value of the x record component.
      Returns:
      the value of the x record component
    • y

      public double y()
      Returns the value of the y record component.
      Returns:
      the value of the y record component