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