|
@@ -8,36 +8,36 @@
|
|
|
<link type="text/css" rel="stylesheet" href="page.css" />
|
|
|
</head>
|
|
|
<body>
|
|
|
- <h1>[name]</h1>
|
|
|
+ <h1>三维向量([name])</h1>
|
|
|
|
|
|
- <p class="desc">Class representing a 3D [link:https://en.wikipedia.org/wiki/Vector_space vector].
|
|
|
+ <p class="desc">该类表示的是一个三维向量(3D [link:https://en.wikipedia.org/wiki/Vector_space vector])。
|
|
|
|
|
|
- A 3D vector is an ordered triplet of numbers (labeled x, y, and z), which can be used to
|
|
|
- represent a number of things, such as:
|
|
|
+ 一个三维向量表示的是一个有顺序的、三个为一组的数字组合(标记为x、y和z),
|
|
|
+ 可被用来表示很多事物,例如:
|
|
|
+
|
|
|
</p>
|
|
|
|
|
|
<ul>
|
|
|
<li>
|
|
|
- A point in 3D space.
|
|
|
+ 一个位于三维空间中的点。
|
|
|
</li>
|
|
|
<li>
|
|
|
- A direction and length in 3D space. In three.js the length will always be the
|
|
|
- [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean distance]
|
|
|
- (straight-line distance) from (0, 0, 0) to (x, y, z) and the direction is also
|
|
|
- measured from (0, 0, 0) towards (x, y, z).
|
|
|
+ 一个在三维空间中的方向与长度的定义。在three.js中,长度总是从(0, 0, 0)到(x, y, z)的
|
|
|
+ [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean distance](欧几里德距离,即直线距离),
|
|
|
+ 方向也是从(0, 0, 0)到(x, y, z)的方向。
|
|
|
</li>
|
|
|
<li>
|
|
|
- Any arbitrary ordered triplet of numbers.
|
|
|
+ 任意的、有顺序的、三个为一组的数字组合。
|
|
|
</li>
|
|
|
</ul>
|
|
|
|
|
|
<p>
|
|
|
- There are other things a 3D vector can be used to represent, such as momentum
|
|
|
- vectors and so on, however these are the most common uses in three.js.
|
|
|
+ 其他的一些事物也可以使用二维向量进行表示,比如说动量矢量等等;
|
|
|
+ 但以上这些是它在three.js中的常用用途。
|
|
|
</p>
|
|
|
|
|
|
|
|
|
- <h2>Example</h2>
|
|
|
+ <h2>示例</h2>
|
|
|
|
|
|
<code>
|
|
|
var a = new THREE.Vector3( 0, 1, 0 );
|
|
@@ -49,25 +49,25 @@ var d = a.distanceTo( b );
|
|
|
</code>
|
|
|
|
|
|
|
|
|
- <h2>Constructor</h2>
|
|
|
+ <h2>构造函数</h2>
|
|
|
|
|
|
<h3>[name]( [param:Float x], [param:Float y], [param:Float z] )</h3>
|
|
|
<p>
|
|
|
- [page:Float x] - the x value of the vector. Default is *0*.<br />
|
|
|
- [page:Float y] - the y value of the vector. Default is *0*.<br />
|
|
|
- [page:Float z] - the z value of the vector. Default is *0*.<br /><br />
|
|
|
+ [page:Float x] - 向量的x值,默认为*0*。<br />
|
|
|
+ [page:Float y] - 向量的y值,默认为*0*。<br />
|
|
|
+ [page:Float z] - 向量的z值,默认为*0*。<br /><br />
|
|
|
|
|
|
- Creates a new [name].
|
|
|
+ 创建一个新的[name]。
|
|
|
</p>
|
|
|
|
|
|
|
|
|
- <h2>Properties</h2>
|
|
|
+ <h2>属性</h2>
|
|
|
|
|
|
<h3>[property:Boolean isVector3]</h3>
|
|
|
<p>
|
|
|
- Used to check whether this or derived classes are Vector3s. Default is *true*.<br /><br />
|
|
|
+ 用于测试这个类或者派生类是否为Vector3,默认为*true*。<br /><br />
|
|
|
|
|
|
- You should not change this, as it is used internally for optimisation.
|
|
|
+ 你不应当对这个属性进行改变,因为它在内部使用,以用于优化。
|
|
|
</p>
|
|
|
|
|
|
<h3>[property:Float x]</h3>
|
|
@@ -77,239 +77,239 @@ var d = a.distanceTo( b );
|
|
|
<h3>[property:Float z]</h3>
|
|
|
|
|
|
|
|
|
- <h2>Methods</h2>
|
|
|
+ <h2>方法</h2>
|
|
|
|
|
|
<h3>[method:this add]( [param:Vector3 v] )</h3>
|
|
|
- <p>Adds [page:Vector3 v] to this vector.</p>
|
|
|
+ <p>将传入的向量[page:Vector3 v]和这个向量相加。</p>
|
|
|
|
|
|
<h3>[method:this addScalar]( [param:Float s] )</h3>
|
|
|
- <p>Adds the scalar value s to this vector's [page:.x x], [page:.y y] and [page:.z z] values.</p>
|
|
|
+ <p>将传入的标量s和这个向量的[page:.x x]值、[page:.y y]值以及[page:.z z]值相加。</p>
|
|
|
|
|
|
<h3>[method:this addScaledVector]( [param:Vector3 v], [param:Float s] )</h3>
|
|
|
- <p>Adds the multiple of [page:Vector3 v] and [page:Float s] to this vector.</p>
|
|
|
+ <p>将所传入的[page:Vector3 v]与[page:Float s]相乘所得的乘积和这个向量相加。</p>
|
|
|
|
|
|
<h3>[method:this addVectors]( [param:Vector3 a], [param:Vector3 b] )</h3>
|
|
|
- <p>Sets this vector to [page:Vector3 a] + [page:Vector3 b].</p>
|
|
|
+ <p>将该向量设置为[page:Vector3 a] + [page:Vector3 b]。</p>
|
|
|
|
|
|
<h3>[method:this applyAxisAngle]( [param:Vector3 axis], [param:Float angle] )</h3>
|
|
|
<p>
|
|
|
- [page:Vector3 axis] - A normalized [page:Vector3].<br />
|
|
|
- [page:Float angle] - An angle in radians.<br /><br />
|
|
|
+ [page:Vector3 axis] - 一个被归一化的[page:Vector3]。<br />
|
|
|
+ [page:Float angle] - 以弧度表示的角度。<br /><br />
|
|
|
|
|
|
- Applies a rotation specified by an axis and an angle to this vector.
|
|
|
+ 将轴和角度所指定的旋转应用到该向量上。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this applyEuler]( [param:Euler euler] )</h3>
|
|
|
<p>
|
|
|
- Applies euler transform to this vector by converting the [page:Euler] object to a
|
|
|
- [page:Quaternion] and applying.
|
|
|
+ 通过将[page:Euler](欧拉)对象转换为[page:Quaternion](四元数)并应用,
|
|
|
+ 将欧拉变换应用到这一向量上。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this applyMatrix3]( [param:Matrix3 m] )</h3>
|
|
|
- <p>Multiplies this vector by [page:Matrix3 m]</p>
|
|
|
+ <p>将该向量乘以三阶矩阵[page:Matrix3 m]。</p>
|
|
|
|
|
|
<h3>[method:this applyMatrix4]( [param:Matrix4 m] )</h3>
|
|
|
<p>
|
|
|
- Multiplies this vector (with an implicit 1 in the 4th dimension) and m, and divides by perspective.
|
|
|
+ 将该向量乘以四阶矩阵m(第四个维度隐式地为1),and divides by perspective.
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this applyQuaternion]( [param:Quaternion quaternion] )</h3>
|
|
|
<p>
|
|
|
- Applies a [page:Quaternion] transform to this vector.
|
|
|
+ 将[page:Quaternion]变换应用到该向量。
|
|
|
</p>
|
|
|
|
|
|
|
|
|
<h3>[method:Float angleTo]( [param:Vector3 v] )</h3>
|
|
|
<p>
|
|
|
- Returns the angle between this vector and vector [page:Vector3 v] in radians.
|
|
|
+ 以弧度返回该向量与向量[page:Vector3 v]之间的角度。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this ceil]()</h3>
|
|
|
<p>
|
|
|
- The [page:.x x], [page:.y y] and [page:.z z] components of the vector are rounded up to the nearest integer value.
|
|
|
+ 将该向量[page:.x x]分量、 [page:.y y]分量以及[page:.z z]分量向上取整为最接近的整数。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this clamp]( [param:Vector3 min], [param:Vector3 max] )</h3>
|
|
|
<p>
|
|
|
- [page:Vector3 min] - the minimum [page:.x x], [page:.y y] and [page:.z z] values.<br />
|
|
|
- [page:Vector3 max] - the maximum [page:.x x], [page:.y y] and [page:.z z] values in the desired range<br /><br />
|
|
|
+ [page:Vector3 min] - 在限制范围内,[page:.x x]值、[page:.y y]值和[page:.z z]的最小值。<br />
|
|
|
+ [page:Vector3 max] - 在限制范围内,[page:.x x]值、[page:.y y]值和[page:.z z]的最大值。<br /><br />
|
|
|
|
|
|
- If this vector's x, y or z value is greater than the max vector's x, y or z value, it is replaced by the corresponding value. <br /><br />
|
|
|
- If this vector's x, y or z value is less than the min vector's x, y or z value, it is replaced by the corresponding value.
|
|
|
+ 如果该向量的x值、y值或z值大于限制范围内最大x值、y值或z值,则该值将会被所对应的值取代。<br /><br />
|
|
|
+ 如果该向量的x值、y值或z值小于限制范围内最小x值、y值或z值,则该值将会被所对应的值取代。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this clampLength]( [param:Float min], [param:Float max] )</h3>
|
|
|
<p>
|
|
|
- [page:Float min] - the minimum value the length will be clamped to <br />
|
|
|
- [page:Float max] - the maximum value the length will be clamped to<br /><br />
|
|
|
+ [page:Float min] - 长度将被限制为的最小值 <br />
|
|
|
+ [page:Float max] - 长度将被限制为的最大值<br /><br />
|
|
|
|
|
|
- If this vector's length is greater than the max value, it is replaced by the max value. <br /><br />
|
|
|
- If this vector's length is less than the min value, it is replaced by the min value.
|
|
|
+ 如果向量长度大于最大值,则它将会被最大值所取代。<br /><br />
|
|
|
+ 如果向量长度小于最小值,则它将会被最小值所取代。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this clampScalar]( [param:Float min], [param:Float max] )</h3>
|
|
|
<p>
|
|
|
- [page:Float min] - the minimum value the components will be clamped to <br />
|
|
|
- [page:Float max] - the maximum value the components will be clamped to<br /><br />
|
|
|
+ [page:Float min] - 分量将被限制为的最小值 <br />
|
|
|
+ [page:Float max] - 分量将被限制为的最大值<br /><br />
|
|
|
|
|
|
- If this vector's x, y or z values are greater than the max value, they are replaced by the max value. <br /><br />
|
|
|
- If this vector's x, y or z values are less than the min value, they are replaced by the min value.
|
|
|
+ 如果该向量的x值、y值或z值大于最大值,则它们将被最大值所取代。<br /><br />
|
|
|
+ 如果该向量的x值、y值或z值小于最小值,则它们将被最小值所取代。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:Vector3 clone]()</h3>
|
|
|
<p>
|
|
|
- Returns a new vector3 with the same [page:.x x], [page:.y y] and [page:.z z] values as this one.
|
|
|
+ 返回一个新的Vector3,其具有和当前这个向量相同的[page:.x x]、[page:.y y]和[page:.z z]。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this copy]( [param:Vector3 v] )</h3>
|
|
|
<p>
|
|
|
- Copies the values of the passed vector3's [page:.x x], [page:.y y] and [page:.z z]
|
|
|
- properties to this vector3.
|
|
|
+ 将所传入Vector3的[page:.x x]、[page:.y y]和[page:.z z]属性复制给这一Vector3。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this cross]( [param:Vector3 v] )</h3>
|
|
|
<p>
|
|
|
- Sets this vector to [link:https://en.wikipedia.org/wiki/Cross_product cross product] of itself and [page:Vector3 v].
|
|
|
+ 将该向量设置为它本身与传入的[page:Vector3 v]的叉积([link:https://en.wikipedia.org/wiki/Cross_product cross product])。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this crossVectors]( [param:Vector3 a], [param:Vector3 b] )</h3>
|
|
|
<p>
|
|
|
- Sets this vector to [link:https://en.wikipedia.org/wiki/Cross_product cross product] of [page:Vector3 a] and [page:Vector3 b].
|
|
|
+ 将该向量设置为传入的[page:Vector3 a]与[page:Vector3 b]的叉积([link:https://en.wikipedia.org/wiki/Cross_product cross product])。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:Float distanceTo]( [param:Vector3 v] )</h3>
|
|
|
- <p>Computes the distance from this vector to [page:Vector3 v].</p>
|
|
|
+ <p>计算该向量到所传入的[page:Vector3 v]间的距离。</p>
|
|
|
|
|
|
<h3>[method:Float manhattanDistanceTo]( [param:Vector3 v] )</h3>
|
|
|
<p>
|
|
|
- Computes the [link:https://en.wikipedia.org/wiki/Taxicab_geometry Manhattan distance] from this vector to [page:Vector3 v].
|
|
|
+ 计算该向量到所传入的[page:Vector3 v]之间的曼哈顿距离([link:https://en.wikipedia.org/wiki/Taxicab_geometry Manhattan distance])。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:Float distanceToSquared]( [param:Vector3 v] )</h3>
|
|
|
<p>
|
|
|
- Computes the squared distance from this vector to [page:Vector3 v]. If you are just
|
|
|
- comparing the distance with another distance, you should compare the distance squared instead
|
|
|
- as it is slightly more efficient to calculate.
|
|
|
+ 计算该向量到传入的[page:Vector3 v]的平方距离。
|
|
|
+ 如果你只是将该距离和另一个距离进行比较,则应当比较的是距离的平方,
|
|
|
+ 因为它的计算效率会更高一些。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this divide]( [param:Vector3 v] )</h3>
|
|
|
- <p>Divides this vector by [page:Vector3 v].</p>
|
|
|
+ <p>将该向量除以向量[page:Vector3 v]。</p>
|
|
|
|
|
|
<h3>[method:this divideScalar]( [param:Float s] )</h3>
|
|
|
<p>
|
|
|
- Divides this vector by scalar [page:Float s].<br />
|
|
|
- Sets vector to *( 0, 0, 0 )* if *[page:Float s] = 0*.
|
|
|
+ 将该向量除以标量[page:Float s]。<br />
|
|
|
+ 如果传入的[page:Float s] = 0,则向量将被设置为*( 0, 0, 0 )*。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:Float dot]( [param:Vector3 v] )</h3>
|
|
|
<p>
|
|
|
- Calculate the [link:https://en.wikipedia.org/wiki/Dot_product dot product] of this
|
|
|
- vector and [page:Vector3 v].
|
|
|
+ 计算该vector和所传入[page:Vector3 v]的点积([link:https://en.wikipedia.org/wiki/Dot_product dot product])。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:Boolean equals]( [param:Vector3 v] )</h3>
|
|
|
- <p>Checks for strict equality of this vector and [page:Vector3 v].</p>
|
|
|
+ <p>检查该向量和[page:Vector3 v]的严格相等性。</p>
|
|
|
|
|
|
<h3>[method:this floor]()</h3>
|
|
|
- <p>The components of the vector are rounded down to the nearest integer value.</p>
|
|
|
+ <p>向量的分量向下取整为最接近的整数值。</p>
|
|
|
|
|
|
<h3>[method:this fromArray]( [param:Array array], [param:Integer offset] )</h3>
|
|
|
<p>
|
|
|
- [page:Array array] - the source array.<br />
|
|
|
- [page:Integer offset] - ( optional) offset into the array. Default is 0.<br /><br />
|
|
|
+ [page:Array array] - 来源矩阵。<br />
|
|
|
+ [page:Integer offset] - (可选)在数组中的元素偏移量,默认值为0。<br /><br />
|
|
|
|
|
|
- Sets this vector's [page:.x x] value to be array[ offset + 0 ], [page:.y y] value to be array[ offset + 1 ]
|
|
|
- and [page:.z z] value to be array[ offset + 2 ].
|
|
|
+ 设置向量中的[page:.x x]值为array[ offset + 0 ],[page:.y y]值为array[ offset + 1 ],
|
|
|
+ [page:.z z]值为array[ offset + 2 ]。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this fromBufferAttribute]( [param:BufferAttribute attribute], [param:Integer index] )</h3>
|
|
|
<p>
|
|
|
- [page:BufferAttribute attribute] - the source attribute.<br />
|
|
|
- [page:Integer index] - index in the attribute.<br /><br />
|
|
|
+ [page:BufferAttribute attribute] - 来源的attribute。<br />
|
|
|
+ [page:Integer index] - 在attribute中的索引。<br /><br />
|
|
|
|
|
|
- Sets this vector's [page:.x x], [page:.y y] and [page:.z z] values from the [page:BufferAttribute attribute].
|
|
|
+ 从[page:BufferAttribute attribute]中设置向量的[page:.x x]值、[page:.y y]值和[page:.z z]值。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:Float getComponent]( [param:Integer index] )</h3>
|
|
|
<p>
|
|
|
[page:Integer index] - 0, 1 or 2.<br /><br />
|
|
|
|
|
|
- If index equals 0 returns the [page:.x x] value. <br />
|
|
|
- If index equals 1 returns the [page:.y y] value. <br />
|
|
|
- If index equals 2 returns the [page:.z z] value.
|
|
|
+ 如果index值为0返回[page:.x x]值。 <br />
|
|
|
+ 如果index值为1返回[page:.y y]值。 <br />
|
|
|
+ 如果index值为2返回[page:.z z]值。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:Float length]()</h3>
|
|
|
- <p>Computes the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length]
|
|
|
- (straight-line length) from (0, 0, 0) to (x, y, z).</p>
|
|
|
+ <p>计算从(0, 0, 0) 到 (x, y, z)的欧几里得长度
|
|
|
+ ([link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length],即直线长度)
|
|
|
+ </p>
|
|
|
|
|
|
<h3>[method:Float manhattanLength]()</h3>
|
|
|
<p>
|
|
|
- Computes the [link:http://en.wikipedia.org/wiki/Taxicab_geometry Manhattan length] of this vector.
|
|
|
+ 计算该向量的曼哈顿长度([link:http://en.wikipedia.org/wiki/Taxicab_geometry Manhattan length])。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:Float lengthSq]()</h3>
|
|
|
<p>
|
|
|
- Computes the square of the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length]
|
|
|
- (straight-line length) from (0, 0, 0) to (x, y, z). If you are comparing the lengths of
|
|
|
- vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
|
|
|
+ 计算从(0, 0, 0)到(x, y, z)的欧几里得长度
|
|
|
+ ([link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length],即直线长度)的平方。
|
|
|
+ 如果你正在比较向量的长度,应当比较的是长度的平方,因为它的计算效率更高一些。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this lerp]( [param:Vector3 v], [param:Float alpha] )</h3>
|
|
|
<p>
|
|
|
- [page:Vector3 v] - [page:Vector3] to interpolate towards.<br />
|
|
|
- alpha - interpolation factor in the closed interval [0, 1].<br /><br />
|
|
|
+ [page:Vector3 v] - 朝着进行插值的[page:Vector3]。<br />
|
|
|
+ alpha - 插值因数,其范围在[0, 1]闭区间。<br /><br />
|
|
|
|
|
|
- Linearly interpolate between this vector and [page:Vector3 v], where alpha is the
|
|
|
- distance along the line - alpha = 0 will be this vector, and alpha = 1 will be [page:Vector3 v].
|
|
|
+ 在该向量与传入的向量[page:Vector3 v]之间的线性插值,alpha是沿着线的距离长度。
|
|
|
+ —— alpha = 0 时表示的是当前向量,alpha = 1 时表示的是所传入的向量[page:Vector3 v]。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this lerpVectors]( [param:Vector3 v1], [param:Vector3 v2], [param:Float alpha] )</h3>
|
|
|
<p>
|
|
|
- [page:Vector3 v1] - the starting [page:Vector3].<br />
|
|
|
- [page:Vector3 v2] - [page:Vector3] to interpolate towards.<br />
|
|
|
- [page:Float alpha] - interpolation factor in the closed interval [0, 1].<br /><br />
|
|
|
+ [page:Vector3 v1] - 起始的[page:Vector3]。<br />
|
|
|
+ [page:Vector3 v2] - 朝着进行插值的[page:Vector3]。<br />
|
|
|
+ [page:Float alpha] - 插值因数,其范围在[0, 1]闭区间。<br /><br />
|
|
|
|
|
|
- Sets this vector to be the vector linearly interpolated between [page:Vector3 v1] and
|
|
|
- [page:Vector3 v2] where alpha is the distance along the line connecting the two vectors
|
|
|
- - alpha = 0 will be [page:Vector3 v1], and alpha = 1 will be [page:Vector3 v2].
|
|
|
+
|
|
|
+ 将此向量设置为在[page:Vector3 v1]和[page:Vector3 v2]之间进行线性插值的向量,
|
|
|
+ 其中alpha为两个向量之间连线的距离长度。
|
|
|
+ —— alpha = 0 时表示的是[page:Vector3 v1],alpha = 1 时表示的是[page:Vector3 v2]。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this max]( [param:Vector3 v] )</h3>
|
|
|
<p>
|
|
|
- If this vector's x, y or z value is less than [page:Vector3 v]'s x, y or z value, replace
|
|
|
- that value with the corresponding max value.
|
|
|
+ 如果该向量的x值、y值或z值小于所传入[page:Vector3 v]的x值、y值或z值,
|
|
|
+ 则将该值替换为对应的最大值。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this min]( [param:Vector3 v] )</h3>
|
|
|
<p>
|
|
|
- If this vector's x, y or z value is greater than [page:Vector3 v]'s x, y or z value, replace
|
|
|
- that value with the corresponding min value.
|
|
|
+ 如果该向量的x值、y值或z值大于所传入[page:Vector3 v]的x值、y值或z值,
|
|
|
+ 则将该值替换为对应的最小值。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this multiply]( [param:Vector3 v] )</h3>
|
|
|
- <p>Multiplies this vector by [page:Vector3 v].</p>
|
|
|
+ <p>将该向量与所传入的向量[page:Vector3 v]进行相乘。</p>
|
|
|
|
|
|
<h3>[method:this multiplyScalar]( [param:Float s] )</h3>
|
|
|
- <p>Multiplies this vector by scalar [page:Float s].</p>
|
|
|
+ <p>将该向量与所传入的标量[page:Float s]进行相乘。</p>
|
|
|
|
|
|
<h3>[method:this multiplyVectors]( [param:Vector3 a], [param:Vector3 b] )</h3>
|
|
|
- <p>Sets this vector equal to [page:Vector3 a] * [page:Vector3 b], component-wise.</p>
|
|
|
+ <p>按照分量顺序,将该向量设置为和[page:Vector3 a] * [page:Vector3 b]相等。</p>
|
|
|
|
|
|
<h3>[method:this negate]()</h3>
|
|
|
- <p>Inverts this vector - i.e. sets x = -x, y = -y and z = -z.</p>
|
|
|
+ <p>向量取反,即: x = -x, y = -y , z = -z。</p>
|
|
|
|
|
|
<h3>[method:this normalize]()</h3>
|
|
|
<p>
|
|
|
- Convert this vector to a [link:https://en.wikipedia.org/wiki/Unit_vector unit vector] - that is, sets it equal to the vector with the same direction
|
|
|
- as this one, but [page:.length length] 1.
|
|
|
+ 将该向量转换为单位向量([link:https://en.wikipedia.org/wiki/Unit_vector unit vector]),
|
|
|
+ 也就是说,将该向量的方向设置为和原向量相同,但是其长度([page:.length length])为1。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this project]( [param:Camera camera] )</h3>
|
|
|
<p>
|
|
|
- [page:Camera camera] — camera to use in the projection.<br /><br />
|
|
|
+ [page:Camera camera] — 在投影中使用的摄像机。<br /><br />
|
|
|
|
|
|
- [link:https://en.wikipedia.org/wiki/Vector_projection Projects] the vector with the camera.
|
|
|
+ 使用所传入的摄像机来投影([link:https://en.wikipedia.org/wiki/Vector_projection projects])该向量。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this projectOnPlane]( [param:Vector3 planeNormal] )</h3>
|
|
@@ -321,7 +321,7 @@ var d = a.distanceTo( b );
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this projectOnVector]( [param:Vector3] )</h3>
|
|
|
- <p>[link:https://en.wikipedia.org/wiki/Vector_projection Projects] this vector onto another vector.</p>
|
|
|
+ <p>投影([link:https://en.wikipedia.org/wiki/Vector_projection Projects])该向量到另一个向量上。 </p>
|
|
|
|
|
|
<h3>[method:this reflect]( [param:Vector3 normal] )</h3>
|
|
|
<p>
|
|
@@ -332,114 +332,112 @@ var d = a.distanceTo( b );
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this round]()</h3>
|
|
|
- <p>The components of the vector are rounded to the nearest integer value.</p>
|
|
|
+ <p> 向量中的分量四舍五入取整为最接近的整数值。</p>
|
|
|
|
|
|
<h3>[method:this roundToZero]()</h3>
|
|
|
<p>
|
|
|
- The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value.
|
|
|
+ 向量中的分量朝向0取整数(若分量为负数则向上取整,若为正数则向下取整)。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this set]( [param:Float x], [param:Float y], [param:Float z] )</h3>
|
|
|
- <p>Sets the [page:.x x], [page:.y y] and [page:.z z] components of this vector.</p>
|
|
|
+ <p>设置该向量的[page:.x x]、[page:.y y] 和 [page:.z z] 分量。</p>
|
|
|
|
|
|
<h3>[method:null setComponent]( [param:Integer index], [param:Float value] )</h3>
|
|
|
<p>
|
|
|
- [page:Integer index] - 0, 1 or 2.<br />
|
|
|
+ [page:Integer index] - 0、1 或 2。<br />
|
|
|
[page:Float value] - [page:Float]<br /><br />
|
|
|
|
|
|
- If index equals 0 set [page:.x x] to [page:Float value].<br />
|
|
|
- If index equals 1 set [page:.y y] to [page:Float value].<br />
|
|
|
- If index equals 2 set [page:.z z] to [page:Float value]
|
|
|
+ 若index为 0 则设置 [page:.x x] 值为 [page:Float value]。<br />
|
|
|
+ 若index为 1 则设置 [page:.y y] 值为 [page:Float value]。<br />
|
|
|
+ 若index为 2 则设置 [page:.z z] 值为 [page:Float value]。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this setFromCylindrical]( [param:Cylindrical c] )</h3>
|
|
|
<p>
|
|
|
- Sets this vector from the cylindrical coordinates [page:Cylindrical c].
|
|
|
+ 从圆柱坐标[page:Cylindrical c]中设置该向量。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this setFromCylindricalCoords]( [param:Float radius], [param:Float theta], [param:Float y] )</h3>
|
|
|
- <p>Sets this vector from the cylindrical coordinates [page:Cylindrical radius], [page:Cylindrical theta] and [page:Cylindrical y].</p>
|
|
|
+ <p>从圆柱坐标中的[page:Cylindrical radius]、[page:Cylindrical theta]和[page:Cylindrical y]设置该向量。</p>
|
|
|
|
|
|
<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].
|
|
|
+ 从传入的四阶矩阵[page:Matrix4 matrix]由[page:Integer index]指定的列中,
|
|
|
+ 设置该向量的[page:.x x]值、[page:.y y]值和[page:.z z]值。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this setFromMatrixPosition]( [param:Matrix4 m] )</h3>
|
|
|
<p>
|
|
|
- Sets this vector to the position elements of the
|
|
|
- [link:https://en.wikipedia.org/wiki/Transformation_matrix transformation matrix] [page:Matrix4 m].
|
|
|
+ 从变换矩阵([link:https://en.wikipedia.org/wiki/Transformation_matrix transformation matrix])[page:Matrix4 m]中,
|
|
|
+ 设置该向量为其中与位置相关的元素。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this setFromMatrixScale]( [param:Matrix4 m] )</h3>
|
|
|
<p>
|
|
|
- Sets this vector to the scale elements of the
|
|
|
- [link:https://en.wikipedia.org/wiki/Transformation_matrix transformation matrix] [page:Matrix4 m].
|
|
|
+ 从变换矩阵([link:https://en.wikipedia.org/wiki/Transformation_matrix transformation matrix])[page:Matrix4 m]中,
|
|
|
+ 设置该向量为其中与缩放相关的元素。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this setFromSpherical]( [param:Spherical s] )</h3>
|
|
|
<p>
|
|
|
- Sets this vector from the spherical coordinates [page:Spherical s].
|
|
|
+ 从球坐标[page:Spherical s]中设置该向量。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this setFromSphericalCoords]( [param:Float radius], [param:Float phi], [param:Float theta] )</h3>
|
|
|
- <p>Sets this vector from the spherical coordinates [page:Spherical radius], [page:Spherical phi] and [page:Spherical theta].</p>
|
|
|
+ <p>从球坐标中的[page:Spherical radius]、[page:Spherical phi]和[page:Spherical theta]设置该向量。</p>
|
|
|
|
|
|
<h3>[method:this setLength]( [param:Float l] )</h3>
|
|
|
<p>
|
|
|
- Set this vector to the vector with the same direction as this one, but [page:.length length]
|
|
|
- [page:Float l].
|
|
|
+ 将该向量的方向设置为和原向量相同,但是长度([page:.length length])为[page:Float l]。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this setScalar]( [param:Float scalar] )</h3>
|
|
|
<p>
|
|
|
- Set the [page:.x x], [page:.y y] and [page:.z z] values of this vector both equal to [page:Float scalar].
|
|
|
+ 将该向量的[page:.x x]、[page:.y y]和[page:.z z]值同时设置为等于传入的[page:Float scalar]。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this setX]( [param:Float x] )</h3>
|
|
|
- <p>Replace this vector's [page:.x x] value with [page:Float x].</p>
|
|
|
+ <p>将向量中的[page:.x x]值替换为[page:Float x]。</p>
|
|
|
|
|
|
<h3>[method:this setY]( [param:Float y] )</h3>
|
|
|
- <p>Replace this vector's [page:.y y] value with [page:Float y].</p>
|
|
|
+ <p>将向量中的[page:.y y]值替换为[page:Float y]。</p>
|
|
|
|
|
|
<h3>[method:this setZ]( [param:Float z] )</h3>
|
|
|
- <p>Replace this vector's [page:.z z] value with [page:Float z].</p>
|
|
|
+ <p>将向量中的[page:.z z]值替换为[page:Float z]。</p>
|
|
|
|
|
|
<h3>[method:this sub]( [param:Vector3 v] )</h3>
|
|
|
- <p>Subtracts [page:Vector3 v] from this vector.</p>
|
|
|
+ <p>从该向量减去向量[page:Vector3 v]。</p>
|
|
|
|
|
|
<h3>[method:this subScalar]( [param:Float s] )</h3>
|
|
|
- <p>Subtracts [page:Float s] from this vector's [page:.x x], [page:.y y] and [page:.z z] compnents.</p>
|
|
|
+ <p>从该向量的[page:.x x]、[page:.y y]和[page:.z z]中减去标量[page:Float s]。</p>
|
|
|
|
|
|
<h3>[method:this subVectors]( [param:Vector3 a], [param:Vector3 b] )</h3>
|
|
|
- <p>Sets this vector to [page:Vector3 a] - [page:Vector3 b].</p>
|
|
|
+ <p>将该向量设置为[page:Vector3 a] - [page:Vector3 b]。</p>
|
|
|
|
|
|
<h3>[method:Array toArray]( [param:Array array], [param:Integer offset] )</h3>
|
|
|
<p>
|
|
|
- [page:Array array] - (optional) array to store the vector to. If this is not provided
|
|
|
- a new array will be created.<br />
|
|
|
- [page:Integer offset] - (optional) optional offset into the array.<br /><br />
|
|
|
+ [page:Array array] - (可选)被用于存储向量的数组。如果这个值没有传入,则将创建一个新的数组。<br />
|
|
|
+ [page:Integer offset] - (可选) 数组中元素的偏移量。<br /><br />
|
|
|
|
|
|
- Returns an array [x, y, z], or copies x, y and z into the provided [page:Array array].
|
|
|
+ 返回一个数组[x, y ,z],或者将x、y和z复制到所传入的[page:Array array]中。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this transformDirection]( [param:Matrix4 m] )</h3>
|
|
|
<p>
|
|
|
- Transforms the direction of this vector by a matrix (the upper left 3 x 3 subset of a [page:Matrix4 m])
|
|
|
- and then [page:.normalize normalizes] the result.
|
|
|
+ 通过传入的矩阵([page:Matrix4 m]的左上角3 x 3子矩阵)变换向量的方向,
|
|
|
+ 并将结果进行[page:.normalize normalizes](归一化)。
|
|
|
</p>
|
|
|
|
|
|
<h3>[method:this unproject]( [param:Camera camera] )</h3>
|
|
|
<p>
|
|
|
- [page:Camera camera] — camera to use in the projection.<br /><br />
|
|
|
+ [page:Camera camera] — 在投影中使用的摄像机。<br /><br />
|
|
|
|
|
|
[link:https://en.wikipedia.org/wiki/Vector_projection Unprojects] the vector with the
|
|
|
camera's projection matrix.
|
|
|
</p>
|
|
|
|
|
|
|
|
|
- <h2>Source</h2>
|
|
|
+ <h2>源代码</h2>
|
|
|
|
|
|
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
|
|
</body>
|