官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 岢岚县| 石景山区| 南丰县| 榆中县| 岗巴县| 芒康县| 滕州市| 吕梁市| 毕节市| 罗定市| 嵊州市| 东方市| 漳浦县| 精河县| 上高县| 揭东县| 油尖旺区| 邵阳市| 三都| 茂名市| 汽车| 响水县| 菏泽市| 老河口市| 仁化县| 新宁县| 土默特左旗| 普宁市| 绥阳县| 祥云县| 沅陵县| 高青县| 婺源县| 巴彦县| 紫云| 鹤峰县| 甘南县| 清徐县| 印江| 华坪县| 铜陵市|