Box2.html 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Class: Box2</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Class: Box2</h1>
  17. <section>
  18. <header>
  19. <h2><span class="attribs"><span class="type-signature"></span></span>Box2<span class="signature">(min, max)</span><span class="type-signature"></span></h2>
  20. </header>
  21. <article>
  22. <div class="container-overview">
  23. <h4 class="name" id="Box2"><span class="type-signature"></span>new Box2<span class="signature">(min, max)</span><span class="type-signature"></span></h4>
  24. <div class="description">
  25. Box is described by a minimum and maximum points. Can be used for collision detection with points and other boxes.
  26. </div>
  27. <h5>Parameters:</h5>
  28. <table class="params">
  29. <thead>
  30. <tr>
  31. <th>Name</th>
  32. <th>Type</th>
  33. <th class="last">Description</th>
  34. </tr>
  35. </thead>
  36. <tbody>
  37. <tr>
  38. <td class="name"><code>min</code></td>
  39. <td class="type">
  40. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  41. </td>
  42. <td class="description last"></td>
  43. </tr>
  44. <tr>
  45. <td class="name"><code>max</code></td>
  46. <td class="type">
  47. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  48. </td>
  49. <td class="description last"></td>
  50. </tr>
  51. </tbody>
  52. </table>
  53. <dl class="details">
  54. <dt class="tag-source">Source:</dt>
  55. <dd class="tag-source"><ul class="dummy"><li>
  56. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line14">line 14</a>
  57. </li></ul></dd>
  58. </dl>
  59. </div>
  60. <h3 class="subsection-title">Methods</h3>
  61. <h4 class="name" id="clone"><span class="type-signature"></span>clone<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Box2.html">Box2</a>}</span></h4>
  62. <div class="description">
  63. Clone the box into a new object. Should be used when it it necessary to make operations to this box.
  64. </div>
  65. <dl class="details">
  66. <dt class="tag-source">Source:</dt>
  67. <dd class="tag-source"><ul class="dummy"><li>
  68. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line75">line 75</a>
  69. </li></ul></dd>
  70. </dl>
  71. <h5>Returns:</h5>
  72. <div class="param-desc">
  73. New box object with the copy of this object.
  74. </div>
  75. <dl>
  76. <dt>
  77. Type
  78. </dt>
  79. <dd>
  80. <span class="param-type"><a href="Box2.html">Box2</a></span>
  81. </dd>
  82. </dl>
  83. <h4 class="name" id="containsBox"><span class="type-signature"></span>containsBox<span class="signature">(box)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
  84. <div class="description">
  85. Check if the box fully contains another box inside (different from intersects box). Only returns true if the box is fully contained.
  86. </div>
  87. <h5>Parameters:</h5>
  88. <table class="params">
  89. <thead>
  90. <tr>
  91. <th>Name</th>
  92. <th>Type</th>
  93. <th class="last">Description</th>
  94. </tr>
  95. </thead>
  96. <tbody>
  97. <tr>
  98. <td class="name"><code>box</code></td>
  99. <td class="type">
  100. <span class="param-type"><a href="Box2.html">Box2</a></span>
  101. </td>
  102. <td class="description last"></td>
  103. </tr>
  104. </tbody>
  105. </table>
  106. <dl class="details">
  107. <dt class="tag-source">Source:</dt>
  108. <dd class="tag-source"><ul class="dummy"><li>
  109. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line197">line 197</a>
  110. </li></ul></dd>
  111. </dl>
  112. <h5>Returns:</h5>
  113. <div class="param-desc">
  114. True if the box contains box.
  115. </div>
  116. <dl>
  117. <dt>
  118. Type
  119. </dt>
  120. <dd>
  121. <span class="param-type">boolean</span>
  122. </dd>
  123. </dl>
  124. <h4 class="name" id="containsPoint"><span class="type-signature"></span>containsPoint<span class="signature">(point)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
  125. <div class="description">
  126. Check if the box contains a point inside.
  127. </div>
  128. <h5>Parameters:</h5>
  129. <table class="params">
  130. <thead>
  131. <tr>
  132. <th>Name</th>
  133. <th>Type</th>
  134. <th class="last">Description</th>
  135. </tr>
  136. </thead>
  137. <tbody>
  138. <tr>
  139. <td class="name"><code>point</code></td>
  140. <td class="type">
  141. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  142. </td>
  143. <td class="description last"></td>
  144. </tr>
  145. </tbody>
  146. </table>
  147. <dl class="details">
  148. <dt class="tag-source">Source:</dt>
  149. <dd class="tag-source"><ul class="dummy"><li>
  150. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line184">line 184</a>
  151. </li></ul></dd>
  152. </dl>
  153. <h5>Returns:</h5>
  154. <div class="param-desc">
  155. True if the box contains point.
  156. </div>
  157. <dl>
  158. <dt>
  159. Type
  160. </dt>
  161. <dd>
  162. <span class="param-type">boolean</span>
  163. </dd>
  164. </dl>
  165. <h4 class="name" id="copy"><span class="type-signature"></span>copy<span class="signature">(point)</span><span class="type-signature"></span></h4>
  166. <div class="description">
  167. Copy the box value from another box.
  168. </div>
  169. <h5>Parameters:</h5>
  170. <table class="params">
  171. <thead>
  172. <tr>
  173. <th>Name</th>
  174. <th>Type</th>
  175. <th class="last">Description</th>
  176. </tr>
  177. </thead>
  178. <tbody>
  179. <tr>
  180. <td class="name"><code>point</code></td>
  181. <td class="type">
  182. <span class="param-type"><a href="Box2.html">Box2</a></span>
  183. </td>
  184. <td class="description last"></td>
  185. </tr>
  186. </tbody>
  187. </table>
  188. <dl class="details">
  189. <dt class="tag-source">Source:</dt>
  190. <dd class="tag-source"><ul class="dummy"><li>
  191. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line87">line 87</a>
  192. </li></ul></dd>
  193. </dl>
  194. <h4 class="name" id="distanceToPoint"><span class="type-signature"></span>distanceToPoint<span class="signature">(point)</span><span class="type-signature"> &rarr; {number}</span></h4>
  195. <div class="description">
  196. Calculate the distance to a point.
  197. </div>
  198. <h5>Parameters:</h5>
  199. <table class="params">
  200. <thead>
  201. <tr>
  202. <th>Name</th>
  203. <th>Type</th>
  204. <th class="last">Description</th>
  205. </tr>
  206. </thead>
  207. <tbody>
  208. <tr>
  209. <td class="name"><code>point</code></td>
  210. <td class="type">
  211. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  212. </td>
  213. <td class="description last"></td>
  214. </tr>
  215. </tbody>
  216. </table>
  217. <dl class="details">
  218. <dt class="tag-source">Source:</dt>
  219. <dd class="tag-source"><ul class="dummy"><li>
  220. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line219">line 219</a>
  221. </li></ul></dd>
  222. </dl>
  223. <h5>Returns:</h5>
  224. <div class="param-desc">
  225. Distance to point calculated.
  226. </div>
  227. <dl>
  228. <dt>
  229. Type
  230. </dt>
  231. <dd>
  232. <span class="param-type">number</span>
  233. </dd>
  234. </dl>
  235. <h4 class="name" id="equals"><span class="type-signature"></span>equals<span class="signature">(box)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
  236. <div class="description">
  237. Checks if two boxes are equal.
  238. </div>
  239. <h5>Parameters:</h5>
  240. <table class="params">
  241. <thead>
  242. <tr>
  243. <th>Name</th>
  244. <th>Type</th>
  245. <th class="last">Description</th>
  246. </tr>
  247. </thead>
  248. <tbody>
  249. <tr>
  250. <td class="name"><code>box</code></td>
  251. <td class="type">
  252. <span class="param-type"><a href="Box2.html">Box2</a></span>
  253. </td>
  254. <td class="description last"></td>
  255. </tr>
  256. </tbody>
  257. </table>
  258. <dl class="details">
  259. <dt class="tag-source">Source:</dt>
  260. <dd class="tag-source"><ul class="dummy"><li>
  261. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line269">line 269</a>
  262. </li></ul></dd>
  263. </dl>
  264. <h5>Returns:</h5>
  265. <div class="param-desc">
  266. True if the two boxes are equal.
  267. </div>
  268. <dl>
  269. <dt>
  270. Type
  271. </dt>
  272. <dd>
  273. <span class="param-type">boolean</span>
  274. </dd>
  275. </dl>
  276. <h4 class="name" id="expandByPoint"><span class="type-signature"></span>expandByPoint<span class="signature">(point)</span><span class="type-signature"></span></h4>
  277. <div class="description">
  278. Expand the box to contain a new point.
  279. </div>
  280. <h5>Parameters:</h5>
  281. <table class="params">
  282. <thead>
  283. <tr>
  284. <th>Name</th>
  285. <th>Type</th>
  286. <th class="last">Description</th>
  287. </tr>
  288. </thead>
  289. <tbody>
  290. <tr>
  291. <td class="name"><code>point</code></td>
  292. <td class="type">
  293. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  294. </td>
  295. <td class="description last"></td>
  296. </tr>
  297. </tbody>
  298. </table>
  299. <dl class="details">
  300. <dt class="tag-source">Source:</dt>
  301. <dd class="tag-source"><ul class="dummy"><li>
  302. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line146">line 146</a>
  303. </li></ul></dd>
  304. </dl>
  305. <h4 class="name" id="expandByScalar"><span class="type-signature"></span>expandByScalar<span class="signature">(scalar)</span><span class="type-signature"></span></h4>
  306. <div class="description">
  307. Expand the box by adding a border with the scalar value.
  308. </div>
  309. <h5>Parameters:</h5>
  310. <table class="params">
  311. <thead>
  312. <tr>
  313. <th>Name</th>
  314. <th>Type</th>
  315. <th class="last">Description</th>
  316. </tr>
  317. </thead>
  318. <tbody>
  319. <tr>
  320. <td class="name"><code>scalar</code></td>
  321. <td class="type">
  322. <span class="param-type">number</span>
  323. </td>
  324. <td class="description last"></td>
  325. </tr>
  326. </tbody>
  327. </table>
  328. <dl class="details">
  329. <dt class="tag-source">Source:</dt>
  330. <dd class="tag-source"><ul class="dummy"><li>
  331. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line172">line 172</a>
  332. </li></ul></dd>
  333. </dl>
  334. <h4 class="name" id="expandByVector"><span class="type-signature"></span>expandByVector<span class="signature">(vector)</span><span class="type-signature"></span></h4>
  335. <div class="description">
  336. Expand the box by adding a border with the vector size. Vector is subtracted from min and added to the max points.
  337. </div>
  338. <h5>Parameters:</h5>
  339. <table class="params">
  340. <thead>
  341. <tr>
  342. <th>Name</th>
  343. <th>Type</th>
  344. <th class="last">Description</th>
  345. </tr>
  346. </thead>
  347. <tbody>
  348. <tr>
  349. <td class="name"><code>vector</code></td>
  350. <td class="type">
  351. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  352. </td>
  353. <td class="description last"></td>
  354. </tr>
  355. </tbody>
  356. </table>
  357. <dl class="details">
  358. <dt class="tag-source">Source:</dt>
  359. <dd class="tag-source"><ul class="dummy"><li>
  360. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line161">line 161</a>
  361. </li></ul></dd>
  362. </dl>
  363. <h4 class="name" id="getCenter"><span class="type-signature"></span>getCenter<span class="signature">(target<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="Vector2.html">Vector2</a>}</span></h4>
  364. <div class="description">
  365. Calculate the center point of the box.
  366. </div>
  367. <h5>Parameters:</h5>
  368. <table class="params">
  369. <thead>
  370. <tr>
  371. <th>Name</th>
  372. <th>Type</th>
  373. <th>Attributes</th>
  374. <th class="last">Description</th>
  375. </tr>
  376. </thead>
  377. <tbody>
  378. <tr>
  379. <td class="name"><code>target</code></td>
  380. <td class="type">
  381. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  382. </td>
  383. <td class="attributes">
  384. &lt;optional><br>
  385. </td>
  386. <td class="description last">Vector to store the result.</td>
  387. </tr>
  388. </tbody>
  389. </table>
  390. <dl class="details">
  391. <dt class="tag-source">Source:</dt>
  392. <dd class="tag-source"><ul class="dummy"><li>
  393. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line111">line 111</a>
  394. </li></ul></dd>
  395. </dl>
  396. <h5>Returns:</h5>
  397. <div class="param-desc">
  398. Central point of the box.
  399. </div>
  400. <dl>
  401. <dt>
  402. Type
  403. </dt>
  404. <dd>
  405. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  406. </dd>
  407. </dl>
  408. <h4 class="name" id="getSize"><span class="type-signature"></span>getSize<span class="signature">(target<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="Vector2.html">Vector2</a>}</span></h4>
  409. <div class="description">
  410. Get the size of the box from its min and max points.
  411. </div>
  412. <h5>Parameters:</h5>
  413. <table class="params">
  414. <thead>
  415. <tr>
  416. <th>Name</th>
  417. <th>Type</th>
  418. <th>Attributes</th>
  419. <th class="last">Description</th>
  420. </tr>
  421. </thead>
  422. <tbody>
  423. <tr>
  424. <td class="name"><code>target</code></td>
  425. <td class="type">
  426. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  427. </td>
  428. <td class="attributes">
  429. &lt;optional><br>
  430. </td>
  431. <td class="description last">Vector to store the result.</td>
  432. </tr>
  433. </tbody>
  434. </table>
  435. <dl class="details">
  436. <dt class="tag-source">Source:</dt>
  437. <dd class="tag-source"><ul class="dummy"><li>
  438. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line129">line 129</a>
  439. </li></ul></dd>
  440. </dl>
  441. <h5>Returns:</h5>
  442. <div class="param-desc">
  443. Vector with the calculated size.
  444. </div>
  445. <dl>
  446. <dt>
  447. Type
  448. </dt>
  449. <dd>
  450. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  451. </dd>
  452. </dl>
  453. <h4 class="name" id="intersect"><span class="type-signature"></span>intersect<span class="signature">(box)</span><span class="type-signature"></span></h4>
  454. <div class="description">
  455. Make a intersection between this box and another box. Store the result in this object.
  456. </div>
  457. <h5>Parameters:</h5>
  458. <table class="params">
  459. <thead>
  460. <tr>
  461. <th>Name</th>
  462. <th>Type</th>
  463. <th class="last">Description</th>
  464. </tr>
  465. </thead>
  466. <tbody>
  467. <tr>
  468. <td class="name"><code>box</code></td>
  469. <td class="type">
  470. <span class="param-type"><a href="Box2.html">Box2</a></span>
  471. </td>
  472. <td class="description last"></td>
  473. </tr>
  474. </tbody>
  475. </table>
  476. <dl class="details">
  477. <dt class="tag-source">Source:</dt>
  478. <dd class="tag-source"><ul class="dummy"><li>
  479. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line233">line 233</a>
  480. </li></ul></dd>
  481. </dl>
  482. <h4 class="name" id="intersectsBox"><span class="type-signature"></span>intersectsBox<span class="signature">(box)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
  483. <div class="description">
  484. Check if two boxes intersect each other, using 4 splitting planes to rule out intersections.
  485. </div>
  486. <h5>Parameters:</h5>
  487. <table class="params">
  488. <thead>
  489. <tr>
  490. <th>Name</th>
  491. <th>Type</th>
  492. <th class="last">Description</th>
  493. </tr>
  494. </thead>
  495. <tbody>
  496. <tr>
  497. <td class="name"><code>box</code></td>
  498. <td class="type">
  499. <span class="param-type"><a href="Box2.html">Box2</a></span>
  500. </td>
  501. <td class="description last"></td>
  502. </tr>
  503. </tbody>
  504. </table>
  505. <dl class="details">
  506. <dt class="tag-source">Source:</dt>
  507. <dd class="tag-source"><ul class="dummy"><li>
  508. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line208">line 208</a>
  509. </li></ul></dd>
  510. </dl>
  511. <h5>Returns:</h5>
  512. <div class="param-desc">
  513. True if the boxes intersect each other.
  514. </div>
  515. <dl>
  516. <dt>
  517. Type
  518. </dt>
  519. <dd>
  520. <span class="param-type">boolean</span>
  521. </dd>
  522. </dl>
  523. <h4 class="name" id="isEmpty"><span class="type-signature"></span>isEmpty<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
  524. <div class="description">
  525. Check if the box is empty (size equals zero or is negative). The box size is condireded valid on two negative axis.
  526. </div>
  527. <dl class="details">
  528. <dt class="tag-source">Source:</dt>
  529. <dd class="tag-source"><ul class="dummy"><li>
  530. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line100">line 100</a>
  531. </li></ul></dd>
  532. </dl>
  533. <h5>Returns:</h5>
  534. <div class="param-desc">
  535. True if the box is empty.
  536. </div>
  537. <dl>
  538. <dt>
  539. Type
  540. </dt>
  541. <dd>
  542. <span class="param-type">boolean</span>
  543. </dd>
  544. </dl>
  545. <h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(min, max)</span><span class="type-signature"></span></h4>
  546. <div class="description">
  547. Set the box values.
  548. </div>
  549. <h5>Parameters:</h5>
  550. <table class="params">
  551. <thead>
  552. <tr>
  553. <th>Name</th>
  554. <th>Type</th>
  555. <th class="last">Description</th>
  556. </tr>
  557. </thead>
  558. <tbody>
  559. <tr>
  560. <td class="name"><code>min</code></td>
  561. <td class="type">
  562. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  563. </td>
  564. <td class="description last"></td>
  565. </tr>
  566. <tr>
  567. <td class="name"><code>max</code></td>
  568. <td class="type">
  569. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  570. </td>
  571. <td class="description last"></td>
  572. </tr>
  573. </tbody>
  574. </table>
  575. <dl class="details">
  576. <dt class="tag-source">Source:</dt>
  577. <dd class="tag-source"><ul class="dummy"><li>
  578. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line26">line 26</a>
  579. </li></ul></dd>
  580. </dl>
  581. <h4 class="name" id="setFromCenterAndSize"><span class="type-signature"></span>setFromCenterAndSize<span class="signature">(center, size)</span><span class="type-signature"></span></h4>
  582. <div class="description">
  583. Set the box minimum and maximum from center point and size.
  584. </div>
  585. <h5>Parameters:</h5>
  586. <table class="params">
  587. <thead>
  588. <tr>
  589. <th>Name</th>
  590. <th>Type</th>
  591. <th class="last">Description</th>
  592. </tr>
  593. </thead>
  594. <tbody>
  595. <tr>
  596. <td class="name"><code>center</code></td>
  597. <td class="type">
  598. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  599. </td>
  600. <td class="description last"></td>
  601. </tr>
  602. <tr>
  603. <td class="name"><code>size</code></td>
  604. <td class="type">
  605. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  606. </td>
  607. <td class="description last"></td>
  608. </tr>
  609. </tbody>
  610. </table>
  611. <dl class="details">
  612. <dt class="tag-source">Source:</dt>
  613. <dd class="tag-source"><ul class="dummy"><li>
  614. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line58">line 58</a>
  615. </li></ul></dd>
  616. </dl>
  617. <h4 class="name" id="setFromPoints"><span class="type-signature"></span>setFromPoints<span class="signature">(points)</span><span class="type-signature"></span></h4>
  618. <div class="description">
  619. Set the box from a list of Vector2 points.
  620. </div>
  621. <h5>Parameters:</h5>
  622. <table class="params">
  623. <thead>
  624. <tr>
  625. <th>Name</th>
  626. <th>Type</th>
  627. <th class="last">Description</th>
  628. </tr>
  629. </thead>
  630. <tbody>
  631. <tr>
  632. <td class="name"><code>points</code></td>
  633. <td class="type">
  634. <span class="param-type">Array</span>
  635. </td>
  636. <td class="description last"></td>
  637. </tr>
  638. </tbody>
  639. </table>
  640. <dl class="details">
  641. <dt class="tag-source">Source:</dt>
  642. <dd class="tag-source"><ul class="dummy"><li>
  643. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line39">line 39</a>
  644. </li></ul></dd>
  645. </dl>
  646. <h4 class="name" id="translate"><span class="type-signature"></span>translate<span class="signature">(offset)</span><span class="type-signature"></span></h4>
  647. <div class="description">
  648. Translate the box by a offset value, adds the offset to booth min and max.
  649. </div>
  650. <h5>Parameters:</h5>
  651. <table class="params">
  652. <thead>
  653. <tr>
  654. <th>Name</th>
  655. <th>Type</th>
  656. <th class="last">Description</th>
  657. </tr>
  658. </thead>
  659. <tbody>
  660. <tr>
  661. <td class="name"><code>offset</code></td>
  662. <td class="type">
  663. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  664. </td>
  665. <td class="description last"></td>
  666. </tr>
  667. </tbody>
  668. </table>
  669. <dl class="details">
  670. <dt class="tag-source">Source:</dt>
  671. <dd class="tag-source"><ul class="dummy"><li>
  672. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line257">line 257</a>
  673. </li></ul></dd>
  674. </dl>
  675. <h4 class="name" id="union"><span class="type-signature"></span>union<span class="signature">(box)</span><span class="type-signature"></span></h4>
  676. <div class="description">
  677. Make a union between this box and another box. Store the result in this object.
  678. </div>
  679. <h5>Parameters:</h5>
  680. <table class="params">
  681. <thead>
  682. <tr>
  683. <th>Name</th>
  684. <th>Type</th>
  685. <th class="last">Description</th>
  686. </tr>
  687. </thead>
  688. <tbody>
  689. <tr>
  690. <td class="name"><code>box</code></td>
  691. <td class="type">
  692. <span class="param-type"><a href="Box2.html">Box2</a></span>
  693. </td>
  694. <td class="description last"></td>
  695. </tr>
  696. </tbody>
  697. </table>
  698. <dl class="details">
  699. <dt class="tag-source">Source:</dt>
  700. <dd class="tag-source"><ul class="dummy"><li>
  701. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line246">line 246</a>
  702. </li></ul></dd>
  703. </dl>
  704. </article>
  705. </section>
  706. </div>
  707. <nav>
  708. <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BezierCurve.html">BezierCurve</a></li><li><a href="Box.html">Box</a></li><li><a href="Box2.html">Box2</a></li><li><a href="BoxMask.html">BoxMask</a></li><li><a href="Circle.html">Circle</a></li><li><a href="DOM.html">DOM</a></li><li><a href="EventManager.html">EventManager</a></li><li><a href="Graph.html">Graph</a></li><li><a href="Helpers.html">Helpers</a></li><li><a href="Image.html">Image</a></li><li><a href="Key.html">Key</a></li><li><a href="Line.html">Line</a></li><li><a href="Mask.html">Mask</a></li><li><a href="Matrix.html">Matrix</a></li><li><a href="Object2D.html">Object2D</a></li><li><a href="Pattern.html">Pattern</a></li><li><a href="Pointer.html">Pointer</a></li><li><a href="Renderer.html">Renderer</a></li><li><a href="Text.html">Text</a></li><li><a href="UUID.html">UUID</a></li><li><a href="Vector2.html">Vector2</a></li><li><a href="Viewport.html">Viewport</a></li><li><a href="ViewportControls.html">ViewportControls</a></li></ul>
  709. </nav>
  710. <br class="clear">
  711. <footer>
  712. Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Tue Jun 25 2019 14:27:21 GMT+0100 (Western European Summer Time)
  713. </footer>
  714. <script> prettyPrint(); </script>
  715. <script src="scripts/linenumber.js"> </script>
  716. </body>
  717. </html>