Skip to content

Commit

Permalink
change GUI movement to match headless wrt distributary bias for edges…
Browse files Browse the repository at this point in the history
… out.
  • Loading branch information
troyfrever committed Feb 4, 2025
1 parent c7d98ed commit 301d905
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/fish.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ void Fish::getReachableNodes(Model &model, std::unordered_map<MapNode *, float>
if (transitSpeed > 0.0f) {
// Calculate effective distance swum
float edgeCost = (edge.length/transitSpeed)*swimSpeed;
if ((isDistributary(edge.source->type) && point == this->location) ){ // || (this->forkLength >= 75)){
if (isDistributary(edge.source->type) && point == this->location){ // || (this->forkLength >= 75)){
// Artificially discount the cost to make distributary nodes easier to access
// (since they are widely spaced)
edgeCost = std::min(edgeCost, swimRange - cost);
Expand All @@ -252,7 +252,7 @@ void Fish::getReachableNodes(Model &model, std::unordered_map<MapNode *, float>
float transitSpeed = swimSpeed + model.hydroModel.getFlowSpeedAlong(edge);
if (transitSpeed > 0.0f) {
float edgeCost = (edge.length/transitSpeed)*swimSpeed;
if ((isDistributary(edge.target->type) && point == this->location) ){ // || (this->forkLength >= 75)){
if (isDistributary(point->type) && point == this->location){ // || (this->forkLength >= 75)){
edgeCost = std::min(edgeCost, swimRange - cost);
}
if (cost + edgeCost <= swimRange) {
Expand Down Expand Up @@ -300,7 +300,7 @@ void Fish::getDestinationProbs(Model &model, std::unordered_map<MapNode *, float
if (transitSpeed > 0.0f) {
// Calculate effective distance swum
float edgeCost = (edge.length/transitSpeed)*swimSpeed;
if ((isDistributary(edge.source->type) && point == this->location) ){ // } || (this->forkLength >= 75)) {
if (isDistributary(edge.source->type) && point == this->location){ // } || (this->forkLength >= 75)) {
// Artificially discount the cost to make distributary nodes easier to access
// (since they are widely spaced)
// change to include discount if fork length > 75mm for exiting
Expand All @@ -322,7 +322,7 @@ void Fish::getDestinationProbs(Model &model, std::unordered_map<MapNode *, float
float transitSpeed = swimSpeed + model.hydroModel.getFlowSpeedAlong(edge);
if (transitSpeed > 0.0f) {
float edgeCost = (edge.length/transitSpeed)*swimSpeed;
if ((isDistributary(edge.target->type) && point == this->location) ){ // || (this->forkLength >= 75)){
if (isDistributary(point->type) && point == this->location){ // || (this->forkLength >= 75)){
edgeCost = std::min(edgeCost, swimRange - cost);
}
if (cost + edgeCost <= swimRange) {
Expand Down Expand Up @@ -392,7 +392,7 @@ bool Fish::move(Model &model) {
if (transitSpeed > 0.0f) {
// Calculate effective distance swum
float edgeCost = (edge.length/transitSpeed)*swimSpeed;
if ((isDistributary(edge.source->type) && point == this->location)){ // || (this->forkLength >= 75)){
if (isDistributary(edge.source->type) && point == this->location){ // || (this->forkLength >= 75)){
// Artificially discount the cost to make at least 1 distributary channel passable
// (since they are widely spaced)
edgeCost = std::min(edgeCost, swimRange - cost);
Expand All @@ -414,7 +414,7 @@ bool Fish::move(Model &model) {
if (transitSpeed > 0.0f) {
float edgeCost = (edge.length/transitSpeed)*swimSpeed;
// if (isDistributary(edge.target->type) && point == this->location) {
if ((isDistributary(edge.source->type) && point == this->location) ){ //|| (this->forkLength >= 75)){
if (isDistributary(point->type) && point == this->location){ //|| (this->forkLength >= 75)){
edgeCost = std::min(edgeCost, swimRange - cost);
}
if (cost + edgeCost <= swimRange) {
Expand Down

0 comments on commit 301d905

Please sign in to comment.