FeatureBoardby Lewis Valentine

A Wrong Answer That Looked Right 98 Times

A crash tells you where to look. A plausible number tells you to stop looking. This is what happened when a geometry census came back confident, self-consistent, and completely wrong — and what it cost before anyone noticed.

NativeCAD refuses to fillet an edge whose neighbouring faces aren't both flat. The message it gave was accurate: the rolling-ball blend is only defined between PLANAR faces. On a real machined part, that accurate message is almost always the wrong diagnosis.

Fixing it meant answering a counting question first. On the NIST CTC-01 conformance part, 98 straight edges have a curved support face. How many of those are corners a user would actually want rounded, and how many are seams that are already round?

I ran that census. It came back saying 74 of the 98 were fillet-able cylinder-plane corners. That number was wrong. The real answer is zero.

The shape of the error

To tell a corner from a seam you need the angle between the two faces at the edge. For a plane that's easy: the normal is the normal everywhere. For a cylinder it depends on where you stand. The outward normal at a point is the radial direction from the axis, which means you need the radial direction at that edge's own station along the axis.

In STEP, a cylinder's axis arrives as an AXIS2_PLACEMENT_3D: a direction, and an origin point. The critical property of that origin is that it is an arbitrary point on an infinite line. It is not the centre of anything. It carries no promise of being near the edge you care about.

The code did this:

const radial = unit(subtract(p, placement.origin));

It should have projected the origin onto the axis at the edge's own station first, then measured radially from there. Skipping the projection leaves a vector that is part radial and part axial, tilted by however far the placement origin happens to sit from the edge.

Why this one was hard to catch

The bad expression returns a unit vector. It has length 1. It points away from the axis, roughly. Dotted with the plane's normal it produces an angle in a believable range. Nothing about the output announces itself as garbage.

Self-consistent, and wrong

This is the part worth dwelling on. The failure produced no exception, no NaN, no degenerate vector, no assertion trip. It produced a well-formed answer for every one of the 98 edges, and those answers agreed with each other.

Spot-checking a few didn't help, because the error scales with the distance from the placement origin to the edge, and neighbouring edges on the same cylinder sit at similar distances. Nearby edges were wrong by similar amounts. The census had internal structure. It looked like a measurement.

A crash tells you where to look. A plausible number tells you to stop looking.

The 74 figure went into a ticket as evidence for building contact-curve marching. It was justification for a substantial piece of kernel work aimed at a population of edges that does not exist.

What the part actually contains

With the projection corrected, the 98 edges split like this:

94
Tangent seams
4
Genuinely unsupported
0
Fillet-able corners

94 of them are tangent seams: the two faces meet smoothly, with outward normals equal to within 1e-6. That is structural rather than incidental. The seam where a cylindrical corner-round meets the flat wall it blends is tangent by construction, so a part full of machined radii is full of those seams by definition. There is no corner at that edge. The edge already is a blend. No kernel would fillet it, and a user asking to has misidentified the edge they meant.

The remaining 4 are conical supports, which really are a capability the kernel doesn't have.

The refusal that shipped

Once you know the split, the fix stops being contact-curve marching and becomes a diagnosis. A tangent seam is now refused as a tangent seam. The message names both faces and their surface types, says there is no corner to round, and tells the user to pick the sharp edge they actually wanted. The seam ids ride out on the error as tangentSeams so the viewer can highlight them.

The 4 conical edges deliberately keep the original wording. That distinction is the whole point of the change: a genuine capability gap must not be quietly relabelled as a smooth join, or the refusal becomes as misleading as the one it replaced.

The difference to a user

"Curved supports are unsupported" means wait for a release. "These two faces meet smoothly, pick the sharp edge you wanted rounded" means do something in the next ten seconds.

Pinning the number

The regression test for this doesn't only check that the new message appears. It re-runs the census and asserts the 94/4/0 split, and it asserts the fixture still holds exactly 98 curved-support edges, so a changed sample invalidates the counts loudly instead of silently.

That matters because of how the bug hid. A test that only checked "tangent seams produce a tangent-seam message" would have passed against the broken projection, since the broken projection still classified most edges correctly by luck of geometry. Only the count catches it.

The general lesson has stuck with me past this ticket. When a measurement is the input to a build-or-don't-build decision, the measurement needs a test as much as the feature does. Geometry code is unusually good at producing confident wrong answers, because the outputs are unit vectors and angles that look valid no matter how you derived them.


NativeCAD is a parametric B-rep kernel that runs in the browser: STEP AP242 in and out, real solid modeling, no server round-trip. You can drive it yourself or book a call if you have a geometry problem you want to talk through.

← Previous Post
Feature Acceleration: What a 20x Token Plan Looks Like on a Real Board