bool CLine2d::mutualBisect(CLine2d& otherLine,CLine2d*& linePart1 ,CLine2d*& linePart2, CLine2d*& otherLinePart1,CLine2d*& otherLinePart2) { bool retval = false; linePart1 = linePart2 = otherLinePart1 = otherLinePart2 = NULL; CPoint2d p0,p1; int numIntersections = intersect(otherLine,p0,p1); if (numIntersections > 0) { if (numIntersections > 1) { // use other intersection point if both edges intersect at their endpoints at p0 if ((p0 == m_p0 || p0 == m_p1) && (p0 == otherLine.m_p0 || p0 == otherLine.m_p1) ) { p0 = p1; } } splitAt(p0,linePart1,linePart2); otherLine.splitAt(p0,otherLinePart1,otherLinePart2); retval = true; } return retval; }
bool NBEdgeCont::splitAt(NBDistrictCont& dc, NBEdge* edge, NBNode* node, const std::string& firstEdgeName, const std::string& secondEdgeName, unsigned int noLanesFirstEdge, unsigned int noLanesSecondEdge) { SUMOReal pos; pos = edge->getGeometry().nearest_offset_to_point2D(node->getPosition()); if (pos <= 0) { pos = GeomHelper::nearest_offset_on_line_to_point2D( edge->myFrom->getPosition(), edge->myTo->getPosition(), node->getPosition()); } if (pos <= 0 || pos + POSITION_EPS > edge->getGeometry().length()) { return false; } return splitAt(dc, edge, pos, node, firstEdgeName, secondEdgeName, noLanesFirstEdge, noLanesSecondEdge); }
void Invocation::setCmdLine(std::vector<std::string> args) { if (!args.empty() && !args[0].empty() && args[0].front() == '.') { prjName = args[0].substr(1); args.erase(args.begin()); } std::vector<std::string> assigns; std::tie(assigns, cmdLine) = span(args, [](const std::string &s) { return contains(s, '='); }); confs.reserve(confs.size() + assigns.size()); for (const std::string &assign : assigns) { confs.emplace_back(splitAt(assign, '=')); } }
// ----- explicit edge manipulation methods bool NBEdgeCont::splitAt(NBDistrictCont& dc, NBEdge* edge, NBNode* node) { return splitAt(dc, edge, node, edge->getID() + "[0]", edge->getID() + "[1]", (unsigned int) edge->myLanes.size(), (unsigned int) edge->myLanes.size()); }