-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent intersections #25
Comments
PyX behaves very well defined given the fact, that circles are closed paths, but still have a begin and end point. It is the point to the right, but you may rotate it, like to the top like so
Your code should probably return the shorter of the two paths created from the split method ... |
Returning the shorter of two paths might we correct in this case, but is wrong in other cases. IMHO, there should be a documented way how to get the intersecting area of two closed paths, e.g. for a venn diagram. |
I am not quite sure whether it is the right format to discuss on a close issue, but I don't mind. In addition I am not familiar with venn diagrams. Regarding the area of two intersecting closed paths, there clearly are several solutions: from pyx import *
c = canvas.canvas()
def intersect(y, p1, p2):
c1 = path.circle(0, y, 4)
c2 = path.circle(3, y, 2)
c.stroke(c1)
c.stroke(c2)
(int1), (int2) = c1.intersect(c2)
c1segs = c1.split(int1)
c2segs = c2.split(int2)
c.fill(c1segs[p1] << c2segs[p2].reversed(), [color.rgb.red])
intersect(0, 0, 0)
intersect(-10, 1, 0)
intersect(-20, 0, 1)
intersect(-30, 1, 1)
c.writePDFfile() |
Let's look at this code:
As one might expect, it produces this figure
But If I replace the last part with
the results looks like this.
The way the blue line looks is inconsistent with the rest.
The text was updated successfully, but these errors were encountered: