Hope is a Dream. Dream is a Hope.

非公開ブログは再開しました。

THREE.jsでベクトルのオイラー角を求めるなら。

演算の都合上、二つのベクトルのオイラー角を求めないといけない。

Euler

Euler Angles.

Example

var a = new THREE.Euler( 0, 1, 1.57, 'XYZ' );
    var b = new THREE.Vector3( 1, 0, 1 );
    b.applyEuler(a);

Constructor

Euler( x, y, z, order )

x -- Float the angle of the x axis in radians
y -- Float the angle of the y axis in radians
z -- Float the angle of the z axis in radians
order -- String A string representing the order that the rotations are applied, defaults to 'XYZ' (must be upper case).
A euler angle for transforming

Properties

.x
.y
.z
.order

Methods.

回転行列からオイラー角を求める。(っぽい)

.setFromRotationMatrix( m, order ) this
/*
m -- Matrix4 assumes upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled)  
order -- string Order of axes, defaults to 'XYZ' (must be upper case)  
Sets the angles of this euler transform from a pure rotation matrix based on the orientation specified by order.  
*/

その他

.set( x, y, z, order ) this
.copy( euler ) this
.setFromRotationMatrix( m, order ) this
.setFromQuaternion( q, order ) this
.reorder( newOrder ) this
.fromArray(array) this
.toArray() Array
.equals( euler ) Boolean
.clone() Euler

Eulerオブジェクトでは、二つのベクトルからオイラー角を求めることはできない。

Matrix4

A 4x4 Matrix.

Example

// Simple rig for rotating around 3 axes

var m = new THREE.Matrix4();

var m1 = new THREE.Matrix4();
var m2 = new THREE.Matrix4();
var m3 = new THREE.Matrix4();

var alpha = 0;
var beta = Math.PI;
var gamma = Math.PI/2;

m1.makeRotationX( alpha );
m2.makeRotationY( beta );
m3.makeRotationZ( gamma );

m.multiplyMatrices( m1, m2 );
m.multiply( m3 );

Constructor

Matrix4( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 )

/*
Initialises the matrix with the supplied row-major values n11..n44, or just creates an identity matrix if no values are passed.
*/

Properties

.elements

Methods

回転行列に関連しそうなの

.makeRotationFromEuler(v, order) this
.makeRotationX( theta ) this
.makeRotationY( theta ) this
.makeRotationZ( theta ) this
.makeRotationAxis( axis, theta ) this
.makeScale( x, y, z ) this
.set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) this
.identity() this
.copy( m ) this
.copyPosition( m ) this
.extractRotation( m ) this
.lookAt( eye, center, up, ) this
.multiply( m ) this
.multiplyMatrices( a, b ) this
.multiplyToArray( a, b, r ) this
.multiplyScalar( s ) this
.determinant() Float
.transpose() this
.flattenToArrayOffset( flat, offset ) Array
.setPosition( v ) this
.getInverse( m ) this
.makeRotationFromEuler( v, order ) this
.makeRotationFromQuaternion( q ) this
.scale( v ) this
.compose( translation, quaternion, scale ) this
.decompose( translation, quaternion, scale ) Array
.makeTranslation( x, y, z ) this
.makeRotationX( theta ) this
.makeRotationY( theta ) this
.makeRotationZ( theta ) this
.makeRotationAxis( axis, theta ) this
.makeScale( x, y, z ) this
.makeFrustum( left, right, bottom, top, near, far ) this
.makePerspective( fov, aspect, near, far ) this
.makeOrthographic( left, right, bottom, top, near, far ) this
.clone() Matrix4
.applyToVector3Array(a) Array
.getMaxScaleOnAxis() Float