Interface OtsBounds2d

All Superinterfaces:
org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
All Known Implementing Classes:
BoundingBox, BoundingBoxRounded, BoundingCircle, BoundingPolygon, BoundingRectangle

public interface OtsBounds2d extends org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
Bounds for generic usage within the OTS context. All input is assumed to be transformed to this bound's space. Default methods use the polygon representation of the bounds. For many shapes there may be faster methods to determine information.

Copyright (c) 2024-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Wouter Schakel
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.djutils.draw.point.Point2d
    Standard mid point.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.djutils.draw.line.Polygon2d
    Returns a polygon representation of the bounds, such that an intersection can be derived.
    default boolean
    contains(org.djutils.draw.Drawable2d drawable)
    default boolean
    contains(org.djutils.draw.point.Point2d point)
    default boolean
    covers(org.djutils.draw.Drawable2d drawable)
    default boolean
    covers(org.djutils.draw.point.Point2d point)
    default boolean
    disjoint(org.djutils.draw.Drawable2d drawable)
    default double
    default double
    default double
    default double
    default OtsBounds2d
    default boolean
    intersects(OtsBounds2d otherBounds)
    default org.djutils.draw.point.Point2d
    default double
    signedDistance(org.djutils.draw.point.Point2d point)
    Signed distance function.

    Methods inherited from interface org.djutils.draw.bounds.Bounds

    getDeltaX, getDeltaY
  • Field Details

    • CENTER

      static final org.djutils.draw.point.Point2d CENTER
      Standard mid point.
  • Method Details

    • getMinX

      default double getMinX()
      Specified by:
      getMinX in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
    • getMaxX

      default double getMaxX()
      Specified by:
      getMaxX in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
    • getMinY

      default double getMinY()
      Specified by:
      getMinY in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
    • getMaxY

      default double getMaxY()
      Specified by:
      getMaxY in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
    • midPoint

      default org.djutils.draw.point.Point2d midPoint()
      Specified by:
      midPoint in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
    • contains

      default boolean contains(org.djutils.draw.point.Point2d point) throws NullPointerException
      Specified by:
      contains in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
      Throws:
      NullPointerException
    • covers

      default boolean covers(org.djutils.draw.point.Point2d point) throws NullPointerException
      Specified by:
      covers in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
      Throws:
      NullPointerException
    • covers

      default boolean covers(org.djutils.draw.Drawable2d drawable) throws NullPointerException
      Specified by:
      covers in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
      Throws:
      NullPointerException
    • contains

      default boolean contains(org.djutils.draw.Drawable2d drawable) throws NullPointerException
      Specified by:
      contains in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
      Throws:
      NullPointerException
    • disjoint

      default boolean disjoint(org.djutils.draw.Drawable2d drawable) throws NullPointerException
      Specified by:
      disjoint in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
      Throws:
      NullPointerException
    • intersects

      default boolean intersects(OtsBounds2d otherBounds)
      Specified by:
      intersects in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
    • intersection

      default OtsBounds2d intersection(OtsBounds2d otherBounds)
      Specified by:
      intersection in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
    • asPolygon

      org.djutils.draw.line.Polygon2d asPolygon()
      Returns a polygon representation of the bounds, such that an intersection can be derived.
      Returns:
      Polygon2d; polygon representation of the bounds.
    • signedDistance

      default double signedDistance(org.djutils.draw.point.Point2d point)
      Signed distance function. The coordinates must be transformed to this bound's space. Negative distances returned are inside the bounds, with the absolute value of the distance towards the edge. The default implementation is based on the polygon representation and is expensive.
      Parameters:
      point - Point2d; point for which distance is returned.
      Returns:
      double; distance from point to these bounds.