index.d.ts 119 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273
  1. declare module "gl-matrix" {
  2. // prettier-ignore
  3. export type mat2 =
  4. | [number, number,
  5. number, number]
  6. | Float32Array;
  7. // prettier-ignore
  8. export type mat2d =
  9. | [number, number,
  10. number, number,
  11. number, number]
  12. | Float32Array;
  13. // prettier-ignore
  14. export type mat3 =
  15. | [number, number, number,
  16. number, number, number,
  17. number, number, number]
  18. | Float32Array;
  19. // prettier-ignore
  20. export type mat4 =
  21. | [number, number, number, number,
  22. number, number, number, number,
  23. number, number, number, number,
  24. number, number, number, number]
  25. | Float32Array;
  26. export type quat = [number, number, number, number] | Float32Array;
  27. // prettier-ignore
  28. export type quat2 =
  29. | [number, number, number, number,
  30. number, number, number, number]
  31. | Float32Array;
  32. export type vec2 = [number, number] | Float32Array;
  33. export type vec3 = [number, number, number] | Float32Array;
  34. export type vec4 = [number, number, number, number] | Float32Array;
  35. // prettier-ignore
  36. export type ReadonlyMat2 =
  37. | readonly [
  38. number, number,
  39. number, number
  40. ]
  41. | Float32Array;
  42. // prettier-ignore
  43. export type ReadonlyMat2d =
  44. | readonly [
  45. number, number,
  46. number, number,
  47. number, number
  48. ]
  49. | Float32Array;
  50. // prettier-ignore
  51. export type ReadonlyMat3 =
  52. | readonly [
  53. number, number, number,
  54. number, number, number,
  55. number, number, number
  56. ]
  57. | Float32Array;
  58. // prettier-ignore
  59. export type ReadonlyMat4 =
  60. | readonly [
  61. number, number, number, number,
  62. number, number, number, number,
  63. number, number, number, number,
  64. number, number, number, number
  65. ]
  66. | Float32Array;
  67. export type ReadonlyQuat =
  68. | readonly [number, number, number, number]
  69. | Float32Array;
  70. export type ReadonlyQuat2 =
  71. | readonly [number, number, number, number, number, number, number, number]
  72. | Float32Array;
  73. export type ReadonlyVec2 = readonly [number, number] | Float32Array;
  74. export type ReadonlyVec3 = readonly [number, number, number] | Float32Array;
  75. export type ReadonlyVec4 =
  76. | readonly [number, number, number, number]
  77. | Float32Array;
  78. export module glMatrix {
  79. /**
  80. * Sets the type of array used when creating new vectors and matrices
  81. *
  82. * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array
  83. */
  84. export function setMatrixArrayType(type: ArrayConstructor | Float32ArrayConstructor): void;
  85. /**
  86. * Convert Degree To Radian
  87. *
  88. * @param {Number} a Angle in Degrees
  89. */
  90. export function toRadian(a: number): number;
  91. /**
  92. * Tests whether or not the arguments have approximately the same value, within an absolute
  93. * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less
  94. * than or equal to 1.0, and a relative tolerance is used for larger values)
  95. *
  96. * @param {Number} a The first number to test.
  97. * @param {Number} b The second number to test.
  98. * @returns {Boolean} True if the numbers are approximately equal, false otherwise.
  99. */
  100. export function equals(a: number, b: number): boolean;
  101. /**
  102. * Common utilities
  103. * @module glMatrix
  104. */
  105. export const EPSILON: 0.000001;
  106. export let ARRAY_TYPE: ArrayConstructor | Float32ArrayConstructor;
  107. export const RANDOM: () => number;
  108. }
  109. export module mat2 {
  110. /**
  111. * 2x2 Matrix
  112. * @module mat2
  113. */
  114. /**
  115. * Creates a new identity mat2
  116. *
  117. * @returns {mat2} a new 2x2 matrix
  118. */
  119. export function create(): mat2;
  120. /**
  121. * Creates a new mat2 initialized with values from an existing matrix
  122. *
  123. * @param {ReadonlyMat2} a matrix to clone
  124. * @returns {mat2} a new 2x2 matrix
  125. */
  126. export function clone(a: ReadonlyMat2): mat2;
  127. /**
  128. * Copy the values from one mat2 to another
  129. *
  130. * @param {mat2} out the receiving matrix
  131. * @param {ReadonlyMat2} a the source matrix
  132. * @returns {mat2} out
  133. */
  134. export function copy(out: mat2, a: ReadonlyMat2): mat2;
  135. /**
  136. * Set a mat2 to the identity matrix
  137. *
  138. * @param {mat2} out the receiving matrix
  139. * @returns {mat2} out
  140. */
  141. export function identity(out: mat2): mat2;
  142. /**
  143. * Create a new mat2 with the given values
  144. *
  145. * @param {Number} m00 Component in column 0, row 0 position (index 0)
  146. * @param {Number} m01 Component in column 0, row 1 position (index 1)
  147. * @param {Number} m10 Component in column 1, row 0 position (index 2)
  148. * @param {Number} m11 Component in column 1, row 1 position (index 3)
  149. * @returns {mat2} out A new 2x2 matrix
  150. */
  151. export function fromValues(m00: number, m01: number, m10: number, m11: number): mat2;
  152. /**
  153. * Set the components of a mat2 to the given values
  154. *
  155. * @param {mat2} out the receiving matrix
  156. * @param {Number} m00 Component in column 0, row 0 position (index 0)
  157. * @param {Number} m01 Component in column 0, row 1 position (index 1)
  158. * @param {Number} m10 Component in column 1, row 0 position (index 2)
  159. * @param {Number} m11 Component in column 1, row 1 position (index 3)
  160. * @returns {mat2} out
  161. */
  162. export function set(out: mat2, m00: number, m01: number, m10: number, m11: number): mat2;
  163. /**
  164. * Transpose the values of a mat2
  165. *
  166. * @param {mat2} out the receiving matrix
  167. * @param {ReadonlyMat2} a the source matrix
  168. * @returns {mat2} out
  169. */
  170. export function transpose(out: mat2, a: ReadonlyMat2): mat2;
  171. /**
  172. * Inverts a mat2
  173. *
  174. * @param {mat2} out the receiving matrix
  175. * @param {ReadonlyMat2} a the source matrix
  176. * @returns {mat2} out
  177. */
  178. export function invert(out: mat2, a: ReadonlyMat2): mat2;
  179. /**
  180. * Calculates the adjugate of a mat2
  181. *
  182. * @param {mat2} out the receiving matrix
  183. * @param {ReadonlyMat2} a the source matrix
  184. * @returns {mat2} out
  185. */
  186. export function adjoint(out: mat2, a: ReadonlyMat2): mat2;
  187. /**
  188. * Calculates the determinant of a mat2
  189. *
  190. * @param {ReadonlyMat2} a the source matrix
  191. * @returns {Number} determinant of a
  192. */
  193. export function determinant(a: ReadonlyMat2): number;
  194. /**
  195. * Multiplies two mat2's
  196. *
  197. * @param {mat2} out the receiving matrix
  198. * @param {ReadonlyMat2} a the first operand
  199. * @param {ReadonlyMat2} b the second operand
  200. * @returns {mat2} out
  201. */
  202. export function multiply(out: mat2, a: ReadonlyMat2, b: ReadonlyMat2): mat2;
  203. /**
  204. * Rotates a mat2 by the given angle
  205. *
  206. * @param {mat2} out the receiving matrix
  207. * @param {ReadonlyMat2} a the matrix to rotate
  208. * @param {Number} rad the angle to rotate the matrix by
  209. * @returns {mat2} out
  210. */
  211. export function rotate(out: mat2, a: ReadonlyMat2, rad: number): mat2;
  212. /**
  213. * Scales the mat2 by the dimensions in the given vec2
  214. *
  215. * @param {mat2} out the receiving matrix
  216. * @param {ReadonlyMat2} a the matrix to rotate
  217. * @param {ReadonlyVec2} v the vec2 to scale the matrix by
  218. * @returns {mat2} out
  219. **/
  220. export function scale(out: mat2, a: ReadonlyMat2, v: ReadonlyVec2): mat2;
  221. /**
  222. * Creates a matrix from a given angle
  223. * This is equivalent to (but much faster than):
  224. *
  225. * mat2.identity(dest);
  226. * mat2.rotate(dest, dest, rad);
  227. *
  228. * @param {mat2} out mat2 receiving operation result
  229. * @param {Number} rad the angle to rotate the matrix by
  230. * @returns {mat2} out
  231. */
  232. export function fromRotation(out: mat2, rad: number): mat2;
  233. /**
  234. * Creates a matrix from a vector scaling
  235. * This is equivalent to (but much faster than):
  236. *
  237. * mat2.identity(dest);
  238. * mat2.scale(dest, dest, vec);
  239. *
  240. * @param {mat2} out mat2 receiving operation result
  241. * @param {ReadonlyVec2} v Scaling vector
  242. * @returns {mat2} out
  243. */
  244. export function fromScaling(out: mat2, v: ReadonlyVec2): mat2;
  245. /**
  246. * Returns a string representation of a mat2
  247. *
  248. * @param {ReadonlyMat2} a matrix to represent as a string
  249. * @returns {String} string representation of the matrix
  250. */
  251. export function str(a: ReadonlyMat2): string;
  252. /**
  253. * Returns Frobenius norm of a mat2
  254. *
  255. * @param {ReadonlyMat2} a the matrix to calculate Frobenius norm of
  256. * @returns {Number} Frobenius norm
  257. */
  258. export function frob(a: ReadonlyMat2): number;
  259. /**
  260. * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
  261. * @param {ReadonlyMat2} L the lower triangular matrix
  262. * @param {ReadonlyMat2} D the diagonal matrix
  263. * @param {ReadonlyMat2} U the upper triangular matrix
  264. * @param {ReadonlyMat2} a the input matrix to factorize
  265. */
  266. export function LDU(L: ReadonlyMat2, D: ReadonlyMat2, U: ReadonlyMat2, a: ReadonlyMat2): ReadonlyMat2[];
  267. /**
  268. * Adds two mat2's
  269. *
  270. * @param {mat2} out the receiving matrix
  271. * @param {ReadonlyMat2} a the first operand
  272. * @param {ReadonlyMat2} b the second operand
  273. * @returns {mat2} out
  274. */
  275. export function add(out: mat2, a: ReadonlyMat2, b: ReadonlyMat2): mat2;
  276. /**
  277. * Subtracts matrix b from matrix a
  278. *
  279. * @param {mat2} out the receiving matrix
  280. * @param {ReadonlyMat2} a the first operand
  281. * @param {ReadonlyMat2} b the second operand
  282. * @returns {mat2} out
  283. */
  284. export function subtract(out: mat2, a: ReadonlyMat2, b: ReadonlyMat2): mat2;
  285. /**
  286. * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
  287. *
  288. * @param {ReadonlyMat2} a The first matrix.
  289. * @param {ReadonlyMat2} b The second matrix.
  290. * @returns {Boolean} True if the matrices are equal, false otherwise.
  291. */
  292. export function exactEquals(a: ReadonlyMat2, b: ReadonlyMat2): boolean;
  293. /**
  294. * Returns whether or not the matrices have approximately the same elements in the same position.
  295. *
  296. * @param {ReadonlyMat2} a The first matrix.
  297. * @param {ReadonlyMat2} b The second matrix.
  298. * @returns {Boolean} True if the matrices are equal, false otherwise.
  299. */
  300. export function equals(a: ReadonlyMat2, b: ReadonlyMat2): boolean;
  301. /**
  302. * Multiply each element of the matrix by a scalar.
  303. *
  304. * @param {mat2} out the receiving matrix
  305. * @param {ReadonlyMat2} a the matrix to scale
  306. * @param {Number} b amount to scale the matrix's elements by
  307. * @returns {mat2} out
  308. */
  309. export function multiplyScalar(out: mat2, a: ReadonlyMat2, b: number): mat2;
  310. /**
  311. * Adds two mat2's after multiplying each element of the second operand by a scalar value.
  312. *
  313. * @param {mat2} out the receiving vector
  314. * @param {ReadonlyMat2} a the first operand
  315. * @param {ReadonlyMat2} b the second operand
  316. * @param {Number} scale the amount to scale b's elements by before adding
  317. * @returns {mat2} out
  318. */
  319. export function multiplyScalarAndAdd(out: mat2, a: ReadonlyMat2, b: ReadonlyMat2, scale: number): mat2;
  320. /**
  321. * Multiplies two mat2's
  322. *
  323. * @param {mat2} out the receiving matrix
  324. * @param {ReadonlyMat2} a the first operand
  325. * @param {ReadonlyMat2} b the second operand
  326. * @returns {mat2} out
  327. */
  328. export function mul(out: mat2, a: ReadonlyMat2, b: ReadonlyMat2): mat2;
  329. /**
  330. * Subtracts matrix b from matrix a
  331. *
  332. * @param {mat2} out the receiving matrix
  333. * @param {ReadonlyMat2} a the first operand
  334. * @param {ReadonlyMat2} b the second operand
  335. * @returns {mat2} out
  336. */
  337. export function sub(out: mat2, a: ReadonlyMat2, b: ReadonlyMat2): mat2;
  338. }
  339. export module mat2d {
  340. /**
  341. * 2x3 Matrix
  342. * @module mat2d
  343. * @description
  344. * A mat2d contains six elements defined as:
  345. * <pre>
  346. * [a, b,
  347. * c, d,
  348. * tx, ty]
  349. * </pre>
  350. * This is a short form for the 3x3 matrix:
  351. * <pre>
  352. * [a, b, 0,
  353. * c, d, 0,
  354. * tx, ty, 1]
  355. * </pre>
  356. * The last column is ignored so the array is shorter and operations are faster.
  357. */
  358. /**
  359. * Creates a new identity mat2d
  360. *
  361. * @returns {mat2d} a new 2x3 matrix
  362. */
  363. export function create(): mat2d;
  364. /**
  365. * Creates a new mat2d initialized with values from an existing matrix
  366. *
  367. * @param {ReadonlyMat2d} a matrix to clone
  368. * @returns {mat2d} a new 2x3 matrix
  369. */
  370. export function clone(a: ReadonlyMat2d): mat2d;
  371. /**
  372. * Copy the values from one mat2d to another
  373. *
  374. * @param {mat2d} out the receiving matrix
  375. * @param {ReadonlyMat2d} a the source matrix
  376. * @returns {mat2d} out
  377. */
  378. export function copy(out: mat2d, a: ReadonlyMat2d): mat2d;
  379. /**
  380. * Set a mat2d to the identity matrix
  381. *
  382. * @param {mat2d} out the receiving matrix
  383. * @returns {mat2d} out
  384. */
  385. export function identity(out: mat2d): mat2d;
  386. /**
  387. * Create a new mat2d with the given values
  388. *
  389. * @param {Number} a Component A (index 0)
  390. * @param {Number} b Component B (index 1)
  391. * @param {Number} c Component C (index 2)
  392. * @param {Number} d Component D (index 3)
  393. * @param {Number} tx Component TX (index 4)
  394. * @param {Number} ty Component TY (index 5)
  395. * @returns {mat2d} A new mat2d
  396. */
  397. export function fromValues(a: number, b: number, c: number, d: number, tx: number, ty: number): mat2d;
  398. /**
  399. * Set the components of a mat2d to the given values
  400. *
  401. * @param {mat2d} out the receiving matrix
  402. * @param {Number} a Component A (index 0)
  403. * @param {Number} b Component B (index 1)
  404. * @param {Number} c Component C (index 2)
  405. * @param {Number} d Component D (index 3)
  406. * @param {Number} tx Component TX (index 4)
  407. * @param {Number} ty Component TY (index 5)
  408. * @returns {mat2d} out
  409. */
  410. export function set(out: mat2d, a: number, b: number, c: number, d: number, tx: number, ty: number): mat2d;
  411. /**
  412. * Inverts a mat2d
  413. *
  414. * @param {mat2d} out the receiving matrix
  415. * @param {ReadonlyMat2d} a the source matrix
  416. * @returns {mat2d} out
  417. */
  418. export function invert(out: mat2d, a: ReadonlyMat2d): mat2d;
  419. /**
  420. * Calculates the determinant of a mat2d
  421. *
  422. * @param {ReadonlyMat2d} a the source matrix
  423. * @returns {Number} determinant of a
  424. */
  425. export function determinant(a: ReadonlyMat2d): number;
  426. /**
  427. * Multiplies two mat2d's
  428. *
  429. * @param {mat2d} out the receiving matrix
  430. * @param {ReadonlyMat2d} a the first operand
  431. * @param {ReadonlyMat2d} b the second operand
  432. * @returns {mat2d} out
  433. */
  434. export function multiply(out: mat2d, a: ReadonlyMat2d, b: ReadonlyMat2d): mat2d;
  435. /**
  436. * Rotates a mat2d by the given angle
  437. *
  438. * @param {mat2d} out the receiving matrix
  439. * @param {ReadonlyMat2d} a the matrix to rotate
  440. * @param {Number} rad the angle to rotate the matrix by
  441. * @returns {mat2d} out
  442. */
  443. export function rotate(out: mat2d, a: ReadonlyMat2d, rad: number): mat2d;
  444. /**
  445. * Scales the mat2d by the dimensions in the given vec2
  446. *
  447. * @param {mat2d} out the receiving matrix
  448. * @param {ReadonlyMat2d} a the matrix to translate
  449. * @param {ReadonlyVec2} v the vec2 to scale the matrix by
  450. * @returns {mat2d} out
  451. **/
  452. export function scale(out: mat2d, a: ReadonlyMat2d, v: ReadonlyVec2): mat2d;
  453. /**
  454. * Translates the mat2d by the dimensions in the given vec2
  455. *
  456. * @param {mat2d} out the receiving matrix
  457. * @param {ReadonlyMat2d} a the matrix to translate
  458. * @param {ReadonlyVec2} v the vec2 to translate the matrix by
  459. * @returns {mat2d} out
  460. **/
  461. export function translate(out: mat2d, a: ReadonlyMat2d, v: ReadonlyVec2): mat2d;
  462. /**
  463. * Creates a matrix from a given angle
  464. * This is equivalent to (but much faster than):
  465. *
  466. * mat2d.identity(dest);
  467. * mat2d.rotate(dest, dest, rad);
  468. *
  469. * @param {mat2d} out mat2d receiving operation result
  470. * @param {Number} rad the angle to rotate the matrix by
  471. * @returns {mat2d} out
  472. */
  473. export function fromRotation(out: mat2d, rad: number): mat2d;
  474. /**
  475. * Creates a matrix from a vector scaling
  476. * This is equivalent to (but much faster than):
  477. *
  478. * mat2d.identity(dest);
  479. * mat2d.scale(dest, dest, vec);
  480. *
  481. * @param {mat2d} out mat2d receiving operation result
  482. * @param {ReadonlyVec2} v Scaling vector
  483. * @returns {mat2d} out
  484. */
  485. export function fromScaling(out: mat2d, v: ReadonlyVec2): mat2d;
  486. /**
  487. * Creates a matrix from a vector translation
  488. * This is equivalent to (but much faster than):
  489. *
  490. * mat2d.identity(dest);
  491. * mat2d.translate(dest, dest, vec);
  492. *
  493. * @param {mat2d} out mat2d receiving operation result
  494. * @param {ReadonlyVec2} v Translation vector
  495. * @returns {mat2d} out
  496. */
  497. export function fromTranslation(out: mat2d, v: ReadonlyVec2): mat2d;
  498. /**
  499. * Returns a string representation of a mat2d
  500. *
  501. * @param {ReadonlyMat2d} a matrix to represent as a string
  502. * @returns {String} string representation of the matrix
  503. */
  504. export function str(a: ReadonlyMat2d): string;
  505. /**
  506. * Returns Frobenius norm of a mat2d
  507. *
  508. * @param {ReadonlyMat2d} a the matrix to calculate Frobenius norm of
  509. * @returns {Number} Frobenius norm
  510. */
  511. export function frob(a: ReadonlyMat2d): number;
  512. /**
  513. * Adds two mat2d's
  514. *
  515. * @param {mat2d} out the receiving matrix
  516. * @param {ReadonlyMat2d} a the first operand
  517. * @param {ReadonlyMat2d} b the second operand
  518. * @returns {mat2d} out
  519. */
  520. export function add(out: mat2d, a: ReadonlyMat2d, b: ReadonlyMat2d): mat2d;
  521. /**
  522. * Subtracts matrix b from matrix a
  523. *
  524. * @param {mat2d} out the receiving matrix
  525. * @param {ReadonlyMat2d} a the first operand
  526. * @param {ReadonlyMat2d} b the second operand
  527. * @returns {mat2d} out
  528. */
  529. export function subtract(out: mat2d, a: ReadonlyMat2d, b: ReadonlyMat2d): mat2d;
  530. /**
  531. * Multiply each element of the matrix by a scalar.
  532. *
  533. * @param {mat2d} out the receiving matrix
  534. * @param {ReadonlyMat2d} a the matrix to scale
  535. * @param {Number} b amount to scale the matrix's elements by
  536. * @returns {mat2d} out
  537. */
  538. export function multiplyScalar(out: mat2d, a: ReadonlyMat2d, b: number): mat2d;
  539. /**
  540. * Adds two mat2d's after multiplying each element of the second operand by a scalar value.
  541. *
  542. * @param {mat2d} out the receiving vector
  543. * @param {ReadonlyMat2d} a the first operand
  544. * @param {ReadonlyMat2d} b the second operand
  545. * @param {Number} scale the amount to scale b's elements by before adding
  546. * @returns {mat2d} out
  547. */
  548. export function multiplyScalarAndAdd(out: mat2d, a: ReadonlyMat2d, b: ReadonlyMat2d, scale: number): mat2d;
  549. /**
  550. * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
  551. *
  552. * @param {ReadonlyMat2d} a The first matrix.
  553. * @param {ReadonlyMat2d} b The second matrix.
  554. * @returns {Boolean} True if the matrices are equal, false otherwise.
  555. */
  556. export function exactEquals(a: ReadonlyMat2d, b: ReadonlyMat2d): boolean;
  557. /**
  558. * Returns whether or not the matrices have approximately the same elements in the same position.
  559. *
  560. * @param {ReadonlyMat2d} a The first matrix.
  561. * @param {ReadonlyMat2d} b The second matrix.
  562. * @returns {Boolean} True if the matrices are equal, false otherwise.
  563. */
  564. export function equals(a: ReadonlyMat2d, b: ReadonlyMat2d): boolean;
  565. /**
  566. * Multiplies two mat2d's
  567. *
  568. * @param {mat2d} out the receiving matrix
  569. * @param {ReadonlyMat2d} a the first operand
  570. * @param {ReadonlyMat2d} b the second operand
  571. * @returns {mat2d} out
  572. */
  573. export function mul(out: mat2d, a: ReadonlyMat2d, b: ReadonlyMat2d): mat2d;
  574. /**
  575. * Subtracts matrix b from matrix a
  576. *
  577. * @param {mat2d} out the receiving matrix
  578. * @param {ReadonlyMat2d} a the first operand
  579. * @param {ReadonlyMat2d} b the second operand
  580. * @returns {mat2d} out
  581. */
  582. export function sub(out: mat2d, a: ReadonlyMat2d, b: ReadonlyMat2d): mat2d;
  583. }
  584. export module mat3 {
  585. /**
  586. * 3x3 Matrix
  587. * @module mat3
  588. */
  589. /**
  590. * Creates a new identity mat3
  591. *
  592. * @returns {mat3} a new 3x3 matrix
  593. */
  594. export function create(): mat3;
  595. /**
  596. * Copies the upper-left 3x3 values into the given mat3.
  597. *
  598. * @param {mat3} out the receiving 3x3 matrix
  599. * @param {ReadonlyMat4} a the source 4x4 matrix
  600. * @returns {mat3} out
  601. */
  602. export function fromMat4(out: mat3, a: ReadonlyMat4): mat3;
  603. /**
  604. * Creates a new mat3 initialized with values from an existing matrix
  605. *
  606. * @param {ReadonlyMat3} a matrix to clone
  607. * @returns {mat3} a new 3x3 matrix
  608. */
  609. export function clone(a: ReadonlyMat3): mat3;
  610. /**
  611. * Copy the values from one mat3 to another
  612. *
  613. * @param {mat3} out the receiving matrix
  614. * @param {ReadonlyMat3} a the source matrix
  615. * @returns {mat3} out
  616. */
  617. export function copy(out: mat3, a: ReadonlyMat3): mat3;
  618. /**
  619. * Create a new mat3 with the given values
  620. *
  621. * @param {Number} m00 Component in column 0, row 0 position (index 0)
  622. * @param {Number} m01 Component in column 0, row 1 position (index 1)
  623. * @param {Number} m02 Component in column 0, row 2 position (index 2)
  624. * @param {Number} m10 Component in column 1, row 0 position (index 3)
  625. * @param {Number} m11 Component in column 1, row 1 position (index 4)
  626. * @param {Number} m12 Component in column 1, row 2 position (index 5)
  627. * @param {Number} m20 Component in column 2, row 0 position (index 6)
  628. * @param {Number} m21 Component in column 2, row 1 position (index 7)
  629. * @param {Number} m22 Component in column 2, row 2 position (index 8)
  630. * @returns {mat3} A new mat3
  631. */
  632. export function fromValues(m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): mat3;
  633. /**
  634. * Set the components of a mat3 to the given values
  635. *
  636. * @param {mat3} out the receiving matrix
  637. * @param {Number} m00 Component in column 0, row 0 position (index 0)
  638. * @param {Number} m01 Component in column 0, row 1 position (index 1)
  639. * @param {Number} m02 Component in column 0, row 2 position (index 2)
  640. * @param {Number} m10 Component in column 1, row 0 position (index 3)
  641. * @param {Number} m11 Component in column 1, row 1 position (index 4)
  642. * @param {Number} m12 Component in column 1, row 2 position (index 5)
  643. * @param {Number} m20 Component in column 2, row 0 position (index 6)
  644. * @param {Number} m21 Component in column 2, row 1 position (index 7)
  645. * @param {Number} m22 Component in column 2, row 2 position (index 8)
  646. * @returns {mat3} out
  647. */
  648. export function set(out: mat3, m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): mat3;
  649. /**
  650. * Set a mat3 to the identity matrix
  651. *
  652. * @param {mat3} out the receiving matrix
  653. * @returns {mat3} out
  654. */
  655. export function identity(out: mat3): mat3;
  656. /**
  657. * Transpose the values of a mat3
  658. *
  659. * @param {mat3} out the receiving matrix
  660. * @param {ReadonlyMat3} a the source matrix
  661. * @returns {mat3} out
  662. */
  663. export function transpose(out: mat3, a: ReadonlyMat3): mat3;
  664. /**
  665. * Inverts a mat3
  666. *
  667. * @param {mat3} out the receiving matrix
  668. * @param {ReadonlyMat3} a the source matrix
  669. * @returns {mat3} out
  670. */
  671. export function invert(out: mat3, a: ReadonlyMat3): mat3;
  672. /**
  673. * Calculates the adjugate of a mat3
  674. *
  675. * @param {mat3} out the receiving matrix
  676. * @param {ReadonlyMat3} a the source matrix
  677. * @returns {mat3} out
  678. */
  679. export function adjoint(out: mat3, a: ReadonlyMat3): mat3;
  680. /**
  681. * Calculates the determinant of a mat3
  682. *
  683. * @param {ReadonlyMat3} a the source matrix
  684. * @returns {Number} determinant of a
  685. */
  686. export function determinant(a: ReadonlyMat3): number;
  687. /**
  688. * Multiplies two mat3's
  689. *
  690. * @param {mat3} out the receiving matrix
  691. * @param {ReadonlyMat3} a the first operand
  692. * @param {ReadonlyMat3} b the second operand
  693. * @returns {mat3} out
  694. */
  695. export function multiply(out: mat3, a: ReadonlyMat3, b: ReadonlyMat3): mat3;
  696. /**
  697. * Translate a mat3 by the given vector
  698. *
  699. * @param {mat3} out the receiving matrix
  700. * @param {ReadonlyMat3} a the matrix to translate
  701. * @param {ReadonlyVec2} v vector to translate by
  702. * @returns {mat3} out
  703. */
  704. export function translate(out: mat3, a: ReadonlyMat3, v: ReadonlyVec2): mat3;
  705. /**
  706. * Rotates a mat3 by the given angle
  707. *
  708. * @param {mat3} out the receiving matrix
  709. * @param {ReadonlyMat3} a the matrix to rotate
  710. * @param {Number} rad the angle to rotate the matrix by
  711. * @returns {mat3} out
  712. */
  713. export function rotate(out: mat3, a: ReadonlyMat3, rad: number): mat3;
  714. /**
  715. * Scales the mat3 by the dimensions in the given vec2
  716. *
  717. * @param {mat3} out the receiving matrix
  718. * @param {ReadonlyMat3} a the matrix to rotate
  719. * @param {ReadonlyVec2} v the vec2 to scale the matrix by
  720. * @returns {mat3} out
  721. **/
  722. export function scale(out: mat3, a: ReadonlyMat3, v: ReadonlyVec2): mat3;
  723. /**
  724. * Creates a matrix from a vector translation
  725. * This is equivalent to (but much faster than):
  726. *
  727. * mat3.identity(dest);
  728. * mat3.translate(dest, dest, vec);
  729. *
  730. * @param {mat3} out mat3 receiving operation result
  731. * @param {ReadonlyVec2} v Translation vector
  732. * @returns {mat3} out
  733. */
  734. export function fromTranslation(out: mat3, v: ReadonlyVec2): mat3;
  735. /**
  736. * Creates a matrix from a given angle
  737. * This is equivalent to (but much faster than):
  738. *
  739. * mat3.identity(dest);
  740. * mat3.rotate(dest, dest, rad);
  741. *
  742. * @param {mat3} out mat3 receiving operation result
  743. * @param {Number} rad the angle to rotate the matrix by
  744. * @returns {mat3} out
  745. */
  746. export function fromRotation(out: mat3, rad: number): mat3;
  747. /**
  748. * Creates a matrix from a vector scaling
  749. * This is equivalent to (but much faster than):
  750. *
  751. * mat3.identity(dest);
  752. * mat3.scale(dest, dest, vec);
  753. *
  754. * @param {mat3} out mat3 receiving operation result
  755. * @param {ReadonlyVec2} v Scaling vector
  756. * @returns {mat3} out
  757. */
  758. export function fromScaling(out: mat3, v: ReadonlyVec2): mat3;
  759. /**
  760. * Copies the values from a mat2d into a mat3
  761. *
  762. * @param {mat3} out the receiving matrix
  763. * @param {ReadonlyMat2d} a the matrix to copy
  764. * @returns {mat3} out
  765. **/
  766. export function fromMat2d(out: mat3, a: ReadonlyMat2d): mat3;
  767. /**
  768. * Calculates a 3x3 matrix from the given quaternion
  769. *
  770. * @param {mat3} out mat3 receiving operation result
  771. * @param {ReadonlyQuat} q Quaternion to create matrix from
  772. *
  773. * @returns {mat3} out
  774. */
  775. export function fromQuat(out: mat3, q: ReadonlyQuat): mat3;
  776. /**
  777. * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
  778. *
  779. * @param {mat3} out mat3 receiving operation result
  780. * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from
  781. *
  782. * @returns {mat3} out
  783. */
  784. export function normalFromMat4(out: mat3, a: ReadonlyMat4): mat3;
  785. /**
  786. * Generates a 2D projection matrix with the given bounds
  787. *
  788. * @param {mat3} out mat3 frustum matrix will be written into
  789. * @param {number} width Width of your gl context
  790. * @param {number} height Height of gl context
  791. * @returns {mat3} out
  792. */
  793. export function projection(out: mat3, width: number, height: number): mat3;
  794. /**
  795. * Returns a string representation of a mat3
  796. *
  797. * @param {ReadonlyMat3} a matrix to represent as a string
  798. * @returns {String} string representation of the matrix
  799. */
  800. export function str(a: ReadonlyMat3): string;
  801. /**
  802. * Returns Frobenius norm of a mat3
  803. *
  804. * @param {ReadonlyMat3} a the matrix to calculate Frobenius norm of
  805. * @returns {Number} Frobenius norm
  806. */
  807. export function frob(a: ReadonlyMat3): number;
  808. /**
  809. * Adds two mat3's
  810. *
  811. * @param {mat3} out the receiving matrix
  812. * @param {ReadonlyMat3} a the first operand
  813. * @param {ReadonlyMat3} b the second operand
  814. * @returns {mat3} out
  815. */
  816. export function add(out: mat3, a: ReadonlyMat3, b: ReadonlyMat3): mat3;
  817. /**
  818. * Subtracts matrix b from matrix a
  819. *
  820. * @param {mat3} out the receiving matrix
  821. * @param {ReadonlyMat3} a the first operand
  822. * @param {ReadonlyMat3} b the second operand
  823. * @returns {mat3} out
  824. */
  825. export function subtract(out: mat3, a: ReadonlyMat3, b: ReadonlyMat3): mat3;
  826. /**
  827. * Multiply each element of the matrix by a scalar.
  828. *
  829. * @param {mat3} out the receiving matrix
  830. * @param {ReadonlyMat3} a the matrix to scale
  831. * @param {Number} b amount to scale the matrix's elements by
  832. * @returns {mat3} out
  833. */
  834. export function multiplyScalar(out: mat3, a: ReadonlyMat3, b: number): mat3;
  835. /**
  836. * Adds two mat3's after multiplying each element of the second operand by a scalar value.
  837. *
  838. * @param {mat3} out the receiving vector
  839. * @param {ReadonlyMat3} a the first operand
  840. * @param {ReadonlyMat3} b the second operand
  841. * @param {Number} scale the amount to scale b's elements by before adding
  842. * @returns {mat3} out
  843. */
  844. export function multiplyScalarAndAdd(out: mat3, a: ReadonlyMat3, b: ReadonlyMat3, scale: number): mat3;
  845. /**
  846. * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
  847. *
  848. * @param {ReadonlyMat3} a The first matrix.
  849. * @param {ReadonlyMat3} b The second matrix.
  850. * @returns {Boolean} True if the matrices are equal, false otherwise.
  851. */
  852. export function exactEquals(a: ReadonlyMat3, b: ReadonlyMat3): boolean;
  853. /**
  854. * Returns whether or not the matrices have approximately the same elements in the same position.
  855. *
  856. * @param {ReadonlyMat3} a The first matrix.
  857. * @param {ReadonlyMat3} b The second matrix.
  858. * @returns {Boolean} True if the matrices are equal, false otherwise.
  859. */
  860. export function equals(a: ReadonlyMat3, b: ReadonlyMat3): boolean;
  861. /**
  862. * Multiplies two mat3's
  863. *
  864. * @param {mat3} out the receiving matrix
  865. * @param {ReadonlyMat3} a the first operand
  866. * @param {ReadonlyMat3} b the second operand
  867. * @returns {mat3} out
  868. */
  869. export function mul(out: mat3, a: ReadonlyMat3, b: ReadonlyMat3): mat3;
  870. /**
  871. * Subtracts matrix b from matrix a
  872. *
  873. * @param {mat3} out the receiving matrix
  874. * @param {ReadonlyMat3} a the first operand
  875. * @param {ReadonlyMat3} b the second operand
  876. * @returns {mat3} out
  877. */
  878. export function sub(out: mat3, a: ReadonlyMat3, b: ReadonlyMat3): mat3;
  879. }
  880. export module mat4 {
  881. /**
  882. * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.
  883. * @module mat4
  884. */
  885. /**
  886. * Creates a new identity mat4
  887. *
  888. * @returns {mat4} a new 4x4 matrix
  889. */
  890. export function create(): mat4;
  891. /**
  892. * Creates a new mat4 initialized with values from an existing matrix
  893. *
  894. * @param {ReadonlyMat4} a matrix to clone
  895. * @returns {mat4} a new 4x4 matrix
  896. */
  897. export function clone(a: ReadonlyMat4): mat4;
  898. /**
  899. * Copy the values from one mat4 to another
  900. *
  901. * @param {mat4} out the receiving matrix
  902. * @param {ReadonlyMat4} a the source matrix
  903. * @returns {mat4} out
  904. */
  905. export function copy(out: mat4, a: ReadonlyMat4): mat4;
  906. /**
  907. * Create a new mat4 with the given values
  908. *
  909. * @param {Number} m00 Component in column 0, row 0 position (index 0)
  910. * @param {Number} m01 Component in column 0, row 1 position (index 1)
  911. * @param {Number} m02 Component in column 0, row 2 position (index 2)
  912. * @param {Number} m03 Component in column 0, row 3 position (index 3)
  913. * @param {Number} m10 Component in column 1, row 0 position (index 4)
  914. * @param {Number} m11 Component in column 1, row 1 position (index 5)
  915. * @param {Number} m12 Component in column 1, row 2 position (index 6)
  916. * @param {Number} m13 Component in column 1, row 3 position (index 7)
  917. * @param {Number} m20 Component in column 2, row 0 position (index 8)
  918. * @param {Number} m21 Component in column 2, row 1 position (index 9)
  919. * @param {Number} m22 Component in column 2, row 2 position (index 10)
  920. * @param {Number} m23 Component in column 2, row 3 position (index 11)
  921. * @param {Number} m30 Component in column 3, row 0 position (index 12)
  922. * @param {Number} m31 Component in column 3, row 1 position (index 13)
  923. * @param {Number} m32 Component in column 3, row 2 position (index 14)
  924. * @param {Number} m33 Component in column 3, row 3 position (index 15)
  925. * @returns {mat4} A new mat4
  926. */
  927. export function fromValues(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): mat4;
  928. /**
  929. * Set the components of a mat4 to the given values
  930. *
  931. * @param {mat4} out the receiving matrix
  932. * @param {Number} m00 Component in column 0, row 0 position (index 0)
  933. * @param {Number} m01 Component in column 0, row 1 position (index 1)
  934. * @param {Number} m02 Component in column 0, row 2 position (index 2)
  935. * @param {Number} m03 Component in column 0, row 3 position (index 3)
  936. * @param {Number} m10 Component in column 1, row 0 position (index 4)
  937. * @param {Number} m11 Component in column 1, row 1 position (index 5)
  938. * @param {Number} m12 Component in column 1, row 2 position (index 6)
  939. * @param {Number} m13 Component in column 1, row 3 position (index 7)
  940. * @param {Number} m20 Component in column 2, row 0 position (index 8)
  941. * @param {Number} m21 Component in column 2, row 1 position (index 9)
  942. * @param {Number} m22 Component in column 2, row 2 position (index 10)
  943. * @param {Number} m23 Component in column 2, row 3 position (index 11)
  944. * @param {Number} m30 Component in column 3, row 0 position (index 12)
  945. * @param {Number} m31 Component in column 3, row 1 position (index 13)
  946. * @param {Number} m32 Component in column 3, row 2 position (index 14)
  947. * @param {Number} m33 Component in column 3, row 3 position (index 15)
  948. * @returns {mat4} out
  949. */
  950. export function set(out: mat4, m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): mat4;
  951. /**
  952. * Set a mat4 to the identity matrix
  953. *
  954. * @param {mat4} out the receiving matrix
  955. * @returns {mat4} out
  956. */
  957. export function identity(out: mat4): mat4;
  958. /**
  959. * Transpose the values of a mat4
  960. *
  961. * @param {mat4} out the receiving matrix
  962. * @param {ReadonlyMat4} a the source matrix
  963. * @returns {mat4} out
  964. */
  965. export function transpose(out: mat4, a: ReadonlyMat4): mat4;
  966. /**
  967. * Inverts a mat4
  968. *
  969. * @param {mat4} out the receiving matrix
  970. * @param {ReadonlyMat4} a the source matrix
  971. * @returns {mat4} out
  972. */
  973. export function invert(out: mat4, a: ReadonlyMat4): mat4;
  974. /**
  975. * Calculates the adjugate of a mat4
  976. *
  977. * @param {mat4} out the receiving matrix
  978. * @param {ReadonlyMat4} a the source matrix
  979. * @returns {mat4} out
  980. */
  981. export function adjoint(out: mat4, a: ReadonlyMat4): mat4;
  982. /**
  983. * Calculates the determinant of a mat4
  984. *
  985. * @param {ReadonlyMat4} a the source matrix
  986. * @returns {Number} determinant of a
  987. */
  988. export function determinant(a: ReadonlyMat4): number;
  989. /**
  990. * Multiplies two mat4s
  991. *
  992. * @param {mat4} out the receiving matrix
  993. * @param {ReadonlyMat4} a the first operand
  994. * @param {ReadonlyMat4} b the second operand
  995. * @returns {mat4} out
  996. */
  997. export function multiply(out: mat4, a: ReadonlyMat4, b: ReadonlyMat4): mat4;
  998. /**
  999. * Translate a mat4 by the given vector
  1000. *
  1001. * @param {mat4} out the receiving matrix
  1002. * @param {ReadonlyMat4} a the matrix to translate
  1003. * @param {ReadonlyVec3} v vector to translate by
  1004. * @returns {mat4} out
  1005. */
  1006. export function translate(out: mat4, a: ReadonlyMat4, v: ReadonlyVec3): mat4;
  1007. /**
  1008. * Scales the mat4 by the dimensions in the given vec3 not using vectorization
  1009. *
  1010. * @param {mat4} out the receiving matrix
  1011. * @param {ReadonlyMat4} a the matrix to scale
  1012. * @param {ReadonlyVec3} v the vec3 to scale the matrix by
  1013. * @returns {mat4} out
  1014. **/
  1015. export function scale(out: mat4, a: ReadonlyMat4, v: ReadonlyVec3): mat4;
  1016. /**
  1017. * Rotates a mat4 by the given angle around the given axis
  1018. *
  1019. * @param {mat4} out the receiving matrix
  1020. * @param {ReadonlyMat4} a the matrix to rotate
  1021. * @param {Number} rad the angle to rotate the matrix by
  1022. * @param {ReadonlyVec3} axis the axis to rotate around
  1023. * @returns {mat4} out
  1024. */
  1025. export function rotate(out: mat4, a: ReadonlyMat4, rad: number, axis: ReadonlyVec3): mat4;
  1026. /**
  1027. * Rotates a matrix by the given angle around the X axis
  1028. *
  1029. * @param {mat4} out the receiving matrix
  1030. * @param {ReadonlyMat4} a the matrix to rotate
  1031. * @param {Number} rad the angle to rotate the matrix by
  1032. * @returns {mat4} out
  1033. */
  1034. export function rotateX(out: mat4, a: ReadonlyMat4, rad: number): mat4;
  1035. /**
  1036. * Rotates a matrix by the given angle around the Y axis
  1037. *
  1038. * @param {mat4} out the receiving matrix
  1039. * @param {ReadonlyMat4} a the matrix to rotate
  1040. * @param {Number} rad the angle to rotate the matrix by
  1041. * @returns {mat4} out
  1042. */
  1043. export function rotateY(out: mat4, a: ReadonlyMat4, rad: number): mat4;
  1044. /**
  1045. * Rotates a matrix by the given angle around the Z axis
  1046. *
  1047. * @param {mat4} out the receiving matrix
  1048. * @param {ReadonlyMat4} a the matrix to rotate
  1049. * @param {Number} rad the angle to rotate the matrix by
  1050. * @returns {mat4} out
  1051. */
  1052. export function rotateZ(out: mat4, a: ReadonlyMat4, rad: number): mat4;
  1053. /**
  1054. * Creates a matrix from a vector translation
  1055. * This is equivalent to (but much faster than):
  1056. *
  1057. * mat4.identity(dest);
  1058. * mat4.translate(dest, dest, vec);
  1059. *
  1060. * @param {mat4} out mat4 receiving operation result
  1061. * @param {ReadonlyVec3} v Translation vector
  1062. * @returns {mat4} out
  1063. */
  1064. export function fromTranslation(out: mat4, v: ReadonlyVec3): mat4;
  1065. /**
  1066. * Creates a matrix from a vector scaling
  1067. * This is equivalent to (but much faster than):
  1068. *
  1069. * mat4.identity(dest);
  1070. * mat4.scale(dest, dest, vec);
  1071. *
  1072. * @param {mat4} out mat4 receiving operation result
  1073. * @param {ReadonlyVec3} v Scaling vector
  1074. * @returns {mat4} out
  1075. */
  1076. export function fromScaling(out: mat4, v: ReadonlyVec3): mat4;
  1077. /**
  1078. * Creates a matrix from a given angle around a given axis
  1079. * This is equivalent to (but much faster than):
  1080. *
  1081. * mat4.identity(dest);
  1082. * mat4.rotate(dest, dest, rad, axis);
  1083. *
  1084. * @param {mat4} out mat4 receiving operation result
  1085. * @param {Number} rad the angle to rotate the matrix by
  1086. * @param {ReadonlyVec3} axis the axis to rotate around
  1087. * @returns {mat4} out
  1088. */
  1089. export function fromRotation(out: mat4, rad: number, axis: ReadonlyVec3): mat4;
  1090. /**
  1091. * Creates a matrix from the given angle around the X axis
  1092. * This is equivalent to (but much faster than):
  1093. *
  1094. * mat4.identity(dest);
  1095. * mat4.rotateX(dest, dest, rad);
  1096. *
  1097. * @param {mat4} out mat4 receiving operation result
  1098. * @param {Number} rad the angle to rotate the matrix by
  1099. * @returns {mat4} out
  1100. */
  1101. export function fromXRotation(out: mat4, rad: number): mat4;
  1102. /**
  1103. * Creates a matrix from the given angle around the Y axis
  1104. * This is equivalent to (but much faster than):
  1105. *
  1106. * mat4.identity(dest);
  1107. * mat4.rotateY(dest, dest, rad);
  1108. *
  1109. * @param {mat4} out mat4 receiving operation result
  1110. * @param {Number} rad the angle to rotate the matrix by
  1111. * @returns {mat4} out
  1112. */
  1113. export function fromYRotation(out: mat4, rad: number): mat4;
  1114. /**
  1115. * Creates a matrix from the given angle around the Z axis
  1116. * This is equivalent to (but much faster than):
  1117. *
  1118. * mat4.identity(dest);
  1119. * mat4.rotateZ(dest, dest, rad);
  1120. *
  1121. * @param {mat4} out mat4 receiving operation result
  1122. * @param {Number} rad the angle to rotate the matrix by
  1123. * @returns {mat4} out
  1124. */
  1125. export function fromZRotation(out: mat4, rad: number): mat4;
  1126. /**
  1127. * Creates a matrix from a quaternion rotation and vector translation
  1128. * This is equivalent to (but much faster than):
  1129. *
  1130. * mat4.identity(dest);
  1131. * mat4.translate(dest, vec);
  1132. * let quatMat = mat4.create();
  1133. * quat4.toMat4(quat, quatMat);
  1134. * mat4.multiply(dest, quatMat);
  1135. *
  1136. * @param {mat4} out mat4 receiving operation result
  1137. * @param {quat4} q Rotation quaternion
  1138. * @param {ReadonlyVec3} v Translation vector
  1139. * @returns {mat4} out
  1140. */
  1141. export function fromRotationTranslation(out: mat4, q: any, v: ReadonlyVec3): mat4;
  1142. /**
  1143. * Creates a new mat4 from a dual quat.
  1144. *
  1145. * @param {mat4} out Matrix
  1146. * @param {ReadonlyQuat2} a Dual Quaternion
  1147. * @returns {mat4} mat4 receiving operation result
  1148. */
  1149. export function fromQuat2(out: mat4, a: ReadonlyQuat2): mat4;
  1150. /**
  1151. * Returns the translation vector component of a transformation
  1152. * matrix. If a matrix is built with fromRotationTranslation,
  1153. * the returned vector will be the same as the translation vector
  1154. * originally supplied.
  1155. * @param {vec3} out Vector to receive translation component
  1156. * @param {ReadonlyMat4} mat Matrix to be decomposed (input)
  1157. * @return {vec3} out
  1158. */
  1159. export function getTranslation(out: vec3, mat: ReadonlyMat4): vec3;
  1160. /**
  1161. * Returns the scaling factor component of a transformation
  1162. * matrix. If a matrix is built with fromRotationTranslationScale
  1163. * with a normalized Quaternion paramter, the returned vector will be
  1164. * the same as the scaling vector
  1165. * originally supplied.
  1166. * @param {vec3} out Vector to receive scaling factor component
  1167. * @param {ReadonlyMat4} mat Matrix to be decomposed (input)
  1168. * @return {vec3} out
  1169. */
  1170. export function getScaling(out: vec3, mat: ReadonlyMat4): vec3;
  1171. /**
  1172. * Returns a quaternion representing the rotational component
  1173. * of a transformation matrix. If a matrix is built with
  1174. * fromRotationTranslation, the returned quaternion will be the
  1175. * same as the quaternion originally supplied.
  1176. * @param {quat} out Quaternion to receive the rotation component
  1177. * @param {ReadonlyMat4} mat Matrix to be decomposed (input)
  1178. * @return {quat} out
  1179. */
  1180. export function getRotation(out: quat, mat: ReadonlyMat4): quat;
  1181. /**
  1182. * Creates a matrix from a quaternion rotation, vector translation and vector scale
  1183. * This is equivalent to (but much faster than):
  1184. *
  1185. * mat4.identity(dest);
  1186. * mat4.translate(dest, vec);
  1187. * let quatMat = mat4.create();
  1188. * quat4.toMat4(quat, quatMat);
  1189. * mat4.multiply(dest, quatMat);
  1190. * mat4.scale(dest, scale)
  1191. *
  1192. * @param {mat4} out mat4 receiving operation result
  1193. * @param {quat4} q Rotation quaternion
  1194. * @param {ReadonlyVec3} v Translation vector
  1195. * @param {ReadonlyVec3} s Scaling vector
  1196. * @returns {mat4} out
  1197. */
  1198. export function fromRotationTranslationScale(out: mat4, q: any, v: ReadonlyVec3, s: ReadonlyVec3): mat4;
  1199. /**
  1200. * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
  1201. * This is equivalent to (but much faster than):
  1202. *
  1203. * mat4.identity(dest);
  1204. * mat4.translate(dest, vec);
  1205. * mat4.translate(dest, origin);
  1206. * let quatMat = mat4.create();
  1207. * quat4.toMat4(quat, quatMat);
  1208. * mat4.multiply(dest, quatMat);
  1209. * mat4.scale(dest, scale)
  1210. * mat4.translate(dest, negativeOrigin);
  1211. *
  1212. * @param {mat4} out mat4 receiving operation result
  1213. * @param {quat4} q Rotation quaternion
  1214. * @param {ReadonlyVec3} v Translation vector
  1215. * @param {ReadonlyVec3} s Scaling vector
  1216. * @param {ReadonlyVec3} o The origin vector around which to scale and rotate
  1217. * @returns {mat4} out
  1218. */
  1219. export function fromRotationTranslationScaleOrigin(out: mat4, q: any, v: ReadonlyVec3, s: ReadonlyVec3, o: ReadonlyVec3): mat4;
  1220. /**
  1221. * Calculates a 4x4 matrix from the given quaternion
  1222. *
  1223. * @param {mat4} out mat4 receiving operation result
  1224. * @param {ReadonlyQuat} q Quaternion to create matrix from
  1225. *
  1226. * @returns {mat4} out
  1227. */
  1228. export function fromQuat(out: mat4, q: ReadonlyQuat): mat4;
  1229. /**
  1230. * Generates a frustum matrix with the given bounds
  1231. *
  1232. * @param {mat4} out mat4 frustum matrix will be written into
  1233. * @param {Number} left Left bound of the frustum
  1234. * @param {Number} right Right bound of the frustum
  1235. * @param {Number} bottom Bottom bound of the frustum
  1236. * @param {Number} top Top bound of the frustum
  1237. * @param {Number} near Near bound of the frustum
  1238. * @param {Number} far Far bound of the frustum
  1239. * @returns {mat4} out
  1240. */
  1241. export function frustum(out: mat4, left: number, right: number, bottom: number, top: number, near: number, far: number): mat4;
  1242. /**
  1243. * Generates a perspective projection matrix with the given bounds.
  1244. * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],
  1245. * which matches WebGL/OpenGL's clip volume.
  1246. * Passing null/undefined/no value for far will generate infinite projection matrix.
  1247. *
  1248. * @param {mat4} out mat4 frustum matrix will be written into
  1249. * @param {number} fovy Vertical field of view in radians
  1250. * @param {number} aspect Aspect ratio. typically viewport width/height
  1251. * @param {number} near Near bound of the frustum
  1252. * @param {number} far Far bound of the frustum, can be null or Infinity
  1253. * @returns {mat4} out
  1254. */
  1255. export function perspectiveNO(out: mat4, fovy: number, aspect: number, near: number, far: number): mat4;
  1256. /**
  1257. * Generates a perspective projection matrix suitable for WebGPU with the given bounds.
  1258. * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],
  1259. * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.
  1260. * Passing null/undefined/no value for far will generate infinite projection matrix.
  1261. *
  1262. * @param {mat4} out mat4 frustum matrix will be written into
  1263. * @param {number} fovy Vertical field of view in radians
  1264. * @param {number} aspect Aspect ratio. typically viewport width/height
  1265. * @param {number} near Near bound of the frustum
  1266. * @param {number} far Far bound of the frustum, can be null or Infinity
  1267. * @returns {mat4} out
  1268. */
  1269. export function perspectiveZO(out: mat4, fovy: number, aspect: number, near: number, far: number): mat4;
  1270. /**
  1271. * Generates a perspective projection matrix with the given field of view.
  1272. * This is primarily useful for generating projection matrices to be used
  1273. * with the still experiemental WebVR API.
  1274. *
  1275. * @param {mat4} out mat4 frustum matrix will be written into
  1276. * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
  1277. * @param {number} near Near bound of the frustum
  1278. * @param {number} far Far bound of the frustum
  1279. * @returns {mat4} out
  1280. */
  1281. export function perspectiveFromFieldOfView(out: mat4, fov: any, near: number, far: number): mat4;
  1282. /**
  1283. * Generates a orthogonal projection matrix with the given bounds.
  1284. * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],
  1285. * which matches WebGL/OpenGL's clip volume.
  1286. *
  1287. * @param {mat4} out mat4 frustum matrix will be written into
  1288. * @param {number} left Left bound of the frustum
  1289. * @param {number} right Right bound of the frustum
  1290. * @param {number} bottom Bottom bound of the frustum
  1291. * @param {number} top Top bound of the frustum
  1292. * @param {number} near Near bound of the frustum
  1293. * @param {number} far Far bound of the frustum
  1294. * @returns {mat4} out
  1295. */
  1296. export function orthoNO(out: mat4, left: number, right: number, bottom: number, top: number, near: number, far: number): mat4;
  1297. /**
  1298. * Generates a orthogonal projection matrix with the given bounds.
  1299. * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],
  1300. * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.
  1301. *
  1302. * @param {mat4} out mat4 frustum matrix will be written into
  1303. * @param {number} left Left bound of the frustum
  1304. * @param {number} right Right bound of the frustum
  1305. * @param {number} bottom Bottom bound of the frustum
  1306. * @param {number} top Top bound of the frustum
  1307. * @param {number} near Near bound of the frustum
  1308. * @param {number} far Far bound of the frustum
  1309. * @returns {mat4} out
  1310. */
  1311. export function orthoZO(out: mat4, left: number, right: number, bottom: number, top: number, near: number, far: number): mat4;
  1312. /**
  1313. * Generates a look-at matrix with the given eye position, focal point, and up axis.
  1314. * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.
  1315. *
  1316. * @param {mat4} out mat4 frustum matrix will be written into
  1317. * @param {ReadonlyVec3} eye Position of the viewer
  1318. * @param {ReadonlyVec3} center Point the viewer is looking at
  1319. * @param {ReadonlyVec3} up vec3 pointing up
  1320. * @returns {mat4} out
  1321. */
  1322. export function lookAt(out: mat4, eye: ReadonlyVec3, center: ReadonlyVec3, up: ReadonlyVec3): mat4;
  1323. /**
  1324. * Generates a matrix that makes something look at something else.
  1325. *
  1326. * @param {mat4} out mat4 frustum matrix will be written into
  1327. * @param {ReadonlyVec3} eye Position of the viewer
  1328. * @param {ReadonlyVec3} center Point the viewer is looking at
  1329. * @param {ReadonlyVec3} up vec3 pointing up
  1330. * @returns {mat4} out
  1331. */
  1332. export function targetTo(out: mat4, eye: ReadonlyVec3, target: any, up: ReadonlyVec3): mat4;
  1333. /**
  1334. * Returns a string representation of a mat4
  1335. *
  1336. * @param {ReadonlyMat4} a matrix to represent as a string
  1337. * @returns {String} string representation of the matrix
  1338. */
  1339. export function str(a: ReadonlyMat4): string;
  1340. /**
  1341. * Returns Frobenius norm of a mat4
  1342. *
  1343. * @param {ReadonlyMat4} a the matrix to calculate Frobenius norm of
  1344. * @returns {Number} Frobenius norm
  1345. */
  1346. export function frob(a: ReadonlyMat4): number;
  1347. /**
  1348. * Adds two mat4's
  1349. *
  1350. * @param {mat4} out the receiving matrix
  1351. * @param {ReadonlyMat4} a the first operand
  1352. * @param {ReadonlyMat4} b the second operand
  1353. * @returns {mat4} out
  1354. */
  1355. export function add(out: mat4, a: ReadonlyMat4, b: ReadonlyMat4): mat4;
  1356. /**
  1357. * Subtracts matrix b from matrix a
  1358. *
  1359. * @param {mat4} out the receiving matrix
  1360. * @param {ReadonlyMat4} a the first operand
  1361. * @param {ReadonlyMat4} b the second operand
  1362. * @returns {mat4} out
  1363. */
  1364. export function subtract(out: mat4, a: ReadonlyMat4, b: ReadonlyMat4): mat4;
  1365. /**
  1366. * Multiply each element of the matrix by a scalar.
  1367. *
  1368. * @param {mat4} out the receiving matrix
  1369. * @param {ReadonlyMat4} a the matrix to scale
  1370. * @param {Number} b amount to scale the matrix's elements by
  1371. * @returns {mat4} out
  1372. */
  1373. export function multiplyScalar(out: mat4, a: ReadonlyMat4, b: number): mat4;
  1374. /**
  1375. * Adds two mat4's after multiplying each element of the second operand by a scalar value.
  1376. *
  1377. * @param {mat4} out the receiving vector
  1378. * @param {ReadonlyMat4} a the first operand
  1379. * @param {ReadonlyMat4} b the second operand
  1380. * @param {Number} scale the amount to scale b's elements by before adding
  1381. * @returns {mat4} out
  1382. */
  1383. export function multiplyScalarAndAdd(out: mat4, a: ReadonlyMat4, b: ReadonlyMat4, scale: number): mat4;
  1384. /**
  1385. * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
  1386. *
  1387. * @param {ReadonlyMat4} a The first matrix.
  1388. * @param {ReadonlyMat4} b The second matrix.
  1389. * @returns {Boolean} True if the matrices are equal, false otherwise.
  1390. */
  1391. export function exactEquals(a: ReadonlyMat4, b: ReadonlyMat4): boolean;
  1392. /**
  1393. * Returns whether or not the matrices have approximately the same elements in the same position.
  1394. *
  1395. * @param {ReadonlyMat4} a The first matrix.
  1396. * @param {ReadonlyMat4} b The second matrix.
  1397. * @returns {Boolean} True if the matrices are equal, false otherwise.
  1398. */
  1399. export function equals(a: ReadonlyMat4, b: ReadonlyMat4): boolean;
  1400. /**
  1401. * Generates a perspective projection matrix with the given bounds.
  1402. * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],
  1403. * which matches WebGL/OpenGL's clip volume.
  1404. * Passing null/undefined/no value for far will generate infinite projection matrix.
  1405. *
  1406. * @param {mat4} out mat4 frustum matrix will be written into
  1407. * @param {number} fovy Vertical field of view in radians
  1408. * @param {number} aspect Aspect ratio. typically viewport width/height
  1409. * @param {number} near Near bound of the frustum
  1410. * @param {number} far Far bound of the frustum, can be null or Infinity
  1411. * @returns {mat4} out
  1412. */
  1413. export function perspective(out: mat4, fovy: number, aspect: number, near: number, far: number): mat4;
  1414. /**
  1415. * Generates a orthogonal projection matrix with the given bounds.
  1416. * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],
  1417. * which matches WebGL/OpenGL's clip volume.
  1418. *
  1419. * @param {mat4} out mat4 frustum matrix will be written into
  1420. * @param {number} left Left bound of the frustum
  1421. * @param {number} right Right bound of the frustum
  1422. * @param {number} bottom Bottom bound of the frustum
  1423. * @param {number} top Top bound of the frustum
  1424. * @param {number} near Near bound of the frustum
  1425. * @param {number} far Far bound of the frustum
  1426. * @returns {mat4} out
  1427. */
  1428. export function ortho(out: mat4, left: number, right: number, bottom: number, top: number, near: number, far: number): mat4;
  1429. /**
  1430. * Multiplies two mat4s
  1431. *
  1432. * @param {mat4} out the receiving matrix
  1433. * @param {ReadonlyMat4} a the first operand
  1434. * @param {ReadonlyMat4} b the second operand
  1435. * @returns {mat4} out
  1436. */
  1437. export function mul(out: mat4, a: ReadonlyMat4, b: ReadonlyMat4): mat4;
  1438. /**
  1439. * Subtracts matrix b from matrix a
  1440. *
  1441. * @param {mat4} out the receiving matrix
  1442. * @param {ReadonlyMat4} a the first operand
  1443. * @param {ReadonlyMat4} b the second operand
  1444. * @returns {mat4} out
  1445. */
  1446. export function sub(out: mat4, a: ReadonlyMat4, b: ReadonlyMat4): mat4;
  1447. }
  1448. export module vec3 {
  1449. /**
  1450. * 3 Dimensional Vector
  1451. * @module vec3
  1452. */
  1453. /**
  1454. * Creates a new, empty vec3
  1455. *
  1456. * @returns {vec3} a new 3D vector
  1457. */
  1458. export function create(): vec3;
  1459. /**
  1460. * Creates a new vec3 initialized with values from an existing vector
  1461. *
  1462. * @param {ReadonlyVec3} a vector to clone
  1463. * @returns {vec3} a new 3D vector
  1464. */
  1465. export function clone(a: ReadonlyVec3): vec3;
  1466. /**
  1467. * Calculates the length of a vec3
  1468. *
  1469. * @param {ReadonlyVec3} a vector to calculate length of
  1470. * @returns {Number} length of a
  1471. */
  1472. export function length(a: ReadonlyVec3): number;
  1473. /**
  1474. * Creates a new vec3 initialized with the given values
  1475. *
  1476. * @param {Number} x X component
  1477. * @param {Number} y Y component
  1478. * @param {Number} z Z component
  1479. * @returns {vec3} a new 3D vector
  1480. */
  1481. export function fromValues(x: number, y: number, z: number): vec3;
  1482. /**
  1483. * Copy the values from one vec3 to another
  1484. *
  1485. * @param {vec3} out the receiving vector
  1486. * @param {ReadonlyVec3} a the source vector
  1487. * @returns {vec3} out
  1488. */
  1489. export function copy(out: vec3, a: ReadonlyVec3): vec3;
  1490. /**
  1491. * Set the components of a vec3 to the given values
  1492. *
  1493. * @param {vec3} out the receiving vector
  1494. * @param {Number} x X component
  1495. * @param {Number} y Y component
  1496. * @param {Number} z Z component
  1497. * @returns {vec3} out
  1498. */
  1499. export function set(out: vec3, x: number, y: number, z: number): vec3;
  1500. /**
  1501. * Adds two vec3's
  1502. *
  1503. * @param {vec3} out the receiving vector
  1504. * @param {ReadonlyVec3} a the first operand
  1505. * @param {ReadonlyVec3} b the second operand
  1506. * @returns {vec3} out
  1507. */
  1508. export function add(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3): vec3;
  1509. /**
  1510. * Subtracts vector b from vector a
  1511. *
  1512. * @param {vec3} out the receiving vector
  1513. * @param {ReadonlyVec3} a the first operand
  1514. * @param {ReadonlyVec3} b the second operand
  1515. * @returns {vec3} out
  1516. */
  1517. export function subtract(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3): vec3;
  1518. /**
  1519. * Multiplies two vec3's
  1520. *
  1521. * @param {vec3} out the receiving vector
  1522. * @param {ReadonlyVec3} a the first operand
  1523. * @param {ReadonlyVec3} b the second operand
  1524. * @returns {vec3} out
  1525. */
  1526. export function multiply(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3): vec3;
  1527. /**
  1528. * Divides two vec3's
  1529. *
  1530. * @param {vec3} out the receiving vector
  1531. * @param {ReadonlyVec3} a the first operand
  1532. * @param {ReadonlyVec3} b the second operand
  1533. * @returns {vec3} out
  1534. */
  1535. export function divide(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3): vec3;
  1536. /**
  1537. * Math.ceil the components of a vec3
  1538. *
  1539. * @param {vec3} out the receiving vector
  1540. * @param {ReadonlyVec3} a vector to ceil
  1541. * @returns {vec3} out
  1542. */
  1543. export function ceil(out: vec3, a: ReadonlyVec3): vec3;
  1544. /**
  1545. * Math.floor the components of a vec3
  1546. *
  1547. * @param {vec3} out the receiving vector
  1548. * @param {ReadonlyVec3} a vector to floor
  1549. * @returns {vec3} out
  1550. */
  1551. export function floor(out: vec3, a: ReadonlyVec3): vec3;
  1552. /**
  1553. * Returns the minimum of two vec3's
  1554. *
  1555. * @param {vec3} out the receiving vector
  1556. * @param {ReadonlyVec3} a the first operand
  1557. * @param {ReadonlyVec3} b the second operand
  1558. * @returns {vec3} out
  1559. */
  1560. export function min(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3): vec3;
  1561. /**
  1562. * Returns the maximum of two vec3's
  1563. *
  1564. * @param {vec3} out the receiving vector
  1565. * @param {ReadonlyVec3} a the first operand
  1566. * @param {ReadonlyVec3} b the second operand
  1567. * @returns {vec3} out
  1568. */
  1569. export function max(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3): vec3;
  1570. /**
  1571. * Math.round the components of a vec3
  1572. *
  1573. * @param {vec3} out the receiving vector
  1574. * @param {ReadonlyVec3} a vector to round
  1575. * @returns {vec3} out
  1576. */
  1577. export function round(out: vec3, a: ReadonlyVec3): vec3;
  1578. /**
  1579. * Scales a vec3 by a scalar number
  1580. *
  1581. * @param {vec3} out the receiving vector
  1582. * @param {ReadonlyVec3} a the vector to scale
  1583. * @param {Number} b amount to scale the vector by
  1584. * @returns {vec3} out
  1585. */
  1586. export function scale(out: vec3, a: ReadonlyVec3, b: number): vec3;
  1587. /**
  1588. * Adds two vec3's after scaling the second operand by a scalar value
  1589. *
  1590. * @param {vec3} out the receiving vector
  1591. * @param {ReadonlyVec3} a the first operand
  1592. * @param {ReadonlyVec3} b the second operand
  1593. * @param {Number} scale the amount to scale b by before adding
  1594. * @returns {vec3} out
  1595. */
  1596. export function scaleAndAdd(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3, scale: number): vec3;
  1597. /**
  1598. * Calculates the euclidian distance between two vec3's
  1599. *
  1600. * @param {ReadonlyVec3} a the first operand
  1601. * @param {ReadonlyVec3} b the second operand
  1602. * @returns {Number} distance between a and b
  1603. */
  1604. export function distance(a: ReadonlyVec3, b: ReadonlyVec3): number;
  1605. /**
  1606. * Calculates the squared euclidian distance between two vec3's
  1607. *
  1608. * @param {ReadonlyVec3} a the first operand
  1609. * @param {ReadonlyVec3} b the second operand
  1610. * @returns {Number} squared distance between a and b
  1611. */
  1612. export function squaredDistance(a: ReadonlyVec3, b: ReadonlyVec3): number;
  1613. /**
  1614. * Calculates the squared length of a vec3
  1615. *
  1616. * @param {ReadonlyVec3} a vector to calculate squared length of
  1617. * @returns {Number} squared length of a
  1618. */
  1619. export function squaredLength(a: ReadonlyVec3): number;
  1620. /**
  1621. * Negates the components of a vec3
  1622. *
  1623. * @param {vec3} out the receiving vector
  1624. * @param {ReadonlyVec3} a vector to negate
  1625. * @returns {vec3} out
  1626. */
  1627. export function negate(out: vec3, a: ReadonlyVec3): vec3;
  1628. /**
  1629. * Returns the inverse of the components of a vec3
  1630. *
  1631. * @param {vec3} out the receiving vector
  1632. * @param {ReadonlyVec3} a vector to invert
  1633. * @returns {vec3} out
  1634. */
  1635. export function inverse(out: vec3, a: ReadonlyVec3): vec3;
  1636. /**
  1637. * Normalize a vec3
  1638. *
  1639. * @param {vec3} out the receiving vector
  1640. * @param {ReadonlyVec3} a vector to normalize
  1641. * @returns {vec3} out
  1642. */
  1643. export function normalize(out: vec3, a: ReadonlyVec3): vec3;
  1644. /**
  1645. * Calculates the dot product of two vec3's
  1646. *
  1647. * @param {ReadonlyVec3} a the first operand
  1648. * @param {ReadonlyVec3} b the second operand
  1649. * @returns {Number} dot product of a and b
  1650. */
  1651. export function dot(a: ReadonlyVec3, b: ReadonlyVec3): number;
  1652. /**
  1653. * Computes the cross product of two vec3's
  1654. *
  1655. * @param {vec3} out the receiving vector
  1656. * @param {ReadonlyVec3} a the first operand
  1657. * @param {ReadonlyVec3} b the second operand
  1658. * @returns {vec3} out
  1659. */
  1660. export function cross(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3): vec3;
  1661. /**
  1662. * Performs a linear interpolation between two vec3's
  1663. *
  1664. * @param {vec3} out the receiving vector
  1665. * @param {ReadonlyVec3} a the first operand
  1666. * @param {ReadonlyVec3} b the second operand
  1667. * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
  1668. * @returns {vec3} out
  1669. */
  1670. export function lerp(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3, t: number): vec3;
  1671. /**
  1672. * Performs a hermite interpolation with two control points
  1673. *
  1674. * @param {vec3} out the receiving vector
  1675. * @param {ReadonlyVec3} a the first operand
  1676. * @param {ReadonlyVec3} b the second operand
  1677. * @param {ReadonlyVec3} c the third operand
  1678. * @param {ReadonlyVec3} d the fourth operand
  1679. * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
  1680. * @returns {vec3} out
  1681. */
  1682. export function hermite(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3, c: ReadonlyVec3, d: ReadonlyVec3, t: number): vec3;
  1683. /**
  1684. * Performs a bezier interpolation with two control points
  1685. *
  1686. * @param {vec3} out the receiving vector
  1687. * @param {ReadonlyVec3} a the first operand
  1688. * @param {ReadonlyVec3} b the second operand
  1689. * @param {ReadonlyVec3} c the third operand
  1690. * @param {ReadonlyVec3} d the fourth operand
  1691. * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
  1692. * @returns {vec3} out
  1693. */
  1694. export function bezier(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3, c: ReadonlyVec3, d: ReadonlyVec3, t: number): vec3;
  1695. /**
  1696. * Generates a random vector with the given scale
  1697. *
  1698. * @param {vec3} out the receiving vector
  1699. * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
  1700. * @returns {vec3} out
  1701. */
  1702. export function random(out: vec3, scale?: number): vec3;
  1703. /**
  1704. * Transforms the vec3 with a mat4.
  1705. * 4th vector component is implicitly '1'
  1706. *
  1707. * @param {vec3} out the receiving vector
  1708. * @param {ReadonlyVec3} a the vector to transform
  1709. * @param {ReadonlyMat4} m matrix to transform with
  1710. * @returns {vec3} out
  1711. */
  1712. export function transformMat4(out: vec3, a: ReadonlyVec3, m: ReadonlyMat4): vec3;
  1713. /**
  1714. * Transforms the vec3 with a mat3.
  1715. *
  1716. * @param {vec3} out the receiving vector
  1717. * @param {ReadonlyVec3} a the vector to transform
  1718. * @param {ReadonlyMat3} m the 3x3 matrix to transform with
  1719. * @returns {vec3} out
  1720. */
  1721. export function transformMat3(out: vec3, a: ReadonlyVec3, m: ReadonlyMat3): vec3;
  1722. /**
  1723. * Transforms the vec3 with a quat
  1724. * Can also be used for dual quaternions. (Multiply it with the real part)
  1725. *
  1726. * @param {vec3} out the receiving vector
  1727. * @param {ReadonlyVec3} a the vector to transform
  1728. * @param {ReadonlyQuat} q quaternion to transform with
  1729. * @returns {vec3} out
  1730. */
  1731. export function transformQuat(out: vec3, a: ReadonlyVec3, q: ReadonlyQuat): vec3;
  1732. /**
  1733. * Rotate a 3D vector around the x-axis
  1734. * @param {vec3} out The receiving vec3
  1735. * @param {ReadonlyVec3} a The vec3 point to rotate
  1736. * @param {ReadonlyVec3} b The origin of the rotation
  1737. * @param {Number} rad The angle of rotation in radians
  1738. * @returns {vec3} out
  1739. */
  1740. export function rotateX(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3, rad: number): vec3;
  1741. /**
  1742. * Rotate a 3D vector around the y-axis
  1743. * @param {vec3} out The receiving vec3
  1744. * @param {ReadonlyVec3} a The vec3 point to rotate
  1745. * @param {ReadonlyVec3} b The origin of the rotation
  1746. * @param {Number} rad The angle of rotation in radians
  1747. * @returns {vec3} out
  1748. */
  1749. export function rotateY(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3, rad: number): vec3;
  1750. /**
  1751. * Rotate a 3D vector around the z-axis
  1752. * @param {vec3} out The receiving vec3
  1753. * @param {ReadonlyVec3} a The vec3 point to rotate
  1754. * @param {ReadonlyVec3} b The origin of the rotation
  1755. * @param {Number} rad The angle of rotation in radians
  1756. * @returns {vec3} out
  1757. */
  1758. export function rotateZ(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3, rad: number): vec3;
  1759. /**
  1760. * Get the angle between two 3D vectors
  1761. * @param {ReadonlyVec3} a The first operand
  1762. * @param {ReadonlyVec3} b The second operand
  1763. * @returns {Number} The angle in radians
  1764. */
  1765. export function angle(a: ReadonlyVec3, b: ReadonlyVec3): number;
  1766. /**
  1767. * Set the components of a vec3 to zero
  1768. *
  1769. * @param {vec3} out the receiving vector
  1770. * @returns {vec3} out
  1771. */
  1772. export function zero(out: vec3): vec3;
  1773. /**
  1774. * Returns a string representation of a vector
  1775. *
  1776. * @param {ReadonlyVec3} a vector to represent as a string
  1777. * @returns {String} string representation of the vector
  1778. */
  1779. export function str(a: ReadonlyVec3): string;
  1780. /**
  1781. * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
  1782. *
  1783. * @param {ReadonlyVec3} a The first vector.
  1784. * @param {ReadonlyVec3} b The second vector.
  1785. * @returns {Boolean} True if the vectors are equal, false otherwise.
  1786. */
  1787. export function exactEquals(a: ReadonlyVec3, b: ReadonlyVec3): boolean;
  1788. /**
  1789. * Returns whether or not the vectors have approximately the same elements in the same position.
  1790. *
  1791. * @param {ReadonlyVec3} a The first vector.
  1792. * @param {ReadonlyVec3} b The second vector.
  1793. * @returns {Boolean} True if the vectors are equal, false otherwise.
  1794. */
  1795. export function equals(a: ReadonlyVec3, b: ReadonlyVec3): boolean;
  1796. /**
  1797. * Subtracts vector b from vector a
  1798. *
  1799. * @param {vec3} out the receiving vector
  1800. * @param {ReadonlyVec3} a the first operand
  1801. * @param {ReadonlyVec3} b the second operand
  1802. * @returns {vec3} out
  1803. */
  1804. export function sub(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3): vec3;
  1805. /**
  1806. * Multiplies two vec3's
  1807. *
  1808. * @param {vec3} out the receiving vector
  1809. * @param {ReadonlyVec3} a the first operand
  1810. * @param {ReadonlyVec3} b the second operand
  1811. * @returns {vec3} out
  1812. */
  1813. export function mul(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3): vec3;
  1814. /**
  1815. * Divides two vec3's
  1816. *
  1817. * @param {vec3} out the receiving vector
  1818. * @param {ReadonlyVec3} a the first operand
  1819. * @param {ReadonlyVec3} b the second operand
  1820. * @returns {vec3} out
  1821. */
  1822. export function div(out: vec3, a: ReadonlyVec3, b: ReadonlyVec3): vec3;
  1823. /**
  1824. * Calculates the euclidian distance between two vec3's
  1825. *
  1826. * @param {ReadonlyVec3} a the first operand
  1827. * @param {ReadonlyVec3} b the second operand
  1828. * @returns {Number} distance between a and b
  1829. */
  1830. export function dist(a: ReadonlyVec3, b: ReadonlyVec3): number;
  1831. /**
  1832. * Calculates the squared euclidian distance between two vec3's
  1833. *
  1834. * @param {ReadonlyVec3} a the first operand
  1835. * @param {ReadonlyVec3} b the second operand
  1836. * @returns {Number} squared distance between a and b
  1837. */
  1838. export function sqrDist(a: ReadonlyVec3, b: ReadonlyVec3): number;
  1839. /**
  1840. * Calculates the length of a vec3
  1841. *
  1842. * @param {ReadonlyVec3} a vector to calculate length of
  1843. * @returns {Number} length of a
  1844. */
  1845. export function len(a: ReadonlyVec3): number;
  1846. /**
  1847. * Calculates the squared length of a vec3
  1848. *
  1849. * @param {ReadonlyVec3} a vector to calculate squared length of
  1850. * @returns {Number} squared length of a
  1851. */
  1852. export function sqrLen(a: ReadonlyVec3): number;
  1853. export function forEach(a: any, stride: any, offset: any, count: any, fn: any, arg: any): any;
  1854. }
  1855. export module vec4 {
  1856. /**
  1857. * 4 Dimensional Vector
  1858. * @module vec4
  1859. */
  1860. /**
  1861. * Creates a new, empty vec4
  1862. *
  1863. * @returns {vec4} a new 4D vector
  1864. */
  1865. export function create(): vec4;
  1866. /**
  1867. * Creates a new vec4 initialized with values from an existing vector
  1868. *
  1869. * @param {ReadonlyVec4} a vector to clone
  1870. * @returns {vec4} a new 4D vector
  1871. */
  1872. export function clone(a: ReadonlyVec4): vec4;
  1873. /**
  1874. * Creates a new vec4 initialized with the given values
  1875. *
  1876. * @param {Number} x X component
  1877. * @param {Number} y Y component
  1878. * @param {Number} z Z component
  1879. * @param {Number} w W component
  1880. * @returns {vec4} a new 4D vector
  1881. */
  1882. export function fromValues(x: number, y: number, z: number, w: number): vec4;
  1883. /**
  1884. * Copy the values from one vec4 to another
  1885. *
  1886. * @param {vec4} out the receiving vector
  1887. * @param {ReadonlyVec4} a the source vector
  1888. * @returns {vec4} out
  1889. */
  1890. export function copy(out: vec4, a: ReadonlyVec4): vec4;
  1891. /**
  1892. * Set the components of a vec4 to the given values
  1893. *
  1894. * @param {vec4} out the receiving vector
  1895. * @param {Number} x X component
  1896. * @param {Number} y Y component
  1897. * @param {Number} z Z component
  1898. * @param {Number} w W component
  1899. * @returns {vec4} out
  1900. */
  1901. export function set(out: vec4, x: number, y: number, z: number, w: number): vec4;
  1902. /**
  1903. * Adds two vec4's
  1904. *
  1905. * @param {vec4} out the receiving vector
  1906. * @param {ReadonlyVec4} a the first operand
  1907. * @param {ReadonlyVec4} b the second operand
  1908. * @returns {vec4} out
  1909. */
  1910. export function add(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4;
  1911. /**
  1912. * Subtracts vector b from vector a
  1913. *
  1914. * @param {vec4} out the receiving vector
  1915. * @param {ReadonlyVec4} a the first operand
  1916. * @param {ReadonlyVec4} b the second operand
  1917. * @returns {vec4} out
  1918. */
  1919. export function subtract(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4;
  1920. /**
  1921. * Multiplies two vec4's
  1922. *
  1923. * @param {vec4} out the receiving vector
  1924. * @param {ReadonlyVec4} a the first operand
  1925. * @param {ReadonlyVec4} b the second operand
  1926. * @returns {vec4} out
  1927. */
  1928. export function multiply(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4;
  1929. /**
  1930. * Divides two vec4's
  1931. *
  1932. * @param {vec4} out the receiving vector
  1933. * @param {ReadonlyVec4} a the first operand
  1934. * @param {ReadonlyVec4} b the second operand
  1935. * @returns {vec4} out
  1936. */
  1937. export function divide(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4;
  1938. /**
  1939. * Math.ceil the components of a vec4
  1940. *
  1941. * @param {vec4} out the receiving vector
  1942. * @param {ReadonlyVec4} a vector to ceil
  1943. * @returns {vec4} out
  1944. */
  1945. export function ceil(out: vec4, a: ReadonlyVec4): vec4;
  1946. /**
  1947. * Math.floor the components of a vec4
  1948. *
  1949. * @param {vec4} out the receiving vector
  1950. * @param {ReadonlyVec4} a vector to floor
  1951. * @returns {vec4} out
  1952. */
  1953. export function floor(out: vec4, a: ReadonlyVec4): vec4;
  1954. /**
  1955. * Returns the minimum of two vec4's
  1956. *
  1957. * @param {vec4} out the receiving vector
  1958. * @param {ReadonlyVec4} a the first operand
  1959. * @param {ReadonlyVec4} b the second operand
  1960. * @returns {vec4} out
  1961. */
  1962. export function min(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4;
  1963. /**
  1964. * Returns the maximum of two vec4's
  1965. *
  1966. * @param {vec4} out the receiving vector
  1967. * @param {ReadonlyVec4} a the first operand
  1968. * @param {ReadonlyVec4} b the second operand
  1969. * @returns {vec4} out
  1970. */
  1971. export function max(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4;
  1972. /**
  1973. * Math.round the components of a vec4
  1974. *
  1975. * @param {vec4} out the receiving vector
  1976. * @param {ReadonlyVec4} a vector to round
  1977. * @returns {vec4} out
  1978. */
  1979. export function round(out: vec4, a: ReadonlyVec4): vec4;
  1980. /**
  1981. * Scales a vec4 by a scalar number
  1982. *
  1983. * @param {vec4} out the receiving vector
  1984. * @param {ReadonlyVec4} a the vector to scale
  1985. * @param {Number} b amount to scale the vector by
  1986. * @returns {vec4} out
  1987. */
  1988. export function scale(out: vec4, a: ReadonlyVec4, b: number): vec4;
  1989. /**
  1990. * Adds two vec4's after scaling the second operand by a scalar value
  1991. *
  1992. * @param {vec4} out the receiving vector
  1993. * @param {ReadonlyVec4} a the first operand
  1994. * @param {ReadonlyVec4} b the second operand
  1995. * @param {Number} scale the amount to scale b by before adding
  1996. * @returns {vec4} out
  1997. */
  1998. export function scaleAndAdd(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4, scale: number): vec4;
  1999. /**
  2000. * Calculates the euclidian distance between two vec4's
  2001. *
  2002. * @param {ReadonlyVec4} a the first operand
  2003. * @param {ReadonlyVec4} b the second operand
  2004. * @returns {Number} distance between a and b
  2005. */
  2006. export function distance(a: ReadonlyVec4, b: ReadonlyVec4): number;
  2007. /**
  2008. * Calculates the squared euclidian distance between two vec4's
  2009. *
  2010. * @param {ReadonlyVec4} a the first operand
  2011. * @param {ReadonlyVec4} b the second operand
  2012. * @returns {Number} squared distance between a and b
  2013. */
  2014. export function squaredDistance(a: ReadonlyVec4, b: ReadonlyVec4): number;
  2015. /**
  2016. * Calculates the length of a vec4
  2017. *
  2018. * @param {ReadonlyVec4} a vector to calculate length of
  2019. * @returns {Number} length of a
  2020. */
  2021. export function length(a: ReadonlyVec4): number;
  2022. /**
  2023. * Calculates the squared length of a vec4
  2024. *
  2025. * @param {ReadonlyVec4} a vector to calculate squared length of
  2026. * @returns {Number} squared length of a
  2027. */
  2028. export function squaredLength(a: ReadonlyVec4): number;
  2029. /**
  2030. * Negates the components of a vec4
  2031. *
  2032. * @param {vec4} out the receiving vector
  2033. * @param {ReadonlyVec4} a vector to negate
  2034. * @returns {vec4} out
  2035. */
  2036. export function negate(out: vec4, a: ReadonlyVec4): vec4;
  2037. /**
  2038. * Returns the inverse of the components of a vec4
  2039. *
  2040. * @param {vec4} out the receiving vector
  2041. * @param {ReadonlyVec4} a vector to invert
  2042. * @returns {vec4} out
  2043. */
  2044. export function inverse(out: vec4, a: ReadonlyVec4): vec4;
  2045. /**
  2046. * Normalize a vec4
  2047. *
  2048. * @param {vec4} out the receiving vector
  2049. * @param {ReadonlyVec4} a vector to normalize
  2050. * @returns {vec4} out
  2051. */
  2052. export function normalize(out: vec4, a: ReadonlyVec4): vec4;
  2053. /**
  2054. * Calculates the dot product of two vec4's
  2055. *
  2056. * @param {ReadonlyVec4} a the first operand
  2057. * @param {ReadonlyVec4} b the second operand
  2058. * @returns {Number} dot product of a and b
  2059. */
  2060. export function dot(a: ReadonlyVec4, b: ReadonlyVec4): number;
  2061. /**
  2062. * Returns the cross-product of three vectors in a 4-dimensional space
  2063. *
  2064. * @param {ReadonlyVec4} result the receiving vector
  2065. * @param {ReadonlyVec4} U the first vector
  2066. * @param {ReadonlyVec4} V the second vector
  2067. * @param {ReadonlyVec4} W the third vector
  2068. * @returns {vec4} result
  2069. */
  2070. export function cross(out: any, u: any, v: any, w: any): vec4;
  2071. /**
  2072. * Performs a linear interpolation between two vec4's
  2073. *
  2074. * @param {vec4} out the receiving vector
  2075. * @param {ReadonlyVec4} a the first operand
  2076. * @param {ReadonlyVec4} b the second operand
  2077. * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
  2078. * @returns {vec4} out
  2079. */
  2080. export function lerp(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4, t: number): vec4;
  2081. /**
  2082. * Generates a random vector with the given scale
  2083. *
  2084. * @param {vec4} out the receiving vector
  2085. * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
  2086. * @returns {vec4} out
  2087. */
  2088. export function random(out: vec4, scale?: number): vec4;
  2089. /**
  2090. * Transforms the vec4 with a mat4.
  2091. *
  2092. * @param {vec4} out the receiving vector
  2093. * @param {ReadonlyVec4} a the vector to transform
  2094. * @param {ReadonlyMat4} m matrix to transform with
  2095. * @returns {vec4} out
  2096. */
  2097. export function transformMat4(out: vec4, a: ReadonlyVec4, m: ReadonlyMat4): vec4;
  2098. /**
  2099. * Transforms the vec4 with a quat
  2100. *
  2101. * @param {vec4} out the receiving vector
  2102. * @param {ReadonlyVec4} a the vector to transform
  2103. * @param {ReadonlyQuat} q quaternion to transform with
  2104. * @returns {vec4} out
  2105. */
  2106. export function transformQuat(out: vec4, a: ReadonlyVec4, q: ReadonlyQuat): vec4;
  2107. /**
  2108. * Set the components of a vec4 to zero
  2109. *
  2110. * @param {vec4} out the receiving vector
  2111. * @returns {vec4} out
  2112. */
  2113. export function zero(out: vec4): vec4;
  2114. /**
  2115. * Returns a string representation of a vector
  2116. *
  2117. * @param {ReadonlyVec4} a vector to represent as a string
  2118. * @returns {String} string representation of the vector
  2119. */
  2120. export function str(a: ReadonlyVec4): string;
  2121. /**
  2122. * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
  2123. *
  2124. * @param {ReadonlyVec4} a The first vector.
  2125. * @param {ReadonlyVec4} b The second vector.
  2126. * @returns {Boolean} True if the vectors are equal, false otherwise.
  2127. */
  2128. export function exactEquals(a: ReadonlyVec4, b: ReadonlyVec4): boolean;
  2129. /**
  2130. * Returns whether or not the vectors have approximately the same elements in the same position.
  2131. *
  2132. * @param {ReadonlyVec4} a The first vector.
  2133. * @param {ReadonlyVec4} b The second vector.
  2134. * @returns {Boolean} True if the vectors are equal, false otherwise.
  2135. */
  2136. export function equals(a: ReadonlyVec4, b: ReadonlyVec4): boolean;
  2137. /**
  2138. * Subtracts vector b from vector a
  2139. *
  2140. * @param {vec4} out the receiving vector
  2141. * @param {ReadonlyVec4} a the first operand
  2142. * @param {ReadonlyVec4} b the second operand
  2143. * @returns {vec4} out
  2144. */
  2145. export function sub(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4;
  2146. /**
  2147. * Multiplies two vec4's
  2148. *
  2149. * @param {vec4} out the receiving vector
  2150. * @param {ReadonlyVec4} a the first operand
  2151. * @param {ReadonlyVec4} b the second operand
  2152. * @returns {vec4} out
  2153. */
  2154. export function mul(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4;
  2155. /**
  2156. * Divides two vec4's
  2157. *
  2158. * @param {vec4} out the receiving vector
  2159. * @param {ReadonlyVec4} a the first operand
  2160. * @param {ReadonlyVec4} b the second operand
  2161. * @returns {vec4} out
  2162. */
  2163. export function div(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4;
  2164. /**
  2165. * Calculates the euclidian distance between two vec4's
  2166. *
  2167. * @param {ReadonlyVec4} a the first operand
  2168. * @param {ReadonlyVec4} b the second operand
  2169. * @returns {Number} distance between a and b
  2170. */
  2171. export function dist(a: ReadonlyVec4, b: ReadonlyVec4): number;
  2172. /**
  2173. * Calculates the squared euclidian distance between two vec4's
  2174. *
  2175. * @param {ReadonlyVec4} a the first operand
  2176. * @param {ReadonlyVec4} b the second operand
  2177. * @returns {Number} squared distance between a and b
  2178. */
  2179. export function sqrDist(a: ReadonlyVec4, b: ReadonlyVec4): number;
  2180. /**
  2181. * Calculates the length of a vec4
  2182. *
  2183. * @param {ReadonlyVec4} a vector to calculate length of
  2184. * @returns {Number} length of a
  2185. */
  2186. export function len(a: ReadonlyVec4): number;
  2187. /**
  2188. * Calculates the squared length of a vec4
  2189. *
  2190. * @param {ReadonlyVec4} a vector to calculate squared length of
  2191. * @returns {Number} squared length of a
  2192. */
  2193. export function sqrLen(a: ReadonlyVec4): number;
  2194. export function forEach(a: any, stride: any, offset: any, count: any, fn: any, arg: any): any;
  2195. }
  2196. export module quat {
  2197. /**
  2198. * Quaternion
  2199. * @module quat
  2200. */
  2201. /**
  2202. * Creates a new identity quat
  2203. *
  2204. * @returns {quat} a new quaternion
  2205. */
  2206. export function create(): quat;
  2207. /**
  2208. * Set a quat to the identity quaternion
  2209. *
  2210. * @param {quat} out the receiving quaternion
  2211. * @returns {quat} out
  2212. */
  2213. export function identity(out: quat): quat;
  2214. /**
  2215. * Sets a quat from the given angle and rotation axis,
  2216. * then returns it.
  2217. *
  2218. * @param {quat} out the receiving quaternion
  2219. * @param {ReadonlyVec3} axis the axis around which to rotate
  2220. * @param {Number} rad the angle in radians
  2221. * @returns {quat} out
  2222. **/
  2223. export function setAxisAngle(out: quat, axis: ReadonlyVec3, rad: number): quat;
  2224. /**
  2225. * Gets the rotation axis and angle for a given
  2226. * quaternion. If a quaternion is created with
  2227. * setAxisAngle, this method will return the same
  2228. * values as providied in the original parameter list
  2229. * OR functionally equivalent values.
  2230. * Example: The quaternion formed by axis [0, 0, 1] and
  2231. * angle -90 is the same as the quaternion formed by
  2232. * [0, 0, 1] and 270. This method favors the latter.
  2233. * @param {vec3} out_axis Vector receiving the axis of rotation
  2234. * @param {ReadonlyQuat} q Quaternion to be decomposed
  2235. * @return {Number} Angle, in radians, of the rotation
  2236. */
  2237. export function getAxisAngle(out_axis: vec3, q: ReadonlyQuat): number;
  2238. /**
  2239. * Gets the angular distance between two unit quaternions
  2240. *
  2241. * @param {ReadonlyQuat} a Origin unit quaternion
  2242. * @param {ReadonlyQuat} b Destination unit quaternion
  2243. * @return {Number} Angle, in radians, between the two quaternions
  2244. */
  2245. export function getAngle(a: ReadonlyQuat, b: ReadonlyQuat): number;
  2246. /**
  2247. * Multiplies two quat's
  2248. *
  2249. * @param {quat} out the receiving quaternion
  2250. * @param {ReadonlyQuat} a the first operand
  2251. * @param {ReadonlyQuat} b the second operand
  2252. * @returns {quat} out
  2253. */
  2254. export function multiply(out: quat, a: ReadonlyQuat, b: ReadonlyQuat): quat;
  2255. /**
  2256. * Rotates a quaternion by the given angle about the X axis
  2257. *
  2258. * @param {quat} out quat receiving operation result
  2259. * @param {ReadonlyQuat} a quat to rotate
  2260. * @param {number} rad angle (in radians) to rotate
  2261. * @returns {quat} out
  2262. */
  2263. export function rotateX(out: quat, a: ReadonlyQuat, rad: number): quat;
  2264. /**
  2265. * Rotates a quaternion by the given angle about the Y axis
  2266. *
  2267. * @param {quat} out quat receiving operation result
  2268. * @param {ReadonlyQuat} a quat to rotate
  2269. * @param {number} rad angle (in radians) to rotate
  2270. * @returns {quat} out
  2271. */
  2272. export function rotateY(out: quat, a: ReadonlyQuat, rad: number): quat;
  2273. /**
  2274. * Rotates a quaternion by the given angle about the Z axis
  2275. *
  2276. * @param {quat} out quat receiving operation result
  2277. * @param {ReadonlyQuat} a quat to rotate
  2278. * @param {number} rad angle (in radians) to rotate
  2279. * @returns {quat} out
  2280. */
  2281. export function rotateZ(out: quat, a: ReadonlyQuat, rad: number): quat;
  2282. /**
  2283. * Calculates the W component of a quat from the X, Y, and Z components.
  2284. * Assumes that quaternion is 1 unit in length.
  2285. * Any existing W component will be ignored.
  2286. *
  2287. * @param {quat} out the receiving quaternion
  2288. * @param {ReadonlyQuat} a quat to calculate W component of
  2289. * @returns {quat} out
  2290. */
  2291. export function calculateW(out: quat, a: ReadonlyQuat): quat;
  2292. /**
  2293. * Calculate the exponential of a unit quaternion.
  2294. *
  2295. * @param {quat} out the receiving quaternion
  2296. * @param {ReadonlyQuat} a quat to calculate the exponential of
  2297. * @returns {quat} out
  2298. */
  2299. export function exp(out: quat, a: ReadonlyQuat): quat;
  2300. /**
  2301. * Calculate the natural logarithm of a unit quaternion.
  2302. *
  2303. * @param {quat} out the receiving quaternion
  2304. * @param {ReadonlyQuat} a quat to calculate the exponential of
  2305. * @returns {quat} out
  2306. */
  2307. export function ln(out: quat, a: ReadonlyQuat): quat;
  2308. /**
  2309. * Calculate the scalar power of a unit quaternion.
  2310. *
  2311. * @param {quat} out the receiving quaternion
  2312. * @param {ReadonlyQuat} a quat to calculate the exponential of
  2313. * @param {Number} b amount to scale the quaternion by
  2314. * @returns {quat} out
  2315. */
  2316. export function pow(out: quat, a: ReadonlyQuat, b: number): quat;
  2317. /**
  2318. * Performs a spherical linear interpolation between two quat
  2319. *
  2320. * @param {quat} out the receiving quaternion
  2321. * @param {ReadonlyQuat} a the first operand
  2322. * @param {ReadonlyQuat} b the second operand
  2323. * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
  2324. * @returns {quat} out
  2325. */
  2326. export function slerp(out: quat, a: ReadonlyQuat, b: ReadonlyQuat, t: number): quat;
  2327. /**
  2328. * Generates a random unit quaternion
  2329. *
  2330. * @param {quat} out the receiving quaternion
  2331. * @returns {quat} out
  2332. */
  2333. export function random(out: quat): quat;
  2334. /**
  2335. * Calculates the inverse of a quat
  2336. *
  2337. * @param {quat} out the receiving quaternion
  2338. * @param {ReadonlyQuat} a quat to calculate inverse of
  2339. * @returns {quat} out
  2340. */
  2341. export function invert(out: quat, a: ReadonlyQuat): quat;
  2342. /**
  2343. * Calculates the conjugate of a quat
  2344. * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
  2345. *
  2346. * @param {quat} out the receiving quaternion
  2347. * @param {ReadonlyQuat} a quat to calculate conjugate of
  2348. * @returns {quat} out
  2349. */
  2350. export function conjugate(out: quat, a: ReadonlyQuat): quat;
  2351. /**
  2352. * Creates a quaternion from the given 3x3 rotation matrix.
  2353. *
  2354. * NOTE: The resultant quaternion is not normalized, so you should be sure
  2355. * to renormalize the quaternion yourself where necessary.
  2356. *
  2357. * @param {quat} out the receiving quaternion
  2358. * @param {ReadonlyMat3} m rotation matrix
  2359. * @returns {quat} out
  2360. * @function
  2361. */
  2362. export function fromMat3(out: quat, m: ReadonlyMat3): quat;
  2363. /**
  2364. * Creates a quaternion from the given euler angle x, y, z.
  2365. *
  2366. * @param {quat} out the receiving quaternion
  2367. * @param {x} Angle to rotate around X axis in degrees.
  2368. * @param {y} Angle to rotate around Y axis in degrees.
  2369. * @param {z} Angle to rotate around Z axis in degrees.
  2370. * @returns {quat} out
  2371. * @function
  2372. */
  2373. export function fromEuler(out: quat, x: any, y: any, z: any): quat;
  2374. /**
  2375. * Returns a string representation of a quatenion
  2376. *
  2377. * @param {ReadonlyQuat} a vector to represent as a string
  2378. * @returns {String} string representation of the vector
  2379. */
  2380. export function str(a: ReadonlyQuat): string;
  2381. /**
  2382. * Creates a new quat initialized with values from an existing quaternion
  2383. *
  2384. * @param {ReadonlyQuat} a quaternion to clone
  2385. * @returns {quat} a new quaternion
  2386. * @function
  2387. */
  2388. export const clone: typeof vec4.clone;
  2389. /**
  2390. * Creates a new quat initialized with the given values
  2391. *
  2392. * @param {Number} x X component
  2393. * @param {Number} y Y component
  2394. * @param {Number} z Z component
  2395. * @param {Number} w W component
  2396. * @returns {quat} a new quaternion
  2397. * @function
  2398. */
  2399. export const fromValues: typeof vec4.fromValues;
  2400. /**
  2401. * Copy the values from one quat to another
  2402. *
  2403. * @param {quat} out the receiving quaternion
  2404. * @param {ReadonlyQuat} a the source quaternion
  2405. * @returns {quat} out
  2406. * @function
  2407. */
  2408. export const copy: typeof vec4.copy;
  2409. /**
  2410. * Set the components of a quat to the given values
  2411. *
  2412. * @param {quat} out the receiving quaternion
  2413. * @param {Number} x X component
  2414. * @param {Number} y Y component
  2415. * @param {Number} z Z component
  2416. * @param {Number} w W component
  2417. * @returns {quat} out
  2418. * @function
  2419. */
  2420. export const set: typeof vec4.set;
  2421. /**
  2422. * Adds two quat's
  2423. *
  2424. * @param {quat} out the receiving quaternion
  2425. * @param {ReadonlyQuat} a the first operand
  2426. * @param {ReadonlyQuat} b the second operand
  2427. * @returns {quat} out
  2428. * @function
  2429. */
  2430. export const add: typeof vec4.add;
  2431. /**
  2432. * Multiplies two quat's
  2433. *
  2434. * @param {quat} out the receiving quaternion
  2435. * @param {ReadonlyQuat} a the first operand
  2436. * @param {ReadonlyQuat} b the second operand
  2437. * @returns {quat} out
  2438. */
  2439. export function mul(out: quat, a: ReadonlyQuat, b: ReadonlyQuat): quat;
  2440. /**
  2441. * Scales a quat by a scalar number
  2442. *
  2443. * @param {quat} out the receiving vector
  2444. * @param {ReadonlyQuat} a the vector to scale
  2445. * @param {Number} b amount to scale the vector by
  2446. * @returns {quat} out
  2447. * @function
  2448. */
  2449. export const scale: typeof vec4.scale;
  2450. /**
  2451. * Calculates the dot product of two quat's
  2452. *
  2453. * @param {ReadonlyQuat} a the first operand
  2454. * @param {ReadonlyQuat} b the second operand
  2455. * @returns {Number} dot product of a and b
  2456. * @function
  2457. */
  2458. export const dot: typeof vec4.dot;
  2459. /**
  2460. * Performs a linear interpolation between two quat's
  2461. *
  2462. * @param {quat} out the receiving quaternion
  2463. * @param {ReadonlyQuat} a the first operand
  2464. * @param {ReadonlyQuat} b the second operand
  2465. * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
  2466. * @returns {quat} out
  2467. * @function
  2468. */
  2469. export const lerp: typeof vec4.lerp;
  2470. /**
  2471. * Calculates the length of a quat
  2472. *
  2473. * @param {ReadonlyQuat} a vector to calculate length of
  2474. * @returns {Number} length of a
  2475. */
  2476. export const length: typeof vec4.length;
  2477. /**
  2478. * Alias for {@link quat.length}
  2479. * @function
  2480. */
  2481. export const len: typeof vec4.length;
  2482. /**
  2483. * Calculates the squared length of a quat
  2484. *
  2485. * @param {ReadonlyQuat} a vector to calculate squared length of
  2486. * @returns {Number} squared length of a
  2487. * @function
  2488. */
  2489. export const squaredLength: typeof vec4.squaredLength;
  2490. /**
  2491. * Alias for {@link quat.squaredLength}
  2492. * @function
  2493. */
  2494. export const sqrLen: typeof vec4.squaredLength;
  2495. /**
  2496. * Normalize a quat
  2497. *
  2498. * @param {quat} out the receiving quaternion
  2499. * @param {ReadonlyQuat} a quaternion to normalize
  2500. * @returns {quat} out
  2501. * @function
  2502. */
  2503. export const normalize: typeof vec4.normalize;
  2504. /**
  2505. * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)
  2506. *
  2507. * @param {ReadonlyQuat} a The first quaternion.
  2508. * @param {ReadonlyQuat} b The second quaternion.
  2509. * @returns {Boolean} True if the vectors are equal, false otherwise.
  2510. */
  2511. export const exactEquals: typeof vec4.exactEquals;
  2512. /**
  2513. * Returns whether or not the quaternions have approximately the same elements in the same position.
  2514. *
  2515. * @param {ReadonlyQuat} a The first vector.
  2516. * @param {ReadonlyQuat} b The second vector.
  2517. * @returns {Boolean} True if the vectors are equal, false otherwise.
  2518. */
  2519. export const equals: typeof vec4.equals;
  2520. export function rotationTo(out: any, a: any, b: any): any;
  2521. export function sqlerp(out: any, a: any, b: any, c: any, d: any, t: any): any;
  2522. export function setAxes(out: any, view: any, right: any, up: any): vec4;
  2523. }
  2524. export module quat2 {
  2525. /**
  2526. * Dual Quaternion<br>
  2527. * Format: [real, dual]<br>
  2528. * Quaternion format: XYZW<br>
  2529. * Make sure to have normalized dual quaternions, otherwise the functions may not work as intended.<br>
  2530. * @module quat2
  2531. */
  2532. /**
  2533. * Creates a new identity dual quat
  2534. *
  2535. * @returns {quat2} a new dual quaternion [real -> rotation, dual -> translation]
  2536. */
  2537. export function create(): quat2;
  2538. /**
  2539. * Creates a new quat initialized with values from an existing quaternion
  2540. *
  2541. * @param {ReadonlyQuat2} a dual quaternion to clone
  2542. * @returns {quat2} new dual quaternion
  2543. * @function
  2544. */
  2545. export function clone(a: ReadonlyQuat2): quat2;
  2546. /**
  2547. * Creates a new dual quat initialized with the given values
  2548. *
  2549. * @param {Number} x1 X component
  2550. * @param {Number} y1 Y component
  2551. * @param {Number} z1 Z component
  2552. * @param {Number} w1 W component
  2553. * @param {Number} x2 X component
  2554. * @param {Number} y2 Y component
  2555. * @param {Number} z2 Z component
  2556. * @param {Number} w2 W component
  2557. * @returns {quat2} new dual quaternion
  2558. * @function
  2559. */
  2560. export function fromValues(x1: number, y1: number, z1: number, w1: number, x2: number, y2: number, z2: number, w2: number): quat2;
  2561. /**
  2562. * Creates a new dual quat from the given values (quat and translation)
  2563. *
  2564. * @param {Number} x1 X component
  2565. * @param {Number} y1 Y component
  2566. * @param {Number} z1 Z component
  2567. * @param {Number} w1 W component
  2568. * @param {Number} x2 X component (translation)
  2569. * @param {Number} y2 Y component (translation)
  2570. * @param {Number} z2 Z component (translation)
  2571. * @returns {quat2} new dual quaternion
  2572. * @function
  2573. */
  2574. export function fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number, x2: number, y2: number, z2: number): quat2;
  2575. /**
  2576. * Creates a dual quat from a quaternion and a translation
  2577. *
  2578. * @param {ReadonlyQuat2} dual quaternion receiving operation result
  2579. * @param {ReadonlyQuat} q a normalized quaternion
  2580. * @param {ReadonlyVec3} t tranlation vector
  2581. * @returns {quat2} dual quaternion receiving operation result
  2582. * @function
  2583. */
  2584. export function fromRotationTranslation(out: any, q: ReadonlyQuat, t: ReadonlyVec3): quat2;
  2585. /**
  2586. * Creates a dual quat from a translation
  2587. *
  2588. * @param {ReadonlyQuat2} dual quaternion receiving operation result
  2589. * @param {ReadonlyVec3} t translation vector
  2590. * @returns {quat2} dual quaternion receiving operation result
  2591. * @function
  2592. */
  2593. export function fromTranslation(out: any, t: ReadonlyVec3): quat2;
  2594. /**
  2595. * Creates a dual quat from a quaternion
  2596. *
  2597. * @param {ReadonlyQuat2} dual quaternion receiving operation result
  2598. * @param {ReadonlyQuat} q the quaternion
  2599. * @returns {quat2} dual quaternion receiving operation result
  2600. * @function
  2601. */
  2602. export function fromRotation(out: any, q: ReadonlyQuat): quat2;
  2603. /**
  2604. * Creates a new dual quat from a matrix (4x4)
  2605. *
  2606. * @param {quat2} out the dual quaternion
  2607. * @param {ReadonlyMat4} a the matrix
  2608. * @returns {quat2} dual quat receiving operation result
  2609. * @function
  2610. */
  2611. export function fromMat4(out: quat2, a: ReadonlyMat4): quat2;
  2612. /**
  2613. * Copy the values from one dual quat to another
  2614. *
  2615. * @param {quat2} out the receiving dual quaternion
  2616. * @param {ReadonlyQuat2} a the source dual quaternion
  2617. * @returns {quat2} out
  2618. * @function
  2619. */
  2620. export function copy(out: quat2, a: ReadonlyQuat2): quat2;
  2621. /**
  2622. * Set a dual quat to the identity dual quaternion
  2623. *
  2624. * @param {quat2} out the receiving quaternion
  2625. * @returns {quat2} out
  2626. */
  2627. export function identity(out: quat2): quat2;
  2628. /**
  2629. * Set the components of a dual quat to the given values
  2630. *
  2631. * @param {quat2} out the receiving quaternion
  2632. * @param {Number} x1 X component
  2633. * @param {Number} y1 Y component
  2634. * @param {Number} z1 Z component
  2635. * @param {Number} w1 W component
  2636. * @param {Number} x2 X component
  2637. * @param {Number} y2 Y component
  2638. * @param {Number} z2 Z component
  2639. * @param {Number} w2 W component
  2640. * @returns {quat2} out
  2641. * @function
  2642. */
  2643. export function set(out: quat2, x1: number, y1: number, z1: number, w1: number, x2: number, y2: number, z2: number, w2: number): quat2;
  2644. /**
  2645. * Gets the dual part of a dual quat
  2646. * @param {quat} out dual part
  2647. * @param {ReadonlyQuat2} a Dual Quaternion
  2648. * @return {quat} dual part
  2649. */
  2650. export function getDual(out: quat, a: ReadonlyQuat2): quat;
  2651. /**
  2652. * Set the dual component of a dual quat to the given quaternion
  2653. *
  2654. * @param {quat2} out the receiving quaternion
  2655. * @param {ReadonlyQuat} q a quaternion representing the dual part
  2656. * @returns {quat2} out
  2657. * @function
  2658. */
  2659. export function setDual(out: quat2, q: ReadonlyQuat): quat2;
  2660. /**
  2661. * Gets the translation of a normalized dual quat
  2662. * @param {vec3} out translation
  2663. * @param {ReadonlyQuat2} a Dual Quaternion to be decomposed
  2664. * @return {vec3} translation
  2665. */
  2666. export function getTranslation(out: vec3, a: ReadonlyQuat2): vec3;
  2667. /**
  2668. * Translates a dual quat by the given vector
  2669. *
  2670. * @param {quat2} out the receiving dual quaternion
  2671. * @param {ReadonlyQuat2} a the dual quaternion to translate
  2672. * @param {ReadonlyVec3} v vector to translate by
  2673. * @returns {quat2} out
  2674. */
  2675. export function translate(out: quat2, a: ReadonlyQuat2, v: ReadonlyVec3): quat2;
  2676. /**
  2677. * Rotates a dual quat around the X axis
  2678. *
  2679. * @param {quat2} out the receiving dual quaternion
  2680. * @param {ReadonlyQuat2} a the dual quaternion to rotate
  2681. * @param {number} rad how far should the rotation be
  2682. * @returns {quat2} out
  2683. */
  2684. export function rotateX(out: quat2, a: ReadonlyQuat2, rad: number): quat2;
  2685. /**
  2686. * Rotates a dual quat around the Y axis
  2687. *
  2688. * @param {quat2} out the receiving dual quaternion
  2689. * @param {ReadonlyQuat2} a the dual quaternion to rotate
  2690. * @param {number} rad how far should the rotation be
  2691. * @returns {quat2} out
  2692. */
  2693. export function rotateY(out: quat2, a: ReadonlyQuat2, rad: number): quat2;
  2694. /**
  2695. * Rotates a dual quat around the Z axis
  2696. *
  2697. * @param {quat2} out the receiving dual quaternion
  2698. * @param {ReadonlyQuat2} a the dual quaternion to rotate
  2699. * @param {number} rad how far should the rotation be
  2700. * @returns {quat2} out
  2701. */
  2702. export function rotateZ(out: quat2, a: ReadonlyQuat2, rad: number): quat2;
  2703. /**
  2704. * Rotates a dual quat by a given quaternion (a * q)
  2705. *
  2706. * @param {quat2} out the receiving dual quaternion
  2707. * @param {ReadonlyQuat2} a the dual quaternion to rotate
  2708. * @param {ReadonlyQuat} q quaternion to rotate by
  2709. * @returns {quat2} out
  2710. */
  2711. export function rotateByQuatAppend(out: quat2, a: ReadonlyQuat2, q: ReadonlyQuat): quat2;
  2712. /**
  2713. * Rotates a dual quat by a given quaternion (q * a)
  2714. *
  2715. * @param {quat2} out the receiving dual quaternion
  2716. * @param {ReadonlyQuat} q quaternion to rotate by
  2717. * @param {ReadonlyQuat2} a the dual quaternion to rotate
  2718. * @returns {quat2} out
  2719. */
  2720. export function rotateByQuatPrepend(out: quat2, q: ReadonlyQuat, a: ReadonlyQuat2): quat2;
  2721. /**
  2722. * Rotates a dual quat around a given axis. Does the normalisation automatically
  2723. *
  2724. * @param {quat2} out the receiving dual quaternion
  2725. * @param {ReadonlyQuat2} a the dual quaternion to rotate
  2726. * @param {ReadonlyVec3} axis the axis to rotate around
  2727. * @param {Number} rad how far the rotation should be
  2728. * @returns {quat2} out
  2729. */
  2730. export function rotateAroundAxis(out: quat2, a: ReadonlyQuat2, axis: ReadonlyVec3, rad: number): quat2;
  2731. /**
  2732. * Adds two dual quat's
  2733. *
  2734. * @param {quat2} out the receiving dual quaternion
  2735. * @param {ReadonlyQuat2} a the first operand
  2736. * @param {ReadonlyQuat2} b the second operand
  2737. * @returns {quat2} out
  2738. * @function
  2739. */
  2740. export function add(out: quat2, a: ReadonlyQuat2, b: ReadonlyQuat2): quat2;
  2741. /**
  2742. * Multiplies two dual quat's
  2743. *
  2744. * @param {quat2} out the receiving dual quaternion
  2745. * @param {ReadonlyQuat2} a the first operand
  2746. * @param {ReadonlyQuat2} b the second operand
  2747. * @returns {quat2} out
  2748. */
  2749. export function multiply(out: quat2, a: ReadonlyQuat2, b: ReadonlyQuat2): quat2;
  2750. /**
  2751. * Scales a dual quat by a scalar number
  2752. *
  2753. * @param {quat2} out the receiving dual quat
  2754. * @param {ReadonlyQuat2} a the dual quat to scale
  2755. * @param {Number} b amount to scale the dual quat by
  2756. * @returns {quat2} out
  2757. * @function
  2758. */
  2759. export function scale(out: quat2, a: ReadonlyQuat2, b: number): quat2;
  2760. /**
  2761. * Performs a linear interpolation between two dual quats's
  2762. * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when t = 0.5)
  2763. *
  2764. * @param {quat2} out the receiving dual quat
  2765. * @param {ReadonlyQuat2} a the first operand
  2766. * @param {ReadonlyQuat2} b the second operand
  2767. * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
  2768. * @returns {quat2} out
  2769. */
  2770. export function lerp(out: quat2, a: ReadonlyQuat2, b: ReadonlyQuat2, t: number): quat2;
  2771. /**
  2772. * Calculates the inverse of a dual quat. If they are normalized, conjugate is cheaper
  2773. *
  2774. * @param {quat2} out the receiving dual quaternion
  2775. * @param {ReadonlyQuat2} a dual quat to calculate inverse of
  2776. * @returns {quat2} out
  2777. */
  2778. export function invert(out: quat2, a: ReadonlyQuat2): quat2;
  2779. /**
  2780. * Calculates the conjugate of a dual quat
  2781. * If the dual quaternion is normalized, this function is faster than quat2.inverse and produces the same result.
  2782. *
  2783. * @param {quat2} out the receiving quaternion
  2784. * @param {ReadonlyQuat2} a quat to calculate conjugate of
  2785. * @returns {quat2} out
  2786. */
  2787. export function conjugate(out: quat2, a: ReadonlyQuat2): quat2;
  2788. /**
  2789. * Normalize a dual quat
  2790. *
  2791. * @param {quat2} out the receiving dual quaternion
  2792. * @param {ReadonlyQuat2} a dual quaternion to normalize
  2793. * @returns {quat2} out
  2794. * @function
  2795. */
  2796. export function normalize(out: quat2, a: ReadonlyQuat2): quat2;
  2797. /**
  2798. * Returns a string representation of a dual quatenion
  2799. *
  2800. * @param {ReadonlyQuat2} a dual quaternion to represent as a string
  2801. * @returns {String} string representation of the dual quat
  2802. */
  2803. export function str(a: ReadonlyQuat2): string;
  2804. /**
  2805. * Returns whether or not the dual quaternions have exactly the same elements in the same position (when compared with ===)
  2806. *
  2807. * @param {ReadonlyQuat2} a the first dual quaternion.
  2808. * @param {ReadonlyQuat2} b the second dual quaternion.
  2809. * @returns {Boolean} true if the dual quaternions are equal, false otherwise.
  2810. */
  2811. export function exactEquals(a: ReadonlyQuat2, b: ReadonlyQuat2): boolean;
  2812. /**
  2813. * Returns whether or not the dual quaternions have approximately the same elements in the same position.
  2814. *
  2815. * @param {ReadonlyQuat2} a the first dual quat.
  2816. * @param {ReadonlyQuat2} b the second dual quat.
  2817. * @returns {Boolean} true if the dual quats are equal, false otherwise.
  2818. */
  2819. export function equals(a: ReadonlyQuat2, b: ReadonlyQuat2): boolean;
  2820. /**
  2821. * Gets the real part of a dual quat
  2822. * @param {quat} out real part
  2823. * @param {ReadonlyQuat2} a Dual Quaternion
  2824. * @return {quat} real part
  2825. */
  2826. export const getReal: typeof vec4.copy;
  2827. /**
  2828. * Set the real component of a dual quat to the given quaternion
  2829. *
  2830. * @param {quat2} out the receiving quaternion
  2831. * @param {ReadonlyQuat} q a quaternion representing the real part
  2832. * @returns {quat2} out
  2833. * @function
  2834. */
  2835. export const setReal: typeof vec4.copy;
  2836. /**
  2837. * Multiplies two dual quat's
  2838. *
  2839. * @param {quat2} out the receiving dual quaternion
  2840. * @param {ReadonlyQuat2} a the first operand
  2841. * @param {ReadonlyQuat2} b the second operand
  2842. * @returns {quat2} out
  2843. */
  2844. export function mul(out: quat2, a: ReadonlyQuat2, b: ReadonlyQuat2): quat2;
  2845. /**
  2846. * Calculates the dot product of two dual quat's (The dot product of the real parts)
  2847. *
  2848. * @param {ReadonlyQuat2} a the first operand
  2849. * @param {ReadonlyQuat2} b the second operand
  2850. * @returns {Number} dot product of a and b
  2851. * @function
  2852. */
  2853. export const dot: typeof vec4.dot;
  2854. /**
  2855. * Calculates the length of a dual quat
  2856. *
  2857. * @param {ReadonlyQuat2} a dual quat to calculate length of
  2858. * @returns {Number} length of a
  2859. * @function
  2860. */
  2861. export const length: typeof vec4.length;
  2862. /**
  2863. * Alias for {@link quat2.length}
  2864. * @function
  2865. */
  2866. export const len: typeof vec4.length;
  2867. /**
  2868. * Calculates the squared length of a dual quat
  2869. *
  2870. * @param {ReadonlyQuat2} a dual quat to calculate squared length of
  2871. * @returns {Number} squared length of a
  2872. * @function
  2873. */
  2874. export const squaredLength: typeof vec4.squaredLength;
  2875. /**
  2876. * Alias for {@link quat2.squaredLength}
  2877. * @function
  2878. */
  2879. export const sqrLen: typeof vec4.squaredLength;
  2880. }
  2881. export module vec2 {
  2882. /**
  2883. * 2 Dimensional Vector
  2884. * @module vec2
  2885. */
  2886. /**
  2887. * Creates a new, empty vec2
  2888. *
  2889. * @returns {vec2} a new 2D vector
  2890. */
  2891. export function create(): vec2;
  2892. /**
  2893. * Creates a new vec2 initialized with values from an existing vector
  2894. *
  2895. * @param {ReadonlyVec2} a vector to clone
  2896. * @returns {vec2} a new 2D vector
  2897. */
  2898. export function clone(a: ReadonlyVec2): vec2;
  2899. /**
  2900. * Creates a new vec2 initialized with the given values
  2901. *
  2902. * @param {Number} x X component
  2903. * @param {Number} y Y component
  2904. * @returns {vec2} a new 2D vector
  2905. */
  2906. export function fromValues(x: number, y: number): vec2;
  2907. /**
  2908. * Copy the values from one vec2 to another
  2909. *
  2910. * @param {vec2} out the receiving vector
  2911. * @param {ReadonlyVec2} a the source vector
  2912. * @returns {vec2} out
  2913. */
  2914. export function copy(out: vec2, a: ReadonlyVec2): vec2;
  2915. /**
  2916. * Set the components of a vec2 to the given values
  2917. *
  2918. * @param {vec2} out the receiving vector
  2919. * @param {Number} x X component
  2920. * @param {Number} y Y component
  2921. * @returns {vec2} out
  2922. */
  2923. export function set(out: vec2, x: number, y: number): vec2;
  2924. /**
  2925. * Adds two vec2's
  2926. *
  2927. * @param {vec2} out the receiving vector
  2928. * @param {ReadonlyVec2} a the first operand
  2929. * @param {ReadonlyVec2} b the second operand
  2930. * @returns {vec2} out
  2931. */
  2932. export function add(out: vec2, a: ReadonlyVec2, b: ReadonlyVec2): vec2;
  2933. /**
  2934. * Subtracts vector b from vector a
  2935. *
  2936. * @param {vec2} out the receiving vector
  2937. * @param {ReadonlyVec2} a the first operand
  2938. * @param {ReadonlyVec2} b the second operand
  2939. * @returns {vec2} out
  2940. */
  2941. export function subtract(out: vec2, a: ReadonlyVec2, b: ReadonlyVec2): vec2;
  2942. /**
  2943. * Multiplies two vec2's
  2944. *
  2945. * @param {vec2} out the receiving vector
  2946. * @param {ReadonlyVec2} a the first operand
  2947. * @param {ReadonlyVec2} b the second operand
  2948. * @returns {vec2} out
  2949. */
  2950. export function multiply(out: vec2, a: ReadonlyVec2, b: ReadonlyVec2): vec2;
  2951. /**
  2952. * Divides two vec2's
  2953. *
  2954. * @param {vec2} out the receiving vector
  2955. * @param {ReadonlyVec2} a the first operand
  2956. * @param {ReadonlyVec2} b the second operand
  2957. * @returns {vec2} out
  2958. */
  2959. export function divide(out: vec2, a: ReadonlyVec2, b: ReadonlyVec2): vec2;
  2960. /**
  2961. * Math.ceil the components of a vec2
  2962. *
  2963. * @param {vec2} out the receiving vector
  2964. * @param {ReadonlyVec2} a vector to ceil
  2965. * @returns {vec2} out
  2966. */
  2967. export function ceil(out: vec2, a: ReadonlyVec2): vec2;
  2968. /**
  2969. * Math.floor the components of a vec2
  2970. *
  2971. * @param {vec2} out the receiving vector
  2972. * @param {ReadonlyVec2} a vector to floor
  2973. * @returns {vec2} out
  2974. */
  2975. export function floor(out: vec2, a: ReadonlyVec2): vec2;
  2976. /**
  2977. * Returns the minimum of two vec2's
  2978. *
  2979. * @param {vec2} out the receiving vector
  2980. * @param {ReadonlyVec2} a the first operand
  2981. * @param {ReadonlyVec2} b the second operand
  2982. * @returns {vec2} out
  2983. */
  2984. export function min(out: vec2, a: ReadonlyVec2, b: ReadonlyVec2): vec2;
  2985. /**
  2986. * Returns the maximum of two vec2's
  2987. *
  2988. * @param {vec2} out the receiving vector
  2989. * @param {ReadonlyVec2} a the first operand
  2990. * @param {ReadonlyVec2} b the second operand
  2991. * @returns {vec2} out
  2992. */
  2993. export function max(out: vec2, a: ReadonlyVec2, b: ReadonlyVec2): vec2;
  2994. /**
  2995. * Math.round the components of a vec2
  2996. *
  2997. * @param {vec2} out the receiving vector
  2998. * @param {ReadonlyVec2} a vector to round
  2999. * @returns {vec2} out
  3000. */
  3001. export function round(out: vec2, a: ReadonlyVec2): vec2;
  3002. /**
  3003. * Scales a vec2 by a scalar number
  3004. *
  3005. * @param {vec2} out the receiving vector
  3006. * @param {ReadonlyVec2} a the vector to scale
  3007. * @param {Number} b amount to scale the vector by
  3008. * @returns {vec2} out
  3009. */
  3010. export function scale(out: vec2, a: ReadonlyVec2, b: number): vec2;
  3011. /**
  3012. * Adds two vec2's after scaling the second operand by a scalar value
  3013. *
  3014. * @param {vec2} out the receiving vector
  3015. * @param {ReadonlyVec2} a the first operand
  3016. * @param {ReadonlyVec2} b the second operand
  3017. * @param {Number} scale the amount to scale b by before adding
  3018. * @returns {vec2} out
  3019. */
  3020. export function scaleAndAdd(out: vec2, a: ReadonlyVec2, b: ReadonlyVec2, scale: number): vec2;
  3021. /**
  3022. * Calculates the euclidian distance between two vec2's
  3023. *
  3024. * @param {ReadonlyVec2} a the first operand
  3025. * @param {ReadonlyVec2} b the second operand
  3026. * @returns {Number} distance between a and b
  3027. */
  3028. export function distance(a: ReadonlyVec2, b: ReadonlyVec2): number;
  3029. /**
  3030. * Calculates the squared euclidian distance between two vec2's
  3031. *
  3032. * @param {ReadonlyVec2} a the first operand
  3033. * @param {ReadonlyVec2} b the second operand
  3034. * @returns {Number} squared distance between a and b
  3035. */
  3036. export function squaredDistance(a: ReadonlyVec2, b: ReadonlyVec2): number;
  3037. /**
  3038. * Calculates the length of a vec2
  3039. *
  3040. * @param {ReadonlyVec2} a vector to calculate length of
  3041. * @returns {Number} length of a
  3042. */
  3043. export function length(a: ReadonlyVec2): number;
  3044. /**
  3045. * Calculates the squared length of a vec2
  3046. *
  3047. * @param {ReadonlyVec2} a vector to calculate squared length of
  3048. * @returns {Number} squared length of a
  3049. */
  3050. export function squaredLength(a: ReadonlyVec2): number;
  3051. /**
  3052. * Negates the components of a vec2
  3053. *
  3054. * @param {vec2} out the receiving vector
  3055. * @param {ReadonlyVec2} a vector to negate
  3056. * @returns {vec2} out
  3057. */
  3058. export function negate(out: vec2, a: ReadonlyVec2): vec2;
  3059. /**
  3060. * Returns the inverse of the components of a vec2
  3061. *
  3062. * @param {vec2} out the receiving vector
  3063. * @param {ReadonlyVec2} a vector to invert
  3064. * @returns {vec2} out
  3065. */
  3066. export function inverse(out: vec2, a: ReadonlyVec2): vec2;
  3067. /**
  3068. * Normalize a vec2
  3069. *
  3070. * @param {vec2} out the receiving vector
  3071. * @param {ReadonlyVec2} a vector to normalize
  3072. * @returns {vec2} out
  3073. */
  3074. export function normalize(out: vec2, a: ReadonlyVec2): vec2;
  3075. /**
  3076. * Calculates the dot product of two vec2's
  3077. *
  3078. * @param {ReadonlyVec2} a the first operand
  3079. * @param {ReadonlyVec2} b the second operand
  3080. * @returns {Number} dot product of a and b
  3081. */
  3082. export function dot(a: ReadonlyVec2, b: ReadonlyVec2): number;
  3083. /**
  3084. * Computes the cross product of two vec2's
  3085. * Note that the cross product must by definition produce a 3D vector
  3086. *
  3087. * @param {vec3} out the receiving vector
  3088. * @param {ReadonlyVec2} a the first operand
  3089. * @param {ReadonlyVec2} b the second operand
  3090. * @returns {vec3} out
  3091. */
  3092. export function cross(out: vec3, a: ReadonlyVec2, b: ReadonlyVec2): vec3;
  3093. /**
  3094. * Performs a linear interpolation between two vec2's
  3095. *
  3096. * @param {vec2} out the receiving vector
  3097. * @param {ReadonlyVec2} a the first operand
  3098. * @param {ReadonlyVec2} b the second operand
  3099. * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
  3100. * @returns {vec2} out
  3101. */
  3102. export function lerp(out: vec2, a: ReadonlyVec2, b: ReadonlyVec2, t: number): vec2;
  3103. /**
  3104. * Generates a random vector with the given scale
  3105. *
  3106. * @param {vec2} out the receiving vector
  3107. * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
  3108. * @returns {vec2} out
  3109. */
  3110. export function random(out: vec2, scale?: number): vec2;
  3111. /**
  3112. * Transforms the vec2 with a mat2
  3113. *
  3114. * @param {vec2} out the receiving vector
  3115. * @param {ReadonlyVec2} a the vector to transform
  3116. * @param {ReadonlyMat2} m matrix to transform with
  3117. * @returns {vec2} out
  3118. */
  3119. export function transformMat2(out: vec2, a: ReadonlyVec2, m: ReadonlyMat2): vec2;
  3120. /**
  3121. * Transforms the vec2 with a mat2d
  3122. *
  3123. * @param {vec2} out the receiving vector
  3124. * @param {ReadonlyVec2} a the vector to transform
  3125. * @param {ReadonlyMat2d} m matrix to transform with
  3126. * @returns {vec2} out
  3127. */
  3128. export function transformMat2d(out: vec2, a: ReadonlyVec2, m: ReadonlyMat2d): vec2;
  3129. /**
  3130. * Transforms the vec2 with a mat3
  3131. * 3rd vector component is implicitly '1'
  3132. *
  3133. * @param {vec2} out the receiving vector
  3134. * @param {ReadonlyVec2} a the vector to transform
  3135. * @param {ReadonlyMat3} m matrix to transform with
  3136. * @returns {vec2} out
  3137. */
  3138. export function transformMat3(out: vec2, a: ReadonlyVec2, m: ReadonlyMat3): vec2;
  3139. /**
  3140. * Transforms the vec2 with a mat4
  3141. * 3rd vector component is implicitly '0'
  3142. * 4th vector component is implicitly '1'
  3143. *
  3144. * @param {vec2} out the receiving vector
  3145. * @param {ReadonlyVec2} a the vector to transform
  3146. * @param {ReadonlyMat4} m matrix to transform with
  3147. * @returns {vec2} out
  3148. */
  3149. export function transformMat4(out: vec2, a: ReadonlyVec2, m: ReadonlyMat4): vec2;
  3150. /**
  3151. * Rotate a 2D vector
  3152. * @param {vec2} out The receiving vec2
  3153. * @param {ReadonlyVec2} a The vec2 point to rotate
  3154. * @param {ReadonlyVec2} b The origin of the rotation
  3155. * @param {Number} rad The angle of rotation in radians
  3156. * @returns {vec2} out
  3157. */
  3158. export function rotate(out: vec2, a: ReadonlyVec2, b: ReadonlyVec2, rad: number): vec2;
  3159. /**
  3160. * Get the angle between two 2D vectors
  3161. * @param {ReadonlyVec2} a The first operand
  3162. * @param {ReadonlyVec2} b The second operand
  3163. * @returns {Number} The angle in radians
  3164. */
  3165. export function angle(a: ReadonlyVec2, b: ReadonlyVec2): number;
  3166. /**
  3167. * Set the components of a vec2 to zero
  3168. *
  3169. * @param {vec2} out the receiving vector
  3170. * @returns {vec2} out
  3171. */
  3172. export function zero(out: vec2): vec2;
  3173. /**
  3174. * Returns a string representation of a vector
  3175. *
  3176. * @param {ReadonlyVec2} a vector to represent as a string
  3177. * @returns {String} string representation of the vector
  3178. */
  3179. export function str(a: ReadonlyVec2): string;
  3180. /**
  3181. * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)
  3182. *
  3183. * @param {ReadonlyVec2} a The first vector.
  3184. * @param {ReadonlyVec2} b The second vector.
  3185. * @returns {Boolean} True if the vectors are equal, false otherwise.
  3186. */
  3187. export function exactEquals(a: ReadonlyVec2, b: ReadonlyVec2): boolean;
  3188. /**
  3189. * Returns whether or not the vectors have approximately the same elements in the same position.
  3190. *
  3191. * @param {ReadonlyVec2} a The first vector.
  3192. * @param {ReadonlyVec2} b The second vector.
  3193. * @returns {Boolean} True if the vectors are equal, false otherwise.
  3194. */
  3195. export function equals(a: ReadonlyVec2, b: ReadonlyVec2): boolean;
  3196. /**
  3197. * Calculates the length of a vec2
  3198. *
  3199. * @param {ReadonlyVec2} a vector to calculate length of
  3200. * @returns {Number} length of a
  3201. */
  3202. export function len(a: ReadonlyVec2): number;
  3203. /**
  3204. * Subtracts vector b from vector a
  3205. *
  3206. * @param {vec2} out the receiving vector
  3207. * @param {ReadonlyVec2} a the first operand
  3208. * @param {ReadonlyVec2} b the second operand
  3209. * @returns {vec2} out
  3210. */
  3211. export function sub(out: vec2, a: ReadonlyVec2, b: ReadonlyVec2): vec2;
  3212. /**
  3213. * Multiplies two vec2's
  3214. *
  3215. * @param {vec2} out the receiving vector
  3216. * @param {ReadonlyVec2} a the first operand
  3217. * @param {ReadonlyVec2} b the second operand
  3218. * @returns {vec2} out
  3219. */
  3220. export function mul(out: vec2, a: ReadonlyVec2, b: ReadonlyVec2): vec2;
  3221. /**
  3222. * Divides two vec2's
  3223. *
  3224. * @param {vec2} out the receiving vector
  3225. * @param {ReadonlyVec2} a the first operand
  3226. * @param {ReadonlyVec2} b the second operand
  3227. * @returns {vec2} out
  3228. */
  3229. export function div(out: vec2, a: ReadonlyVec2, b: ReadonlyVec2): vec2;
  3230. /**
  3231. * Calculates the euclidian distance between two vec2's
  3232. *
  3233. * @param {ReadonlyVec2} a the first operand
  3234. * @param {ReadonlyVec2} b the second operand
  3235. * @returns {Number} distance between a and b
  3236. */
  3237. export function dist(a: ReadonlyVec2, b: ReadonlyVec2): number;
  3238. /**
  3239. * Calculates the squared euclidian distance between two vec2's
  3240. *
  3241. * @param {ReadonlyVec2} a the first operand
  3242. * @param {ReadonlyVec2} b the second operand
  3243. * @returns {Number} squared distance between a and b
  3244. */
  3245. export function sqrDist(a: ReadonlyVec2, b: ReadonlyVec2): number;
  3246. /**
  3247. * Calculates the squared length of a vec2
  3248. *
  3249. * @param {ReadonlyVec2} a vector to calculate squared length of
  3250. * @returns {Number} squared length of a
  3251. */
  3252. export function sqrLen(a: ReadonlyVec2): number;
  3253. export function forEach(a: any, stride: any, offset: any, count: any, fn: any, arg: any): any;
  3254. }
  3255. }