taichi-dev/taichi

[Discussion] Taichi's standard math library

Open

#833 ouverte le 21 avr. 2020

Voir sur GitHub
 (17 commentaires) (0 réactions) (1 assigné)C++ (2 384 forks)batch import
discussionfeature requestgood first issuepythonwelcome contribution

Métriques du dépôt

Stars
 (28 195 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

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

Guide contributeur