Class BoundingPolygon

java.lang.Object
org.opentrafficsim.base.geometry.BoundingPolygon
All Implemented Interfaces:
org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>, OtsBounds2d

public class BoundingPolygon extends Object implements OtsBounds2d
Bounds defined by a polygon.

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
  • Constructor Details

    • BoundingPolygon

      public BoundingPolygon(org.djutils.draw.line.Polygon2d polygon)
      Constructor.
      Parameters:
      polygon - Polygon2d; polygon.
  • Method Details

    • asPolygon

      public org.djutils.draw.line.Polygon2d asPolygon()
      Returns a polygon representation of the bounds, such that an intersection can be derived.
      Specified by:
      asPolygon in interface OtsBounds2d
      Returns:
      Polygon2d; polygon representation of the bounds.
    • geometryToBounds

      public static BoundingPolygon geometryToBounds(org.djutils.draw.point.OrientedPoint2d location, org.djutils.draw.line.PolyLine2d geometry)
      Translates absolute geometry to bounds relative to location, including rotation.
      Parameters:
      location - OrientedPoint2d; location.
      geometry - PolyLine2d; geometry..
      Returns:
      BoundingPolygon; bounded polygon.