Class Rect

  • All Implemented Interfaces:
    Shape

    public class Rect
    extends java.lang.Object
    implements Shape
    Two-dimensional rectangle with coordinates defined with float precision.
    • Field Summary

      • Fields inherited from interface nl.colorize.multimedialib.math.Shape

        EPSILON
    • Constructor Summary

      Constructors 
      Constructor Description
      Rect​(float x, float y, float width, float height)  
    • Constructor Detail

      • Rect

        public Rect​(float x,
                    float y,
                    float width,
                    float height)
    • Method Detail

      • getX

        public float getX()
      • setX

        public void setX​(float x)
      • getY

        public float getY()
      • setY

        public void setY​(float y)
      • getWidth

        public float getWidth()
      • setWidth

        public void setWidth​(float width)
      • getHeight

        public float getHeight()
      • setHeight

        public void setHeight​(float height)
      • getCenterX

        public float getCenterX()
      • getCenterY

        public float getCenterY()
      • getEndX

        public float getEndX()
      • getEndY

        public float getEndY()
      • set

        public void set​(float x,
                        float y,
                        float width,
                        float height)
      • set

        public void set​(Rect r)
      • contains

        public boolean contains​(float px,
                                float py)
      • contains

        public boolean contains​(Rect r)
      • intersects

        public boolean intersects​(Rect r)
      • copy

        public Rect copy()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

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

        public static Rect around​(float x,
                                  float y,
                                  float width,
                                  float height)
        Returns a rectangle that has X and Y coordinates so that the specified point becomes its center.
      • around

        public static Rect around​(Point2D center,
                                  float width,
                                  float height)
        Returns a rectangle that has X and Y coordinates so that the specified point becomes its center.