2021年小结

整理2021年发过的文章

前言

这是白玉无冰第三篇年度合集文章整理。

2020年一共发布了47篇原创内容,2021年一共发布了16篇原创内容,同比负增长65.96%。总得来说,从每1.1周一更进步到每3.3周一更

争取在2022年有新的进步!

开始

按时间顺序梳理,随白玉无冰一起遨游2021吧!

四元数与3D旋转实例

用几个实用的例子去理解四元数。

当时发这篇文章的时候,四元数的单词拼错了,正确的应该是 Quaternion

有时候,白玉无冰也会忘了怎么使用四元数,经常翻这篇文章回忆。

73fc87c79a9dcf5f73a0e3a0f8b9597a.gif

其中,绕指定轴旋转四元数要特别注意是本地空间(局部坐标)的轴,还是世界空间下轴。

/**
  * @en Sets the out quaternion to represent a radian rotation around a given rotation axis in world space
  * @zh 绕世界空间下指定轴旋转四元数
  * @param axis axis of rotation, normalized by default
  * @param rad radius of rotation
  */
public static rotateAround<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, rot: Out, axis: VecLike, rad: number) {
    // get inv-axis (local to rot)
    Quat.invert(qt_1, rot);
    Vec3.transformQuat(v3_1, axis, qt_1);
    // rotate by inv-axis
    Quat.fromAxisAngle(qt_1, v3_1, rad);
    Quat.multiply(out, rot, qt_1);
    return out;
}

/**
  * @en Sets the out quaternion to represent a radian rotation around a given rotation axis in local space
  * @zh 绕本地空间下指定轴旋转四元数
  * @param axis axis of rotation
  * @param rad radius of rotation
  */
public static rotateAroundLocal<Out extends IQuatLike, VecLike extends IVec3Like&g
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值