Class Segment2f

java.lang.Object
com.dua3.utility.math.geometry.Segment2f
Direct Known Subclasses:
AbstractCurve2f, ClosePath2f, Line2f, MoveTo2f

public abstract class Segment2f extends Object
Base class for segments that form a Path2f.
  • Method Details

    • vertex

      protected Vector2f vertex(int idx)
      Retrieves the vertex at the specified index from the associated path.
      Parameters:
      idx - the index of the vertex to retrieve
      Returns:
      the Vector2f representing the vertex at the specified index
    • name

      public abstract String name()
      The identifying name for the type of the segment.
      Returns:
      name of the segment
    • start

      public abstract Vector2f start()
      The segment's starting point.
      Returns:
      the start of the segment
    • end

      public abstract Vector2f end()
      The segment's end point.
      Returns:
      the end of the segment
    • vertexToString

      protected String vertexToString(int idx)
      Converts a vertex at a specified index into a string representation. The string representation includes the index and the coordinates of the vertex.
      Parameters:
      idx - the index of the vertex in the path
      Returns:
      a string representing the vertex in the format "[index](x,y)"
    • toString

      public String toString()
      Overrides:
      toString in class Object