当前位置:网站首页>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; //弧度角
边栏推荐
- 【NPOI】C#跨工作薄复制Sheet模板导出Excel
- Let torch cuda. is_ Experience of available() changing from false to true
- MySQL download and configuration MySQL remote control
- 请指教同花顺开户选选择哪家券商比较好?现在在线开户安全么?
- 刻录光盘的程序步骤
- VCD video disc
- tag动态规划-刷题预备知识-2. 0-1背包理论基础和二维数组解法模板
- RSA encryption and decryption details
- Analysis of deep security definition and encryption technology
- Ethereum技术架构介绍
猜你喜欢
Lm06 the mystery of constructing the bottom and top trading strategy only by trading volume
Applet setting button sharing function
Let torch cuda. is_ Experience of available() changing from false to true
Leetcode - 226. Retourner l'arbre binaire (bfs)
The king of Internet of things protocol: mqtt
The difference between round and truncate in SQL (round or truncate)
next(iter(dataloader))的一点点体会
行锁与隔离级别案例分析
[code Capriccio - dynamic planning] t583. Deleting two strings
Preparing for the Blue Bridge Cup and ccf-csp
随机推荐
深入理解MySQL锁与事务隔离级别
Detailed explanation of asymmetric cryptosystem
Padding percentage operation
Lm06 the mystery of constructing the bottom and top trading strategy only by trading volume
Introduction to Ethereum Technology Architecture
数据加密标准(DES)概念及工作原理
数字签名标准(DSS)
行锁与隔离级别案例分析
How about opening an account at Guojin securities? Is it safe to open an account?
Data Encryption Standard DES security
DoS及攻击方法详解
MySQL的MVCC机制详解
必须要掌握的面试重点——索引和事务(附讲B-树与B+树)
Rich professional product lines, and Jiangling Ford Lingrui · Jijing version is listed
正则匹配相同字符
[dynamic planning] Jianzhi offer II 091 Paint the house
输入n个整数,输出出现次数大于等于数组长度一半的数
gdb安装
Let torch cuda. is_ Experience of available() changing from false to true
股票开账户如何优惠开户?现在在线开户安全么?