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

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).

主站蜘蛛池模板: 绥滨县| 顺昌县| 江油市| 吕梁市| 阳信县| 岳阳县| 泰顺县| 南京市| 武安市| 正蓝旗| 桂阳县| 茶陵县| 东港市| 津南区| 凤庆县| 西峡县| 和林格尔县| 沽源县| 汉川市| 宁河县| 龙南县| 甘泉县| 尚志市| 岑巩县| 长岭县| 博罗县| 武汉市| 北碚区| 特克斯县| 班玛县| 磐安县| 贵州省| 张北县| 长海县| 调兵山市| 化州市| 广东省| 师宗县| 深圳市| 长岛县| 光山县|