Class JavaRectangleRotated2D

    • Constructor Detail

      • JavaRectangleRotated2D

        protected JavaRectangleRotated2D()
        Empty constructor for deriving classes
      • JavaRectangleRotated2D

        public JavaRectangleRotated2D​(JavaPoint2D centerPoint,
                                      double width,
                                      double height,
                                      double rotation)
        Constructs a rotated rectangle by it's centerPoint, width, height and getRotation.
        Parameters:
        centerPoint - the center point of the rectangle
        width - the width of the rectangle
        height - the height of the rectangle
        rotation - the getRotation in radians of the rectangle
    • Method Detail

      • getTopRight

        public JavaPoint2D getTopRight()
        Calculate the top right point of the rectangle
        Returns:
        the top right point
      • getBottomLeft

        public JavaPoint2D getBottomLeft()
        Calculate the bottom left point of the rectangle
        Returns:
        the bottom left point
      • getTopLeft

        public JavaPoint2D getTopLeft()
        Calculate the top left point of the rectangle
        Returns:
        the top left point
      • getBottomRight

        public JavaPoint2D getBottomRight()
        Calculate the bottom right point of the rectangle
        Returns:
        the bottom right point
      • getCenterPoint

        public JavaPoint2D getCenterPoint()
        Returns:
        the center point
      • getWidth

        public double getWidth()
        Returns:
        the width of the rectangle
      • getHeight

        public double getHeight()
        Returns:
        return the height of the rectangle
      • getRotation

        public double getRotation()
        gets value of field rotation
        Returns:
        value of field getRotation
        See Also:
        rotation
      • containsJavaPoint

        public boolean containsJavaPoint​(JavaPoint2D javaPoint2D)
      • getTopLine

        public JavaLine2D getTopLine()
        Returns:
        top line (new object)
      • getRightLine

        public JavaLine2D getRightLine()
        Returns:
        right line (new object)
      • getBottomLine

        public JavaLine2D getBottomLine()
        Returns:
        bottom line (new object)
      • getLeftLine

        public JavaLine2D getLeftLine()
        Returns:
        left line (new object)
      • getBorderLines

        public List<JavaLine2D> getBorderLines()
        Returns:
        List of (top line, right line, bottom line and left line)
      • getArea

        public double getArea()
        Returns:
        returns the size of the rectangle
      • rotate

        public JavaRectangleRotated2D rotate​(double rotation)
        adds the given getRotation to the current rectangle and returns
        Parameters:
        rotation - the getRotation in radians
        Returns:
        the new java rectangle with the applied getRotation
      • normalize

        public JavaRectangle2D normalize()
        Normalizes the rotated rectangles
        Returns:
        a normalized java rectangle
      • moveTo

        public JavaRectangleRotated2D moveTo​(JavaPoint2D newCenterPoint)
        Moves the rectangle to a given position
        Parameters:
        newCenterPoint - the new center point
        Returns:
        the moved rectangle
      • move

        public JavaRectangleRotated2D move​(JavaPoint2D distance)
        Moves the rectangle by a given distance
        Parameters:
        distance - the given distance
        Returns:
        the moved rectangle
      • stretch

        public JavaRectangleRotated2D stretch​(double widthFactor,
                                              double heightFactor)
        Stretches the rectangle by given factors
        Parameters:
        widthFactor - the factor for the width
        heightFactor - the factor for the height
        Returns:
        the stretched rectangle
      • stretchTo

        public JavaRectangleRotated2D stretchTo​(double width,
                                                double height)
        Stretches the rectangle to given width and heights
        Parameters:
        width - new width
        height - new height
        Returns:
        the stretched rectangle
      • equals

        public boolean equals​(Object o)
        Generated Code
        Overrides:
        equals in class JavaPolygon2D
        Parameters:
        o - value to compare
        Returns:
        true if values are equals else false
      • hashCode

        public int hashCode()
        Generated Code
        Overrides:
        hashCode in class JavaPolygon2D
        Returns:
        hashCode for the object
      • toString

        public String toString()
        Generated Code
        Overrides:
        toString in class Object
        Returns:
        String representation of the object