BoxDiagrams.DiagramGestureAnalyzer.PickMerge C# (CSharp) Method

PickMerge() static private method

static private PickMerge ( Section &s0, Section s1, Section &s2 ) : bool
s0 Section
s1 Section
s2 Section
return bool
		static bool PickMerge(ref Section s0, Section s1, ref Section s2)
		{
			if (s0 == null)
			{
				if (s2 == null)
					return false;
				else
				{
					s2 = Merged(s1, s2);
					return true;
				}
			}
			else if (s2 == null)
			{
				s0 = Merged(s0, s1);
				return true;
			}
			// decide the best way to merge
			double e0Before = AngleError(s0.Vector(), s0.AngleMod8), e0After = AngleError(s1.EndSS.Sub(s0.StartSS), s0.AngleMod8);
			double e2Before = AngleError(s2.Vector(), s2.AngleMod8), e2After = AngleError(s2.EndSS.Sub(s1.StartSS), s2.AngleMod8);
			if (e0Before - e0After > e2Before - e2After)
			{
				s0 = Merged(s0, s1);
				return true;
			}
			else
			{
				s2 = Merged(s1, s2);
				return true;
			}
		}
		static Section Merged(Section s1, Section s2)