Class CanvasSize


  • public class CanvasSize
    extends java.lang.Object
    Size of a canvas. A 2D bounding rectangle.
    Since:
    0.5.0
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      double maxx
      Maximum X
      double maxy
      Maximum Y
      double minx
      Minimum X
      double miny
      Minimum Y
    • Constructor Summary

      Constructors 
      Constructor Description
      CanvasSize​(double minx, double maxx, double miny, double maxy)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean clipToMargin​(double[] origin, double[] target)
      Clip a line on the margin (modifies arrays!)
      double continueToMargin​(double[] origin, double[] delta)
      Continue a line along a given direction to the margin.
      double getDiffX()  
      double getDiffY()  
      double getMaxX()  
      double getMaxY()  
      double getMinX()  
      double getMinY()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • minx

        public final double minx
        Minimum X
      • maxx

        public final double maxx
        Maximum X
      • miny

        public final double miny
        Minimum Y
      • maxy

        public final double maxy
        Maximum Y
    • Constructor Detail

      • CanvasSize

        public CanvasSize​(double minx,
                          double maxx,
                          double miny,
                          double maxy)
        Constructor.
        Parameters:
        minx - Minimum X
        maxx - Maximum X
        miny - Minimum Y
        maxy - Maximum Y
    • Method Detail

      • getMinX

        public double getMinX()
        Returns:
        the mininum X
      • getMaxX

        public double getMaxX()
        Returns:
        the maximum X
      • getMinY

        public double getMinY()
        Returns:
        the minimum Y
      • getMaxY

        public double getMaxY()
        Returns:
        the maximum Y
      • getDiffX

        public double getDiffX()
        Returns:
        the length on X
      • getDiffY

        public double getDiffY()
        Returns:
        the length on Y
      • continueToMargin

        public double continueToMargin​(double[] origin,
                                       double[] delta)
        Continue a line along a given direction to the margin.
        Parameters:
        origin - Origin point
        delta - Direction vector
        Returns:
        scaling factor for delta vector
      • clipToMargin

        public boolean clipToMargin​(double[] origin,
                                    double[] target)
        Clip a line on the margin (modifies arrays!)
        Parameters:
        origin - Origin point, will be modified
        target - Target point, will be modified
        Returns:
        false if entirely outside the margin
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object