|
@@ -8,6 +8,7 @@ import {
|
|
|
} from '../../../../src/core/BufferAttribute';
|
|
|
import { Vector3 } from '../../../../src/math/Vector3';
|
|
|
import { Matrix4 } from '../../../../src/math/Matrix4';
|
|
|
+import { Quaternion } from '../../../../src/math/Quaternion';
|
|
|
import { Sphere } from '../../../../src/math/Sphere';
|
|
|
import {
|
|
|
x,
|
|
@@ -212,6 +213,21 @@ export default QUnit.module( 'Core', () => {
|
|
|
|
|
|
} );
|
|
|
|
|
|
+ QUnit.test( "applyQuaternion", ( assert ) => {
|
|
|
+
|
|
|
+ var geometry = new BufferGeometry();
|
|
|
+ geometry.setAttribute( "position", new BufferAttribute( new Float32Array( [ 1, 2, 3, 4, 5, 6 ] ), 3 ) );
|
|
|
+
|
|
|
+ var q = new Quaternion( 0.5, 0.5, 0.5, 0.5 );
|
|
|
+ geometry.applyQuaternion( q );
|
|
|
+
|
|
|
+ var pos = geometry.attributes.position.array;
|
|
|
+
|
|
|
+ // geometry was rotated around the (1, 1, 1) axis.
|
|
|
+ assert.ok( pos[ 0 ] === 3 && pos[ 1 ] === 1 && pos[ 2 ] === 2 &&
|
|
|
+ pos[ 3 ] === 6 && pos[ 4 ] === 4 && pos[ 5 ] === 5, "vertices were rotated properly" );
|
|
|
+ } );
|
|
|
+
|
|
|
QUnit.test( "rotateX/Y/Z", ( assert ) => {
|
|
|
|
|
|
var geometry = new BufferGeometry();
|