taichi-dev/taichi

[Discussion] Taichi's standard math library

Open

#833 opened on Apr 21, 2020

View on GitHub
 (17 comments) (0 reactions) (1 assignee)C++ (28,195 stars) (2,384 forks)batch import
discussionfeature requestgood first issuepythonwelcome contribution

Description

Concisely describe the proposed feature Currently Taichi's math utility functions are very basic and thus not very rich. And the linear algebra part has some name nit problems, e.g. normalized() is a static method while norm() is not. I would like to use glsl-alike functions to manuplate vectors so that users from the world of OpenGL can easily get used to our vector system and thus minimize learning cost.

Describe the solution you'd like (if any) linear algebra: ti.vec2(x, y) -> ti.Vector([x, y]) u.norm() -> ti.length(u) u.dot(v) -> ti.dot(u, v) ti.Vector.normalized(u) -> ti.normalize(u) (u - v).norm() -> ti.distance(u, v) ti.reflect(i, d), ti.refract(i, d, eta) (see examples/renderer_util.py) ... some scalar functions: step(), smoothstep(), clamp()...

Additional comments GLSL built-in functions: https://blog.csdn.net/hgl868/article/details/7876257 GLSL-alike C++ header-only math library: https://github.com/g-truc/glm

Contributor guide