Package org.joml

Class Rectangled

    • Field Detail

      • minX

        public double minX
        The x coordinate of the minimum corner.
      • minY

        public double minY
        The y coordinate of the minimum corner.
      • maxX

        public double maxX
        The x coordinate of the maximum corner.
      • maxY

        public double maxY
        The y coordinate of the maximum corner.
    • Constructor Detail

      • Rectangled

        public Rectangled​()
        Create a new Rectangled with a minimum and maximum corner of (0, 0).
      • Rectangled

        public Rectangled​(Rectangled source)
        Create a new Rectangled as a copy of the given source.
        Parameters:
        source - the Rectangled to copy from
      • Rectangled

        public Rectangled​(Vector2dc min,
                          Vector2dc max)
        Create a new Rectangled with the given min and max corner coordinates.
        Parameters:
        min - the minimum coordinates
        max - the maximum coordinates
      • Rectangled

        public Rectangled​(double minX,
                          double minY,
                          double maxX,
                          double maxY)
        Create a new Rectangled with the given minimum and maximum corner coordinates.
        Parameters:
        minX - the x coordinate of the minimum corner
        minY - the y coordinate of the minimum corner
        maxX - the x coordinate of the maximum corner
        maxY - the y coordinate of the maximum corner
    • Method Detail

      • intersects

        public boolean intersects​(Rectangled other)
        Check if this and the given rectangle intersect.
        Parameters:
        other - the other rectangle
        Returns:
        true iff both rectangles intersect; false otherwise
      • contains

        public boolean contains​(Vector2d point)
        Check if this rectangle contains the given point.
        Parameters:
        point - the point to test
        Returns:
        true iff this rectangle contains the point; false otherwise
      • contains

        public boolean contains​(double x,
                                double y)
        Check if this rectangle contains the given point (x, y).
        Parameters:
        x - the x coordinate of the point to check
        y - the y coordinate of the point to check
        Returns:
        true iff this rectangle contains the point; false otherwise
      • translate

        public Rectangled translate​(Vector2dc xy)
        Translate this by the given vector xy.
        Parameters:
        xy - the vector to translate by
        Returns:
        this
      • translate

        public Rectangled translate​(Vector2dc xy,
                                    Rectangled dest)
        Translate this by the given vector xy and store the result in dest.
        Parameters:
        xy - the vector to translate by
        dest - will hold the result
        Returns:
        dest
      • translate

        public Rectangled translate​(Vector2fc xy)
        Translate this by the given vector xy.
        Parameters:
        xy - the vector to translate by
        Returns:
        this
      • translate

        public Rectangled translate​(Vector2fc xy,
                                    Rectangled dest)
        Translate this by the given vector xy and store the result in dest.
        Parameters:
        xy - the vector to translate by
        dest - will hold the result
        Returns:
        dest
      • translate

        public Rectangled translate​(double x,
                                    double y)
        Translate this by the vector (x, y).
        Parameters:
        x - the x coordinate to translate by
        y - the y coordinate to translate by
        Returns:
        this
      • translate

        public Rectangled translate​(double x,
                                    double y,
                                    Rectangled dest)
        Translate this by the vector (x, y) and store the result in dest.
        Parameters:
        x - the x coordinate to translate by
        y - the y coordinate to translate by
        dest - will hold the result
        Returns:
        dest
      • hashCode

        public int hashCode​()
        Overrides:
        hashCode in class Object
      • toString

        public String toString​()
        Return a string representation of this rectangle.

        This method creates a new DecimalFormat on every invocation with the format string "0.000E0;-".

        Overrides:
        toString in class Object
        Returns:
        the string representation
      • toString

        public String toString​(NumberFormat formatter)
        Return a string representation of this rectangle by formatting the vector components with the given NumberFormat.
        Parameters:
        formatter - the NumberFormat used to format the vector components with
        Returns:
        the string representation