- 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.
推薦閱讀
- Go Web編程
- Spring Cloud Alibaba核心技術(shù)與實(shí)戰(zhàn)案例
- Podman實(shí)戰(zhàn)
- Getting Started with Python Data Analysis
- Python漫游數(shù)學(xué)王國(guó):高等數(shù)學(xué)、線性代數(shù)、數(shù)理統(tǒng)計(jì)及運(yùn)籌學(xué)
- 深入淺出Serverless:技術(shù)原理與應(yīng)用實(shí)踐
- Android系統(tǒng)級(jí)深入開(kāi)發(fā)
- Kotlin編程實(shí)戰(zhàn):創(chuàng)建優(yōu)雅、富于表現(xiàn)力和高性能的JVM與Android應(yīng)用程序
- Test-Driven Machine Learning
- Learning Apache Cassandra
- Oracle GoldenGate 12c Implementer's Guide
- 一本書講透Java線程:原理與實(shí)踐
- Mastering Gephi Network Visualization
- C# 7.0本質(zhì)論
- 少年小魚的魔法之旅:神奇的Python