35 Crossing::Crossing(
const std::vector< Eigen::Vector2d > &_segment_points) : segments_start_(), segments_end_()
37 int min_x = __INT_MAX__;
39 int min_y = __INT_MAX__;
42 for(
auto it = _segment_points.begin(); it != _segment_points.end(); ++it)
58 center_[0] = ((float)(max_x + min_x)) / 2.0;
59 center_[1] = ((float)(max_y + min_y)) / 2.0;
72 (*segmentReference_)[s_idx].addPredecessor(_seg.
getId());
78 (*segmentReference_)[s_idx].addSuccessor(_seg.
getId());
81 std::vector<Eigen::Vector2d> p = _seg.
getPath();
84 segments_start_.push_back(_seg.
getId());
88 if(srPoint[0] == _seg.
getEnd()[0] && srPoint[1] == _seg.
getEnd()[1])
93 (*segmentReference_)[s_idx].addPredecessor(_seg.
getId());
100 (*segmentReference_)[s_idx].addSuccessor(_seg.
getId());
103 std::vector<Eigen::Vector2d> p = _seg.
getPath();
106 segments_end_.push_back(_seg.
getId());
void addPredecessor(const uint32_t _predecessor)
adds a predecessor to the object
uint32_t getId() const
returns the id
void setPath(const std::vector< Eigen::Vector2d > &_path)
sets a new path of the robot
Crossing(const std::vector< Eigen::Vector2d > &_segment_points)
constructor
const Eigen::Vector2d & getEnd() const
returns const ref to endpoint
Eigen::Vector2d getCenter() const
returns the center of the crossing (average of all pts)
void setSegmentReference(const std::shared_ptr< std::vector< Segment >> &segs)
saves the reference to the vector containing all segments to have access to them to alter other segme...
std::shared_ptr< std::vector< Segment > > segmentReference_
void addSuccessor(const uint32_t _successor)
adds a successor to the object
std::vector< uint32_t > segments_end_
bool tryAddSegment(Segment &_seg)
tries to add the segment to the crossing and adds the given segment to each segments neighbors in the...
std::vector< Eigen::Vector2d > getPath() const
returns the path
std::vector< uint32_t > segments_start_
const Eigen::Vector2d & getStart() const
returns const ref to startpoint
std::vector< Eigen::Vector2d > surroundingPoints_