pv.Vector.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <meta name="generator" content="JsDoc Toolkit" />
  7. <title>JsDoc Reference - pv.Vector</title>
  8. <style type="text/css">
  9. /* default.css */
  10. body
  11. {
  12. font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
  13. width: 800px;
  14. }
  15. .header
  16. {
  17. clear: both;
  18. background-color: #ccc;
  19. padding: 8px;
  20. }
  21. h1
  22. {
  23. font-size: 150%;
  24. font-weight: bold;
  25. padding: 0;
  26. margin: 1em 0 0 .3em;
  27. }
  28. hr
  29. {
  30. border: none 0;
  31. border-top: 1px solid #7F8FB1;
  32. height: 1px;
  33. }
  34. pre.code
  35. {
  36. display: block;
  37. padding: 8px;
  38. border: 1px dashed #ccc;
  39. }
  40. #index
  41. {
  42. margin-top: 24px;
  43. float: left;
  44. width: 160px;
  45. position: absolute;
  46. left: 8px;
  47. background-color: #F3F3F3;
  48. padding: 8px;
  49. }
  50. #content
  51. {
  52. margin-left: 190px;
  53. width: 600px;
  54. }
  55. .classList
  56. {
  57. list-style-type: none;
  58. padding: 0;
  59. margin: 0 0 0 8px;
  60. font-family: arial, sans-serif;
  61. font-size: 1em;
  62. overflow: auto;
  63. }
  64. .classList li
  65. {
  66. padding: 0;
  67. margin: 0 0 8px 0;
  68. }
  69. .summaryTable { width: 100%; }
  70. h1.classTitle
  71. {
  72. font-size:170%;
  73. line-height:130%;
  74. }
  75. h2 { font-size: 110%; }
  76. caption, div.sectionTitle
  77. {
  78. background-color: #7F8FB1;
  79. color: #fff;
  80. font-size:130%;
  81. text-align: left;
  82. padding: 2px 6px 2px 6px;
  83. border: 1px #7F8FB1 solid;
  84. }
  85. div.sectionTitle { margin-bottom: 8px; }
  86. .summaryTable thead { display: none; }
  87. .summaryTable td
  88. {
  89. vertical-align: top;
  90. padding: 4px;
  91. border-bottom: 1px #7F8FB1 solid;
  92. border-right: 1px #7F8FB1 solid;
  93. }
  94. /*col#summaryAttributes {}*/
  95. .summaryTable td.attributes
  96. {
  97. border-left: 1px #7F8FB1 solid;
  98. width: 140px;
  99. text-align: right;
  100. }
  101. td.attributes, .fixedFont
  102. {
  103. line-height: 15px;
  104. color: #002EBE;
  105. font-family: "Courier New",Courier,monospace;
  106. font-size: 13px;
  107. }
  108. .summaryTable td.nameDescription
  109. {
  110. text-align: left;
  111. font-size: 13px;
  112. line-height: 15px;
  113. }
  114. .summaryTable td.nameDescription, .description
  115. {
  116. line-height: 15px;
  117. padding: 4px;
  118. padding-left: 4px;
  119. }
  120. pre
  121. {
  122. border-left: solid 10px #ddd;
  123. padding-left: 1.5em;
  124. }
  125. .summaryTable { margin-bottom: 8px; }
  126. ul.inheritsList
  127. {
  128. list-style: square;
  129. margin-left: 20px;
  130. padding-left: 0;
  131. }
  132. .detailList {
  133. margin-left: 20px;
  134. line-height: 15px;
  135. }
  136. .detailList dt { margin-left: 20px; }
  137. .detailList .heading
  138. {
  139. font-weight: bold;
  140. padding-bottom: 6px;
  141. margin-left: 0;
  142. }
  143. .light, td.attributes, .light a:link, .light a:visited
  144. {
  145. color: #777;
  146. font-style: italic;
  147. }
  148. .fineprint
  149. {
  150. text-align: right;
  151. font-size: 10px;
  152. }
  153. </style>
  154. </head>
  155. <body>
  156. <!-- ============================== header ================================= -->
  157. <!-- begin static/header.html -->
  158. <div id="header">
  159. </div>
  160. <!-- end static/header.html -->
  161. <!-- ============================== classes index ============================ -->
  162. <div id="index">
  163. <!-- begin publish.classesIndex -->
  164. <div align="center"><a href="../index.html">Class Index</a>
  165. | <a href="../files.html">File Index</a></div>
  166. <hr />
  167. <h2>Classes</h2>
  168. <ul class="classList">
  169. <li><i><a href="../symbols/_global_.html">_global_</a></i></li>
  170. <li><a href="../symbols/Array.html">Array</a></li>
  171. <li><a href="../symbols/Date.html">Date</a></li>
  172. <li><a href="../symbols/pv.html">pv</a></li>
  173. <li><a href="../symbols/pv.Anchor.html">pv.Anchor</a></li>
  174. <li><a href="../symbols/pv.Area.html">pv.Area</a></li>
  175. <li><a href="../symbols/pv.Bar.html">pv.Bar</a></li>
  176. <li><a href="../symbols/pv.Color.html">pv.Color</a></li>
  177. <li><a href="../symbols/pv.Color.Hsl.html">pv.Color.Hsl</a></li>
  178. <li><a href="../symbols/pv.Color.Rgb.html">pv.Color.Rgb</a></li>
  179. <li><a href="../symbols/pv.Colors.html">pv.Colors</a></li>
  180. <li><a href="../symbols/pv.Dot.html">pv.Dot</a></li>
  181. <li><a href="../symbols/pv.Flatten.html">pv.Flatten</a></li>
  182. <li><a href="../symbols/pv.Image.html">pv.Image</a></li>
  183. <li><a href="../symbols/pv.Label.html">pv.Label</a></li>
  184. <li><a href="../symbols/pv.Layout.grid.html">pv.Layout.grid</a></li>
  185. <li><a href="../symbols/pv.Layout.icicle.html">pv.Layout.icicle</a></li>
  186. <li><a href="../symbols/pv.Layout.stack.html">pv.Layout.stack</a></li>
  187. <li><a href="../symbols/pv.Layout.sunburst.html">pv.Layout.sunburst</a></li>
  188. <li><a href="../symbols/pv.Layout.treemap.html">pv.Layout.treemap</a></li>
  189. <li><a href="../symbols/pv.Line.html">pv.Line</a></li>
  190. <li><a href="../symbols/pv.Mark.html">pv.Mark</a></li>
  191. <li><a href="../symbols/pv.Nest.html">pv.Nest</a></li>
  192. <li><a href="../symbols/pv.ns.html">pv.ns</a></li>
  193. <li><a href="../symbols/pv.Panel.html">pv.Panel</a></li>
  194. <li><a href="../symbols/pv.Rule.html">pv.Rule</a></li>
  195. <li><a href="../symbols/pv.Scale.linear.html">pv.Scale.linear</a></li>
  196. <li><a href="../symbols/pv.Scale.log.html">pv.Scale.log</a></li>
  197. <li><a href="../symbols/pv.Scale.ordinal.html">pv.Scale.ordinal</a></li>
  198. <li><a href="../symbols/pv.Tree.html">pv.Tree</a></li>
  199. <li><a href="../symbols/pv.Vector.html">pv.Vector</a></li>
  200. <li><a href="../symbols/pv.version.html">pv.version</a></li>
  201. <li><a href="../symbols/pv.Wedge.html">pv.Wedge</a></li>
  202. </ul>
  203. <hr />
  204. <!-- end publish.classesIndex -->
  205. </div>
  206. <div id="content">
  207. <!-- ============================== class title ============================ -->
  208. <h1 class="classTitle">
  209. Class pv.Vector
  210. </h1>
  211. <!-- ============================== class summary ========================== -->
  212. <p class="description">
  213. Represents a two-dimensional vector; a 2-tuple <i>&#x27e8;x,
  214. y&#x27e9;</i>.
  215. <br /><i>Defined in: </i> <a href="../symbols/src/data_Vector.js.html">Vector.js</a>.
  216. </p>
  217. <!-- ============================== constructor summary ==================== -->
  218. <table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class pv.Vector.">
  219. <caption>Class Summary</caption>
  220. <thead>
  221. <tr>
  222. <th scope="col">Constructor Attributes</th>
  223. <th scope="col">Constructor Name and Description</th>
  224. </tr>
  225. </thead>
  226. <tbody>
  227. <tr>
  228. <td class="attributes">&nbsp;</td>
  229. <td class="nameDescription" >
  230. <div class="fixedFont">
  231. <b><a href="../symbols/pv.Vector.html#constructor">pv.Vector</a></b>(x, y)
  232. </div>
  233. <div class="description">Constructs a <a href="../symbols/pv.Vector.html">pv.Vector</a> for the specified <i>x</i> and <i>y</i>
  234. coordinate.</div>
  235. </td>
  236. </tr>
  237. </tbody>
  238. </table>
  239. <!-- ============================== properties summary ===================== -->
  240. <!-- ============================== methods summary ======================== -->
  241. <table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class pv.Vector.">
  242. <caption>Method Summary</caption>
  243. <thead>
  244. <tr>
  245. <th scope="col">Method Attributes</th>
  246. <th scope="col">Method Name and Description</th>
  247. </tr>
  248. </thead>
  249. <tbody>
  250. <tr>
  251. <td class="attributes">&nbsp;</td>
  252. <td class="nameDescription">
  253. <div class="fixedFont"><b><a href="../symbols/pv.Vector.html#dot">dot</a></b>(x, y)
  254. </div>
  255. <div class="description">Returns the dot product of this vector and the vector <i>v</i>: <i>x * v.x +
  256. y * v.y</i>.</div>
  257. </td>
  258. </tr>
  259. <tr>
  260. <td class="attributes">&nbsp;</td>
  261. <td class="nameDescription">
  262. <div class="fixedFont"><b><a href="../symbols/pv.Vector.html#length">length</a></b>()
  263. </div>
  264. <div class="description">Returns the magnitude of this vector, defined as <i>sqrt(x * x + y * y)</i>.</div>
  265. </td>
  266. </tr>
  267. <tr>
  268. <td class="attributes">&nbsp;</td>
  269. <td class="nameDescription">
  270. <div class="fixedFont"><b><a href="../symbols/pv.Vector.html#minus">minus</a></b>(x, y)
  271. </div>
  272. <div class="description">Returns this vector minus the vector <i>v</i>: <i>&#x27e8;x - v.x, y -
  273. v.y&#x27e9;</i>.</div>
  274. </td>
  275. </tr>
  276. <tr>
  277. <td class="attributes">&nbsp;</td>
  278. <td class="nameDescription">
  279. <div class="fixedFont"><b><a href="../symbols/pv.Vector.html#norm">norm</a></b>()
  280. </div>
  281. <div class="description">Returns a normalized copy of this vector: a vector with the same direction,
  282. but unit length.</div>
  283. </td>
  284. </tr>
  285. <tr>
  286. <td class="attributes">&nbsp;</td>
  287. <td class="nameDescription">
  288. <div class="fixedFont"><b><a href="../symbols/pv.Vector.html#perp">perp</a></b>()
  289. </div>
  290. <div class="description">Returns a vector perpendicular to this vector: <i>&#x27e8;-y, x&#x27e9;</i>.</div>
  291. </td>
  292. </tr>
  293. <tr>
  294. <td class="attributes">&nbsp;</td>
  295. <td class="nameDescription">
  296. <div class="fixedFont"><b><a href="../symbols/pv.Vector.html#plus">plus</a></b>(x, y)
  297. </div>
  298. <div class="description">Returns this vector plus the vector <i>v</i>: <i>&#x27e8;x + v.x, y +
  299. v.y&#x27e9;</i>.</div>
  300. </td>
  301. </tr>
  302. <tr>
  303. <td class="attributes">&nbsp;</td>
  304. <td class="nameDescription">
  305. <div class="fixedFont"><b><a href="../symbols/pv.Vector.html#times">times</a></b>(k)
  306. </div>
  307. <div class="description">Returns a scaled copy of this vector: <i>&#x27e8;x * k, y * k&#x27e9;</i>.</div>
  308. </td>
  309. </tr>
  310. </tbody>
  311. </table>
  312. <!-- ============================== events summary ======================== -->
  313. <!-- ============================== constructor details ==================== -->
  314. <div class="details"><a name="constructor"> </a>
  315. <div class="sectionTitle">
  316. Class Detail
  317. </div>
  318. <div class="fixedFont">
  319. <b>pv.Vector</b>(x, y)
  320. </div>
  321. <div class="description">
  322. Constructs a <a href="../symbols/pv.Vector.html">pv.Vector</a> for the specified <i>x</i> and <i>y</i>
  323. coordinate. This constructor should not be invoked directly; use
  324. <a href="../symbols/pv.html#.vector">pv.vector</a> instead.
  325. </div>
  326. <dl class="detailList">
  327. <dt class="heading">Parameters:</dt>
  328. <dt>
  329. <span class="light fixedFont">{number}</span> <b>x</b>
  330. </dt>
  331. <dd>the <i>x</i> coordinate.</dd>
  332. <dt>
  333. <span class="light fixedFont">{number}</span> <b>y</b>
  334. </dt>
  335. <dd>the <i>y</i> coordinate.</dd>
  336. </dl>
  337. </div>
  338. <!-- ============================== field details ========================== -->
  339. <!-- ============================== method details ========================= -->
  340. <div class="sectionTitle">
  341. Method Detail
  342. </div>
  343. <a name="dot"> </a>
  344. <div class="fixedFont">
  345. <span class="light">{number}</span>
  346. <b>dot</b>(x, y)
  347. </div>
  348. <div class="description">
  349. Returns the dot product of this vector and the vector <i>v</i>: <i>x * v.x +
  350. y * v.y</i>. If only one argument is specified, it is interpreted as the
  351. vector <i>v</i>.
  352. </div>
  353. <dl class="detailList">
  354. <dt class="heading">Parameters:</dt>
  355. <dt>
  356. <span class="light fixedFont">{number}</span> <b>x</b>
  357. </dt>
  358. <dd>the <i>x</i> coordinate to dot.</dd>
  359. <dt>
  360. <span class="light fixedFont">{number}</span> <b>y</b>
  361. </dt>
  362. <dd>the <i>y</i> coordinate to dot.</dd>
  363. </dl>
  364. <dl class="detailList">
  365. <dt class="heading">Returns:</dt>
  366. <dd><span class="light fixedFont">{number}</span> a dot product.</dd>
  367. </dl>
  368. <hr />
  369. <a name="length"> </a>
  370. <div class="fixedFont">
  371. <span class="light">{number}</span>
  372. <b>length</b>()
  373. </div>
  374. <div class="description">
  375. Returns the magnitude of this vector, defined as <i>sqrt(x * x + y * y)</i>.
  376. </div>
  377. <dl class="detailList">
  378. <dt class="heading">Returns:</dt>
  379. <dd><span class="light fixedFont">{number}</span> a length.</dd>
  380. </dl>
  381. <hr />
  382. <a name="minus"> </a>
  383. <div class="fixedFont">
  384. <span class="light">{<a href="../symbols/pv.Vector.html">pv.Vector</a>}</span>
  385. <b>minus</b>(x, y)
  386. </div>
  387. <div class="description">
  388. Returns this vector minus the vector <i>v</i>: <i>&#x27e8;x - v.x, y -
  389. v.y&#x27e9;</i>. If only one argument is specified, it is interpreted as the
  390. vector <i>v</i>.
  391. </div>
  392. <dl class="detailList">
  393. <dt class="heading">Parameters:</dt>
  394. <dt>
  395. <span class="light fixedFont">{number}</span> <b>x</b>
  396. </dt>
  397. <dd>the <i>x</i> coordinate to subtract.</dd>
  398. <dt>
  399. <span class="light fixedFont">{number}</span> <b>y</b>
  400. </dt>
  401. <dd>the <i>y</i> coordinate to subtract.</dd>
  402. </dl>
  403. <dl class="detailList">
  404. <dt class="heading">Returns:</dt>
  405. <dd><span class="light fixedFont">{<a href="../symbols/pv.Vector.html">pv.Vector</a>}</span> a new vector.</dd>
  406. </dl>
  407. <hr />
  408. <a name="norm"> </a>
  409. <div class="fixedFont">
  410. <span class="light">{<a href="../symbols/pv.Vector.html">pv.Vector</a>}</span>
  411. <b>norm</b>()
  412. </div>
  413. <div class="description">
  414. Returns a normalized copy of this vector: a vector with the same direction,
  415. but unit length. If this vector has zero length this method returns a copy of
  416. this vector.
  417. </div>
  418. <dl class="detailList">
  419. <dt class="heading">Returns:</dt>
  420. <dd><span class="light fixedFont">{<a href="../symbols/pv.Vector.html">pv.Vector</a>}</span> a unit vector.</dd>
  421. </dl>
  422. <hr />
  423. <a name="perp"> </a>
  424. <div class="fixedFont">
  425. <span class="light">{<a href="../symbols/pv.Vector.html">pv.Vector</a>}</span>
  426. <b>perp</b>()
  427. </div>
  428. <div class="description">
  429. Returns a vector perpendicular to this vector: <i>&#x27e8;-y, x&#x27e9;</i>.
  430. </div>
  431. <dl class="detailList">
  432. <dt class="heading">Returns:</dt>
  433. <dd><span class="light fixedFont">{<a href="../symbols/pv.Vector.html">pv.Vector</a>}</span> a perpendicular vector.</dd>
  434. </dl>
  435. <hr />
  436. <a name="plus"> </a>
  437. <div class="fixedFont">
  438. <span class="light">{<a href="../symbols/pv.Vector.html">pv.Vector</a>}</span>
  439. <b>plus</b>(x, y)
  440. </div>
  441. <div class="description">
  442. Returns this vector plus the vector <i>v</i>: <i>&#x27e8;x + v.x, y +
  443. v.y&#x27e9;</i>. If only one argument is specified, it is interpreted as the
  444. vector <i>v</i>.
  445. </div>
  446. <dl class="detailList">
  447. <dt class="heading">Parameters:</dt>
  448. <dt>
  449. <span class="light fixedFont">{number}</span> <b>x</b>
  450. </dt>
  451. <dd>the <i>x</i> coordinate to add.</dd>
  452. <dt>
  453. <span class="light fixedFont">{number}</span> <b>y</b>
  454. </dt>
  455. <dd>the <i>y</i> coordinate to add.</dd>
  456. </dl>
  457. <dl class="detailList">
  458. <dt class="heading">Returns:</dt>
  459. <dd><span class="light fixedFont">{<a href="../symbols/pv.Vector.html">pv.Vector</a>}</span> a new vector.</dd>
  460. </dl>
  461. <hr />
  462. <a name="times"> </a>
  463. <div class="fixedFont">
  464. <span class="light">{<a href="../symbols/pv.Vector.html">pv.Vector</a>}</span>
  465. <b>times</b>(k)
  466. </div>
  467. <div class="description">
  468. Returns a scaled copy of this vector: <i>&#x27e8;x * k, y * k&#x27e9;</i>.
  469. To perform the equivalent divide operation, use <i>1 / k</i>.
  470. </div>
  471. <dl class="detailList">
  472. <dt class="heading">Parameters:</dt>
  473. <dt>
  474. <span class="light fixedFont">{number}</span> <b>k</b>
  475. </dt>
  476. <dd>the scale factor.</dd>
  477. </dl>
  478. <dl class="detailList">
  479. <dt class="heading">Returns:</dt>
  480. <dd><span class="light fixedFont">{<a href="../symbols/pv.Vector.html">pv.Vector</a>}</span> a scaled vector.</dd>
  481. </dl>
  482. <!-- ============================== event details ========================= -->
  483. <hr />
  484. </div>
  485. <!-- ============================== footer ================================= -->
  486. <div class="fineprint" style="clear:both">
  487. Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.0 on Tue Oct 06 2009 09:59:02 GMT-0700 (PDT)
  488. </div>
  489. </body>
  490. </html>