Class RectObstacle2D

  • All Implemented Interfaces:
    it.unibo.alchemist.model.Obstacle , it.unibo.alchemist.model.Obstacle2D , java.awt.Shape , java.io.Serializable , java.lang.Cloneable

    
    public final class RectObstacle2D<V extends Vector2D<V>>
    extends Rectangle2D.Double implements Obstacle2D<V>
                        

    This class implements a rectangular obstacle, whose sides are parallel to the cartesian axis.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final int id
      public final double minX
      public final double maxX
      public final double minY
      public final double maxY
      public double x
      public double y
      public double width
      public double height
      public final static int OUT_LEFT
      public final static int OUT_TOP
      public final static int OUT_RIGHT
      public final static int OUT_BOTTOM
    • Constructor Summary

      Constructors 
      Constructor Description
      RectObstacle2D(double x, double y, double w, double h) Builds a new RectObstacle2D, given a point, the width and the height.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      int getId()
      double getMinX()
      double getMaxX()
      double getMinY()
      double getMaxY()
      V next(@Nonnull() V start, @Nonnull() V end)
      V nearestIntersection(V start, V end)
      boolean contains(double x, double y)
      String toString()
      • Methods inherited from class java.awt.geom.Rectangle2D.Double

        createIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, isEmpty, outcode, setRect
      • Methods inherited from class java.awt.geom.Rectangle2D

        add, equals, getPathIterator, hashCode, intersect, intersects, intersectsLine, setFrame, union
      • Methods inherited from class java.awt.geom.RectangularShape

        clone, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, setFrameFromCenter, setFrameFromDiagonal
      • Methods inherited from class it.unibo.alchemist.model.Obstacle

        getId
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RectObstacle2D

        RectObstacle2D(double x, double y, double w, double h)
        Builds a new RectObstacle2D, given a point, the width and the height.
        Parameters:
        x - x coordinate of the starting point
        y - y coordinate of the starting point
        w - the rectangle width.
        h - the rectangle height.