-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to render some straight or curve line in taichi_three #30
Comments
Doc here: t3.142857.red, mainly detailed in rendering meshes, though. |
Thanks for your reply, I hope the document would include the example how to draw traight or curve line , it could be friendly to new Taichi users like me. |
Here's the example that draws a helix-alike curve in 3d space: import taichi_three as t3
import taichi as ti
N = 512
scene = t3.Scene()
mesh = t3.DynamicMesh(n_faces=N - 1, n_pos=N)
model = t3.WireframeModel(t3.PolyToEdge(mesh))
scene.add_model(model)
camera = t3.Camera()
scene.add_camera(camera)
@ti.kernel
def init_mesh():
for i in range(N):
x = i / N * 2 - 1
mesh.pos[i] = [x, ti.sin(x * 10), ti.cos(x * 10)]
for i in range(N - 1):
mesh.faces[i] = [[i, 0, 0], [i, 0, 0], [i + 1, 0, 0]]
mesh.n_faces[None] = N - 1
init_mesh()
gui = ti.GUI('Helix', camera.res)
while gui.running and not gui.get_event(gui.ESCAPE):
camera.from_mouse(gui)
scene.render()
gui.set_image(camera.img)
gui.show() |
Thanks for your reply, it was a great help to me |
Glad to help! Also note that |
I want to draw some curve in 3D space by using taichi_three to render, but some functions which I don't understand
The text was updated successfully, but these errors were encountered: