THREE.Euler()欧拉角
来源:互联网 发布:centos nat 配置 编辑:程序博客网 时间:2024/06/05 18:33
THREE.Euler
- 用法 THREE.Euler( a , b , c , ‘xyz’ );
表示将一个几何体绕x轴旋转a度,绕y轴旋转b度,绕z轴旋转c度;并且旋转的顺序是xyz ; 第三个参数旋转顺序可以是’XYZ’, ‘YZX’, ‘ZXY’, ‘XZY’, ‘YXZ’, ‘ZYX’
THREE.Euler = function ( x, y, z, order ) { this._x = x || 0; this._y = y || 0; this._z = z || 0; this._order = order || THREE.Euler.DefaultOrder;};
原型上的方法
set( x , y , z , order )
set: function ( x, y, z, order ) { this._x = x; this._y = y; this._z = z; this._order = order || this._order; this.onChangeCallback(); //调用回调函数. return this; //返回新的Euler(欧拉角)},
setFromRotationMatrix
setFromRotationMatrix: function ( m, order ) { var clamp = THREE.Math.clamp; //clamp用来设置数值的取值范围 // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) // 确保参数m是一个3x3的旋转矩阵. var te = m.elements; var m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ]; var m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ]; var m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ]; order = order || this._order; if ( order === 'XYZ' ) { this._y = Math.asin( clamp( m13, - 1, 1 ) ); if ( Math.abs( m13 ) < 0.99999 ) { this._x = Math.atan2( - m23, m33 ); this._z = Math.atan2( - m12, m11 ); } else { this._x = Math.atan2( m32, m22 ); this._z = 0; } } else if ( order === 'YXZ' ) { this._x = Math.asin( - clamp( m23, - 1, 1 ) ); if ( Math.abs( m23 ) < 0.99999 ) { this._y = Math.atan2( m13, m33 ); this._z = Math.atan2( m21, m22 ); } else { this._y = Math.atan2( - m31, m11 ); this._z = 0; } } else if ( order === 'ZXY' ) { this._x = Math.asin( clamp( m32, - 1, 1 ) ); if ( Math.abs( m32 ) < 0.99999 ) { this._y = Math.atan2( - m31, m33 ); this._z = Math.atan2( - m12, m22 ); } else { this._y = 0; this._z = Math.atan2( m21, m11 ); } } else if ( order === 'ZYX' ) { this._y = Math.asin( - clamp( m31, - 1, 1 ) ); if ( Math.abs( m31 ) < 0.99999 ) { this._x = Math.atan2( m32, m33 ); this._z = Math.atan2( m21, m11 ); } else { this._x = 0; this._z = Math.atan2( - m12, m22 ); } } else if ( order === 'YZX' ) { this._z = Math.asin( clamp( m21, - 1, 1 ) ); if ( Math.abs( m21 ) < 0.99999 ) { this._x = Math.atan2( - m23, m22 ); this._y = Math.atan2( - m31, m11 ); } else { this._x = 0; this._y = Math.atan2( m13, m33 ); } } else if ( order === 'XZY' ) { this._z = Math.asin( - clamp( m12, - 1, 1 ) ); if ( Math.abs( m12 ) < 0.99999 ) { this._x = Math.atan2( m32, m22 ); this._y = Math.atan2( m13, m11 ); } else { this._x = Math.atan2( - m23, m33 ); this._y = 0; } } else { console.warn( 'THREE.Euler: .setFromRotationMatrix() given unsupported order: ' + order ) //通过按照以上几种旋转顺序设置欧拉角对象失败报错 } this._order = order; //重新设置旋转顺序 this.onChangeCallback(); //调用回调函数. return this; //返回新的Euler(欧拉角)},
阅读全文
0 0
- THREE.Euler()欧拉角
- three.js 源码注释(七)Math/Euler.js
- Project Euler:Problem 82 Path sum: three ways
- 欧拉角(Euler angles)
- 欧拉角(Euler Angles)
- 欧拉角(Euler angles)
- Euler
- Three
- three
- three
- three
- 关于Euler angles(欧拉角)的问题
- Project Euler
- project euler
- euler测试
- Euler 1
- Euler 2
- Euler 25
- Visual studio 2017 Community 安装 for MFC桌面应用程序
- 二叉树遍历算法(递归实现先序中序和后续遍历)(非递归实现中序和先续)
- iOS学习笔记-126.SDWebImage2——显示gif图片
- 一个员工都不想招,我还能创业成功吗?
- 数据库的脏读、不可重复读、幻读以及不可重复读和幻读的区别
- THREE.Euler()欧拉角
- 九度[1042]-Coincidence
- DL&ML基础学习一
- [codeforces] 854C. Planning(优先队列)
- 使用python操作mysql数据库
- 机器学习简介 | GAIR大讲堂
- 笔记7 | 淡入淡出动画TransitionDrawable
- CSS垂直水平居中8种方法
- web应用国际化