当前位置:网站首页>Eigen库计算两个向量夹角
Eigen库计算两个向量夹角
2022-06-26 18:07:00 【Maccy37】
一、一点到原点的距离,pt(x,y)
Vector2f v1(x,y);
float res1= v1.norm(); // 等于 sqrt(x^2+y^2) , 即距离
float res2 = v1.squaredNorm(); // (x^2+y^2)二、两个点之间的距离
CPoint pt1(10, 10), pt2(5, 5);
Vector2f v4(pt1.x, pt1.y), v5(pt2.x, pt2.y);
float len = (v4 - v5).norm();三、两个向量之间的夹角
Vector2f v1,Vector2f v2;
double cosValNew=v1.dot(v2) /(v1.norm()*v2.norm()); //角度cos值
double angleNew = acos(cosValNew) * 180 / M_PI; //弧度角
边栏推荐
- JVM entry Door (1)
- (必须掌握的多线程知识点)认识线程,创建线程,使用Thread的常见方法及属性,以及线程的状态和状态转移的意义
- Prometeus 2.34.0 new features
- JVM入个门(1)
- Regular match same character
- Static registration and dynamic registration of JNI
- [dynamic planning] Jianzhi offer II 091 Paint the house
- JNI的 静态注册与动态注册
- How to add an application to the deviceidle whitelist?
- [code Capriccio - dynamic planning] t583. Deleting two strings
猜你喜欢

深入理解MySQL锁与事务隔离级别

Let torch cuda. is_ Experience of available() changing from false to true

Concept and working principle of data encryption standard (DES)

Lm06 the mystery of constructing the bottom and top trading strategy only by trading volume

博云,站在中国容器潮头

二分查找法-1

pycharm如何修改多行注释快捷键
![[buuctf.reverse] 126-130](/img/df/e35633d85caeff1dece62a66cb7804.png)
[buuctf.reverse] 126-130

wechat_微信小程序中解决navigator进行页面跳转并传递参数问题
![[buuctf.reverse] 126-130](/img/df/e35633d85caeff1dece62a66cb7804.png)
[buuctf.reverse] 126-130
随机推荐
利用递归实现求n位所有格雷码
JS 常用正则表达式
Get and set settings in 26class
Map and list < map > transfer to corresponding objects
Data Encryption Standard DES security
[buuctf.reverse] 126-130
数字签名标准(DSS)
LM06丨仅用成交量构造抄底摸顶策略的奥秘
Binary search-2
Leetcode - 226. Retourner l'arbre binaire (bfs)
How about opening an account at Guojin securities? Is it safe?
Map and filter methods for processing scarce arrays
[dynamic planning] Jianzhi offer II 091 Paint the house
小程序设置按钮分享功能
Class inheritance of 25class
How sparksql returns a specific day of the week by date -dayofweek function
Deep understanding of MySQL lock and transaction isolation level
[code Capriccio - dynamic planning] t583. Deleting two strings
[uniapp] the uniapp mobile terminal uses uni Troubleshooting of navigateback failure
sqlite数据库的系统表sqlite_master