## The wrong conics

Sunday, December 17th, 2006 at 6:52 pm

I wasted most of the week pursuing the wrong idea for how to implement tapered cutters, unable to work out why my calculation was failing. It was because I got it completely wrong, which I found out by finally plotting what I was trying to do in 3D and looking at it very carefully.

I already had the code for generating z-constant waterline passes for a flat-bottomed cylindrical cutter by projecting it sideways until it collided with the triangulated surface.

I was pretty sure I could extend this code to work for conical shapes, where the radius was different for the top and bottom of the cylinder, by distorting the space.

Suppose the radius of the cylinder/chopped cone at zo was ro, and r1 at z1, with zo < z1 and ro < r1. Given a node point p from the triangular mesh, I would transform this to the point (s px, s py, pz) where

s = 1 + (r1/r0 – 1)(z1 – pz) / (z1 – z0)

This would tranform the cone into a cylinder, I’d work with the transformed points against the cylinder, and then reverse the transform to get the answer for the cone.

Totally wrong, since everything not centred on the origin gets smeared and changes its angle.

The way I really should have thought of it was to imagine testing the cone against a single line segment in the triangulated surface. The cone of the cutter moves horizontally through space until it collides with the line. The relative sweep of the line therefore can be represented by a plane in space tilted up at the angle of the line as it is projected into the plane perpendicular to the motion of the cone.

By embedding the line into this plane, and imagining the plane cutting the cone, it appears I would have to be able to find the tangents to an arbitrary conic section, which includes crazy curves such as the hyperbola. No wonder it wasn’t straight-forward.

Anyways, now I’m on the right track, I’ve spent the whole weekend getting it done.

For the surface parts of the cylinder and cone, as opposed to their circular end-disks, you only need to test against points and lines, but not the triangular facets; only two-way curved surfaces such as the hemispherical ball-nose can make a single-point contact in the middle of a triangle.