内插弧度角? [英] Interpolating Radian Angles?

查看:89
本文介绍了内插弧度角?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果给定我的开始角度为1.0f,结束角度为6.0f,那么我真正想要插值的不是1到6之间的5,而是较小的部分.这将导致逆时针插值.插值时如何解释呢?

If I'm given a start angle of 1.0f, and an end angle of 6.0f, then what I really want to interpolate is not the 5 in between 1 and 6, but the smaller portion. This will cause counter clockwise interpolation. How can I account of this when interpolating?

本质上,当给定2个弧度角(从0到6.283)时,我如何知道应该基于哪个较短"进行顺时针或逆时针插值?

Essentially, when given 2 radian angles from 0 to 6.283, how can I know if I should interpolate clockwise or counter clockwise based on which would be "shorter"?

谢谢

推荐答案

获取目标角度减去起始角度.如果该值大于PI,则逆时针旋转.

Get the target angle minus starting angle. If that is greater than PI, go counterclockwise.

如果该值为负,则反转逻辑.

Invert the logic if the value is negative.

这篇关于内插弧度角?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