Skip to content

Commit

Permalink
Merge cc7d185 into f0bb9ba
Browse files Browse the repository at this point in the history
  • Loading branch information
alcarney committed Jan 6, 2019
2 parents f0bb9ba + cc7d185 commit 1da7ed8
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
20 changes: 20 additions & 0 deletions stylo/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
from .color import FillColor # noqa: F401
from .domain.transform import ( # noqa: F401
horizontal_shear,
rotate,
translate,
vertical_shear,
)
from .image import LayeredImage, SimpleImage # noqa: F401
from .math import anded, lerp # noqa: F401
from .shape import ( # noqa: F401
Circle,
Ellipse,
ImplicitXY,
Rectangle,
Shape,
Square,
Triangle,
)
from .time import Timeline # noqa: F401

from ._version import __version__ # noqa: F401
1 change: 1 addition & 0 deletions stylo/math/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .logic import anded # noqa: F401
from .interpolation import lerp # noqa: F401
26 changes: 26 additions & 0 deletions stylo/math/logic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import numpy as np


class LogicalAnd:
"""Represents a logical AND between N values.
Yes, there is currently no reason to use a class but where I want to
take this in the near future will require a class.
"""

def __init__(self, values):
self.values = values

def __call__(self):

result = True

for v in self.values:
result = np.logical_and(result, v)

return result


def anded(*args):
logical_and = LogicalAnd(args)
return logical_and()

0 comments on commit 1da7ed8

Please sign in to comment.