Skip to content

Commit f5fa438

Browse files
committed
Basically just stabbing in the dark here
1 parent a7b59f8 commit f5fa438

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/flitter/language/functions/waves.pyx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,12 @@ def square(Vector xs not None):
8787
return ys
8888

8989

90-
def triangle(Vector xs not None):
91-
if xs.numbers == NULL:
90+
def triangle(Vector xs):
91+
if xs is None or xs.numbers == NULL:
9292
return null_
9393
cdef Vector ys = Vector.__new__(Vector)
94-
cdef double x, y
94+
cdef double x
9595
for i in range(ys.allocate_numbers(xs.length)):
9696
x = xs.numbers[i]
97-
x -= floor(x)
98-
y = 1 - abs(x - 0.5) * 2
99-
ys.numbers[i] = y
97+
ys.numbers[i] = 1 - abs((x - floor(x))*2 - 1)
10098
return ys

0 commit comments

Comments
 (0)