\returns if features |r1| and |r2| have a common end returns its joint id. If not, returns Joint::kInvalidId. \note It's possible that the both ends of |r1| and |r2| have common joint ids. In that case returns any of them. \note In general case ends of features don't have to be joints. For example all loose feature ends aren't joints. But if ends of r1 and r2 are connected at this point there has
| 33 | /// loose feature ends aren't joints. But if ends of r1 and r2 are connected at this |
| 34 | /// point there has to be a joint. So the method is valid. |
| 35 | Joint::Id GetCommonEndJoint(RoadJointIds const & r1, RoadJointIds const & r2) |
| 36 | { |
| 37 | auto const & j11 = r1.GetJointId(0 /* point id */); |
| 38 | auto const & j12 = r1.GetEndingJointId(); |
| 39 | auto const & j21 = r2.GetJointId(0 /* point id */); |
| 40 | auto const & j22 = r2.GetEndingJointId(); |
| 41 | |
| 42 | if (j11 == j21 || j11 == j22) |
| 43 | return j11; |
| 44 | |
| 45 | if (j12 == j21 || j12 == j22) |
| 46 | return j12; |
| 47 | |
| 48 | return Joint::kInvalidId; |
| 49 | } |
| 50 | } // namespace |
| 51 | |
| 52 | namespace routing |
no test coverage detected