Replace invalid characters with HTML entities
— with — ’ with ’ + with + × with x ç with ç “ with “ ” with ” ‘ with ‘ • with • – with - µ with µ † with † Fix C++ θ with θ Yen symbol instead of times Fix broken apos Bullet again E-circumflex
This commit is contained in:
parent
9e52de9586
commit
500e7f5654
353 changed files with 5091 additions and 5091 deletions
52
41-04.html
52
41-04.html
|
|
@ -43,13 +43,13 @@
|
|||
If the first and last points in VertexList are not the same, the path
|
||||
around the polygon is automatically closed. All vertices are offset
|
||||
by (XOffset, YOffset). Returns 1 for success, 0 if memory allocation
|
||||
failed. All C code tested with Borland C++.
|
||||
failed. All C code tested with Borland C++.
|
||||
|
||||
If the polygon shape is known in advance, speedier processing may be
|
||||
enabled by specifying the shape as follows: “convex” - a rubber band
|
||||
enabled by specifying the shape as follows: “convex” - a rubber band
|
||||
stretched around the polygon would touch every vertex in order;
|
||||
”nonconvex” - the polygon is not self-intersecting, but need not be
|
||||
convex; “complex” - the polygon may be self-intersecting, or, indeed,
|
||||
”nonconvex” - the polygon is not self-intersecting, but need not be
|
||||
convex; “complex” - the polygon may be self-intersecting, or, indeed,
|
||||
any sort of polygon at all. Complex will work for all polygons; convex
|
||||
is fastest. Undefined results will occur if convex is specified for a
|
||||
nonconvex or complex polygon.
|
||||
|
|
@ -67,7 +67,7 @@ discussion of faster nonconvex handling. */
|
|||
#else /* MSC */
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include “polygon.h”
|
||||
#include “polygon.h”
|
||||
|
||||
#define SWAP(a,b) {temp = a; a = b; b = temp;}
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ int FillPolygon(struct PointListHeader * VertexList, int Color,
|
|||
if ((EdgeTableBuffer =
|
||||
(struct EdgeState *) (malloc(sizeof(struct EdgeState) *
|
||||
VertexList->Length))) == NULL)
|
||||
return(0); /* couldn’t get memory for the edge table */
|
||||
return(0); /* couldn’t get memory for the edge table */
|
||||
/* Build the global edge table */
|
||||
BuildGET(VertexList, EdgeTableBuffer, XOffset, YOffset);
|
||||
/* Scan down through the polygon edges, one scan line at a time,
|
||||
|
|
@ -131,9 +131,9 @@ int FillPolygon(struct PointListHeader * VertexList, int Color,
|
|||
ScanOutAET(CurrentY, Color); /* draw this scan line from AET */
|
||||
AdvanceAET(); /* advance AET edges 1 scan line */
|
||||
XSortAET(); /* resort on X */
|
||||
CurrentY++; /* advance to the next scan line */
|
||||
CurrentY++; /* advance to the next scan line */
|
||||
}
|
||||
/* Release the memory we’ve allocated and we’re done */
|
||||
/* Release the memory we’ve allocated and we’re done */
|
||||
free(EdgeTableBuffer);
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -155,29 +155,29 @@ static void BuildGET(struct PointListHeader * VertexList,
|
|||
the GET, sorted by increasing Y start coordinate */
|
||||
VertexPtr = VertexList->PointPtr; /* point to the vertex list */
|
||||
GETPtr = NULL; /* initialize the global edge table to empty */
|
||||
for (i = 0; i < VertexList->Length; i++) {
|
||||
for (i = 0; i < VertexList->Length; i++) {
|
||||
/* Calculate the edge height and width */
|
||||
StartX = VertexPtr[i].X + XOffset;
|
||||
StartY = VertexPtr[i].Y + YOffset;
|
||||
StartX = VertexPtr[i].X + XOffset;
|
||||
StartY = VertexPtr[i].Y + YOffset;
|
||||
/* The edge runs from the current point to the previous one */
|
||||
if (i == 0) {
|
||||
/* Wrap back around to the end of the list */
|
||||
EndX = VertexPtr[VertexList->Length-1].X + XOffset;
|
||||
EndY = VertexPtr[VertexList->Length-1].Y + YOffset;
|
||||
EndX = VertexPtr[VertexList->Length-1].X + XOffset;
|
||||
EndY = VertexPtr[VertexList->Length-1].Y + YOffset;
|
||||
} else {
|
||||
EndX = VertexPtr[i-1].X + XOffset;
|
||||
EndY = VertexPtr[i-1].Y + YOffset;
|
||||
EndX = VertexPtr[i-1].X + XOffset;
|
||||
EndY = VertexPtr[i-1].Y + YOffset;
|
||||
}
|
||||
/* Make sure the edge runs top to bottom */
|
||||
if (StartY > EndY) {
|
||||
SWAP(StartX, EndX);
|
||||
SWAP(StartY, EndY);
|
||||
}
|
||||
/* Skip if this can’t ever be an active edge (has 0 height) */
|
||||
/* Skip if this can’t ever be an active edge (has 0 height) */
|
||||
if ((DeltaY = EndY - StartY) != 0) {
|
||||
/* Allocate space for this edge’s info, and fill in the
|
||||
/* Allocate space for this edge’s info, and fill in the
|
||||
structure */
|
||||
NewEdgePtr = NextFreeEdgeStruc++;
|
||||
NewEdgePtr = NextFreeEdgeStruc++;
|
||||
NewEdgePtr->XDirection = /* direction in which X moves */
|
||||
((DeltaX = EndX - StartX) > 0) ? 1 : -1;
|
||||
Width = abs(DeltaX);
|
||||
|
|
@ -188,7 +188,7 @@ static void BuildGET(struct PointListHeader * VertexList,
|
|||
if (DeltaX >= 0) /* initial error term going L->R */
|
||||
NewEdgePtr->ErrorTerm = 0;
|
||||
else /* initial error term going R->L */
|
||||
NewEdgePtr->ErrorTerm = -DeltaY + 1;
|
||||
NewEdgePtr->ErrorTerm = -DeltaY + 1;
|
||||
if (DeltaY >= Width) { /* Y-major edge */
|
||||
NewEdgePtr->WholePixelXMove = 0;
|
||||
NewEdgePtr->ErrorTermAdjUp = Width;
|
||||
|
|
@ -259,12 +259,12 @@ static void AdvanceAET() {
|
|||
/* This edge is finished, so remove it from the AET */
|
||||
*CurrentEdgePtr = CurrentEdge->NextEdge;
|
||||
} else {
|
||||
/* Advance the edge’s X coordinate by minimum move */
|
||||
CurrentEdge->X += CurrentEdge->WholePixelXMove;
|
||||
/* Determine whether it’s time for X to advance one extra */
|
||||
if ((CurrentEdge->ErrorTerm +=
|
||||
/* Advance the edge’s X coordinate by minimum move */
|
||||
CurrentEdge->X += CurrentEdge->WholePixelXMove;
|
||||
/* Determine whether it’s time for X to advance one extra */
|
||||
if ((CurrentEdge->ErrorTerm +=
|
||||
CurrentEdge->ErrorTermAdjUp) > 0) {
|
||||
CurrentEdge->X += CurrentEdge->XDirection;
|
||||
CurrentEdge->X += CurrentEdge->XDirection;
|
||||
CurrentEdge->ErrorTerm -= CurrentEdge->ErrorTermAdjDown;
|
||||
}
|
||||
CurrentEdgePtr = &CurrentEdge->NextEdge;
|
||||
|
|
@ -279,7 +279,7 @@ static void MoveXSortedToAET(int YToMove) {
|
|||
int CurrentX;
|
||||
|
||||
/* The GET is Y sorted. Any edges that start at the desired Y
|
||||
coordinate will be first in the GET, so we’ll move edges from
|
||||
coordinate will be first in the GET, so we’ll move edges from
|
||||
the GET to AET until the first edge left in the GET is no longer
|
||||
at the desired Y coordinate. Also, the GET is X sorted within
|
||||
each Y coordinate, so each successive edge we add to the AET is
|
||||
|
|
@ -367,7 +367,7 @@ struct HLineList {
|
|||
struct RGB { unsigned char Red, Green, Blue, Spare; };
|
||||
</PRE>
|
||||
<!-- END CODE //-->
|
||||
<P>Is monotone-vertical polygon detection worth all this trouble? Under the right circumstances, you bet. In a situation where a great many polygons are being drawn, and the application either doesn’t know whether they’re monotone-vertical or has no way to tell the polygon filler that they are, performance can be increased considerably if most polygons are, in fact, monotone-vertical. This potential performance advantage is helped along by the surprising fact that Jim’s test for monotone-vertical status is simpler and faster than my original, nonfunctional test for convexity.
|
||||
<P>Is monotone-vertical polygon detection worth all this trouble? Under the right circumstances, you bet. In a situation where a great many polygons are being drawn, and the application either doesn’t know whether they’re monotone-vertical or has no way to tell the polygon filler that they are, performance can be increased considerably if most polygons are, in fact, monotone-vertical. This potential performance advantage is helped along by the surprising fact that Jim’s test for monotone-vertical status is simpler and faster than my original, nonfunctional test for convexity.
|
||||
</P>
|
||||
<P>See what accurate terminology and effective communication can do?</P><P><BR></P>
|
||||
<CENTER>
|
||||
|
|
|
|||
Loading…
Reference in a new issue