add chamfered primitives

8 views
Skip to first unread message

Angelo Tartanian

unread,
Mar 19, 2021, 4:31:29 PM3/19/21
to Curv

It’s great to be able to chamfer boolean operations between shapes, but something missing is the ability to generate chamfered shaped initially.

let
chamfered_rect = size -> chamfer_r -> 
    let
        r = size / 2 - chamfer_r;
    in
        make_shape {
            dist[x,y,z,t] =
                if (abs(x) > abs(r@X) && abs(y) > abs(r@Y))
                    (abs(x)-abs(r@X)+abs(y)-abs(r@Y)) - chamfer_r
                else
                    (max(abs([x,y]) - (r + chamfer_r)));
            bbox = [[-r@X,-r@Y,0],[r@X,r@Y,0]];
            is_2d = true;
        }
;

in
show_dist (chamfered_rect (2, 3) .5)

This could be added as a .chamfered alternate distance field like .exact or .mitred and could be added to all of the primitives with sharp edges. since it would be an addition it should not break any backwards compatibility.

Angelo Tartanian

unread,
Mar 19, 2021, 4:51:05 PM3/19/21
to Curv
Screen Shot 2021-03-19 at 4.50.20 PM.png

Angelo Tartanian

unread,
Mar 19, 2021, 4:54:58 PM3/19/21
to Curv
Likewise, a rounded/filleted version of all of the primitives with sharp edges would also be really useful.
Reply all
Reply to author
Forward
0 new messages