- 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.
推薦閱讀
- JavaScript全程指南
- Python 3.7網絡爬蟲快速入門
- Swift 3 New Features
- C語言程序設計
- Python數據可視化之Matplotlib與Pyecharts實戰
- 基于Swift語言的iOS App 商業實戰教程
- Java語言程序設計教程
- QGIS 2 Cookbook
- Java 9 Programming By Example
- Delphi開發典型模塊大全(修訂版)
- 深入淺出Python數據分析
- HTML5移動前端開發基礎與實戰(微課版)
- Learning C++ by Creating Games with UE4
- Building Apple Watch Projects
- Managing Windows Servers with Chef