Class Line

  • All Implemented Interfaces:
    Shape

    public class Line
    extends java.lang.Object
    implements Shape
    Represents a line.
    Since:
    5.5.6
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Point2D p1  
      private Point2D p2  
    • Constructor Summary

      Constructors 
      Constructor Description
      Line()
      Constructs a new zero-length line starting at zero.
      Line​(float x1, float y1, float x2, float y2)
      Constructs a new line based on the given coordinates.
      Line​(Point2D p1, Point2D p2)
      Constructs a new line based on the given coordinates.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<Point2D> getBasePoints()
      Treat base points as the points which are enough to construct a shape.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Line

        public Line()
        Constructs a new zero-length line starting at zero.
      • Line

        public Line​(float x1,
                    float y1,
                    float x2,
                    float y2)
        Constructs a new line based on the given coordinates.
      • Line

        public Line​(Point2D p1,
                    Point2D p2)
        Constructs a new line based on the given coordinates.
    • Method Detail

      • getBasePoints

        public java.util.List<Point2D> getBasePoints()
        Description copied from interface: Shape
        Treat base points as the points which are enough to construct a shape. E.g. for a bezier curve they are control points, for a line segment - the start and the end points of the segment.
        Specified by:
        getBasePoints in interface Shape
        Returns:
        Ordered List consisting of shape's base points.