add mirror2d() to Rotatable
This commit is contained in:
parent
09a5e4a2db
commit
8e1c05cf73
3 changed files with 19 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
|||
from typing import TypeVar
|
||||
from typing import TypeVar, Tuple
|
||||
from abc import ABCMeta, abstractmethod
|
||||
|
||||
|
||||
|
|
@ -28,6 +28,22 @@ class Mirrorable(metaclass=ABCMeta):
|
|||
"""
|
||||
pass
|
||||
|
||||
def mirror2d(self: T, axes: Tuple[bool, bool]) -> T:
|
||||
"""
|
||||
Optionally mirror the entity across both axes
|
||||
|
||||
Args:
|
||||
axes: (mirror_across_x, mirror_across_y)
|
||||
|
||||
Returns:
|
||||
self
|
||||
"""
|
||||
if axes[0]:
|
||||
self.mirror(0)
|
||||
if axes[1]:
|
||||
self.mirror(1)
|
||||
return self
|
||||
|
||||
|
||||
#class MirrorableImpl(Mirrorable, metaclass=ABCMeta):
|
||||
# """
|
||||
|
|
|
|||
Loading…
Reference in a new issue