当前位置:网站首页>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; //弧度角
边栏推荐
- Dos et détails de la méthode d'attaque
- [uniapp] the uniapp mobile terminal uses uni Troubleshooting of navigateback failure
- Which securities company is better for a novice to open a stock trading account? How is it safer to speculate in stocks??
- 你了解如何比较两个对象吗
- Map和List<Map>转相应的对象
- Digital signature standard (DSS)
- How about opening an account at Guojin securities? Is it safe?
- JVM entry Door (1)
- VCD-影音光碟
- Connected to surface test questions
猜你喜欢

非对称密码体制详解

Detailed explanation of asymmetric cryptosystem

深入理解MySQL锁与事务隔离级别
![[buuctf.reverse] 126-130](/img/df/e35633d85caeff1dece62a66cb7804.png)
[buuctf.reverse] 126-130

(必须掌握的多线程知识点)认识线程,创建线程,使用Thread的常见方法及属性,以及线程的状态和状态转移的意义

wechat_微信小程序中解决navigator进行页面跳转并传递参数问题
![[code Capriccio - dynamic planning] t583. Deleting two strings](/img/01/fd9ff51ea1d70188e372e925d8a1c7.png)
[code Capriccio - dynamic planning] t583. Deleting two strings

Get and set settings in 26class

Bayesian network explanation

数字签名标准(DSS)
随机推荐
#25class的类继承
Map and list < map > transfer to corresponding objects
js强制转换
Bayesian network explanation
17.13 补充知识、线程池浅谈、数量谈、总结
How pycharm modifies multiline annotation shortcuts
MySQL download and configuration MySQL remote control
Ethereum技术架构介绍
VCD-影音光碟
正则匹配相同字符
Hello, is it safe to open an online stock account and buy stocks now?
让torch.cuda.is_available()从false变成true的一点经验
股票开账户如何优惠开户?现在在线开户安全么?
How about opening a flush account? Is it safe? How to open a stock trading account
JS cast
pycharm如何修改多行注释快捷键
Detailed explanation of asymmetric cryptosystem
QPushButton 样式使用示例(以及按钮setmenu添加下拉菜单的方法)
GDB installation
DVD-数字通用光盘