GLSL ROTATION ABOUT AN ARBITRARY AXIS
来源:互联网 发布:撒贝宁智商知乎 编辑:程序博客网 时间:2024/06/09 19:52
mat4 rotationMatrix(vec3 axis, float angle){
axis = normalize(axis);
float s = sin(angle);
float c = cos(angle);
float oc = 1.0 - c;
return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
0.0, 0.0, 0.0, 1.0);
axis = normalize(axis);
float s = sin(angle);
float c = cos(angle);
float oc = 1.0 - c;
return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
0.0, 0.0, 0.0, 1.0);
}
mat4 rotationMatrix(vec3 axis, float angle) {vec3 a = normalize(axis);float s = sin(angle);float c = cos(angle);float oc = 1.0 – c;float sx = s * a.x;float sy = s * a.y;float sz = s * a.z;float ocx = oc * a.x;float ocy = oc * a.y;float ocz = oc * a.z;float ocxx = ocx * a.x;float ocxy = ocx * a.y;float ocxz = ocx * a.z;float ocyy = ocy * a.y;float ocyz = ocy * a.z;float oczz = ocz * a.z;return mat4(vec4(ocxx + c, ocxy – sz, ocxz + sy, 0.0),vec4(ocxy + sz, ocyy + c, ocyz – sx, 0.0),vec4(ocxz – sy, ocyz + sx, oczz + c, 0.0),vec4( 0.0, 0.0, 0.0, 1.0));}
0 0
- GLSL ROTATION ABOUT AN ARBITRARY AXIS
- Interactive Computer Graphics :3.10.4 Rotation About an Arbitrary Axis 绕任意轴旋转
- Mathematics for 3D Game Programming and Computer Graphics - Rotation Transforms About Arbitrary Axis
- 任意轴算法 Arbitrary Axis Algorithm
- 【论文笔记】 Arbitrary-Oriented Scene Text Detection via Rotation Proposals
- 论文笔记-Arbitrary-Oriented Scene Text Detection via Rotation Proposals
- [论文笔记]Arbitrary-Oriented Scene Text Detection via Rotation Proposals
- Redirecting an arbitrary Console's Input/Output
- OPENCL ROTATION x y z axis
- How do I design an arbitrary system in an interview?
- how to enumerate subkey names under an arbitrary key
- Computing Tangent Space Basis Vectors for an Arbitrary Mesh
- Computing Tangent Space Basis Vectors for an Arbitrary Mesh
- rounding to an arbitrary number of significant digits
- SUNDIALS-CLN:An Arbitrary Precision Extension of the CVODE Library
- SUNDIALS-CLN:An Arbitrary Precision Extension of the CVODE Library
- An usage about "equals ()"
- An problem about date
- 仿iphone原生短信滑动时惯性效果
- 背包问题(01背包,完全背包,多重背包)
- Android View基础知识
- Java中的读/写锁
- N阶楼梯上楼问题
- GLSL ROTATION ABOUT AN ARBITRARY AXIS
- 【干货】一键压缩Android项目中png的大小!
- Docker学习(一)简介
- C/C++常用头文件及函数汇总
- Android 可拖拽悬浮按钮
- 微信小程序的逻辑层
- Redis集群的搭建
- 005-搭建私有仓库,上传镜像报错:server gave HTTP response to HTTPS client
- android 中的每日构造 ——android stuido 中的build.gradle示例