浏览代码

Added .setFromMatrix3Column()

WestLangley 5 年之前
父节点
当前提交
1fa508d0f9
共有 3 个文件被更改,包括 13 次插入2 次删除
  1. 6 2
      docs/api/en/math/Vector3.html
  2. 1 0
      src/math/Vector3.d.ts
  3. 6 0
      src/math/Vector3.js

+ 6 - 2
docs/api/en/math/Vector3.html

@@ -358,8 +358,12 @@ var d = a.distanceTo( b );
 
 		<h3>[method:this setFromMatrixColumn]( [param:Matrix4 matrix], [param:Integer index] )</h3>
 		<p>
-		Sets this vector's [page:.x x], [page:.y y] and [page:.z z] equal to the column of
-		the [page:Matrix4 matrix] specified by the [page:Integer index].
+		Sets this vector's [page:.x x], [page:.y y] and [page:.z z] components from [page:Integer index] column of [page:Matrix4 matrix].
+		</p>
+
+		<h3>[method:this setFromMatrix3Column]( [param:Matrix3 matrix], [param:Integer index] )</h3>
+		<p>
+		Sets this vector's [page:.x x], [page:.y y] and [page:.z z] components from [page:Integer index] column of [page:Matrix3 matrix].
 		</p>
 
 		<h3>[method:this setFromMatrixPosition]( [param:Matrix4 m] )</h3>

+ 1 - 0
src/math/Vector3.d.ts

@@ -244,6 +244,7 @@ export class Vector3 implements Vector {
 	setFromMatrixPosition( m: Matrix4 ): this;
 	setFromMatrixScale( m: Matrix4 ): this;
 	setFromMatrixColumn( matrix: Matrix4, index: number ): this;
+	setFromMatrix3Column( matrix: Matrix3, index: number ): this;
 
 	/**
 	 * Checks for strict equality of this vector and v.

+ 6 - 0
src/math/Vector3.js

@@ -659,6 +659,12 @@ Object.assign( Vector3.prototype, {
 
 	},
 
+	setFromMatrix3Column: function ( m, index ) {
+
+		return this.fromArray( m.elements, index * 3 );
+
+	},
+
 	equals: function ( v ) {
 
 		return ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );