Class Ots2dSet

java.lang.Object
org.opentrafficsim.core.geometry.Ots2dSet
All Implemented Interfaces:
Serializable, Iterable<OtsShape>, Collection<OtsShape>, Set<OtsShape>

public class Ots2dSet extends Object implements Set<OtsShape>, Serializable
Set of OtsShape objects and provides methods for fast selection of those objects that intersect an OtsShape.
An Ots2dSet internally stores the OtsShapes in a quad tree. At time of construction the minimum cell size is defined. Node expansion is never performed on nodes that are smaller than this limit.
Each node (even the non-leaf nodes) store a set of OtsShape. Non-leaf nodes locally store those shapes that completely cover the rectangular area of the node. Such shapes are not also stored in leaf nodes below that node. OtsShapes that partially cover a non-leaf node are stored in each of the leaf nodes below that node that those OtsShapes (partially) cover. Leaf nodes that cannot be expanded (because they are too small) also store all OtsShapes that partially cover the area of the node.
If removal of an OtsShape objects results in a leaf becoming empty, that leaf is removed from its parent (which may then itself become empty and removed in turn).

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

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
See Also: