Nonzero-rule
   HOME

TheInfoList



OR:

In two-dimensional
computer graphics Computer graphics deals with generating images with the aid of computers. Today, computer graphics is a core technology in digital photography, film, video games, cell phone and computer displays, and many specialized applications. A great de ...
, the non-zero winding rule is a means of determining whether a given point falls within an enclosed curve. Unlike the similar even-odd rule, it relies on knowing the direction of stroke for each part of the curve. For a given curve C and a given point P: construct a ray (a straight line) heading out from P in any direction towards infinity. Find all the intersections of C with this ray. Score up the winding number as follows: for every clockwise intersection (the curve passing through the ray from left to right, as viewed from P) subtract 1; for every counter-clockwise intersection (curve passing from right to left, as viewed from P) add 1. If the total winding number is zero, P is outside C; otherwise, it is inside. The
winding number In mathematics, the winding number or winding index of a closed curve in the plane around a given point is an integer representing the total number of times that curve travels counterclockwise around the point, i.e., the curve's number of t ...
is effectively a count of how many full counter-clockwise revolutions ('windings') the curve makes around P without doubling back on itself. (If P were a nail and C were a looped piece of string, try pulling some part of the string sideways away from the nail: it will either come free, or it will be found to be wound some number of times around the nail.) Some implementations instead score up the number of clockwise revolutions, so that clockwise crossings are awarded +1, counter-clockwise crossings -1. The result is the same. One formal definition of the winding number of point P with respect to curve C (where P does not lie on the curve) is as follows: The
SVG Scalable Vector Graphics (SVG) is an XML-based vector image format for defining two-dimensional graphics, having support for interactivity and animation. The SVG specification is an open standard developed by the World Wide Web Consortium s ...
computer graphics vector standard uses the non-zero rule by default when drawing polygons.
w3c.org, retrieved 2019 03 28


See also

* Even-odd rule * Complex polygon *
Tessellation A tessellation or tiling is the covering of a surface, often a plane, using one or more geometric shapes, called ''tiles'', with no overlaps and no gaps. In mathematics, tessellation can be generalized to higher dimensions and a variety of ...
*
Polygon triangulation In computational geometry, polygon triangulation is the partition of a polygonal area ( simple polygon) into a set of triangles, i.e., finding a set of triangles with pairwise non-intersecting interiors whose union is . Triangulations may ...
*
TrueType TrueType is an outline font standard developed by Apple in the late 1980s as a competitor to Adobe's Type 1 fonts used in PostScript. It has become the most common format for fonts on the classic Mac OS, macOS, and Microsoft Windows operating ...


References


External links


Definition of fill rules in SVG


Computer graphics algorithms {{compu-prog-stub