1.47k likes | 1.62k Vues
Contouring in C. ATS 315. How Contours Really Work. Contours may LOOK like curves, but they are really just straight line segments. How Contouring Works:. How Contouring Works:. How Contouring Works:. How Contouring Works:. How Contouring Works:. How Contouring Works:.
E N D
Contouring in C ATS 315
How Contours Really Work • Contours may LOOK like curves, but they are really just straight line segments.
The northwest corner is grid[i][j]. grid[i][j]
The northwest corner is grid[i][j]. grid[i][j] grid[i][j+1] grid[i+1][j] grid[i+1][j+1]
The northwest corner is grid[i][j]. grid[i][j] grid[i][j+1] grid[i+1][j] grid[i+1][j+1]
How the contour is drawn depends on the value of the contour and the values at the four corners! grid[i][j] grid[i][j+1] grid[i+1][j] grid[i+1][j+1]
For simplicity, rename the values at the corners: nw ne sw se
Count the number of corners with values greater than the contour line. nw ne sw se
CornersGreaterThanContour can be 0, 1, 2, 3, or 4. nw ne sw se
if (CornersGreaterThanContour==0) do nothing nw ne sw se
if (CornersGreaterThanContour==4) do nothing nw ne sw se
if (CornersGreaterThanContour==1)… there are four possibilities: nw ne sw se
if (CornersGreaterThanContour==1)… there are four possibilities: Possibility 1: Only the northwest corner is greater than the value of the contour. nw ne sw se
if (CornersGreaterThanContour==1)… there are four possibilities: Possibility 2: Only the northeast corner is greater than the value of the contour. nw ne sw se
if (CornersGreaterThanContour==1)… there are four possibilities: Possibility 3: Only the southeast corner is greater than the value of the contour. nw ne sw se
if (CornersGreaterThanContour==1)… there are four possibilities: Possibility 4: Only the southwest corner is greater than the value of the contour. nw ne sw se
if (CornersGreaterThanContour==2)… there are three possibilities: nw ne sw se
if (CornersGreaterThanContour==2)… there are three possibilities: Possibility 1: The line should be drawn from the west edge to the east edge. Either: Both ne and nw are bigger than contour… or Both ne and nw are smaller than contour. nw ne sw se
if (CornersGreaterThanContour==2)… there are three possibilities: Possibility 2: The line should be drawn from the north edge to the south edge. Either: Both ne and se are bigger than contour… or Both ne and se are smaller than contour. nw ne sw se
if (CornersGreaterThanContour==2)… there are three possibilities: Possibility 3: Two contour lines pass through this box. Either: Both nw and se are bigger than contour… or Both nw and se are smaller than contour. nw ne sw se
if (CornersGreaterThanContour==3)… there are four possibilities: nw ne sw se