taichi-dev/taichi

[Discussion] Taichi's standard math library

Open

#833 aperta il 21 apr 2020

Vedi su GitHub
 (17 commenti) (0 reazioni) (1 assegnatario)C++ (2384 fork)batch import
discussionfeature requestgood first issuepythonwelcome contribution

Metriche repository

Star
 (28.195 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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

Guida contributor