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);
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.
double getLength() const
Returns the length of the edge.
static double randomPositionInStreet(const AGStreet &street)
Determines a random relative position on a street.
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 getPosition() const
Provides the relative position of this AGPosition on the street.
double minDistanceTo(const std::list< AGPosition > &positions) const
Computes the distance to the closest position in a list.
AGPosition(const AGStreet &str, double pos)
Constructs an AGPosition at a certain point on a street.
const RONode * getToJunction() const
bool operator==(const AGPosition &pos) const
Tests whether two positions are at the same place.
Position compute2dPosition() const
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
bool almostSame(const Position &p2, double maxDiv=POSITION_EPS) const
checki if two position is almost the sme as other
const RONode * getFromJunction() const
void mul(double val)
Multiplies both positions with the given value.
const Position & getPosition() const
Returns the position of the node.
void sub(double dx, double dy)
Substracts the given position from this one.