- Hands-On C++ Game Animation Programming
- Gabor Szauer
- 97字
- 2021-06-30 14:45:50
Multiplying vectors
Vector multiplication can be considered a non-uniform scale. Instead of scaling every component of a vector by a scalar, to multiply two vectors, you scale every component of a vector by the like component of another vector.
You can implement vector multiplication by overloading the * operator in vec3.cpp. Don't forget to add the function declaration to vec3.h:
vec3 operator*(const vec3 &l, const vec3 &r) {
return vec3(l.x * r.x, l.y * r.y, l.z * r.z);
}
The result generated by multiplying two vectors will have a different direction and magnitude.
推薦閱讀
- Java多線程編程實戰指南:設計模式篇(第2版)
- GitLab Cookbook
- 小創客玩轉圖形化編程
- Developing Mobile Web ArcGIS Applications
- Cross-platform Desktop Application Development:Electron,Node,NW.js,and React
- 精通軟件性能測試與LoadRunner實戰(第2版)
- JavaScript從入門到精通(第3版)
- 鋒利的SQL(第2版)
- The Complete Coding Interview Guide in Java
- Oracle 18c 必須掌握的新特性:管理與實戰
- Learning Vaadin 7(Second Edition)
- Mastering JavaScript High Performance
- Getting Started with React Native
- SQL 經典實例
- Unity Character Animation with Mecanim