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

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.

主站蜘蛛池模板: 涞源县| 富平县| 昌黎县| 正安县| 溧水县| 多伦县| 霍林郭勒市| 沾化县| 肇庆市| 垦利县| 民权县| 五原县| 济阳县| 张家港市| 驻马店市| 平塘县| 新昌县| 桓仁| 余姚市| 兰州市| 紫云| 阿瓦提县| 彭州市| 饶河县| 凤冈县| 玉山县| 洪江市| 敦煌市| 蒙阴县| 宿松县| 罗江县| 闵行区| 双辽市| 和顺县| 梁河县| 井陉县| 上林县| 雅江县| 营山县| 法库县| 宜宾县|