SCNVector3 QuaternionMultVector(SCNQuaternion rotation, SCNVector3 point)
{
float num = rotation.x * 2;
float num2 = rotation.y * 2;
float num3 = rotation.z * 2;
float num4 = rotation.x * num;
float num5 = rotation.y * num2;
float num6 = rotation.z * num3;
float num7 = rotation.x * num2;
float num8 = rotation.x * num3;
float num9 = rotation.y * num3;
float num10 = rotation.w * num;
float num11 = rotation.w * num2;
float num12 = rotation.w * num3;
SCNVector3 result;
result.x = (1 - (num5 + num6)) * point.x + (num7 - num12) * point.y + (num8 + num11) * point.z;
result.y = (num7 + num12) * point.x + (1 - (num4 + num6)) * point.y + (num9 - num10) * point.z;
result.z = (num8 - num11) * point.x + (num9 + num10) * point.y + (1 - (num4 + num5)) * point.z;
return result;
}
四元素与点的乘法-得到的是空间点做旋转后的点的坐标-AR开发常用
最新推荐文章于 2025-06-20 14:47:14 发布