- 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.
推薦閱讀
- .NET之美:.NET關鍵技術深入解析
- Visual Basic程序設計教程
- WSO2 Developer’s Guide
- Easy Web Development with WaveMaker
- Building Minecraft Server Modifications
- 數據結構與算法分析(C++語言版)
- 利用Python進行數據分析
- Geospatial Development By Example with Python
- Access 2010數據庫應用技術實驗指導與習題選解(第2版)
- Python 3 Object:oriented Programming(Second Edition)
- PHP+MySQL動態網站開發從入門到精通(視頻教學版)
- LabVIEW入門與實戰開發100例(第4版)
- 循序漸進Vue.js 3前端開發實戰
- Node.js Web Development
- Visual C++實用教程