Vector3 : three.js

Vector3

Class representing a 3D 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:

  • A point in 3D space.
  • A direction and length in 3D space. In three.js the length will always be the 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).
  • Any arbitrary ordered triplet of numbers.

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.

Example

var a = new THREE.Vector3( 0, 1, 0 ); //no arguments; will be initialised to (0, 0, 0) var b = new THREE.Vector3( ); var d = a.distanceTo( b );

Constructor

Vector3( xyz )

x - the x value of the vector. Default is 0.
y - the y value of the vector. Default is 0.
z - the z value of the vector. Default is 0.

Creates a new Vector3.

Properties

#.isVector3

Used to check whether this or derived classes are Vector3s. Default is true.

You should not change this, as it is used internally for optimisation.

#.x

#.y

#.z

Methods

#.add ( v )

Adds v to this vector.

#.addScalar ( s )

Adds the scalar value s to this vector's xy and z values.

#.addScaledVector ( vs )

Adds the multiple of v and s to this vector.

#.addVectors ( ab )

Sets this vector to a + b.

#.applyAxisAngle ( axisangle )

axis - A normalized Vector3.
angle - An angle in radians.

Applies a rotation specified by an axis and an angle to this vector.

#.applyEuler ( euler )

Applies euler transform to this vector by converting the Euler object to a Quaternion and applying.

#.applyMatrix3 ( m )

Multiplies this vector by m

#.applyMatrix4 ( m )

Multiplies this vector (with an implicit 1 in the 4th dimension) and m, and divides by perspective.

#.applyQuaternion ( quaternion )

Applies a Quaternion transform to this vector.

#.angleTo ( v )

Returns the angle between this vector and vector v in radians.

#.ceil ()

The xy and z components of the vector are rounded up to the nearest integer value.

#.clamp ( minmax )

min - the minimum xy and z values.
max - the maximum xy and z values in the desired range

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. 

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.

#.clampLength ( minmax )

min - the minimum value the length will be clamped to 
max - the maximum value the length will be clamped to

If this vector's length is greater than the max value, it is replaced by the max value. 

If this vector's length is less than the min value, it is replaced by the min value.

#.clampScalar ( minmax )

min - the minimum value the components will be clamped to 
max - the maximum value the components will be clamped to

If this vector's x, y or z values are greater than the max value, they are replaced by the max value. 

If this vector's x, y or z values are less than the min value, they are replaced by the min value.

#.clone ()

Returns a new vector3 with the same xy and z values as this one.

#.copy ( v )

Copies the values of the passed vector3's xy and z properties to this vector3.

#.cross ( v )

Sets this vector to cross product of itself and v.

#.crossVectors ( ab )

Sets this vector to cross product of a and b.

#.distanceTo ( v )

Computes the distance from this vector to v.

#.distanceToManhattan ( v )

Computes the Manhattan distance from this vector to v.

#.distanceToSquared ( v )

Computes the squared distance from this vector to 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.

#.divide ( v )

Divides this vector by v.

#.divideScalar ( s )

Divides this vector by scalar s.
Sets vector to ( 0, 0 ) if *s = 0*.

#.dot ( v )

Calculate the dot product of this vector and v.

#.equals ( v )

Checks for strict equality of this vector and v.

#.floor ()

The components of the vector are rounded down to the nearest integer value.

#.fromArray ( arrayoffset )

array - the source array.
offset - ( optional) offset into the array. Default is 0.

Sets this vector's x value to be array[ offset + 0 ], y value to be array[ offset + 1 ] and z value to be array[ offset + 2 ].

#.fromBufferAttribute ( attributeindex )

attribute - the source attribute.
index - index in the attribute.

Sets this vector's xy and z values from the attribute.

#.getComponent ( index )

index - 0, 1 or 2.

If index equals 0 returns the x value. 
If index equals 1 returns the y value. 
If index equals 2 returns the z value.

#.length ()

Computes the Euclidean length (straight-line length) from (0, 0, 0) to (x, y, z).

#.lengthManhattan ()

Computes the Manhattan length of this vector.

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com

#.lengthSq ()

Computes the square of the 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.

#.lerp ( valpha )

v - Vector3 to interpolate towards.
alpha - interpolation factor in the closed interval [0, 1].

Linearly interpolate between this vector and v, where alpha is the distance along the line - alpha = 0 will be this vector, and alpha = 1 will be v.

#.lerpVectors ( v1v2alpha )

v1 - the starting Vector3.
v2 - Vector3 to interpolate towards.
alpha - interpolation factor in the closed interval [0, 1].

Sets this vector to be the vector linearly interpolated between v1 and v2 where alpha is the distance along the line connecting the two vectors - alpha = 0 will be v1, and alpha = 1 will be v2.

#.negate ()

Inverts this vector - i.e. sets x = -x, y = -y and z = -z.

#.normalize ()

Convert this vector to a unit vector - that is, sets it equal to the vector with the same direction as this one, but length 1.

#.max ( v )

If this vector's x, y or z value is less than v's x, y or z value, replace that value with the corresponding max value.

#.min ( v )

If this vector's x, y or z value is greater than v's x, y or z value, replace that value with the corresponding min value.

