39 street(&str), position(pos), pos2d(compute2dPosition()) {
44 street(&str), position(randomPositionInStreet(str)), pos2d(compute2dPosition()) {
68 double minDist = std::numeric_limits<double>::infinity();
70 std::list<AGPosition>::const_iterator itt;
72 for (itt = positions.begin(); itt != positions.end(); ++itt) {
74 if (tempDist < minDist) {
84 double minDist = std::numeric_limits<double>::infinity();
86 std::map<int, AGPosition>::const_iterator itt;
88 for (itt = positions.begin(); itt != positions.end(); ++itt) {
90 if (tempDist < minDist) {
123 position2d.
sub(From);
125 position2d.
add(From);
A location in the 2D plane freely positioned on a street.
double getPosition() const
Provides the relative position of this AGPosition on the street.
double distanceTo(const AGPosition &otherPos) const
Computes the distance between two AGPosition objects.
const AGStreet & getStreet() const
Provides the street this AGPosition is located on.
void print() const
Prints out a summary of the properties of this class on standard output.
bool operator==(const AGPosition &pos) const
Tests whether two positions are at the same place.
double minDistanceTo(const std::list< AGPosition > &positions) const
Computes the distance to the closest position in a list.
static double randomPositionInStreet(const AGStreet &street)
Determines a random relative position on a street.
AGPosition(const AGStreet &str, double pos)
Constructs an AGPosition at a certain point on a street.
Position compute2dPosition() const
A model of the street in the city.
A point in 2D or 3D with translation and scaling methods.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimensions
void sub(double dx, double dy)
Subtracts the given position from this one.
void add(const Position &pos)
Adds the given position to this one.
void mul(double val)
Multiplies position with the given value.
bool almostSame(const Position &p2, double maxDiv=POSITION_EPS) const
check whether the other position has a euclidean distance of less than maxDiv
const RONode * getToJunction() const
const RONode * getFromJunction() const
double getLength() const
Returns the length of the edge.
const Position & getPosition() const
Returns the position of the node.
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)