Closed anthrotype closed 8 years ago
The methods are carefully taken with glyph math in mind. plus
, minus
, multiply
and divide
are 'taken' or used to perform glyph math; calculating with point coordinates. BooleanOperations should be clearly something else so no __sub__
. This is handy for subclassing both from a GlyphMath
object as from BooleanGlyph
object.
The rest of the api follows the same logic as built-in sets.
I don't know what you mean by "glyph math". I am familiar with the sets interface, and I thought the operations on sets could be assimilated with what we do on contours in booleanOperations. I don't really mind, actually.
Thanks for the clarification!
Python built-in sets use the same names for three out of four of the
booleanOperations
methods:union
,difference
,intersection
. Only forsymmetrical_difference
we use a different name,xor
.https://docs.python.org/3/library/stdtypes.html#set
I propose we make
xor
an alias ofsymmetrical_difference
, for consistency with the built-in Python set API.Similarly, the
BooleanGlyph
overrides the binary arithmetic operators, using the same symbols as those used by Python sets -- except for difference, where we use modulo%
whereas sets use minus-
.Again, for consistency, I believe we should add
__sub__
as an alias to__mod__
, so we can doBooleanGlyph(glyph1) - BooleanGlyph(glyph2)
, while maintaining compatibility with the old%
operator.