#.multiply ( v )

Multiplies this vector by v.

#.multiplyScalar ( s )

Multiplies this vector by scalar s.

#.multiplyVectors ( ab )

Sets this vector equal to a x b.

#.project ( camera )

camera — camera to use in the projection.

Projects the vector with the camera.

#.projectOnPlane ( planeNormal )

planeNormal - A vector representing a plane normal.

Projects this vector onto a plane by subtracting this vector projected onto the plane's normal from this vector.

#.projectOnVector ( Vector3 )

Projects this vector onto another vector.

#.reflect ( normal )

normal - the normal to the reflecting plane

Reflect the vector off of plane orthogonal to normal. Normal is assumed to have unit length.

#.round ()

The components of the vector are rounded to the nearest integer value.

#.roundToZero ()

The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value.

#.set ( xyz )

Sets the xy and z components of this vector.

#.setComponent ( indexvalue )

index - 0, 1 or 2.
value - Float

If index equals 0 set x to value.
If index equals 1 set y to value.
If index equals 2 set z to value

#.setFromCylindrical ( c )

Sets this vector from the cylindrical coordinates c.

#.setFromMatrixColumn ( matrixindex )

Sets this vector's xy and z equal to the column of the matrix specified by the index.

#.setFromMatrixPosition ( m )

Sets this vector to the position elements of the transformation matrix m.

#.setFromMatrixScale ( m )

Sets this vector to the scale elements of the transformation matrix m.

#.setFromSpherical ( s )

Sets this vector from the spherical coordinates s.

#.setLength ( l )

Set this vector to the vector with the same direction as this one, but length l.

#.setScalar ( scalar )

Set the xy and z values of this vector both equal to scalar.

#.setX ( x )

Replace this vector's x value with x.

#.setY ( y )

Replace this vector's y value with y.

#.setZ ( z )

Replace this vector's z value with z.

#.sub ( v )

Subtracts v from this vector.

#.subScalar ( s )

Subtracts s from this vector's xy and z compnents.

#.subVectors ( ab )

Sets this vector to a - b.

#.toArray ( arrayoffset )

array - (optional) array to store the vector to. If this is not provided a new array will be created.
offset - (optional) optional offset into the array.

Returns an array [x, y, z], or copies x, y and z into the provided array.

#.transformDirection ( m )

Transforms the direction of this vector by a matrix (the upper left 3 x 3 subset of a m) and then normalizes the result.

#.unproject ( camera )

camera — camera to use in the projection.

Unprojects the vector with the camera's projection matrix.

 

[출처] https://threejs.org/docs/#api/math/Vector3

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
41 Responsive Web ① – 반응형 웹을 위해 개발자가 꼭 알아야 하는 기술들 file 졸리운_곰 2019.02.08 325
40 서버 사이드 렌더링 그리고 클라이언트 사이드 렌더링 file 졸리운_곰 2018.11.02 800
39 무료 디자인소스 홈페이지들을 소개합니다! file 졸리운_곰 2018.02.27 516
38 스토리보드 템플릿 file 졸리운_곰 2017.10.10 626
37 [웹 기획] 화면 설계 용어 - 와이어프레임, 스토리보드, 프로토타입의 차이점 file 졸리운_곰 2017.10.10 1584
36 웹기획 탄탄한 홈페이지 설계방법 (스토리보드 다운로드) file 졸리운_곰 2017.10.10 2062
35 정보설계(IA : Information Architecture) 졸리운_곰 2016.11.20 330
34 정보 설계 — 웹 사이트 기획 file 졸리운_곰 2016.11.20 756
33 웹 서비스 구축 체크리스트 file 졸리운_곰 2016.10.30 608
32 반응형 웹 기획 file 졸리운_곰 2016.10.27 673
31 [UX 컨설팅] 모 전자 서비스 사례 보고서 secret 졸리운_곰 2016.10.09 0
30 [웹 기획] 기획자가 화면설계서(스토리보드)를 만든다구요? 기획자가 무슨 능력을 가지고 있는데요? 졸리운_곰 2016.10.09 484
29 [UX 디자인] UI 설계도에 해당하는 용어들 file 졸리운_곰 2016.10.09 531
28 [UX 디자인 사례] T모 소프트 "BUX컨설팅소개_V.1.0" file 졸리운_곰 2016.10.09 255
27 [UX 디자인] 사용자 경험(UX)과 사용자 경험 디자인(UX Design) - 위키피디아 정의 살펴보기 file 졸리운_곰 2016.10.08 289
26 [UX 디자인] UX 디자인 조직의 구조와 역할 file 졸리운_곰 2016.10.08 481
25 [UX 디자인] UX 디자인이란? - UI, UX, 인터랙션 디자인의 정의 file 졸리운_곰 2016.10.08 487
24 [UX 디자인] UX(User Experience) 란? UX 디자인 관련 다이어그램 Best 14 file 졸리운_곰 2016.10.08 584
23 [UX 디자인] 7단계 인간행위 모형 - 터치 기기 사용의 행위 모형 file 졸리운_곰 2016.10.08 533
22 [UX 디자인] 애플의 디자인 방법 file 졸리운_곰 2016.10.08 631
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED