Box2.html 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428
  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.
  26. Can be used for collision detection with points and other boxes.
  27. </div>
  28. <h5>Parameters:</h5>
  29. <table class="params">
  30. <thead>
  31. <tr>
  32. <th>Name</th>
  33. <th>Type</th>
  34. <th class="last">Description</th>
  35. </tr>
  36. </thead>
  37. <tbody>
  38. <tr>
  39. <td class="name"><code>min</code></td>
  40. <td class="type">
  41. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  42. </td>
  43. <td class="description last">Minimum point of the box.</td>
  44. </tr>
  45. <tr>
  46. <td class="name"><code>max</code></td>
  47. <td class="type">
  48. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  49. </td>
  50. <td class="description last">Maximum point of the box.</td>
  51. </tr>
  52. </tbody>
  53. </table>
  54. <dl class="details">
  55. <dt class="tag-source">Source:</dt>
  56. <dd class="tag-source"><ul class="dummy"><li>
  57. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line12">line 12</a>
  58. </li></ul></dd>
  59. </dl>
  60. </div>
  61. <h3 class="subsection-title">Members</h3>
  62. <h4 class="name" id="max"><span class="type-signature"></span>max<span class="type-signature"> :<a href="Vector2.html">Vector2</a></span></h4>
  63. <div class="description">
  64. Maximum point of the box.
  65. </div>
  66. <h5>Type:</h5>
  67. <ul>
  68. <li>
  69. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  70. </li>
  71. </ul>
  72. <dl class="details">
  73. <dt class="tag-source">Source:</dt>
  74. <dd class="tag-source"><ul class="dummy"><li>
  75. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line26">line 26</a>
  76. </li></ul></dd>
  77. </dl>
  78. <h4 class="name" id="min"><span class="type-signature"></span>min<span class="type-signature"> :<a href="Vector2.html">Vector2</a></span></h4>
  79. <div class="description">
  80. Minimum point of the box.
  81. </div>
  82. <h5>Type:</h5>
  83. <ul>
  84. <li>
  85. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  86. </li>
  87. </ul>
  88. <dl class="details">
  89. <dt class="tag-source">Source:</dt>
  90. <dd class="tag-source"><ul class="dummy"><li>
  91. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line19">line 19</a>
  92. </li></ul></dd>
  93. </dl>
  94. <h3 class="subsection-title">Methods</h3>
  95. <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>
  96. <div class="description">
  97. Clone the box into a new object.
  98. Should be used when it it necessary to make operations to this box.
  99. </div>
  100. <dl class="details">
  101. <dt class="tag-source">Source:</dt>
  102. <dd class="tag-source"><ul class="dummy"><li>
  103. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line84">line 84</a>
  104. </li></ul></dd>
  105. </dl>
  106. <h5>Returns:</h5>
  107. <div class="param-desc">
  108. New box object with the copy of this object.
  109. </div>
  110. <dl>
  111. <dt>
  112. Type
  113. </dt>
  114. <dd>
  115. <span class="param-type"><a href="Box2.html">Box2</a></span>
  116. </dd>
  117. </dl>
  118. <h4 class="name" id="containsBox"><span class="type-signature"></span>containsBox<span class="signature">(box)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
  119. <div class="description">
  120. Check if the box fully contains another box inside (different from intersects box).
  121. Only returns true if the box is fully contained.
  122. </div>
  123. <h5>Parameters:</h5>
  124. <table class="params">
  125. <thead>
  126. <tr>
  127. <th>Name</th>
  128. <th>Type</th>
  129. <th class="last">Description</th>
  130. </tr>
  131. </thead>
  132. <tbody>
  133. <tr>
  134. <td class="name"><code>box</code></td>
  135. <td class="type">
  136. <span class="param-type"><a href="Box2.html">Box2</a></span>
  137. </td>
  138. <td class="description last"></td>
  139. </tr>
  140. </tbody>
  141. </table>
  142. <dl class="details">
  143. <dt class="tag-source">Source:</dt>
  144. <dd class="tag-source"><ul class="dummy"><li>
  145. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line206">line 206</a>
  146. </li></ul></dd>
  147. </dl>
  148. <h5>Returns:</h5>
  149. <div class="param-desc">
  150. True if the box contains box.
  151. </div>
  152. <dl>
  153. <dt>
  154. Type
  155. </dt>
  156. <dd>
  157. <span class="param-type">boolean</span>
  158. </dd>
  159. </dl>
  160. <h4 class="name" id="containsPoint"><span class="type-signature"></span>containsPoint<span class="signature">(point)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
  161. <div class="description">
  162. Check if the box contains a point inside.
  163. </div>
  164. <h5>Parameters:</h5>
  165. <table class="params">
  166. <thead>
  167. <tr>
  168. <th>Name</th>
  169. <th>Type</th>
  170. <th class="last">Description</th>
  171. </tr>
  172. </thead>
  173. <tbody>
  174. <tr>
  175. <td class="name"><code>point</code></td>
  176. <td class="type">
  177. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  178. </td>
  179. <td class="description last"></td>
  180. </tr>
  181. </tbody>
  182. </table>
  183. <dl class="details">
  184. <dt class="tag-source">Source:</dt>
  185. <dd class="tag-source"><ul class="dummy"><li>
  186. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line193">line 193</a>
  187. </li></ul></dd>
  188. </dl>
  189. <h5>Returns:</h5>
  190. <div class="param-desc">
  191. True if the box contains point.
  192. </div>
  193. <dl>
  194. <dt>
  195. Type
  196. </dt>
  197. <dd>
  198. <span class="param-type">boolean</span>
  199. </dd>
  200. </dl>
  201. <h4 class="name" id="copy"><span class="type-signature"></span>copy<span class="signature">(point)</span><span class="type-signature"></span></h4>
  202. <div class="description">
  203. Copy the box value from another box.
  204. </div>
  205. <h5>Parameters:</h5>
  206. <table class="params">
  207. <thead>
  208. <tr>
  209. <th>Name</th>
  210. <th>Type</th>
  211. <th class="last">Description</th>
  212. </tr>
  213. </thead>
  214. <tbody>
  215. <tr>
  216. <td class="name"><code>point</code></td>
  217. <td class="type">
  218. <span class="param-type"><a href="Box2.html">Box2</a></span>
  219. </td>
  220. <td class="description last"></td>
  221. </tr>
  222. </tbody>
  223. </table>
  224. <dl class="details">
  225. <dt class="tag-source">Source:</dt>
  226. <dd class="tag-source"><ul class="dummy"><li>
  227. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line96">line 96</a>
  228. </li></ul></dd>
  229. </dl>
  230. <h4 class="name" id="distanceToPoint"><span class="type-signature"></span>distanceToPoint<span class="signature">(point)</span><span class="type-signature"> &rarr; {number}</span></h4>
  231. <div class="description">
  232. Calculate the distance to a point.
  233. </div>
  234. <h5>Parameters:</h5>
  235. <table class="params">
  236. <thead>
  237. <tr>
  238. <th>Name</th>
  239. <th>Type</th>
  240. <th class="last">Description</th>
  241. </tr>
  242. </thead>
  243. <tbody>
  244. <tr>
  245. <td class="name"><code>point</code></td>
  246. <td class="type">
  247. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  248. </td>
  249. <td class="description last"></td>
  250. </tr>
  251. </tbody>
  252. </table>
  253. <dl class="details">
  254. <dt class="tag-source">Source:</dt>
  255. <dd class="tag-source"><ul class="dummy"><li>
  256. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line228">line 228</a>
  257. </li></ul></dd>
  258. </dl>
  259. <h5>Returns:</h5>
  260. <div class="param-desc">
  261. Distance to point calculated.
  262. </div>
  263. <dl>
  264. <dt>
  265. Type
  266. </dt>
  267. <dd>
  268. <span class="param-type">number</span>
  269. </dd>
  270. </dl>
  271. <h4 class="name" id="equals"><span class="type-signature"></span>equals<span class="signature">(box)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
  272. <div class="description">
  273. Checks if two boxes are equal.
  274. </div>
  275. <h5>Parameters:</h5>
  276. <table class="params">
  277. <thead>
  278. <tr>
  279. <th>Name</th>
  280. <th>Type</th>
  281. <th class="last">Description</th>
  282. </tr>
  283. </thead>
  284. <tbody>
  285. <tr>
  286. <td class="name"><code>box</code></td>
  287. <td class="type">
  288. <span class="param-type"><a href="Box2.html">Box2</a></span>
  289. </td>
  290. <td class="description last"></td>
  291. </tr>
  292. </tbody>
  293. </table>
  294. <dl class="details">
  295. <dt class="tag-source">Source:</dt>
  296. <dd class="tag-source"><ul class="dummy"><li>
  297. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line278">line 278</a>
  298. </li></ul></dd>
  299. </dl>
  300. <h5>Returns:</h5>
  301. <div class="param-desc">
  302. True if the two boxes are equal.
  303. </div>
  304. <dl>
  305. <dt>
  306. Type
  307. </dt>
  308. <dd>
  309. <span class="param-type">boolean</span>
  310. </dd>
  311. </dl>
  312. <h4 class="name" id="expandByPoint"><span class="type-signature"></span>expandByPoint<span class="signature">(point)</span><span class="type-signature"></span></h4>
  313. <div class="description">
  314. Expand the box to contain a new point.
  315. </div>
  316. <h5>Parameters:</h5>
  317. <table class="params">
  318. <thead>
  319. <tr>
  320. <th>Name</th>
  321. <th>Type</th>
  322. <th class="last">Description</th>
  323. </tr>
  324. </thead>
  325. <tbody>
  326. <tr>
  327. <td class="name"><code>point</code></td>
  328. <td class="type">
  329. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  330. </td>
  331. <td class="description last"></td>
  332. </tr>
  333. </tbody>
  334. </table>
  335. <dl class="details">
  336. <dt class="tag-source">Source:</dt>
  337. <dd class="tag-source"><ul class="dummy"><li>
  338. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line155">line 155</a>
  339. </li></ul></dd>
  340. </dl>
  341. <h4 class="name" id="expandByScalar"><span class="type-signature"></span>expandByScalar<span class="signature">(scalar)</span><span class="type-signature"></span></h4>
  342. <div class="description">
  343. Expand the box by adding a border with the scalar value.
  344. </div>
  345. <h5>Parameters:</h5>
  346. <table class="params">
  347. <thead>
  348. <tr>
  349. <th>Name</th>
  350. <th>Type</th>
  351. <th class="last">Description</th>
  352. </tr>
  353. </thead>
  354. <tbody>
  355. <tr>
  356. <td class="name"><code>scalar</code></td>
  357. <td class="type">
  358. <span class="param-type">number</span>
  359. </td>
  360. <td class="description last"></td>
  361. </tr>
  362. </tbody>
  363. </table>
  364. <dl class="details">
  365. <dt class="tag-source">Source:</dt>
  366. <dd class="tag-source"><ul class="dummy"><li>
  367. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line181">line 181</a>
  368. </li></ul></dd>
  369. </dl>
  370. <h4 class="name" id="expandByVector"><span class="type-signature"></span>expandByVector<span class="signature">(vector)</span><span class="type-signature"></span></h4>
  371. <div class="description">
  372. Expand the box by adding a border with the vector size.
  373. Vector is subtracted from min and added to the max points.
  374. </div>
  375. <h5>Parameters:</h5>
  376. <table class="params">
  377. <thead>
  378. <tr>
  379. <th>Name</th>
  380. <th>Type</th>
  381. <th class="last">Description</th>
  382. </tr>
  383. </thead>
  384. <tbody>
  385. <tr>
  386. <td class="name"><code>vector</code></td>
  387. <td class="type">
  388. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  389. </td>
  390. <td class="description last"></td>
  391. </tr>
  392. </tbody>
  393. </table>
  394. <dl class="details">
  395. <dt class="tag-source">Source:</dt>
  396. <dd class="tag-source"><ul class="dummy"><li>
  397. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line170">line 170</a>
  398. </li></ul></dd>
  399. </dl>
  400. <h4 class="name" id="fromArray"><span class="type-signature"></span>fromArray<span class="signature">(array)</span><span class="type-signature"></span></h4>
  401. <div class="description">
  402. Set box data min and max from numeric array.
  403. </div>
  404. <h5>Parameters:</h5>
  405. <table class="params">
  406. <thead>
  407. <tr>
  408. <th>Name</th>
  409. <th>Type</th>
  410. <th class="last">Description</th>
  411. </tr>
  412. </thead>
  413. <tbody>
  414. <tr>
  415. <td class="name"><code>array</code></td>
  416. <td class="type">
  417. <span class="param-type">Array.&lt;number></span>
  418. </td>
  419. <td class="description last">Numeric array with box data min and max.</td>
  420. </tr>
  421. </tbody>
  422. </table>
  423. <dl class="details">
  424. <dt class="tag-source">Source:</dt>
  425. <dd class="tag-source"><ul class="dummy"><li>
  426. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line298">line 298</a>
  427. </li></ul></dd>
  428. </dl>
  429. <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>
  430. <div class="description">
  431. Calculate the center point of the box.
  432. </div>
  433. <h5>Parameters:</h5>
  434. <table class="params">
  435. <thead>
  436. <tr>
  437. <th>Name</th>
  438. <th>Type</th>
  439. <th>Attributes</th>
  440. <th class="last">Description</th>
  441. </tr>
  442. </thead>
  443. <tbody>
  444. <tr>
  445. <td class="name"><code>target</code></td>
  446. <td class="type">
  447. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  448. </td>
  449. <td class="attributes">
  450. &lt;optional><br>
  451. </td>
  452. <td class="description last">Vector to store the result.</td>
  453. </tr>
  454. </tbody>
  455. </table>
  456. <dl class="details">
  457. <dt class="tag-source">Source:</dt>
  458. <dd class="tag-source"><ul class="dummy"><li>
  459. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line120">line 120</a>
  460. </li></ul></dd>
  461. </dl>
  462. <h5>Returns:</h5>
  463. <div class="param-desc">
  464. Central point of the box.
  465. </div>
  466. <dl>
  467. <dt>
  468. Type
  469. </dt>
  470. <dd>
  471. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  472. </dd>
  473. </dl>
  474. <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>
  475. <div class="description">
  476. Get the size of the box from its min and max points.
  477. </div>
  478. <h5>Parameters:</h5>
  479. <table class="params">
  480. <thead>
  481. <tr>
  482. <th>Name</th>
  483. <th>Type</th>
  484. <th>Attributes</th>
  485. <th class="last">Description</th>
  486. </tr>
  487. </thead>
  488. <tbody>
  489. <tr>
  490. <td class="name"><code>target</code></td>
  491. <td class="type">
  492. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  493. </td>
  494. <td class="attributes">
  495. &lt;optional><br>
  496. </td>
  497. <td class="description last">Vector to store the result.</td>
  498. </tr>
  499. </tbody>
  500. </table>
  501. <dl class="details">
  502. <dt class="tag-source">Source:</dt>
  503. <dd class="tag-source"><ul class="dummy"><li>
  504. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line138">line 138</a>
  505. </li></ul></dd>
  506. </dl>
  507. <h5>Returns:</h5>
  508. <div class="param-desc">
  509. Vector with the calculated size.
  510. </div>
  511. <dl>
  512. <dt>
  513. Type
  514. </dt>
  515. <dd>
  516. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  517. </dd>
  518. </dl>
  519. <h4 class="name" id="intersect"><span class="type-signature"></span>intersect<span class="signature">(box)</span><span class="type-signature"></span></h4>
  520. <div class="description">
  521. Make a intersection between this box and another box.
  522. Store the result in this object.
  523. </div>
  524. <h5>Parameters:</h5>
  525. <table class="params">
  526. <thead>
  527. <tr>
  528. <th>Name</th>
  529. <th>Type</th>
  530. <th class="last">Description</th>
  531. </tr>
  532. </thead>
  533. <tbody>
  534. <tr>
  535. <td class="name"><code>box</code></td>
  536. <td class="type">
  537. <span class="param-type"><a href="Box2.html">Box2</a></span>
  538. </td>
  539. <td class="description last"></td>
  540. </tr>
  541. </tbody>
  542. </table>
  543. <dl class="details">
  544. <dt class="tag-source">Source:</dt>
  545. <dd class="tag-source"><ul class="dummy"><li>
  546. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line242">line 242</a>
  547. </li></ul></dd>
  548. </dl>
  549. <h4 class="name" id="intersectsBox"><span class="type-signature"></span>intersectsBox<span class="signature">(box)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
  550. <div class="description">
  551. Check if two boxes intersect each other, using 4 splitting planes to rule out intersections.
  552. </div>
  553. <h5>Parameters:</h5>
  554. <table class="params">
  555. <thead>
  556. <tr>
  557. <th>Name</th>
  558. <th>Type</th>
  559. <th class="last">Description</th>
  560. </tr>
  561. </thead>
  562. <tbody>
  563. <tr>
  564. <td class="name"><code>box</code></td>
  565. <td class="type">
  566. <span class="param-type"><a href="Box2.html">Box2</a></span>
  567. </td>
  568. <td class="description last"></td>
  569. </tr>
  570. </tbody>
  571. </table>
  572. <dl class="details">
  573. <dt class="tag-source">Source:</dt>
  574. <dd class="tag-source"><ul class="dummy"><li>
  575. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line217">line 217</a>
  576. </li></ul></dd>
  577. </dl>
  578. <h5>Returns:</h5>
  579. <div class="param-desc">
  580. True if the boxes intersect each other.
  581. </div>
  582. <dl>
  583. <dt>
  584. Type
  585. </dt>
  586. <dd>
  587. <span class="param-type">boolean</span>
  588. </dd>
  589. </dl>
  590. <h4 class="name" id="isEmpty"><span class="type-signature"></span>isEmpty<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
  591. <div class="description">
  592. Check if the box is empty (size equals zero or is negative).
  593. The box size is condireded valid on two negative axis.
  594. </div>
  595. <dl class="details">
  596. <dt class="tag-source">Source:</dt>
  597. <dd class="tag-source"><ul class="dummy"><li>
  598. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line109">line 109</a>
  599. </li></ul></dd>
  600. </dl>
  601. <h5>Returns:</h5>
  602. <div class="param-desc">
  603. True if the box is empty.
  604. </div>
  605. <dl>
  606. <dt>
  607. Type
  608. </dt>
  609. <dd>
  610. <span class="param-type">boolean</span>
  611. </dd>
  612. </dl>
  613. <h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(min, max)</span><span class="type-signature"></span></h4>
  614. <div class="description">
  615. Set the box values.
  616. </div>
  617. <h5>Parameters:</h5>
  618. <table class="params">
  619. <thead>
  620. <tr>
  621. <th>Name</th>
  622. <th>Type</th>
  623. <th class="last">Description</th>
  624. </tr>
  625. </thead>
  626. <tbody>
  627. <tr>
  628. <td class="name"><code>min</code></td>
  629. <td class="type">
  630. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  631. </td>
  632. <td class="description last">Minimum point of the box.</td>
  633. </tr>
  634. <tr>
  635. <td class="name"><code>max</code></td>
  636. <td class="type">
  637. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  638. </td>
  639. <td class="description last">Maximum point of the box.</td>
  640. </tr>
  641. </tbody>
  642. </table>
  643. <dl class="details">
  644. <dt class="tag-source">Source:</dt>
  645. <dd class="tag-source"><ul class="dummy"><li>
  646. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line35">line 35</a>
  647. </li></ul></dd>
  648. </dl>
  649. <h4 class="name" id="setFromCenterAndSize"><span class="type-signature"></span>setFromCenterAndSize<span class="signature">(center, size)</span><span class="type-signature"></span></h4>
  650. <div class="description">
  651. Set the box minimum and maximum from center point and size.
  652. </div>
  653. <h5>Parameters:</h5>
  654. <table class="params">
  655. <thead>
  656. <tr>
  657. <th>Name</th>
  658. <th>Type</th>
  659. <th class="last">Description</th>
  660. </tr>
  661. </thead>
  662. <tbody>
  663. <tr>
  664. <td class="name"><code>center</code></td>
  665. <td class="type">
  666. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  667. </td>
  668. <td class="description last"></td>
  669. </tr>
  670. <tr>
  671. <td class="name"><code>size</code></td>
  672. <td class="type">
  673. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  674. </td>
  675. <td class="description last"></td>
  676. </tr>
  677. </tbody>
  678. </table>
  679. <dl class="details">
  680. <dt class="tag-source">Source:</dt>
  681. <dd class="tag-source"><ul class="dummy"><li>
  682. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line67">line 67</a>
  683. </li></ul></dd>
  684. </dl>
  685. <h4 class="name" id="setFromPoints"><span class="type-signature"></span>setFromPoints<span class="signature">(points)</span><span class="type-signature"></span></h4>
  686. <div class="description">
  687. Set the box from a list of Vector2 points.
  688. </div>
  689. <h5>Parameters:</h5>
  690. <table class="params">
  691. <thead>
  692. <tr>
  693. <th>Name</th>
  694. <th>Type</th>
  695. <th class="last">Description</th>
  696. </tr>
  697. </thead>
  698. <tbody>
  699. <tr>
  700. <td class="name"><code>points</code></td>
  701. <td class="type">
  702. <span class="param-type">Array</span>
  703. </td>
  704. <td class="description last"></td>
  705. </tr>
  706. </tbody>
  707. </table>
  708. <dl class="details">
  709. <dt class="tag-source">Source:</dt>
  710. <dd class="tag-source"><ul class="dummy"><li>
  711. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line48">line 48</a>
  712. </li></ul></dd>
  713. </dl>
  714. <h4 class="name" id="toArray"><span class="type-signature"></span>toArray<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;number>}</span></h4>
  715. <div class="description">
  716. Store the box data into a numeric array.
  717. </div>
  718. <dl class="details">
  719. <dt class="tag-source">Source:</dt>
  720. <dd class="tag-source"><ul class="dummy"><li>
  721. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line288">line 288</a>
  722. </li></ul></dd>
  723. </dl>
  724. <h5>Returns:</h5>
  725. <div class="param-desc">
  726. Numeric array with box data min and max.
  727. </div>
  728. <dl>
  729. <dt>
  730. Type
  731. </dt>
  732. <dd>
  733. <span class="param-type">Array.&lt;number></span>
  734. </dd>
  735. </dl>
  736. <h4 class="name" id="translate"><span class="type-signature"></span>translate<span class="signature">(offset)</span><span class="type-signature"></span></h4>
  737. <div class="description">
  738. Translate the box by a offset value, adds the offset to booth min and max.
  739. </div>
  740. <h5>Parameters:</h5>
  741. <table class="params">
  742. <thead>
  743. <tr>
  744. <th>Name</th>
  745. <th>Type</th>
  746. <th class="last">Description</th>
  747. </tr>
  748. </thead>
  749. <tbody>
  750. <tr>
  751. <td class="name"><code>offset</code></td>
  752. <td class="type">
  753. <span class="param-type"><a href="Vector2.html">Vector2</a></span>
  754. </td>
  755. <td class="description last"></td>
  756. </tr>
  757. </tbody>
  758. </table>
  759. <dl class="details">
  760. <dt class="tag-source">Source:</dt>
  761. <dd class="tag-source"><ul class="dummy"><li>
  762. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line266">line 266</a>
  763. </li></ul></dd>
  764. </dl>
  765. <h4 class="name" id="union"><span class="type-signature"></span>union<span class="signature">(box)</span><span class="type-signature"></span></h4>
  766. <div class="description">
  767. Make a union between this box and another box.
  768. Store the result in this object.
  769. </div>
  770. <h5>Parameters:</h5>
  771. <table class="params">
  772. <thead>
  773. <tr>
  774. <th>Name</th>
  775. <th>Type</th>
  776. <th class="last">Description</th>
  777. </tr>
  778. </thead>
  779. <tbody>
  780. <tr>
  781. <td class="name"><code>box</code></td>
  782. <td class="type">
  783. <span class="param-type"><a href="Box2.html">Box2</a></span>
  784. </td>
  785. <td class="description last"></td>
  786. </tr>
  787. </tbody>
  788. </table>
  789. <dl class="details">
  790. <dt class="tag-source">Source:</dt>
  791. <dd class="tag-source"><ul class="dummy"><li>
  792. <a href="math_Box2.js.html">math/Box2.js</a>, <a href="math_Box2.js.html#line255">line 255</a>
  793. </li></ul></dd>
  794. </dl>
  795. </article>
  796. </section>
  797. </div>
  798. <nav>
  799. <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnimationTimer.html">AnimationTimer</a></li><li><a href="BarGraph.html">BarGraph</a></li><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="ColorStyle.html">ColorStyle</a></li><li><a href="DOM.html">DOM</a></li><li><a href="EventManager.html">EventManager</a></li><li><a href="FileUtils.html">FileUtils</a></li><li><a href="Gauge.html">Gauge</a></li><li><a href="GradientColorStop.html">GradientColorStop</a></li><li><a href="GradientStyle.html">GradientStyle</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="LinearGradientStyle.html">LinearGradientStyle</a></li><li><a href="Mask.html">Mask</a></li><li><a href="Matrix.html">Matrix</a></li><li><a href="MultiLineText.html">MultiLineText</a></li><li><a href="Node.html">Node</a></li><li><a href="NodeConnector.html">NodeConnector</a></li><li><a href="NodeGraph.html">NodeGraph</a></li><li><a href="NodeSocket.html">NodeSocket</a></li><li><a href="Object2D.html">Object2D</a></li><li><a href="Path.html">Path</a></li><li><a href="Pattern.html">Pattern</a></li><li><a href="PatternStyle.html">PatternStyle</a></li><li><a href="PieChart.html">PieChart</a></li><li><a href="Pointer.html">Pointer</a></li><li><a href="QuadraticCurve.html">QuadraticCurve</a></li><li><a href="RadialGradientStyle.html">RadialGradientStyle</a></li><li><a href="Renderer.html">Renderer</a></li><li><a href="RoundedBox.html">RoundedBox</a></li><li><a href="ScatterGraph.html">ScatterGraph</a></li><li><a href="Style.html">Style</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><h3>Global</h3><ul><li><a href="global.html#writeFile">writeFile</a></li></ul>
  800. </nav>
  801. <br class="clear">
  802. <footer>
  803. Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Sat Sep 17 2022 14:24:36 GMT+0100 (Hora de verão da Europa Ocidental)
  804. </footer>
  805. <script> prettyPrint(); </script>
  806. <script src="scripts/linenumber.js"> </script>
  807. </body>
  808. </html>