Example #1
0
def activate(t: ti.f32):
    for i, j in ti.ndrange(n, n):
        p = ti.Vector([i, j]) / n
        p = ti.Matrix.rotation2d(ti.sin(t)) @ (p - 0.5) + 0.5

        if ti.taichi_logo(p) == 0:
            x[i, j] = 1
Example #2
0
    def init():
        for i, j in v:
            v[i, j] = ti.Vector([j / n - 0.5, 0.5 - i / n])

        for i, j in ti.ndrange(n * 4, n * 4):
            ret = ti.taichi_logo(ti.Vector([i, j]) / (n * 4))
            x[i // 4, j // 4][0] += ret / 16
            x[i // 4, j // 4][1] += ret / 16
            x[i // 4, j // 4][2] += ret / 16
Example #3
0
def paint():
    for i, j in ti.ndrange(n * 4, n * 4):
        # 4x4 super sampling:
        ret = ti.taichi_logo(ti.Vector([i, j]) / (n * 4))
        x[i // 4, j // 4] += ret / 16