 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
18 #ifndef PositionVector_h
19 #define PositionVector_h
49 typedef std::vector<Position>
vp;
62 PositionVector(
const std::vector<Position>::const_iterator beg,
const std::vector<Position>::const_iterator end);
81 using vp::const_iterator;
84 using vp::const_reference;
214 std::pair<PositionVector, PositionVector>
splitAt(
double where,
bool use2D =
false)
const;
223 void add(
double xoff,
double yoff,
double zoff);
229 void sub(
double xoff,
double yoff,
double zoff);
262 void extrapolate(
const double val,
const bool onlyFirst =
false,
const bool onlyLast =
false);
265 void extrapolate2D(
const double val,
const bool onlyFirst =
false);
274 void move2side(
double amount,
double maxExtension = 100);
277 void move2side(std::vector<double> amount,
double maxExtension = 100);
double nearest_offset_to_point25D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D projected onto the 3D geometry
bool operator==(const PositionVector &v2) const
comparing operation
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position
std::vector< Position > vp
vector of position
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
PositionVector getSubpartByIndex(int beginIndex, int count) const
get subpart of a position vector using index and a cout
PositionVector simplified() const
return the same shape with intermediate colinear points removed
std::vector< double > intersectsAtLengths2D(const PositionVector &other) const
For all intersections between this vector and other, return the 2D-length of the subvector from this ...
double isLeft(const Position &P0, const Position &P1, const Position &P2) const
get left
PositionVector getSubpart2D(double beginOffset, double endOffset) const
get subpart of a position vector in two dimensions (Z is ignored)
const Position & operator[](int index) const
returns the constat position at the given index @ToDo !!! exceptions?
void rotate2D(double angle)
bool overlapsWith(const AbstractPoly &poly, double offset=0) const
Returns the information whether the given polygon overlaps with this.
PositionVector getSubpart(double beginOffset, double endOffset) const
get subpart of a position vector
PositionVector smoothedZFront(double dist=std::numeric_limits< double >::max()) const
returned vector that is smoothed at the front (within dist)
void sortByIncreasingXY()
shory by increasing X-Y Psitions
PositionVector operator-(const PositionVector &v2) const
substracts two vectors (requires vectors of the same length)
void scaleRelative(double factor)
enlarges/shrinks the polygon by a factor based at the centroid
static Position sideOffset(const Position &beg, const Position &end, const double amount)
get a side position of position vector using a offset
double slopeDegreeAtOffset(double pos) const
Returns the slope at the given length.
PositionVector()
Constructor. Creates an empty position vector.
bool isNAN() const
check if PositionVector is NAN
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
double length() const
Returns the length.
double offsetAtIndex2D(int index) const
return the offset at the given index
bool isClosed() const
check if PositionVector is closed
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
int operator()(const Position &p1, const Position &p2) const
comparing operation
double angleAt2D(int pos) const
get angle in certain position of position vector
void add(double xoff, double yoff, double zoff)
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
int removeClosest(const Position &p)
removes the point closest to p and return the removal index
bool intersects(const Position &p1, const Position &p2) const
Returns the information whether this list of points interesects the given line.
void push_back_noDoublePos(const Position &p)
insert in back a non double position
Position transformToVectorCoordinates(const Position &p, bool extend=false) const
return position p within the length-wise coordinate system defined by this position vector....
bool crosses(const Position &p1, const Position &p2) const
Returns whether the AbstractPoly crosses the given line.
double getOverlapWith(const PositionVector &poly, double zThreshold) const
Returns the maximum overlaps between this and the given polygon (when not separated by at least zThre...
PositionVector operator+(const PositionVector &v2) const
adds two vectors (requires vectors of the same length)
bool around(const Position &p, double offset=0) const
Returns the information whether the position vector describes a polygon lying around the given point.
void closePolygon()
ensures that the last position equals the first
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
void sub(double xoff, double yoff, double zoff)
A class that stores a 2D geometrical boundary.
increasing_x_y_sorter()
constructor
A point in 2D or 3D with translation and scaling methods.
void append(const PositionVector &v, double sameThreshold=2.0)
static const PositionVector EMPTY
empty Vector
clase for increasing Sorter
int operator()(const Position &p1, const Position &p2) const
comparing operation for sort
int indexOfClosest(const Position &p) const
index of the closest position to p
double length2D() const
Returns the length.
int insertAtClosest(const Position &p, bool interpolateZ)
inserts p between the two closest positions
void pop_front()
pop first Position
std::pair< PositionVector, PositionVector > splitAt(double where, bool use2D=false) const
Returns the two lists made when this list vector is splitted at the given point.
PositionVector getOrthogonal(const Position &p, double extend, bool before, double length=1.0) const
return orthogonal through p (extending this vector if necessary)
double distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector)
void sortAsPolyCWByAngle()
short as polygon CV by angle
double getMaxGrade(double &maxJump) const
friend std::ostream & operator<<(std::ostream &os, const PositionVector &geom)
bool partialWithin(const AbstractPoly &poly, double offset=0) const
Returns the information whether this polygon lies partially within the given polygon.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
PositionVector resample(double maxLength) const
resample shape with the given number of points (equal spacing)
PositionVector reverse() const
reverse position vector
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
Position intersectionPosition2D(const Position &p1, const Position &p2, const double withinDist=0.) const
Returns the position of the intersection.
PositionVector interpolateZ(double zStart, double zEnd) const
returned vector that varies z smoothly over its length
void insert_noDoublePos(const std::vector< Position >::iterator &at, const Position &p)
insert in front a non double position
std::vector< double > distances(const PositionVector &s, bool perpendicular=false) const
distances of all my points to s and all of s points to myself
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
PositionVector bezier(int numPoints)
return a bezier interpolation
as_poly_cw_sorter()
constructor
bool hasElevation() const
return whether two positions differ in z-coordinate
bool operator!=(const PositionVector &v2) const
comparing operation
Position getLineCenter() const
get line center
void scaleAbsolute(double offset)
enlarges/shrinks the polygon by an absolute offset based at the centroid
double area() const
Returns the area (0 for non-closed)
~PositionVector()
Destructor.
void extrapolate2D(const double val, const bool onlyFirst=false)
extrapolate position vector in two dimensions (Z is ignored)
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
void push_front_noDoublePos(const Position &p)
insert in front a non double position
void push_front(const Position &p)
insert in front a Position
void removeDoublePoints(double minDist=POSITION_EPS, bool assertLength=false)
Removes positions if too near.
PositionVector added(const Position &offset) const