Following up from yesterday here's how to make a constant-width chamfer using implicit modeling. Images are from @nTopology.
— Blake Courter (@bcourter) June 23, 2022
(1/n) pic.twitter.com/6k7BtKv3cP
Let's work in 2D so we can visualize the field. We will take two planes represented as signed distance fields (SDFs), and let's call those fields "A" and "B".
— Blake Courter (@bcourter) June 23, 2022
Here's A, and B is it's mirror image across the vertical axis:
(2/n) pic.twitter.com/htvjfd4FBx
We will can intersect these together by taking the max of the fields. (Our sign convention is that inside is negative.)
— Blake Courter (@bcourter) June 23, 2022
This corner, A ∩ B, is what we want to chamfer. Note that this result is not an SDF, because the field extending up from the corner is sharp.
(3/n) pic.twitter.com/9UsepToZPT
SDFs are more special than general implicits because their gradient has unit magnitude. The sum and difference of two unit vectors are perpendicular, as seen in the diagonals of the rhombus of the vectors.
— Blake Courter (@bcourter) June 23, 2022
Defining:
S = A + B
D = A - B
(4/n) pic.twitter.com/21ielqTTX4
Here is A + B with A ∩ B overlaid above. Looks okay at first glance, but notice (left) that the spacing between the contours is wider than our original fields. It's gradient magnitude is not unity, but we can normalize the field by dividing by that magnitude (right).
— Blake Courter (@bcourter) June 23, 2022
(5/n) pic.twitter.com/BJ5SwRPfxL
To get a chamfer, we just need to offset our normalized A + B field inward and intersect again. This result produces a constant inset chamfer, where the width increases with dihedral angle between faces.
— Blake Courter (@bcourter) June 23, 2022
(6/n) pic.twitter.com/YCDmpANN7h
To convert to a constant width chamfer, one simply does some trig on the triangle to figure out what the inset should be based on the angle between the gradients.
— Blake Courter (@bcourter) June 23, 2022
Here's what that looks like in nTopology:
(7/n) pic.twitter.com/SmFSH59ckC
But what about asymmetric chamfers? One approach is to expand A + B into
— Blake Courter (@bcourter) June 23, 2022
A * t + B * (1 - t)
But it's not convenient for precise geometry.
(8/n)
One can create a surface at an arbitrary angle Θ to the normalized S or D fields using
— Blake Courter (@bcourter) June 23, 2022
S * cos(Θ) + D * sin(Θ)
Algebraic geometers call this family of surfaces the "pencil" of their intersection curve.
With some more trig, any CAD-like chamfer is now in your control.
(9/n) pic.twitter.com/5eA5MvAhlb
That's the full story of implicit chamfers, as far as I can tell.
— Blake Courter (@bcourter) June 23, 2022
BTW, this is my first attempt to make a math tweet thread in the style of my heroes like @keenanisalive and @johncarlosbaez . Would very much appreciate feedback.
(10/n, n = 10)