taichi-dev/taichi

[Discussion] Taichi's standard math library

Open

#833 创建于 2020年4月21日

在 GitHub 查看
 (17 评论) (0 反应) (1 负责人)C++ (2,384 fork)batch import
discussionfeature requestgood first issuepythonwelcome contribution

仓库指标

Star
 (28,195 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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

贡献者指南