Skip to content

XOR operation of two circles are not correct #2

@carlos-adir

Description

@carlos-adir

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions