Package org.joml

Class Rectanglef

    • Field Detail

      • minX

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

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

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

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

      • Rectanglef

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

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

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

        public Rectanglef​(float minX,
                          float minY,
                          float maxX,
                          float maxY)
        Create a new Rectanglef 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​(Vector2f 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​(float x,
                                float 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 Rectanglef translate​(Vector2fc xy)
        Translate this by the given vector xy.
        Parameters:
        xy - the vector to translate by
        Returns:
        this
      • translate

        public Rectanglef translate​(Vector2fc xy,
                                    Rectanglef 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 Rectanglef translate​(float x,
                                    float 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 Rectanglef translate​(float x,
                                    float y,
                                    Rectanglef 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