简体   繁体   English

在C#中标准化角度和长度

[英]Normalize angle and length in c#

Does anyone know how to normalize angle to [0,360] and length to [0,1] in c#. 有谁知道如何在c#中将角度归一化为[0,360],将长度归一化为[0,1]。

please refer the link below, I'm trying to implement the second step in the answer. 请参考下面的链接,我正在尝试实施答案中的第二步。

how should I use the velX,velY information to get the displacement in X and Y between current frame and previous frame? 我应该如何使用velX,velY信息获取当前帧和前一帧在X和Y中的位移?

 angle1 = Math.Atan2(h.Intensity, g.Intensity);
 if(angle1 < 0)
 {
       angle1 += 2 * Math.PI;
 }

Is this the right way, Any suggestions please? 这是正确的方法吗,有什么建议吗? Can i use Math.round function instead? 我可以改用Math.round函数吗?

It seems you want to do this: 看来您想这样做:

displacement = velocity * timestep

If you have 60Hz video, for example, then timestep is 1/60 . 例如,如果您有60Hz的视频,那么timestep就是1/60

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM