- 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.
推薦閱讀
- Java程序設計(慕課版)
- CMDB分步構建指南
- Java 開發從入門到精通(第2版)
- Python數據可視化:基于Bokeh的可視化繪圖
- PaaS程序設計
- C和C++安全編碼(原書第2版)
- Machine Learning with R Cookbook(Second Edition)
- BeagleBone Media Center
- Python機器學習編程與實戰
- Drupal 8 Configuration Management
- Windows Phone 7.5:Building Location-aware Applications
- Java程序設計教程
- 零基礎學SQL(升級版)
- 算法超簡單:趣味游戲帶你輕松入門與實踐
- Java程序設計教程