Skip to content
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

XOR operation of two circles are not correct #2

Open
carlos-adir opened this issue Sep 24, 2023 · 1 comment
Open

XOR operation of two circles are not correct #2

carlos-adir opened this issue Sep 24, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@carlos-adir
Copy link
Contributor

carlos-adir commented Sep 24, 2023

The operation XOR between to circles does not give the correct result:

from compmec.shape import Primitive

circle_left = Primitive.circle(radius = 50, center = (-15, 0))
circle_right = Primitive.circle(radius = 50, center = (15, 0))
circle_xor = circle_left ^ circle_right 

Although using this operation we get the correct shape

circle_or = circle_left | circle_right
circle_and = circle_left & circle_right
circle_xor = circle_or - circle_and

The current implementation of __xor__ is theorically correct:

def __xor__(self, other):
    return (self - other) | (other - self)
@carlos-adir
Copy link
Contributor Author

Using regular_polygon gives the correct result:

from compmec.shape import Primitive

circle_left = Primitive.regular_polygon(35, radius = 50, center = (-15, 0))
circle_right = Primitive.regular_polygon(35, radius = 50, center = (15, 0))
circle_xor = circle_left ^ circle_right

Probably it's a problem from the intersection between two bezier curves of degree 2.

@carlos-adir carlos-adir added the bug Something isn't working label Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant