Vector4.d.ts 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. import { Matrix4 } from './Matrix4';
  2. import { Quaternion } from './Quaternion';
  3. import { Matrix3 } from './Matrix3';
  4. import { BufferAttribute } from './../core/BufferAttribute';
  5. import { Vector } from './Vector2';
  6. /**
  7. * @deprecated use {@link Vector3 THREE.Vector3} instead.
  8. */
  9. /**
  10. * 4D vector.
  11. *
  12. * ( class Vector4 implements Vector<Vector4> )
  13. */
  14. export class Vector4 implements Vector {
  15. constructor( x?: number, y?: number, z?: number, w?: number );
  16. x: number;
  17. y: number;
  18. z: number;
  19. w: number;
  20. width: number;
  21. height: number;
  22. isVector4: true;
  23. /**
  24. * Sets value of this vector.
  25. */
  26. set( x: number, y: number, z: number, w: number ): this;
  27. /**
  28. * Sets all values of this vector.
  29. */
  30. setScalar( scalar: number ): this;
  31. /**
  32. * Sets X component of this vector.
  33. */
  34. setX( x: number ): this;
  35. /**
  36. * Sets Y component of this vector.
  37. */
  38. setY( y: number ): this;
  39. /**
  40. * Sets Z component of this vector.
  41. */
  42. setZ( z: number ): this;
  43. /**
  44. * Sets w component of this vector.
  45. */
  46. setW( w: number ): this;
  47. setComponent( index: number, value: number ): this;
  48. getComponent( index: number ): number;
  49. /**
  50. * Clones this vector.
  51. */
  52. clone(): this;
  53. /**
  54. * Copies value of v to this vector.
  55. */
  56. copy( v: Vector4 ): this;
  57. /**
  58. * Adds v to this vector.
  59. */
  60. add( v: Vector4, w?: Vector4 ): this;
  61. addScalar( scalar: number ): this;
  62. /**
  63. * Sets this vector to a + b.
  64. */
  65. addVectors( a: Vector4, b: Vector4 ): this;
  66. addScaledVector( v: Vector4, s: number ): this;
  67. /**
  68. * Subtracts v from this vector.
  69. */
  70. sub( v: Vector4 ): this;
  71. subScalar( s: number ): this;
  72. /**
  73. * Sets this vector to a - b.
  74. */
  75. subVectors( a: Vector4, b: Vector4 ): this;
  76. /**
  77. * Multiplies this vector by scalar s.
  78. */
  79. multiplyScalar( s: number ): this;
  80. applyMatrix4( m: Matrix4 ): this;
  81. /**
  82. * Divides this vector by scalar s.
  83. * Set vector to ( 0, 0, 0 ) if s == 0.
  84. */
  85. divideScalar( s: number ): this;
  86. /**
  87. * http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm
  88. * @param q is assumed to be normalized
  89. */
  90. setAxisAngleFromQuaternion( q: Quaternion ): this;
  91. /**
  92. * http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
  93. * @param m assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
  94. */
  95. setAxisAngleFromRotationMatrix( m: Matrix3 ): this;
  96. min( v: Vector4 ): this;
  97. max( v: Vector4 ): this;
  98. clamp( min: Vector4, max: Vector4 ): this;
  99. clampScalar( min: number, max: number ): this;
  100. floor(): this;
  101. ceil(): this;
  102. round(): this;
  103. roundToZero(): this;
  104. /**
  105. * Inverts this vector.
  106. */
  107. negate(): this;
  108. /**
  109. * Computes dot product of this vector and v.
  110. */
  111. dot( v: Vector4 ): number;
  112. /**
  113. * Computes squared length of this vector.
  114. */
  115. lengthSq(): number;
  116. /**
  117. * Computes length of this vector.
  118. */
  119. length(): number;
  120. /**
  121. * Computes the Manhattan length of this vector.
  122. *
  123. * @return {number}
  124. *
  125. * @see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry}
  126. */
  127. manhattanLength(): number;
  128. /**
  129. * Normalizes this vector.
  130. */
  131. normalize(): this;
  132. /**
  133. * Normalizes this vector and multiplies it by l.
  134. */
  135. setLength( length: number ): this;
  136. /**
  137. * Linearly interpolate between this vector and v with alpha factor.
  138. */
  139. lerp( v: Vector4, alpha: number ): this;
  140. lerpVectors( v1: Vector4, v2: Vector4, alpha: number ): this;
  141. /**
  142. * Checks for strict equality of this vector and v.
  143. */
  144. equals( v: Vector4 ): boolean;
  145. fromArray( xyzw: number[], offset?: number ): this;
  146. toArray( xyzw?: number[], offset?: number ): number[];
  147. fromBufferAttribute(
  148. attribute: BufferAttribute,
  149. index: number,
  150. offset?: number
  151. ): this;
  152. }
粤ICP备19079148号