 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
36 : myXmin(10000000000.0), myXmax(-10000000000.0),
37 myYmin(10000000000.0), myYmax(-10000000000.0),
38 myZmin(10000000000.0), myZmax(-10000000000.0),
39 myWasInitialised(false) {}
43 : myXmin(10000000000.0), myXmax(-10000000000.0),
44 myYmin(10000000000.0), myYmax(-10000000000.0),
45 myZmin(10000000000.0), myZmax(-10000000000.0),
46 myWasInitialised(false) {
53 : myXmin(10000000000.0), myXmax(-10000000000.0),
54 myYmin(10000000000.0), myYmax(-10000000000.0),
55 myZmin(10000000000.0), myZmax(-10000000000.0),
56 myWasInitialised(false) {
223 const double leftDist =
myXmin - p.
x();
224 const double rightDist = p.
x() -
myXmax;
225 const double bottomDist =
myYmin - p.
y();
226 const double topDist = p.
y() -
myYmax;
228 if (bottomDist > 0.) {
229 return sqrt(leftDist * leftDist + bottomDist * bottomDist);
232 return sqrt(leftDist * leftDist + topDist * topDist);
236 if (rightDist > 0.) {
237 if (bottomDist > 0.) {
238 return sqrt(rightDist * rightDist + bottomDist * bottomDist);
241 return sqrt(rightDist * rightDist + topDist * topDist);
245 if (bottomDist > 0) {
262 if (bottomDist > 0.) {
263 return sqrt(leftDist * leftDist + bottomDist * bottomDist);
266 return sqrt(leftDist * leftDist + topDist * topDist);
270 if (rightDist > 0.) {
271 if (bottomDist > 0.) {
272 return sqrt(rightDist * rightDist + bottomDist * bottomDist);
275 return sqrt(rightDist * rightDist + topDist * topDist);
279 if (bottomDist > 0) {
354 return !(*
this == b);
void moveby(double x, double y, double z=0)
Moves the boundary by the given amount.
double getZRange() const
Returns the elevation range of the boundary (z-axis)
double zmax() const
Returns maximum z-coordinate.
double ymin() const
Returns minimum y-coordinate.
double distanceTo2D(const Position &p) const
returns the euclidean distance in the x-y-plane
double z() const
Returns the z-position.
double xmax() const
Returns maximum x-coordinate.
bool partialWithin(const AbstractPoly &poly, double offset=0) const
Returns whether the boundary is partially within the given polygon.
double getHeight() const
Returns the height of the boundary (y-axis)
bool around(const Position &p, double offset=0) const
Returns whether the AbstractPoly the given coordinate.
std::ostream & operator<<(std::ostream &os, const Boundary &b)
void reset()
Resets the boundary.
void set(double xmin, double ymin, double xmax, double ymax)
Sets the boundary to the given values.
bool intersects(const Position &p1, const Position &p2) const
Returns the information whether this list of points interesects the given line.
double xmin() const
Returns minimum x-coordinate.
virtual bool crosses(const Position &p1, const Position &p2) const =0
Returns whether the AbstractPoly crosses the given line.
A class that stores a 2D geometrical boundary.
virtual bool partialWithin(const AbstractPoly &poly, double offset=0) const =0
Returns whether the AbstractPoly is partially within the given polygon.
double getWidth() const
Returns the width of the boudary (x-axis)
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
bool crosses(const Position &p1, const Position &p2) const
Returns whether the boundary crosses the given line.
void growWidth(double by)
Increases the width of the boundary (x-axis)
double myXmin
The boundaries.
bool myWasInitialised
Information whether the boundary was initialised.
double y() const
Returns the y-position.
bool operator!=(const Boundary &b) const
Comparison operator not equal.
Position getCenter() const
Returns the center of the boundary.
virtual bool around(const Position &p, double offset=0) const =0
Returns whether the AbstractPoly the given coordinate.
bool operator==(const Boundary &b) const
Comparison operator equal.
bool isInitialised() const
check if Boundary is Initialised
Boundary & grow(double by)
extends the boundary by the given amount
Boundary()
Constructor - the boundary is unset.
void flipY()
flips ymin and ymax
double zmin() const
Returns minimum z-coordinate.
void growHeight(double by)
Increases the height of the boundary (y-axis)
double ymax() const
Returns maximum y-coordinate.
bool overlapsWith(const AbstractPoly &poly, double offset=0) const
Returns whether the boundary overlaps with the given polygon.