Eclipse SUMO - Simulation of Urban MObility
AbstractPoly.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // The base class for polygons
16 /****************************************************************************/
17 #ifndef AbstractPoly_h
18 #define AbstractPoly_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include "Position.h"
27 
28 
29 // ===========================================================================
30 // class definitions
31 // ===========================================================================
35 class AbstractPoly {
36 public:
39 
42 
44  virtual ~AbstractPoly() { }
45 
47  virtual bool around(const Position& p, double offset = 0) const = 0;
48 
50  virtual bool overlapsWith(const AbstractPoly& poly, double offset = 0) const = 0;
51 
53  virtual bool partialWithin(const AbstractPoly& poly, double offset = 0) const = 0;
54 
56  virtual bool crosses(const Position& p1, const Position& p2) const = 0;
57 };
58 
59 
60 #endif
61 
62 /****************************************************************************/
63 
AbstractPoly
Definition: AbstractPoly.h:35
AbstractPoly::AbstractPoly
AbstractPoly(const AbstractPoly &)
copy constructor
Definition: AbstractPoly.h:41
AbstractPoly::crosses
virtual bool crosses(const Position &p1, const Position &p2) const =0
Returns whether the AbstractPoly crosses the given line.
AbstractPoly::partialWithin
virtual bool partialWithin(const AbstractPoly &poly, double offset=0) const =0
Returns whether the AbstractPoly is partially within the given polygon.
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
Position.h
AbstractPoly::overlapsWith
virtual bool overlapsWith(const AbstractPoly &poly, double offset=0) const =0
Returns whether the AbstractPoly overlaps with the given polygon.
AbstractPoly::AbstractPoly
AbstractPoly()
constructor
Definition: AbstractPoly.h:38
AbstractPoly::around
virtual bool around(const Position &p, double offset=0) const =0
Returns whether the AbstractPoly the given coordinate.
config.h
AbstractPoly::~AbstractPoly
virtual ~AbstractPoly()
destructor
Definition: AbstractPoly.h:44