Class OTSShape

    • Constructor Detail

      • OTSShape

        public OTSShape​(OTSPoint3D... points)
                 throws OTSGeometryException
        Construct a new OTSShape (closed shape).
        Parameters:
        points - OTSPoint3D...; the array of points to construct this OTSLine3D from.
        Throws:
        OTSGeometryException - when the provided points do not constitute a valid line (too few points or identical adjacent points)
      • OTSShape

        public OTSShape​(org.locationtech.jts.geom.Coordinate[] coordinates)
                 throws OTSGeometryException
        Construct a new OTSShape (closed shape) from an array of Coordinate.
        Parameters:
        coordinates - Coordinate[]; the array of coordinates to construct this OTSLine3D from
        Throws:
        OTSGeometryException - when the provided points do not constitute a valid line (too few points or identical adjacent points)
      • OTSShape

        public OTSShape​(org.locationtech.jts.geom.LineString lineString)
                 throws OTSGeometryException
        Construct a new OTSShape (closed shape) from a LineString.
        Parameters:
        lineString - LineString; the lineString to construct this OTSLine3D from.
        Throws:
        OTSGeometryException - when the provided LineString does not constitute a valid line (too few points or identical adjacent points)
      • OTSShape

        public OTSShape​(org.locationtech.jts.geom.Geometry geometry)
                 throws OTSGeometryException
        Construct a new OTSShape (closed shape) from a Geometry.
        Parameters:
        geometry - Geometry; the geometry to construct this OTSLine3D from
        Throws:
        OTSGeometryException - when the provided Geometry do not constitute a valid line (too few points or identical adjacent points)
      • OTSShape

        public OTSShape​(List<OTSPoint3D> pointList)
                 throws OTSGeometryException
        Construct a new OTSShape (closed shape) from a List<OTSPoint3D>.
        Parameters:
        pointList - List<OTSPoint3D>; the list of points to construct this OTSLine3D from.
        Throws:
        OTSGeometryException - when the provided points do not constitute a valid line (too few points or identical adjacent points)
      • OTSShape

        public OTSShape​(Path2D path)
                 throws OTSGeometryException
        Construct a new OTSShape (closed shape) from a Path2D.
        Parameters:
        path - Path2D; the Path2D to construct this OTSLine3D from.
        Throws:
        OTSGeometryException - when the provided points do not constitute a valid line (too few points or identical adjacent points)
    • Method Detail

      • getShape

        public final Path2D getShape()
        Returns:
        shape
      • contains

        public final boolean contains​(OTSPoint3D point)
        Parameters:
        point - OTSPoint3D; the point to check if it is inside the shape
        Returns:
        whether the point is inside the shape
      • contains

        public final boolean contains​(Rectangle2D rectangle)
        Check if this OTSShape completely covers a rectangular region.
        Parameters:
        rectangle - Rectangle2D; the rectangular region
        Returns:
        boolean; true if this OTSShape completely covers the region; false otherwise (or when the implementation of java.awt.geom.Path2D.contains found it prohibitively expensive to decide. Let us hope that this cannot happen with OTSShape objects. Peter has been unable to find out when this might happen.
      • intersects

        public final boolean intersects​(OTSShape otsShape)
        Parameters:
        otsShape - OTSShape; the shape to test the intersection with
        Returns:
        whether the shapes intersect or whether one shape contains the other
      • createAndCleanOTSShape

        public static OTSShape createAndCleanOTSShape​(OTSPoint3D[] points)
                                               throws OTSGeometryException
        Create an OTSLine3D, while cleaning repeating successive points.
        Parameters:
        points - OTSPoint3D[]; the coordinates of the line as OTSPoint3D
        Returns:
        the line
        Throws:
        OTSGeometryException - when number of points < 2
      • createAndCleanOTSShape

        public static OTSShape createAndCleanOTSShape​(List<OTSPoint3D> pointList)
                                               throws OTSGeometryException
        Create an OTSLine3D, while cleaning repeating successive points.
        Parameters:
        pointList - List<OTSPoint3D>; list of the coordinates of the line as OTSPoint3D; any duplicate points in this list are removed (this method may modify the provided list)
        Returns:
        OTSLine3D; the line
        Throws:
        OTSGeometryException - when number of non-equal points < 2