This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sympy import * | |
x, y, X, Y = symbols("x y X Y") | |
P = x**2 + y**2 - 1 | |
dx = diff(P, x) # gradient of P | |
dy = diff(P, y) | |
curve = Matrix([x, y]) | |
light_source = Matrix([1, 0]) | |
l = curve - light_source # the incident ray | |
n = Matrix([dx, dy]) # the normal vector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
Simple Hyperbolic tiling animation using taichi | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
""" | |
import taichi as ti | |
from taichi.math import * | |
ti.init(arch=ti.cpu) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import cairocffi as cairo | |
import numpy as np | |
import taichi as ti | |
ti.init(arch=ti.cpu) | |
scale = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install taichi | |
import taichi as ti | |
ti.init(arch=ti.gpu) | |
d = 3 | |
num_rounds = 100000 | |
max_steps = 1000000 | |
ivec = ti.types.vector(d, int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import taichi as ti | |
import taichi.math as tm | |
ti.init(arch=ti.vulkan) | |
w, h = 800, 640 | |
res = (w, h) | |
pixels = ti.Vector.field(3, float, shape=res) | |
window = ti.ui.Window("fractal", res=res) | |
canvas = window.get_canvas() |