SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Line.h
Go to the documentation of this file.
1 /****************************************************************************/
9 //
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef Line_h
23 #define Line_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include "Position.h"
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
42 class PositionVector;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
51 class Line {
52 public:
53  Line();
54  Line(const Position& p1, const Position& p2);
55  ~Line();
57  void extrapolateFirstBy(SUMOReal length);
58  void extrapolateSecondBy(SUMOReal length);
59  const Position& p1() const;
60  const Position& p2() const;
63  void move2side(SUMOReal amount);
64  std::vector<SUMOReal> intersectsAtLengths2D(const PositionVector& v);
65 
68 
69  SUMOReal atan2Angle() const;
70  SUMOReal atan2DegreeAngle() const;
72  SUMOReal atan2TiltDegree() const;
73  bool intersects(const Line& l) const;
74  Position intersectsAt(const Line& l) const;
75  SUMOReal length() const;
76  SUMOReal length2D() const;
77  void add(SUMOReal x, SUMOReal y);
78  void add(const Position& p);
79  void sub(SUMOReal x, SUMOReal y);
80  Line& reverse();
81  void rotateAtP1(SUMOReal rot);
82 
83 private:
85 };
86 
87 
88 #endif
89 
90 /****************************************************************************/
91