A new method for the drawing API: curve offsets #65
sgenoud
announced in
Announcements
Replies: 1 comment 2 replies
-
Some more! The logic for offsetting lines was laying the ground work for: fillet and chamfer in 2D. And I went all the way to expose it with two different API. While drawing const shape = draw().hLine(10).customCorner(2, 'fillet').vLine(5).close() on a closed drawing const shape = draw()
.hLine(10)
.vLine(5)
.close()
.fillet(2, (e) => e.ofAngle(90)) The first example is nicer when you are drawing a full shape, and the second can be used after some boolean operations have been done, for instance: const shape = drawRoundedRectangle(10, 20)
.fuse(drawCircle(5).translate(5, 10))
.fuse(drawCircle(3).translate(-3.5, -11));
const customWithFinder = shape.fillet(2, (e) => e.ofAngle(90));
return [
{
shape: shape,
name: "Base Shape",
},
{
shape: customWithFinder.translate(20, 0),
name: "Modified with selectors",
color: "blue",
},
]; will show something like this |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This one was more difficult than I thought. I have added a
offset
method on drawings.What does that mean? You can now take a 2d drawing a create an offset (i.e. contour). You can even make many of them:
It works as you would expect:
Which draws
Note that there are some known bugs around bezier curves that I need to fix (and I am curious to see how you break it as well!
Beta Was this translation helpful? Give feedback.
All reactions