48 street(&str), position(pos), pos2d(compute2dPosition()) {
53 street(&str), position(randomPositionInStreet(str)), pos2d(compute2dPosition()) {
77 SUMOReal minDist = std::numeric_limits<SUMOReal>::infinity();
79 std::list<AGPosition>::const_iterator itt;
81 for (itt = positions.begin(); itt != positions.end(); ++itt) {
83 if (tempDist < minDist) {
93 SUMOReal minDist = std::numeric_limits<SUMOReal>::infinity();
95 std::map<int, AGPosition>::const_iterator itt;
97 for (itt = positions.begin(); itt != positions.end(); ++itt) {
99 if (tempDist < minDist) {
132 position2d.
sub(From);
134 position2d.
add(From);
void sub(SUMOReal dx, SUMOReal dy)
Substracts the given position from this one.
void print() const
Prints out a summary of the properties of this class on standard output.
const AGStreet & getStreet() const
Provides the street this AGPosition is located on.
void add(const Position &pos)
Adds the given position to this one.
A location in the 2D plane freely positioned on a street.
static SUMOReal rand()
Returns a random real number in [0, 1)
A model of the street in the city.
SUMOReal distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
bool almostSame(const Position &p2, SUMOReal maxDiv=POSITION_EPS) const
SUMOReal getPosition() const
Provides the relative position of this AGPosition on the street.
const RONode * getToJunction() const
bool operator==(const AGPosition &pos) const
Tests whether two positions are at the same place.
AGPosition(const AGStreet &str, SUMOReal pos)
Constructs an AGPosition at a certain point on a street.
Position compute2dPosition() const
A point in 2D or 3D with translation and scaling methods.
SUMOReal minDistanceTo(const std::list< AGPosition > &positions) const
Computes the distance to the closest position in a list.
static SUMOReal randomPositionInStreet(const AGStreet &street)
Determines a random relative position on a street.
const RONode * getFromJunction() const
SUMOReal getLength() const
Returns the length of the edge.
void mul(SUMOReal val)
Multiplies both positions with the given value.
SUMOReal distanceTo(const AGPosition &otherPos) const
Computes the distance between two AGPosition objects.
const Position & getPosition() const
Returns the position of the node.