Normal quotes
This commit is contained in:
parent
5e10794a24
commit
18011c595a
352 changed files with 6040 additions and 6040 deletions
16
41-02.md
16
41-02.md
|
|
@ -16,13 +16,13 @@ from Chapter 39) remains the same, and so is not shown again here.
|
|||
**LISTING 41.2 L41-2.C**
|
||||
|
||||
/* Color-fills a convex polygon. All vertices are offset by (XOffset, YOffset).
|
||||
“Convex” means “monotone with respect to a vertical line”; that is, every
|
||||
"Convex" means "monotone with respect to a vertical line"; that is, every
|
||||
horizontal line drawn through the polygon at any point would cross exactly two
|
||||
active edges (neither horizontal lines nor zero-length edges count as active
|
||||
edges; both are acceptable anywhere in the polygon). Right & left edges may
|
||||
cross (polygons may be nonsimple). Polygons that are not convex according to
|
||||
this definition won’t be drawn properly. (Yes, “convex” is a lousy name for
|
||||
this type of polygon, but it’s convenient; use “monotone-vertical” if it makes
|
||||
this definition won't be drawn properly. (Yes, "convex" is a lousy name for
|
||||
this type of polygon, but it's convenient; use "monotone-vertical" if it makes
|
||||
you happier!)
|
||||
*******************************************************************
|
||||
NOTE: the low-level drawing routine, DrawHorizontalLineList, must be able to
|
||||
|
|
@ -31,14 +31,14 @@ from Chapter 39) remains the same, and so is not shown again here.
|
|||
highest coordinate to draw). In both respects, this differs from low-level
|
||||
drawing routines presented in earlier columns; changes are necessary to make it
|
||||
possible to draw nonsimple monotone-vertical polygons; that in turn makes it
|
||||
possible to use Jim Kent’s test for monotone-vertical polygons.
|
||||
possible to use Jim Kent's test for monotone-vertical polygons.
|
||||
*******************************************************************
|
||||
Returns 1 for success, 0 if memory allocation failed */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include “polygon.h”
|
||||
#include "polygon.h"
|
||||
|
||||
/* Advances the index by one vertex forward through the vertex list,
|
||||
wrapping at the end of the list */
|
||||
|
|
@ -86,14 +86,14 @@ from Chapter 39) remains the same, and so is not shown again here.
|
|||
|
||||
/* Set the # of scan lines in the polygon, skipping the bottom edge */
|
||||
if ((WorkingHLineList.Length = MaxPoint_Y - MinPoint_Y) <= 0)
|
||||
return(1); /* there’s nothing to draw, so we’re done */
|
||||
return(1); /* there's nothing to draw, so we're done */
|
||||
WorkingHLineList.YStart = YOffset + MinPoint_Y;
|
||||
|
||||
/* Get memory in which to store the line list we generate */
|
||||
if ((WorkingHLineList.HLinePtr =
|
||||
(struct HLine *) (malloc(sizeof(struct HLine) *
|
||||
WorkingHLineList.Length))) == NULL)
|
||||
return(0); /* couldn’t get memory for the line list */
|
||||
return(0); /* couldn't get memory for the line list */
|
||||
|
||||
/* Scan the first edge and store the boundary points in the list */
|
||||
/* Initial pointer for storing scan converted first-edge coords */
|
||||
|
|
@ -126,7 +126,7 @@ from Chapter 39) remains the same, and so is not shown again here.
|
|||
/* Draw the line list representing the scan converted polygon */
|
||||
DrawHorizontalLineList(&WorkingHLineList, Color);
|
||||
|
||||
/* Release the line list’s memory and we’re successfully done */
|
||||
/* Release the line list's memory and we're successfully done */
|
||||
free(WorkingHLineList.HLinePtr);
|
||||
return(1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue