taichi-dev/taichi

[Discussion] Taichi's standard math library

Open

#833 geöffnet am 21. Apr. 2020

Auf GitHub ansehen
 (17 Kommentare) (0 Reaktionen) (1 zugewiesene Person)C++ (2.384 Forks)batch import
discussionfeature requestgood first issuepythonwelcome contribution

Repository-Metriken

Stars
 (28.195 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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