comparison layer/TimeValueLayer.cpp @ 851:cf23656a8ca6

Clarify some sneaky logic
author Chris Cannam
date Wed, 03 Sep 2014 11:49:31 +0100
parents 1d526ba11a24
children 6c6e34b09688
comparison
equal deleted inserted replaced
850:0c993091a4c9 851:cf23656a8ca6
731 float epsilon = 0.0001; 731 float epsilon = 0.0001;
732 732
733 i = close.begin(); 733 i = close.begin();
734 734
735 // Scan through the close points first, then the more distant ones 735 // Scan through the close points first, then the more distant ones
736 // if no suitable close one is found 736 // if no suitable close one is found. So the while-termination
737 // condition here can only happen once i has passed through the
738 // whole of the close container and then the whole of the separate
739 // points container. The two iterators are totally distinct, but
740 // have the same type so we cheekily use the same variable and a
741 // single loop for both.
737 742
738 while (i != points.end()) { 743 while (i != points.end()) {
739 744
740 if (i == close.end()) { 745 if (!distant) {
741 i = points.begin(); 746 if (i == close.end()) {
742 distant = true; 747 // switch from the close container to the points container
748 i = points.begin();
749 distant = true;
750 }
743 } 751 }
744 752
745 if (snap == SnapRight) { 753 if (snap == SnapRight) {
746 754
747 if (i->frame > matchframe && 755 if (i->frame > matchframe &&