# Explanation of the Marching Squares saddle points resolution

I was reading the Wikipedia entry on Marching Squares, and was confused by the explanation of the saddle point disambiguation:

Ambiguous Case:

Basically, given the saddle points, the ambiguity is resolved by using the average data value for the center of the cell. I don't understand why this would help resolve the ambiguity. It seems to just select the longer pair of lines over the shorter pair. Is there any reason for this approach?

• "It seems to just select the longer pair of lines over the shorter pair." What? All the red lines in the figure are the same length.
– user106
Jun 1, 2017 at 21:51

Imagine that a black dot represents a value of -1 whereas a white dot represents a value of +1. You are looking for the iso-line(s) where each point upon the line is 0.

For this example you could either place the iso-lines like on the left or the right:

or

The difference between the solutions is the value in the center. In the left case we assume 1s whereas in the right solution we assume -1s. So we check the center value and based on that value decide which solution fits best. If the center value is 1, we pick the left solution. If the center value is -1, we choose the right solution.

• But what if the values are all different ?
– user1703
Apr 24, 2023 at 10:31
• @YvesDaoust Which values do you mean? Jul 18, 2023 at 8:03

Continuing on the answer by user3405743, using a bilinear model, we have that the intersection curve is an hyperbola with axis-aligned asymptotes, so we link the left intersection to the top or bottom one, whichever is leftmost (the segment lengths themselves are unimportant).

The piecewise bilinear model is appropriate in that it defines a continuous surface.

That disambiguation method often selects the shorter pair of line segments over the longer pair.

A different method which can be shown (with some algebra) to always select the shorter pair of line segments over the longer pair is based on bilinear interpolation, i.e. fitting a polynomial of the form
axy + bx + cy + d
to the given data values at the 4 corners of the cell.

The contour curve at height h is the locus of points (x, y) that satisfy
axy + bx + cy + d - h = 0.

Such a contour curve is a hyperbola, which has 2 branches. The portion of each branch of the hyperbola inside the cell is then approximated with a line segment connecting the intersection points of that branch with the 2 cell edges that it intersects.