Shapes overlaps challenge #277
Replies: 1 comment 3 replies
-
Hey Matthieu, This is known as hidden line removal. Unfortunately, vsketch doesn't readily support this, but there are various ways to achieve the same result. Using ShapelyShapely is a great 2D geometry library for python, which vsketch uses internally for other things. It supports boolean operations, so they can be used to "cut" parts of some geometries to emulate hidden line removal. from shapely.geometry import Point
# create two circular polygons
circle1 = Point(0, 0).buffer(4)
circle2 = Point(3, 0).buffer(4)
# draw the boundary of circle1 after being subtracted by circle2
vsk.geometry(circle1.exterior.difference(circle2))
# draw the boundary of circle2
vsk.geometry(circle2.exterior) Using
|
Beta Was this translation helpful? Give feedback.
-
Hey there!
First, thank you so much @abey79 for the library. It makes my plotting experience much more fun.
My challenge is to draw a path, but not drawing it if the path go into a "shape zone". As filling shapes doesn't make much sense when plotting, what would be your approach for doing it ?
To illustrate what I mean:
Today, if I draw circle 1 and then 2 with vsk.circle(), I get:
However, what I would like to achieve is:
So that the path of circle 1 "stops" if it enters in circle 2.
What I was thinking, but seems complicated, is to draw circle 2 with sin() cos() and bezier curves and store all inner coordinates in a matrice. Then, when I draw the second shape (circle 1 here), I check if it enters the first shape ( circle 2 here ) by looking into the matrice.
I would hope for a much easier way, if anyone of you know about how to solve that more easily than my approach ?
Thank you so much for your support,
Cheers,
Matthieu
Beta Was this translation helpful? Give feedback.
All reactions