Class Line

    • Constructor Detail

      • Line

        public Line​(Point point1,
                    Point point2)
        Constructor
        Parameters:
        point1 - first point
        point2 - second point
      • Line

        public Line​(Line line)
        Copy Constructor
        Parameters:
        line - line to copy
    • Method Detail

      • line

        public static Line line​(Point point1,
                                Point point2)
        Create a line
        Parameters:
        point1 - first point
        point2 - second point
        Returns:
        line
      • line

        public static Line line​(Line line)
        Copy a line
        Parameters:
        line - line to copy
        Returns:
        line
      • getPoint1

        public Point getPoint1()
        Get the first point
        Returns:
        first point
      • setPoint1

        public void setPoint1​(Point point1)
        Set the first point
        Parameters:
        point1 - first point
      • getPoint2

        public Point getPoint2()
        Get the second point
        Returns:
        second point
      • setPoint2

        public void setPoint2​(Point point2)
        Set the second point
        Parameters:
        point2 - second point
      • setPoints

        public void setPoints​(Point point1,
                              Point point2)
        Set the points
        Parameters:
        point1 - first point
        point2 - second point
      • getUnit

        public Unit getUnit()
        Get the unit
        Returns:
        unit
      • isUnit

        public boolean isUnit​(Unit unit)
        Is in the provided unit type
        Parameters:
        unit - unit
        Returns:
        true if in the unit
      • isDegrees

        public boolean isDegrees()
        Is this line in degrees
        Returns:
        true if degrees
      • isMeters

        public boolean isMeters()
        Is this line in meters
        Returns:
        true if meters
      • toUnit

        public Line toUnit​(Unit unit)
        Convert to the unit
        Parameters:
        unit - unit
        Returns:
        line in units, same line if equal units
      • toDegrees

        public Line toDegrees()
        Convert to degrees
        Returns:
        line in degrees, same line if already in degrees
      • toMeters

        public Line toMeters()
        Convert to meters
        Returns:
        line in meters, same line if already in meters
      • intersection

        public Point intersection​(Line line)
        Get the intersection between this line and the provided line
        Parameters:
        line - line
        Returns:
        intersection
      • copy

        public Line copy()
        Copy the line
        Overrides:
        copy in class Line
        Returns:
        line copy