Class LineUtils


  • public class LineUtils
    extends java.lang.Object
    Some utility methods for Line2D objects.
    • Constructor Summary

      Constructors 
      Constructor Description
      LineUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean clipLine​(java.awt.geom.Line2D line, java.awt.geom.Rectangle2D rect)
      Clips the specified line to the given rectangle.
      static java.awt.geom.Line2D extendLine​(java.awt.geom.Line2D line, double startPercent, double endPercent)
      Creates a new line by extending an existing line.
      • Methods inherited from class java.lang.Object

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

      • LineUtils

        public LineUtils()
    • Method Detail

      • clipLine

        public static boolean clipLine​(java.awt.geom.Line2D line,
                                       java.awt.geom.Rectangle2D rect)
        Clips the specified line to the given rectangle. If any of the line coordinates is not finite, then the method returns false and the line is not modified.
        Parameters:
        line - the line (null not permitted).
        rect - the clipping rectangle (null not permitted).
        Returns:
        true if the clipped line is visible, and false otherwise.
      • extendLine

        public static java.awt.geom.Line2D extendLine​(java.awt.geom.Line2D line,
                                                      double startPercent,
                                                      double endPercent)
        Creates a new line by extending an existing line.
        Parameters:
        line - the line (null not permitted).
        startPercent - the amount to extend the line at the start point end.
        endPercent - the amount to extend the line at the end point end.
        Returns:
        A new line.