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

Vec object type

Vec is a template class mainly for numerical vectors. We can define any type of vector and the number of components:

Vec<double,19> myVector; 

We can also use any of the predefined types:

 

typedef Vec<uchar, 2> Vec2b; 
typedef Vec<uchar, 3> Vec3b; 
typedef Vec<uchar, 4> Vec4b; 
 
typedef Vec<short, 2> Vec2s; 
typedef Vec<short, 3> Vec3s; 
typedef Vec<short, 4> Vec4s; 
 
typedef Vec<int, 2> Vec2i; 
typedef Vec<int, 3> Vec3i; 
typedef Vec<int, 4> Vec4i; 
 
typedef Vec<float, 2> Vec2f; 
typedef Vec<float, 3> Vec3f; 
typedef Vec<float, 4> Vec4f; 
typedef Vec<float, 6> Vec6f; 
 
typedef Vec<double, 2> Vec2d; 
typedef Vec<double, 3> Vec3d; 
typedef Vec<double, 4> Vec4d; 
typedef Vec<double, 6> Vec6d; 
 
All the following vector operations are also implemented:
v1 = v2 + v3
v1 = v2 - v3
v1 = v2 * scale
v1 = scale * v2
v1 = -v2
v1 += v2  

 

Other augmenting operations implemented are the following:
v1 == v2, v1 != v2
norm(v1) (euclidean norm).

主站蜘蛛池模板: 麟游县| 延长县| 毕节市| 屯昌县| 特克斯县| 吴川市| 化德县| 诏安县| 浏阳市| 新安县| 嘉鱼县| 仪征市| 岳普湖县| 屯留县| 新营市| 武清区| 甘南县| 买车| 济南市| 贵德县| 九台市| 大渡口区| 家居| 府谷县| 金沙县| 麻江县| 遂溪县| 平原县| 萨嘎县| 文水县| 苏尼特右旗| 绍兴市| 阿克| 铜梁县| 横峰县| 星座| 宁夏| 湘乡市| 扎赉特旗| 威信县| 嘉义县|