Where classification is used
Almost every operation a modelling kernel performs has to decide, at some point, which side of something a point is on. In most of them this is the central step, and the rest of the operation is arranged around it.
A Boolean cuts two shapes into pieces along their intersections and then has to sort the pieces (this piece of A is inside B, that one is outside), and each piece is sorted by classifying one of its points. Trimming a surface asks whether a point of it is within the face. A mesher must not emit a triangle outside the region it is meshing, so it tests candidate points. Hatching a section, picking a face with the mouse, deciding which loop of a split face is the outer one, finding which side of a shell a hole belongs to, checking whether an imported solid is inside out: all of these come down to the same question, and most of them ask it many thousands of times per operation.
In one production kernel, the two routines that answer this question are called from twelve separate libraries across five subsystems: Booleans, topological algorithms, shape healing, feature removal and offsetting, meshing, and display. So it is more than a utility that Booleans happen to use; a large part of a Boolean is made of it.
The answer everybody knows is correct: shoot a ray from the point, count how many times it crosses the boundary, and an odd count means inside. We will not correct that rule. We will look at why it is true, at the four configurations on which the usual seven-line implementation returns the wrong answer, and at what is left of it when the region is a face on a curved surface instead of a polygon in a plane (which is the only kind of region a kernel has).
Counting ray crossings
Take a closed polygon whose edges meet only at their shared endpoints (no crossings, no overlaps) and a point R that is not on it. Draw a ray from R in any direction and count how many times it crosses the boundary. If the count is odd, R is inside; if it is even, R is outside. On such a polygon this is exactly true.
The proof is short. Travel outward along the ray. Each time we cross the boundary we go from inside to outside or from outside to inside, so the state changes exactly once per crossing and at no other moment. Far enough along, we have passed the whole polygon and we are outside. So the parity of the crossings and the starting side determine each other: an odd number of changes means we ended on a different side from the one we started on, and since we ended outside, we started inside.
Two consequences of this argument matter later.
The ray may be any ray. The argument does not use its direction. This is why the two panels above agree while their counts differ: the number of crossings depends on the direction, and only the parity is a property of the point. A test that gave different answers for different directions would be wrong. We will use this freedom to choose the direction that makes the arithmetic cheap.
The far end is exact. “Far enough out” does not need a large constant. It only uses the fact that a bounded region has an outside and that a ray reaches it. The method is anchored at infinity, the one place in the plane where the answer is known without computing anything, and every difficulty later in this article is about the path from there to the point, never about the anchor.
Since the direction is free, we choose the cheapest one: the ray running horizontally to the right of R. A polygon is made of straight segments, and along a straight segment the height rises or falls steadily from one end to the other, without turning back. The rest of the method depends on this property.
It means an edge meets the horizontal line through R at most once, and meets it only when one end is below that line and the other is not. So the first question (does this edge cross?) takes two comparisons of y. Most edges of a real polygon fail it and cost no more than that.
For the edges that pass, the second question is whether they cross to the right of R. Two cases are settled by the endpoints alone. If both ends are left of R, so is the crossing, and we discard it. If both are right of it, so is the crossing, and we count it. Only when the edge also straddles R horizontally do we need more, and then the answer is the sign of one expression:
(Px − Rx)(Qy − Ry) − (Qx − Rx)(Py − Ry)
This is twice the signed area of the triangle R, P, Q, so its sign says which side of the line through P and Q the point R is on. Combined with the direction of the edge (upward or downward, which the first test has already found), it places the crossing. There is no division, no square root and no trigonometry: only multiplications, subtractions and a sign.
The degenerate case comes out of the same expression. If it is exactly zero, R lies on the line through P and Q, and since the edge already straddles R’s height, R lies on the edge itself. Section seven covers what to do with that case.
inside = false
for each edge (P, Q) of the polygon:
if (P.y < R.y) != (Q.y < R.y): // the edge crosses R's horizontal
d = (P.x-R.x)*(Q.y-R.y) - (Q.x-R.x)*(P.y-R.y)
if (d > 0) == (Q.y > P.y): // and it crosses to the right of R
inside = not inside
return inside
This is the full routine, not a simplified version for the article. Some transcription of these seven lines is in most geometry libraries, most graphics textbooks and most answers found by searching, often with a comment that says so. It works well: one pass over the edges, no preprocessing, no trigonometry, no division, no requirement that the polygon be convex, and it is right on the corridor above or on a polygon with ten thousand vertices.
It is right on the input it assumes, and the seven lines make three assumptions: no vertex of the polygon lies exactly on the ray, R is not on the boundary, and the boundary does not cross itself. A textbook polygon satisfies all three. A CAD model breaks all three, routinely and by construction. Section three deals with the first, section seven with the second, and section six with the third, which comes from an unexpected place. The rest of the article follows from these three cases.
Degenerate cases and the half-open rule
Take the first assumption: no vertex lies exactly on the ray. Each of the seven lines is correct, and the routine still returns the wrong answer when this assumption fails. The configurations that make it fail are not rare floating-point accidents. CAD models are made of them (axis-aligned faces, shared vertices, edges built to meet exactly), so in a kernel they are the ordinary case.
Start with the vertex. A vertex exactly on the ray belongs to two edges, and a naive loop asks each edge separately whether it crosses. Both say yes, the vertex is counted twice and the result is inverted. Counting it once is also wrong, because sometimes twice is correct: a boundary that passes through the ray at that vertex crosses once, and one that touches and turns back does not cross at all. A test that looks at one edge at a time cannot tell the two apart.
An edge lying along the ray is the same problem with an extra vertex. A chain of collinear edges (what a coarse tessellation of a flat region produces) is the same problem again, repeated once per edge.
The usual reaction is to add a tolerance: treat the vertex as on the ray if it is within ε of it, then handle it specially. This does not work, and choosing a better ε does not help, because the problem is structural. The same mistake is possible in every geometric predicate.
A tolerance replaces one sharp boundary with two, at ε above and ε below, and each of them is as sharp as the original. The configurations that sat exactly on the line are replaced by configurations sitting exactly ε off it. These are no easier to decide, and the two edges meeting at a vertex can now disagree whenever they are tested separately. The problem has moved and the code is longer.
The fix is a half-open convention. Classify every vertex once, as strictly below the ray or at or above it:
below(P) ≡ Py < Ry
and count an edge as crossing exactly when its two ends are in different classes.
With this rule no vertex is on the ray, because the predicate has no third outcome. The two configurations separate: when the boundary passes through, the ends fall on opposite sides; when it turns back, they fall on the same side. A collinear edge has both ends at or above, contributes nothing, and leaves the decision to the edges either side of it. A chain of a hundred collinear edges also contributes nothing.
The fix relies on two properties of this comparison. It is the same comparison everywhere: it belongs to the vertex, so neighbouring edges share it by construction, and this is what makes double counting impossible. And it is exact: it compares two stored numbers, with no error term and no dependence on how close they are. Part five gave a test for whether parameter-space code needs the metric: does its answer survive multiplying the two axes by different constants? This comparison passes it. A tolerance would not.
So the rule is total on the polygon of section two. Given a simple polygon and exact arithmetic, it answers every input: every vertex falls on one side of the comparison, every edge crosses or does not, and the parity follows. The only case left is a point exactly on the boundary, and there the rule is not ambiguous: the determinant is zero and reports it. Nothing here needs a tolerance or an “I do not know” result. Those come later, from the geometry and not from the arithmetic.
A common alternative avoids the problem by firing the ray in a random direction, since a random direction almost surely misses every vertex. In practice this is worse than it looks. It makes a degenerate configuration less likely but never impossible, so the code still needs the handling it was meant to avoid, now on a branch that runs once in ten thousand times and is therefore never tested enough to be right. It makes the function non-deterministic: the same model classified twice can give two answers, and no bug can be reproduced from its input. And it usually comes with a retry loop, which turns a wrong answer into a hang on the inputs where every direction is bad. Real kernels do use it, but it is a sign that the degenerate cases were not handled.
How much does this matter in practice? Schirra tested widely used point-in-polygon implementations and found that they work very well for random query points and often fail for degenerate and nearly degenerate ones. Random query points are the test set we write by default; degenerate queries are what a CAD model produces.
Counting vs the nearest crossing
A second family of classification algorithms does not count anything. The difference between the two families is in how many things have to be computed correctly.
Counting is a global operation. The result is the parity of a sum over the whole ray, so every term must be right, including terms from parts of the model far from the point, and including tangencies, where the boundary grazes the ray without changing sides and the correct contribution is zero or two, never one. One error anywhere along the ray inverts the result. There is no locality either: a defect in a face on the far side of the model can change the classification of a point here.
The other family reads the nearest crossing and its direction. Walk out from the test point along the ray, discard anything that does not change side, and stop at the first meeting that does. Then ask a local question about the boundary there: is it entering or leaving, that is, does its outward normal face towards the point or away? If the first real meeting is the boundary entering the region as we travel outward, the point is outside; if it is leaving, the point is inside. One crossing and one local reading are enough.
The earliest solid modellers worked this way, and the B-rep literature states it in these terms: classify each intersection along the ray as enters or leaves, take the first real one, and ignore the grazing points (the same tangencies as above). The word real covers the tangency handling, and it uses the same mechanism that produces the answer: a graze has no transition to report, so the test that reads the transition also discards it.
So the trade-off is this. Counting needs only the position of the boundary, so it works on a polygon and asks nothing more of the geometry, but every crossing on an unbounded ray must be right. Reading transitions needs only one crossing to be right, but it needs more geometry at that crossing: the tangent, to know which way the boundary runs, and, where the tangent is degenerate or the meeting is tangential, the curvature, to decide whether the boundary bends away or through.
For a modelling kernel the choice is clear, because of where the query points come from. In a Boolean, the point being classified is next to the other shape’s boundary by construction, so the nearest crossing carries the information and everything beyond it adds only risk. Counting spends its accuracy on crossings that do not matter; reading the nearest crossing spends it on the one that does, at the cost of needing differential geometry at one point instead of arithmetic at many.
Link to part eleven. Part eleven of this series describes the classical Boolean pipeline and says of its third step that the usual mechanism is ray firing, and that counting crossings is the form everyone learns while it is not the form that survives contact. This section explains that claim. Part eleven shows the consequence: a Boolean between two shapes that touch along a face is a query where every crossing is a tangency, and parity has no defensible answer to give.
Classifying a point in a face
So far we have worked with a polygon in a plane. A kernel does not have one. It has a face: a region of a curved surface, bounded by curves, and described in the parameter rectangle that part five was about.
Since there is no polygon, the kernel builds one. It walks each curve of the face’s boundary, evaluates it at a series of parameters, and joins consecutive samples with straight chords. The result is a closed polygon in the parameter rectangle, of the kind section two assumed, and the seven lines run on it unchanged. The curved problem is replaced by the flat one, and everything difficult in this section and the next is a consequence of that replacement.
Three properties of the region carry over into the rectangle and have to be handled before the polygon is built. A fourth point, at the end, is what the test looks like without building a polygon at all.
The region has holes, named by orientation. There is an outer loop and some number of inner loops, as in the plane. They are told apart by the sign of the signed area each loop encloses in the parameter rectangle, not by a containment test between loops (which would be circular, and expensive). The signed area is a sum of cross products over the loop, the same arithmetic the classifier already does. Each loop is then classified independently and the results are combined according to the loop’s role.
The region can wrap the rectangle. A face covering a whole cylinder has an outer loop that leaves one side of the rectangle and returns at the other. The loop is closed on the surface and open in the chart. Before classification, the loop has to be reframed into a single period, by shifting its pieces by whole periods until they join. A test that skips this step on a cylinder is reading a polygon that does not close.
The rectangle is not a plane, and here that does not matter. This is the one exception to what part five argued. The crossing predicate is a comparison of coordinates and the sign of a determinant, and both survive multiplying u by one positive constant and v by another: the scale factors appear in every term of the determinant and cancel out of its sign. The decision is combinatorial, so the distortion of the chart cannot affect it. A classifier can therefore normalise its loops to the unit square: the transform provably changes no answer, and it gives floating-point headroom in a space where u might be in radians and v in millimetres. What it must not do is use a threshold: as soon as the code asks whether a parametric gap is small, the test is no longer combinatorial and it needs the first fundamental form.
The ray does not have to be a straight line. In the rectangle it usually is, because there it costs nothing. But the older and more general formulation works on the surface: intersect a plane through the point with the surface to get a curve lying in the face, intersect that curve with the face’s boundary, and read the first crossing after the point. This works on geometry where no parameter-space polygon is available, and it has one instructive failure. A cylindrical face that is a complete cylinder, with no seam edge, is bounded by two circles and nothing else, and a curve drawn around the cylinder from an interior point meets neither. The classical repair is to add an artificial edge along the seam, so that there is always something to hit. So the seam edge is a topological device with a role in classification, and more than bookkeeping about periodicity; this is easiest to see by looking at what breaks without it.
Chords, sag and tolerance
A chord does not lie on its curve, and the gap between the two is inherent to sampling. What a kernel can say about a curved boundary depends on how it handles that gap.
Take one chord joining two consecutive samples of a boundary curve. Between its ends, the curve bulges away from it. The largest distance from the curve to its chord is the sagitta, or sag, and it is the error the discretiser accepted when it chose those two samples rather than four. Finer sampling makes it smaller, but nothing makes it zero, because a straight segment is not a curve.
The effect on classification is local. The curve and the chord enclose a thin lens, and the lens is the set of points where the two disagree: a query point inside it is on one side of the real boundary and on the other side of the tested one. The answer is wrong even though no arithmetic is at fault: the sign of every determinant is correct, and the polygon is correct, but the polygon is not the face.
Since the sag cannot be removed, the kernel keeps track of it. While sampling, the discretiser records the largest sag it leaves, measured separately along u and along v. There are two numbers because the rectangle stretches the two axes differently, and a sag that is negligible along one may not be along the other. These two numbers are passed to the classifier as its tolerance, with the face’s own stored tolerance as a minimum, so they never claim more precision than the geometry has. So the error the sampler made and the uncertainty band the classifier uses are the same two numbers.
This makes the uncertainty check easy to state. Around the query point, take the box of half-width tolu in u and tolv in v, and run the same test at its four corners. If all four agree, no chord that is off by at most its own sag could have moved the boundary far enough to change the result. If they disagree, one might have, and the query cannot be answered at this resolution.
This check samples the uncertainty box and does not prove anything about all of it: it tests four points of a continuum, chosen because they are the corners and because four runs of a predicate costing a few dozen operations are cheap. It can be fooled by a boundary that enters the box and leaves it again between two corners, and in that case it wrongly reports a confident answer. In exchange, it does not depend on any error analysis being correct. It asks the question by running the same code again, so it keeps working when someone later edits the routine.
Chords can fail in one more way, and this one makes the question itself meaningless. Consider a face that is narrow somewhere: a sliver, or a thin collar around a hole, the kind of region an earlier modelling operation can produce without anyone intending it. If the sag is larger than the width of the region, a chord on one side of the narrow part bulges across to the far side and crosses a chord coming back. The polygon given to the classifier is then self-intersecting, and the rule of section two does not apply to it: that rule assumes a polygon whose edges meet only at shared endpoints, and a boundary that crosses itself encloses regions the ray passes through twice. Parity still returns a value, but that value says nothing about the face.
The guard compares two lengths that are already available. The thickness of the region can be estimated as twice its area divided by its perimeter. For a long thin region this is close to its width, and it costs nothing, because the signed area is already computed to decide which loop is the outer one. If the sag exceeds this estimate, the chords may have crossed. In that case we resample the whole boundary an order of magnitude finer, recompute both numbers, and repeat until the sag fits inside the region, or until further refinement costs too much.
None of this removes the uncertainty. It bounds it, measures it and keeps it attached to the answer. But the return type of most classifiers has no place to put it, which is the subject of the next section.
Four results: inside, outside, on, unknown
A test that knows its own error bound still has to report it, and the return type of most classifiers has no room for it. Two extra values solve this, and they are also what allows the cheap test to stay cheap.
A point exactly on the boundary is neither inside nor outside, and it is the most common query a Boolean makes. The points a Boolean classifies belong to pieces created by cutting along the other shape’s boundary, so by construction they lie on it or within a tolerance of it. A routine that returns a boolean has to give a false answer for such a query, and which one it gives depends on the sign of a subtraction.
So the return type needs three values, inside, outside and on, and in a tolerant modeller a fourth: unknown, meaning the test cannot separate the cases at the tolerance it was given. These two extra values let the caller do something sensible, and they let the cheap test stay cheap.
The last two sections have built up to this. The classification a kernel performs is layered, and each layer has now been described:
- A cheap test against the chord polygon of section five, which answers most queries in a few dozen operations.
- An uncertainty check (the four corners of section six), which asks whether the query was close enough to the boundary that the chords, and not the curves, might have decided it. If the four corners disagree, the answer is unknown.
- An exact test against the real curves instead of their chords, run only for the unknown cases. It is expensive, and affordable because it is rare.
This pattern applies well beyond this problem, but it only works if the cheap layer is allowed to say it does not know. A cheap test that must always return a verdict will sometimes return a wrong one, and the expensive layer is never called.
Point in solid
The three-dimensional question is answered by the two-dimensional one, many times. What is new in 3D is the choice of the ray.
To decide whether a point is inside a solid, we fire a ray from it and find where it meets the boundary. Each meeting takes two steps. First, intersect the ray with a face’s underlying surface, which gives candidate points on an unbounded surface. Then ask, for each candidate, whether it lies within the face. That second question is a point-in-face test, run in the face’s own parameter rectangle with the algorithm of sections five and six. So point-in-solid is a loop that calls point-in-face.
From there the same two families apply: tally the crossings and take the parity, or find the nearest real crossing and read whether the boundary there is entering or leaving. The same trade-off applies too. Tangencies are now rays grazing a face along its silhouette, and on a model built from cylinders and fillets this happens constantly.
Choosing the ray has no clean answer. The ray has to hit something, or there is nothing to classify from. If we aim at the centre of the bounding box, a shape with a large void lets the ray pass straight through the hole. Aiming at a vertex of the solid works better, but not every vertex will do: the ray must arrive from a direction that every face around that vertex turns away from, otherwise it grazes instead of cutting. A vertex on a silhouette fails this condition. And some shapes have no suitable vertex at all (a ray lying in a cylinder’s tangent plane is the standard example), and there the classical advice is to find an interior point by some special means. There is no choice that always works, and this is why the random-direction retry loop tends to appear here, presented as robustness.
One trap in three dimensions has no two-dimensional equivalent, and it still appears in modern code. The shortcut is to test the point against the solid’s bounding box first and conclude that anything outside the box is outside the solid. This is false for a negative body: a solid that is the complement of its boundary, the infinite region outside a void instead of the finite region inside a skin. Used the other way round, the same test is the standard way to detect one: take a point known to be far outside the bounding box, classify it properly, and if it comes out inside, the body is negative. Kernels that import geometry meet inverted solids regularly, and the bounding-box shortcut gives a wrong answer, silently, on every one of them.
Implementation checklist
If you are writing this from scratch (and it is one of the first things to write, because nothing else works without it), here is the order in which to get things right.
- Return more than a boolean. Inside, outside, on the boundary, and unknown. Add the last two from the start: adding them later means changing every call site, and there are call sites everywhere.
- Resolve degeneracy with a half-open comparison, never a tolerance. Classify each vertex once as strictly below or at or above, and share that classification between the edges that meet there. It is exact, it costs nothing, and it removes the whole class of problem instead of making it rarer.
- Keep the predicate combinatorial. Use only comparisons and determinant signs. Then it survives an anisotropic rescaling of the parameter axes, and you can normalise your loops for conditioning without changing any answer. As soon as a threshold appears, you need the metric, and you are in the second group of part five.
- Layer it: cheap, uncertain, exact. The cheap test runs against chords and is allowed to decline. The uncertainty check can be as simple as classifying the corners of a small box and checking that they agree. The exact test runs against the real curves and is affordable because it is rare.
- Check the sag against the region’s own width. Chords sampled more coarsely than the face is thin cross each other, and a self-intersecting polygon has no inside to report, only a choice of convention. Twice the area over the perimeter estimates the width well enough, and the area is already computed to name the loops.
- Handle the seam before classifying. Reframe wrapped loops into one period first. Code that handles periodicity and the polygon test at the same time is very hard to read afterwards.
- Prefer the nearest crossing to the tally where you can afford the geometry. Needing one crossing to be right is better than needing every crossing to be right, and the query points a kernel generates are near boundaries by construction.
- Test the degeneracies, because random points never reach them. A test set of uniformly random query points will report that the implementation is perfect, because it only tests the easy branch.
Test cases for the degenerate configurations. Each of these is a configuration a real model produces, and none will occur in a million random trials: the query point exactly on a vertex; exactly on an edge; on the extension of an edge beyond its end; level with a vertex where the boundary passes through; level with a vertex where it turns back; level with a horizontal edge; level with a chain of several collinear edges; inside a hole whose loop touches the outer loop at one point; on a loop that has a repeated vertex or a zero-length edge; and the same point tested against the same region rotated by ninety degrees, which should give the same answer and is the cheapest way to catch an axis-aligned assumption. Build these by hand, assert exact expected values, and keep them. They find more bugs than any amount of random testing, and they fail when someone later replaces the comparison with a tolerant one.
What this article leaves out
Preprocessing, beyond a mention. Grids, bins, trapezoid decompositions and BSP trees turn a linear test into a nearly constant one, and a kernel does build them, but lazily, and only for a boundary that has already been queried enough times to justify one. A caller that asks a few questions of a boundary and then throws it away must not pay for a structure it will never reuse. The decision depends on which kind of caller it is, so it is a question about the pipeline and not about the predicate.
Containment of things other than points. A Boolean does not really want to classify points; it wants to know whether a whole edge, loop, face or shell is inside a shape. The usual reduction (pick a point on it and classify that point) is valid only when the entity is known not to cross the boundary, which is what the intersection stage is supposed to guarantee. When the intersection stage does this imperfectly, the reduction inherits the error, and this causes a family of Boolean failures that do not look like classification bugs. Part eleven covers them.
Reading list
Sources
K. Hormann and A. Agathos, “The point in polygon problem for arbitrary polygons”, Computational Geometry: Theory and Applications 20 (2001), 131–144. Read directly, and the main source for section three. The quadrant classification, the half-open comparison and its consequence that “no vertex can ever coincide with the ray”, the detection of a point on an edge by the determinant being zero, and the measured cost of each refinement are all theirs. It also reports timings, and notes that the variant which detects a point on the boundary does not scale like the others, because the larger the polygon, the more likely a query is to land on its boundary and exit early.
E. Haines, “Point in Polygon Strategies”, in Graphics Gems IV, ed. P. Heckbert, Academic Press, 1994, pp. 24–46. Read in the author’s companion web edition rather than the printed chapter, since that is where the code and the timing discussion are. It is open about the limit of the whole approach: points exactly on an edge are classified arbitrarily, which it treats as acceptable for rendering and which is not acceptable here.
I. Stroud, Boundary Representation Modelling Techniques, Springer, 2006. Read directly. Appendix E.3 to E.5, pp. 709–713, is the B-rep statement of the problem: point in body, point in face, loop in face. The enters and leaves classification of section four is its E.2 and E.3, with the instruction to take the first real intersection and ignore grazing points; the ray-selection difficulty and the acceptable-vertex condition are its figure E.1 and the text around it; the negative-body trap in section eight is stated there as the standard way to detect a negative body. The angle-counting method is attributed to Jared, with the note that it also works on slightly curved faces where the sum is not a full turn, and that this is one reason the BUILD modeller did not allow a face to extend through more than 180 degrees. That is a modelling restriction adopted to keep a classification algorithm valid, a clear case of the influence running in the opposite direction. Ray tests in faces are credited to Braid.
S. Schirra, “How reliable are practical point-in-polygon strategies?”, Algorithms – ESA 2008, Lecture Notes in Computer Science 5193, Springer, pp. 744–755. Not consulted directly. The claim in section three that published implementations pass random queries and fail degenerate ones is this paper’s stated finding, taken from its abstract and its companion page rather than from the text. It is the study to read before trusting any of this, including the version here.
One further work is quoted second-hand and named for that reason: J. Foley et al., Computer Graphics: Principles and Practice, for the requirement that “the ray must hit no vertices of the polyline”, read in Hormann and Agathos rather than in the original.
Method
Every count in the figures is computed by the program that draws them, from the same predicates the article describes, instead of being drawn by hand. The following are all assertions in the generator, so a figure that disagreed with the text would fail to build: the two crossing counts of figure one, and the fact that they differ while their parity does not; the opposite orientations of the two loops in figure four; in figure five, that the gap drawn between the arc and its chord is the sagitta the formula gives, and that the corners of one box straddle the chord while the corners of the other do not; and, in figure six, that exactly one of the three meetings lies inside its face and that the second ray leaves through an edge.
The claim about breadth in section one (two classification routines called from twelve libraries across five subsystems) was obtained by searching the source of a production kernel for call sites and grouping them by library, not from memory. The behaviours described in general terms throughout (the two classification families coexisting in one kernel, the four-valued return with its unknown state, the four-corner uncertainty check, the chord polygon and the sag it carries as its tolerance, the refinement that keeps those chords from crossing, the periodic reframing before classification, the signed area naming the outer loop, the lazily built grid, the random ray direction with its retry loop) were each read in that source. They are stated here without attribution because this series is about the problem rather than any one implementation of it.
. Part numbers renumbered for the new part two, The Mathematics a Kernel Stands On.