- Hands-On C++ Game Animation Programming
- Gabor Szauer
- 102字
- 2021-06-30 14:45:49
Epsilon
Comparing floating point numbers is difficult. Instead of comparing two floating point numbers directly, you need to compare them using an epsilon. An epsilon is an arbitrarily small positive number that is the minimum difference two numbers need to have to be considered different numbers. Declare an epsilon constant in vec3.h:
#define VEC3_EPSILON 0.000001f
Important note:
You can learn more about floating point comparison at https://bitbashing.io/comparing-floats.html
With the vec3 structure created and the vec3 epsilon defined, you are ready to start implementing some common vector operations. In the next section, you're going to start by learning and implementing several component-wise operations.
推薦閱讀
- 區(qū)塊鏈架構(gòu)與實(shí)現(xiàn):Cosmos詳解
- Hands-On GPU:Accelerated Computer Vision with OpenCV and CUDA
- 軟件工程
- Learning Vaadin 7(Second Edition)
- 21天學(xué)通C++(第5版)
- Scratch3.0趣味編程動(dòng)手玩:比賽訓(xùn)練營
- Clojure for Java Developers
- Webpack實(shí)戰(zhàn):入門、進(jìn)階與調(diào)優(yōu)(第2版)
- 超簡單:Photoshop+JavaScript+Python智能修圖與圖像自動(dòng)化處理
- Python面試通關(guān)寶典
- C++17 By Example
- Node.js應(yīng)用開發(fā)
- Learning WordPress REST API
- MATLAB從入門到精通
- Mastering Responsive Web Design