惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
P
Palo Alto Networks Blog
月光博客
月光博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
InfoQ
aimingoo的专栏
aimingoo的专栏
腾讯CDC
T
Threatpost
D
DataBreaches.Net
Vercel News
Vercel News
F
Fortinet All Blogs
Engineering at Meta
Engineering at Meta
C
Cybersecurity and Infrastructure Security Agency CISA
Forbes - Security
Forbes - Security
U
Unit 42
C
Check Point Blog
Blog — PlanetScale
Blog — PlanetScale
O
OpenAI News
量子位
TaoSecurity Blog
TaoSecurity Blog
Microsoft Azure Blog
Microsoft Azure Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Visual Studio Blog
Recorded Future
Recorded Future
云风的 BLOG
云风的 BLOG
Security Archives - TechRepublic
Security Archives - TechRepublic
The Last Watchdog
The Last Watchdog
S
Security Affairs
Attack and Defense Labs
Attack and Defense Labs
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
Microsoft Security Blog
Microsoft Security Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
小众软件
小众软件
S
SegmentFault 最新的问题
www.infosecurity-magazine.com
www.infosecurity-magazine.com
W
WeLiveSecurity
AI
AI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 聂微东
I
Intezer
Know Your Adversary
Know Your Adversary
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
博客园_首页
NISL@THU
NISL@THU
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

博客园 - Anders06

A memory leak issue with WPF Command Binding 我也谈面试 附赠一份题目 败给了IEqualityComparer How to detect memory leak issue 图纸中角度标注算法 认真的程序员最可爱 Clean Code反案例:什么是不好的API 避免陷阱,重写Equals方法您需要注意的其中2个原则 What’s the problems with the following code 对象池 关于设计和设计文档的2个补充 SelectMany ConverAll & Exists SOS:利用WPF RichTextBox 提取RTF, 莫名丢掉了Underline样式信息 想探讨两个关于设计文档问题 Don‘t Cry for Me, Argentina 拒绝高姿态 Please avoid implement C# Destruction SOS: How to popup a HwndSource on topmost
标注随测量物体旋转问题
Anders06 · 2010-11-20 · via 博客园 - Anders06

假设我们对如下Block中的红色线段做了标注,那么这个标注的两个锚点(Anchor Point)分别为红色线段的2个端点

image

当我们旋转这个Block后,我们自然希望这个标注也跟着物体旋转的,调整到如下合理的位置,  

image

现在的问题是如何为这个标注求得变换矩阵。

一开始我以为只要根据红色初始位置,跟终止位置,求得它的变换矩阵,再作用到标注上就可以了。 但是结果下来,发现自己想简单了。在上面第二张图中,用户可以继续绕着红色线段,旋转Block,比如得到下面的形状:

image

我们发现实际上第二张图跟第三张图中红色线段对应的向量是一样的,那么计算出来的变换矩阵肯定跟第二张图一样,得到的一定是下面这个错误的结果:

image

正确的结果应该如下:

image

这个问题的本质原因在于: 一条直线不能决定平面。 那么2点不能决定平面,三点总归可以了吧。关键问题就是第三个点怎么选取。这个第三个点必须相对红色线段是稳定的,那么当Block旋转后,我们依然能够找回来。于是想到了求这个Block的中心点,而后构建一个平面,根据这个平面前后位置,求得变化矩阵,问题就得以解决了。

imageimage

原始矩阵:

Vector3d vecX =  (p2 - p1).Normal();
Vector3d refVec = (centerPoint - p1).Mormal();
Vector3d vecZ = vecX.CrossProduct(refVec);
Vector3d vecY = vecX.CrossProduct(vecZ);
Matrix3d m0 = new Matrix3d();
m0.SetCoordinateSystem(p1, vecX, vecY, vecZ); // orignal transform

新的矩阵:

Vector3d vecX' = (p2' - p1').Normal();
Vector3d refVec' = (centerPoint' - p1').Mormal();
Vector3d vecZ' = vecX'.CrossProduct(refVec');
Vector3d vecY' = vecX'.CrossProduct(vecZ');
Matrix3d m1 = new Matrix3d();
m1.SetCoordinateSystem(p1', vecX', vecY', vecZ'); // new transform

变换矩阵:

Matrix3d transform = m1 * (m0.Invert());