diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-10-25 18:49:19 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-10-28 02:10:47 +0100 |
commit | 37b135e59ba22cf9ace1141b9dd21d0819fe3d1d (patch) | |
tree | 1b24085262116f04c8869365e50f971af56f7d3d /game/network/network.impl.h | |
parent | Move findDir into member function findNodeDirection (diff) | |
download | ilt-37b135e59ba22cf9ace1141b9dd21d0819fe3d1d.tar.bz2 ilt-37b135e59ba22cf9ace1141b9dd21d0819fe3d1d.tar.xz ilt-37b135e59ba22cf9ace1141b9dd21d0819fe3d1d.zip |
Implement extending a network into open space
Diffstat (limited to 'game/network/network.impl.h')
-rw-r--r-- | game/network/network.impl.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/game/network/network.impl.h b/game/network/network.impl.h index cee8155..859d1ac 100644 --- a/game/network/network.impl.h +++ b/game/network/network.impl.h @@ -68,9 +68,10 @@ NetworkOf<T>::candidateJoins(glm::vec3 n1, glm::vec3 n2) template<typename T> Link::CCollection -NetworkOf<T>::candidateExtend(glm::vec3 n1, glm::vec3 n2) +NetworkOf<T>::candidateExtend(glm::vec3 start, glm::vec3 end) { - return {candidateLink<typename T::StraightLink>(n1, n2)}; + const auto [cstart, cend, centre] = genCurveDef(start, end, findNodeDirection(candidateNodeAt(start).first)); + return {candidateLink<typename T::CurveLink>(cstart, cend, centre)}; } template<typename T> @@ -89,7 +90,8 @@ NetworkOf<T>::addJoins(glm::vec3 n1, glm::vec3 n2) template<typename T> Link::CCollection -NetworkOf<T>::addExtend(glm::vec3 n1, glm::vec3 n2) +NetworkOf<T>::addExtend(glm::vec3 start, glm::vec3 end) { - return {addLink<typename T::StraightLink>(n1, n2)}; + const auto [cstart, cend, centre] = genCurveDef(start, end, findNodeDirection(nodeAt(start))); + return {addLink<typename T::CurveLink>(cstart, cend, centre)}; } |