How to use p_in method in wpt

Best JavaScript code snippet using wpt

test.js

Source:test.js Github

copy

Full Screen

1const upd = {2 m_start_time: 1651495981881,3 m_sw_ver:4 ' FiberHome Fengine S4820-52T-X Routing Switch Sw Ver V310R220,Building revision M38,Hw Ver 1.02,Mac 80:3a:f4:50:f4:8e',5 m_sw_sn: ' NYY1FEC11131',6 m_name: 'Rabochih_11_2',7 portList: [8 {9 p_num: 1,10 p_index: 17410,11 p_admin: 1,12 p_name: 'GigabitEthernet1/0/1',13 p_in: 59035389,14 p_in_error: 0,15 p_out: 3967419996,16 p_out_error: 0,17 change: {18 string: '0 days 0:3:3',19 object: {20 timeticks: 18355,21 days: 0,22 hours: 0,23 minutes: 3,24 seconds: 3,25 miliseconds: 183550,26 },27 },28 p_oper: 1,29 p_speed: 100,30 cP_tag: '7',31 cP_untag: '686',32 cP_pvid: 686,33 m_macs: [34 {35 mac: '50d4f7d9c38f',36 vlan: '686',37 },38 ],39 },40 {41 p_num: 2,42 p_index: 17411,43 p_admin: 1,44 p_name: 'GigabitEthernet1/0/2',45 p_in: 0,46 p_in_error: 0,47 p_out: 0,48 p_out_error: 0,49 change: {50 string: '0 days 0:0:21',51 object: {52 timeticks: 2106,53 days: 0,54 hours: 0,55 minutes: 0,56 seconds: 21,57 miliseconds: 21060,58 },59 },60 p_oper: 2,61 p_speed: 1000,62 cP_tag: '7',63 cP_untag: '686',64 cP_pvid: 686,65 m_macs: [],66 },67 {68 p_num: 3,69 p_index: 17412,70 p_admin: 1,71 p_name: 'GigabitEthernet1/0/3',72 p_in: 1208973426,73 p_in_error: 0,74 p_out: 2302261162,75 p_out_error: 0,76 change: {77 string: '0 days 0:3:2',78 object: {79 timeticks: 18211,80 days: 0,81 hours: 0,82 minutes: 3,83 seconds: 2,84 miliseconds: 182110,85 },86 },87 p_oper: 1,88 p_speed: 100,89 cP_tag: '7',90 cP_untag: '686',91 cP_pvid: 686,92 m_macs: [93 {94 mac: '58d56e6e5548',95 vlan: '686',96 },97 ],98 },99 {100 p_num: 4,101 p_index: 17413,102 p_admin: 1,103 p_name: 'GigabitEthernet1/0/4',104 p_in: 486249433,105 p_in_error: 0,106 p_out: 1308566372,107 p_out_error: 0,108 change: {109 string: '0 days 0:3:2',110 object: {111 timeticks: 18217,112 days: 0,113 hours: 0,114 minutes: 3,115 seconds: 2,116 miliseconds: 182170,117 },118 },119 p_oper: 1,120 p_speed: 100,121 cP_tag: '7',122 cP_untag: '686',123 cP_pvid: 686,124 m_macs: [125 {126 mac: '6470262147',127 vlan: '686',128 },129 ],130 },131 {132 p_num: 5,133 p_index: 17414,134 p_admin: 1,135 p_name: 'GigabitEthernet1/0/5',136 p_in: 0,137 p_in_error: 0,138 p_out: 0,139 p_out_error: 0,140 change: {141 string: '0 days 0:0:21',142 object: {143 timeticks: 2114,144 days: 0,145 hours: 0,146 minutes: 0,147 seconds: 21,148 miliseconds: 21140,149 },150 },151 p_oper: 2,152 p_speed: 1000,153 cP_tag: '7',154 cP_untag: '686',155 cP_pvid: 686,156 m_macs: [],157 },158 {159 p_num: 6,160 p_index: 17415,161 p_admin: 1,162 p_name: 'GigabitEthernet1/0/6',163 p_in: 0,164 p_in_error: 0,165 p_out: 0,166 p_out_error: 0,167 change: {168 string: '0 days 0:0:21',169 object: {170 timeticks: 2117,171 days: 0,172 hours: 0,173 minutes: 0,174 seconds: 21,175 miliseconds: 21170,176 },177 },178 p_oper: 2,179 p_speed: 1000,180 cP_tag: '7',181 cP_untag: '686',182 cP_pvid: 686,183 m_macs: [],184 },185 {186 p_num: 7,187 p_index: 17416,188 p_admin: 1,189 p_name: 'GigabitEthernet1/0/7',190 p_in: 114978102,191 p_in_error: 0,192 p_out: 1950422595,193 p_out_error: 0,194 change: {195 string: '0 days 22:50:19',196 object: {197 timeticks: 8221976,198 days: 0,199 hours: 22,200 minutes: 50,201 seconds: 19,202 miliseconds: 82219760,203 },204 },205 p_oper: 1,206 p_speed: 100,207 cP_tag: '7',208 cP_untag: '686',209 cP_pvid: 686,210 m_macs: [211 {212 mac: 'fcf52847f34',213 vlan: '686',214 },215 {216 mac: 'fcf52847f35',217 vlan: '686',218 },219 ],220 },221 {222 p_num: 8,223 p_index: 17417,224 p_admin: 1,225 p_name: 'GigabitEthernet1/0/8',226 p_in: 5352747,227 p_in_error: 0,228 p_out: 2721552,229 p_out_error: 0,230 change: {231 string: '0 days 0:3:2',232 object: {233 timeticks: 18201,234 days: 0,235 hours: 0,236 minutes: 3,237 seconds: 2,238 miliseconds: 182010,239 },240 },241 p_oper: 1,242 p_speed: 100,243 cP_tag: '7',244 cP_untag: '686',245 cP_pvid: 686,246 m_macs: [247 {248 mac: '3c9872332d76',249 vlan: '686',250 },251 ],252 },253 {254 p_num: 9,255 p_index: 17418,256 p_admin: 1,257 p_name: 'GigabitEthernet1/0/9',258 p_in: 991938105,259 p_in_error: 0,260 p_out: 2755233536,261 p_out_error: 0,262 change: {263 string: '0 days 0:3:2',264 object: {265 timeticks: 18204,266 days: 0,267 hours: 0,268 minutes: 3,269 seconds: 2,270 miliseconds: 182040,271 },272 },273 p_oper: 1,274 p_speed: 100,275 cP_tag: '7',276 cP_untag: '686',277 cP_pvid: 686,278 m_macs: [279 {280 mac: 'bcaec5a777e3',281 vlan: '686',282 },283 ],284 },285 {286 p_num: 10,287 p_index: 17419,288 p_admin: 1,289 p_name: 'GigabitEthernet1/0/10',290 p_in: 1105758234,291 p_in_error: 0,292 p_out: 1219201815,293 p_out_error: 0,294 change: {295 string: '1 days 14:37:2',296 object: {297 timeticks: 13902200,298 days: 1,299 hours: 14,300 minutes: 37,301 seconds: 2,302 miliseconds: 139022000,303 },304 },305 p_oper: 1,306 p_speed: 100,307 cP_tag: '7',308 cP_untag: '686',309 cP_pvid: 686,310 m_macs: [311 {312 mac: '14cc20adba4b',313 vlan: '686',314 },315 ],316 },317 {318 p_num: 11,319 p_index: 17420,320 p_admin: 1,321 p_name: 'GigabitEthernet1/0/11',322 p_in: 555941252,323 p_in_error: 0,324 p_out: 641834631,325 p_out_error: 0,326 change: {327 string: '0 days 0:3:2',328 object: {329 timeticks: 18206,330 days: 0,331 hours: 0,332 minutes: 3,333 seconds: 2,334 miliseconds: 182060,335 },336 },337 p_oper: 1,338 p_speed: 100,339 cP_tag: '7',340 cP_untag: '686',341 cP_pvid: 686,342 m_macs: [343 {344 mac: '1c5f2b985b19',345 vlan: '686',346 },347 ],348 },349 {350 p_num: 12,351 p_index: 17421,352 p_admin: 1,353 p_name: 'GigabitEthernet1/0/12',354 p_in: 0,355 p_in_error: 0,356 p_out: 0,357 p_out_error: 0,358 change: {359 string: '0 days 0:0:21',360 object: {361 timeticks: 2129,362 days: 0,363 hours: 0,364 minutes: 0,365 seconds: 21,366 miliseconds: 21290,367 },368 },369 p_oper: 2,370 p_speed: 1000,371 cP_tag: '7',372 cP_untag: '686',373 cP_pvid: 686,374 m_macs: [],375 },376 {377 p_num: 13,378 p_index: 17422,379 p_admin: 1,380 p_name: 'GigabitEthernet1/0/13',381 p_in: 266402393,382 p_in_error: 0,383 p_out: 3873462012,384 p_out_error: 2622,385 change: {386 string: '2 days 0:16:29',387 object: {388 timeticks: 17378919,389 days: 2,390 hours: 0,391 minutes: 16,392 seconds: 29,393 miliseconds: 173789190,394 },395 },396 p_oper: 1,397 p_speed: 100,398 cP_tag: '7',399 cP_untag: '686',400 cP_pvid: 686,401 m_macs: [402 {403 mac: 'f0795993148d',404 vlan: '686',405 },406 ],407 },408 {409 p_num: 14,410 p_index: 17423,411 p_admin: 1,412 p_name: 'GigabitEthernet1/0/14',413 p_in: 472151741,414 p_in_error: 0,415 p_out: 313790952,416 p_out_error: 0,417 change: {418 string: '0 days 0:3:2',419 object: {420 timeticks: 18226,421 days: 0,422 hours: 0,423 minutes: 3,424 seconds: 2,425 miliseconds: 182260,426 },427 },428 p_oper: 1,429 p_speed: 100,430 cP_tag: '7',431 cP_untag: '686',432 cP_pvid: 686,433 m_macs: [434 {435 mac: '0ad2493a62d',436 vlan: '686',437 },438 ],439 },440 {441 p_num: 15,442 p_index: 17424,443 p_admin: 1,444 p_name: 'GigabitEthernet1/0/15',445 p_in: 1171610,446 p_in_error: 0,447 p_out: 2607788,448 p_out_error: 0,449 change: {450 string: '0 days 0:3:2',451 object: {452 timeticks: 18231,453 days: 0,454 hours: 0,455 minutes: 3,456 seconds: 2,457 miliseconds: 182310,458 },459 },460 p_oper: 1,461 p_speed: 100,462 cP_tag: '7',463 cP_untag: '686',464 cP_pvid: 686,465 m_macs: [466 {467 mac: '8c6b3b9e4be',468 vlan: '686',469 },470 ],471 },472 {473 p_num: 16,474 p_index: 17425,475 p_admin: 1,476 p_name: 'GigabitEthernet1/0/16',477 p_in: 0,478 p_in_error: 0,479 p_out: 0,480 p_out_error: 0,481 change: {482 string: '0 days 0:0:21',483 object: {484 timeticks: 2137,485 days: 0,486 hours: 0,487 minutes: 0,488 seconds: 21,489 miliseconds: 21370,490 },491 },492 p_oper: 2,493 p_speed: 1000,494 cP_tag: '7',495 cP_untag: '686',496 cP_pvid: 686,497 m_macs: [],498 },499 {500 p_num: 17,501 p_index: 17426,502 p_admin: 1,503 p_name: 'GigabitEthernet1/0/17',504 p_in: 443157659,505 p_in_error: 0,506 p_out: 2013404933,507 p_out_error: 0,508 change: {509 string: '1 days 2:37:18',510 object: {511 timeticks: 9583836,512 days: 1,513 hours: 2,514 minutes: 37,515 seconds: 18,516 miliseconds: 95838360,517 },518 },519 p_oper: 1,520 p_speed: 100,521 cP_tag: '7',522 cP_untag: '686',523 cP_pvid: 686,524 m_macs: [525 {526 mac: '3c987246ef62',527 vlan: '686',528 },529 ],530 },531 {532 p_num: 18,533 p_index: 17427,534 p_admin: 1,535 p_name: 'GigabitEthernet1/0/18',536 p_in: 1102793392,537 p_in_error: 0,538 p_out: 3025456210,539 p_out_error: 0,540 change: {541 string: '0 days 0:3:3',542 object: {543 timeticks: 18327,544 days: 0,545 hours: 0,546 minutes: 3,547 seconds: 3,548 miliseconds: 183270,549 },550 },551 p_oper: 1,552 p_speed: 1000,553 cP_tag: '7',554 cP_untag: '686',555 cP_pvid: 686,556 m_macs: [557 {558 mac: 'f4e5785a38d4',559 vlan: '686',560 },561 ],562 },563 {564 p_num: 19,565 p_index: 17428,566 p_admin: 1,567 p_name: 'GigabitEthernet1/0/19',568 p_in: 0,569 p_in_error: 0,570 p_out: 0,571 p_out_error: 0,572 change: {573 string: '0 days 0:0:21',574 object: {575 timeticks: 2143,576 days: 0,577 hours: 0,578 minutes: 0,579 seconds: 21,580 miliseconds: 21430,581 },582 },583 p_oper: 2,584 p_speed: 1000,585 cP_tag: '7',586 cP_untag: '686',587 cP_pvid: 686,588 m_macs: [],589 },590 {591 p_num: 20,592 p_index: 17429,593 p_admin: 1,594 p_name: 'GigabitEthernet1/0/20',595 p_in: 0,596 p_in_error: 0,597 p_out: 0,598 p_out_error: 0,599 change: {600 string: '0 days 0:0:21',601 object: {602 timeticks: 2145,603 days: 0,604 hours: 0,605 minutes: 0,606 seconds: 21,607 miliseconds: 21450,608 },609 },610 p_oper: 2,611 p_speed: 1000,612 cP_tag: '7',613 cP_untag: '686',614 cP_pvid: 686,615 m_macs: [],616 },617 {618 p_num: 21,619 p_index: 17430,620 p_admin: 1,621 p_name: 'GigabitEthernet1/0/21',622 p_in: 3913762221,623 p_in_error: 0,624 p_out: 3631382146,625 p_out_error: 0,626 change: {627 string: '0 days 0:3:3',628 object: {629 timeticks: 18379,630 days: 0,631 hours: 0,632 minutes: 3,633 seconds: 3,634 miliseconds: 183790,635 },636 },637 p_oper: 1,638 p_speed: 100,639 cP_tag: '7',640 cP_untag: '686',641 cP_pvid: 686,642 m_macs: [643 {644 mac: '3c846a2e6655',645 vlan: '686',646 },647 ],648 },649 {650 p_num: 22,651 p_index: 17431,652 p_admin: 1,653 p_name: 'GigabitEthernet1/0/22',654 p_in: 0,655 p_in_error: 0,656 p_out: 0,657 p_out_error: 0,658 change: {659 string: '0 days 0:0:21',660 object: {661 timeticks: 2149,662 days: 0,663 hours: 0,664 minutes: 0,665 seconds: 21,666 miliseconds: 21490,667 },668 },669 p_oper: 2,670 p_speed: 1000,671 cP_tag: '7',672 cP_untag: '686',673 cP_pvid: 686,674 m_macs: [],675 },676 {677 p_num: 23,678 p_index: 17432,679 p_admin: 1,680 p_name: 'GigabitEthernet1/0/23',681 p_in: 0,682 p_in_error: 0,683 p_out: 0,684 p_out_error: 0,685 change: {686 string: '0 days 0:0:21',687 object: {688 timeticks: 2151,689 days: 0,690 hours: 0,691 minutes: 0,692 seconds: 21,693 miliseconds: 21510,694 },695 },696 p_oper: 2,697 p_speed: 1000,698 cP_tag: '7',699 cP_untag: '686',700 cP_pvid: 686,701 m_macs: [],702 },703 {704 p_num: 24,705 p_index: 17433,706 p_admin: 1,707 p_name: 'GigabitEthernet1/0/24',708 p_in: 0,709 p_in_error: 0,710 p_out: 0,711 p_out_error: 0,712 change: {713 string: '0 days 0:0:21',714 object: {715 timeticks: 2154,716 days: 0,717 hours: 0,718 minutes: 0,719 seconds: 21,720 miliseconds: 21540,721 },722 },723 p_oper: 2,724 p_speed: 1000,725 cP_tag: '7',726 cP_untag: '686',727 cP_pvid: 686,728 m_macs: [],729 },730 {731 p_num: 25,732 p_index: 17434,733 p_admin: 1,734 p_name: 'GigabitEthernet1/0/25',735 p_in: 264035235,736 p_in_error: 0,737 p_out: 44333967,738 p_out_error: 0,739 change: {740 string: '0 days 0:3:2',741 object: {742 timeticks: 18221,743 days: 0,744 hours: 0,745 minutes: 3,746 seconds: 2,747 miliseconds: 182210,748 },749 },750 p_oper: 1,751 p_speed: 100,752 cP_tag: '7',753 cP_untag: '686',754 cP_pvid: 686,755 m_macs: [756 {757 mac: '382c4aabade8',758 vlan: '686',759 },760 ],761 },762 {763 p_num: 26,764 p_index: 17435,765 p_admin: 1,766 p_name: 'GigabitEthernet1/0/26',767 p_in: 43051533,768 p_in_error: 0,769 p_out: 418563906,770 p_out_error: 0,771 change: {772 string: '1 days 22:48:52',773 object: {774 timeticks: 16853235,775 days: 1,776 hours: 22,777 minutes: 48,778 seconds: 52,779 miliseconds: 168532350,780 },781 },782 p_oper: 1,783 p_speed: 1000,784 cP_tag: '7',785 cP_untag: '686',786 cP_pvid: 686,787 m_macs: [788 {789 mac: 'bc5ff4a857',790 vlan: '686',791 },792 ],793 },794 {795 p_num: 27,796 p_index: 17436,797 p_admin: 1,798 p_name: 'GigabitEthernet1/0/27',799 p_in: 118958139,800 p_in_error: 0,801 p_out: 1929270991,802 p_out_error: 0,803 change: {804 string: '0 days 0:3:14',805 object: {806 timeticks: 19457,807 days: 0,808 hours: 0,809 minutes: 3,810 seconds: 14,811 miliseconds: 194570,812 },813 },814 p_oper: 1,815 p_speed: 100,816 cP_tag: '7',817 cP_untag: '686',818 cP_pvid: 686,819 m_macs: [820 {821 mac: '74da88a0cefd',822 vlan: '686',823 },824 ],825 },826 {827 p_num: 28,828 p_index: 17437,829 p_admin: 1,830 p_name: 'GigabitEthernet1/0/28',831 p_in: 362919048,832 p_in_error: 0,833 p_out: 1480513734,834 p_out_error: 0,835 change: {836 string: '0 days 0:3:3',837 object: {838 timeticks: 18345,839 days: 0,840 hours: 0,841 minutes: 3,842 seconds: 3,843 miliseconds: 183450,844 },845 },846 p_oper: 1,847 p_speed: 1000,848 cP_tag: '7',849 cP_untag: '686',850 cP_pvid: 686,851 m_macs: [852 {853 mac: '7898e8a7d64',854 vlan: '686',855 },856 ],857 },858 {859 p_num: 29,860 p_index: 17438,861 p_admin: 1,862 p_name: 'GigabitEthernet1/0/29',863 p_in: 2687332427,864 p_in_error: 0,865 p_out: 2283709659,866 p_out_error: 0,867 change: {868 string: '1 days 19:3:12',869 object: {870 timeticks: 15499251,871 days: 1,872 hours: 19,873 minutes: 3,874 seconds: 12,875 miliseconds: 154992510,876 },877 },878 p_oper: 1,879 p_speed: 100,880 cP_tag: '7',881 cP_untag: '686',882 cP_pvid: 686,883 m_macs: [884 {885 mac: '78b213bbf03e',886 vlan: '686',887 },888 ],889 },890 {891 p_num: 30,892 p_index: 17439,893 p_admin: 1,894 p_name: 'GigabitEthernet1/0/30',895 p_in: 1252769267,896 p_in_error: 0,897 p_out: 3055639713,898 p_out_error: 0,899 change: {900 string: '0 days 0:3:2',901 object: {902 timeticks: 18228,903 days: 0,904 hours: 0,905 minutes: 3,906 seconds: 2,907 miliseconds: 182280,908 },909 },910 p_oper: 1,911 p_speed: 100,912 cP_tag: '7',913 cP_untag: '686',914 cP_pvid: 686,915 m_macs: [916 {917 mac: 'bcf9a1039e8',918 vlan: '686',919 },920 ],921 },922 {923 p_num: 31,924 p_index: 17440,925 p_admin: 1,926 p_name: 'GigabitEthernet1/0/31',927 p_in: 0,928 p_in_error: 0,929 p_out: 0,930 p_out_error: 0,931 change: {932 string: '0 days 0:0:21',933 object: {934 timeticks: 2168,935 days: 0,936 hours: 0,937 minutes: 0,938 seconds: 21,939 miliseconds: 21680,940 },941 },942 p_oper: 2,943 p_speed: 10,944 cP_tag: '7',945 cP_untag: '686',946 cP_pvid: 686,947 m_macs: [],948 },949 {950 p_num: 32,951 p_index: 17441,952 p_admin: 1,953 p_name: 'GigabitEthernet1/0/32',954 p_in: 2302683205,955 p_in_error: 0,956 p_out: 1544857090,957 p_out_error: 0,958 change: {959 string: '0 days 0:3:6',960 object: {961 timeticks: 18647,962 days: 0,963 hours: 0,964 minutes: 3,965 seconds: 6,966 miliseconds: 186470,967 },968 },969 p_oper: 1,970 p_speed: 100,971 cP_tag: '7',972 cP_untag: '686',973 cP_pvid: 686,974 m_macs: [975 {976 mac: 'b42e99294bed',977 vlan: '686',978 },979 ],980 },981 {982 p_num: 33,983 p_index: 17442,984 p_admin: 1,985 p_name: 'GigabitEthernet1/0/33',986 p_in: 287614334,987 p_in_error: 0,988 p_out: 1079158552,989 p_out_error: 0,990 change: {991 string: '0 days 0:3:3',992 object: {993 timeticks: 18335,994 days: 0,995 hours: 0,996 minutes: 3,997 seconds: 3,998 miliseconds: 183350,999 },1000 },1001 p_oper: 1,1002 p_speed: 100,1003 cP_tag: '7',1004 cP_untag: '686',1005 cP_pvid: 686,1006 m_macs: [1007 {1008 mac: 'b0be76d46791',1009 vlan: '686',1010 },1011 ],1012 },1013 {1014 p_num: 34,1015 p_index: 17443,1016 p_admin: 1,1017 p_name: 'GigabitEthernet1/0/34',1018 p_in: 378218784,1019 p_in_error: 0,1020 p_out: 1909941096,1021 p_out_error: 0,1022 change: {1023 string: '0 days 20:41:6',1024 object: {1025 timeticks: 7446670,1026 days: 0,1027 hours: 20,1028 minutes: 41,1029 seconds: 6,1030 miliseconds: 74466700,1031 },1032 },1033 p_oper: 1,1034 p_speed: 100,1035 cP_tag: '7',1036 cP_untag: '686',1037 cP_pvid: 686,1038 m_macs: [1039 {1040 mac: '0ad24e236bf',1041 vlan: '686',1042 },1043 ],1044 },1045 {1046 p_num: 35,1047 p_index: 17444,1048 p_admin: 1,1049 p_name: 'GigabitEthernet1/0/35',1050 p_in: 265496780,1051 p_in_error: 0,1052 p_out: 360789563,1053 p_out_error: 0,1054 change: {1055 string: '1 days 6:4:23',1056 object: {1057 timeticks: 10826335,1058 days: 1,1059 hours: 6,1060 minutes: 4,1061 seconds: 23,1062 miliseconds: 108263350,1063 },1064 },1065 p_oper: 1,1066 p_speed: 1000,1067 cP_tag: '7',1068 cP_untag: '686',1069 cP_pvid: 686,1070 m_macs: [1071 {1072 mac: 'f0b4d2433df2',1073 vlan: '686',1074 },1075 ],1076 },1077 {1078 p_num: 36,1079 p_index: 17445,1080 p_admin: 1,1081 p_name: 'GigabitEthernet1/0/36',1082 p_in: 104660815,1083 p_in_error: 0,1084 p_out: 1288932073,1085 p_out_error: 0,1086 change: {1087 string: '0 days 0:3:2',1088 object: {1089 timeticks: 18214,1090 days: 0,1091 hours: 0,1092 minutes: 3,1093 seconds: 2,1094 miliseconds: 182140,1095 },1096 },1097 p_oper: 1,1098 p_speed: 100,1099 cP_tag: '7',1100 cP_untag: '686',1101 cP_pvid: 686,1102 m_macs: [1103 {1104 mac: 'bcf9afbdc0',1105 vlan: '686',1106 },1107 ],1108 },1109 {1110 p_num: 37,1111 p_index: 17446,1112 p_admin: 1,1113 p_name: 'GigabitEthernet1/0/37',1114 p_in: 0,1115 p_in_error: 0,1116 p_out: 0,1117 p_out_error: 0,1118 change: {1119 string: '0 days 0:0:21',1120 object: {1121 timeticks: 2180,1122 days: 0,1123 hours: 0,1124 minutes: 0,1125 seconds: 21,1126 miliseconds: 21800,1127 },1128 },1129 p_oper: 2,1130 p_speed: 1000,1131 cP_tag: '7',1132 cP_untag: '686',1133 cP_pvid: 686,1134 m_macs: [],1135 },1136 {1137 p_num: 38,1138 p_index: 17447,1139 p_admin: 1,1140 p_name: 'GigabitEthernet1/0/38',1141 p_in: 0,1142 p_in_error: 0,1143 p_out: 0,1144 p_out_error: 0,1145 change: {1146 string: '0 days 0:0:21',1147 object: {1148 timeticks: 2182,1149 days: 0,1150 hours: 0,1151 minutes: 0,1152 seconds: 21,1153 miliseconds: 21820,1154 },1155 },1156 p_oper: 2,1157 p_speed: 1000,1158 cP_tag: '7',1159 cP_untag: '686',1160 cP_pvid: 686,1161 m_macs: [],1162 },1163 {1164 p_num: 39,1165 p_index: 17448,1166 p_admin: 1,1167 p_name: 'GigabitEthernet1/0/39',1168 p_in: 0,1169 p_in_error: 0,1170 p_out: 0,1171 p_out_error: 0,1172 change: {1173 string: '0 days 0:0:21',1174 object: {1175 timeticks: 2184,1176 days: 0,1177 hours: 0,1178 minutes: 0,1179 seconds: 21,1180 miliseconds: 21840,1181 },1182 },1183 p_oper: 2,1184 p_speed: 1000,1185 cP_tag: '7',1186 cP_untag: '686',1187 cP_pvid: 686,1188 m_macs: [],1189 },1190 {1191 p_num: 40,1192 p_index: 17449,1193 p_admin: 1,1194 p_name: 'GigabitEthernet1/0/40',1195 p_in: 0,1196 p_in_error: 0,1197 p_out: 0,1198 p_out_error: 0,1199 change: {1200 string: '0 days 0:0:21',1201 object: {1202 timeticks: 2186,1203 days: 0,1204 hours: 0,1205 minutes: 0,1206 seconds: 21,1207 miliseconds: 21860,1208 },1209 },1210 p_oper: 2,1211 p_speed: 1000,1212 cP_tag: '7',1213 cP_untag: '686',1214 cP_pvid: 686,1215 m_macs: [],1216 },1217 {1218 p_num: 41,1219 p_index: 17450,1220 p_admin: 1,1221 p_name: 'GigabitEthernet1/0/41',1222 p_in: 0,1223 p_in_error: 0,1224 p_out: 0,1225 p_out_error: 0,1226 change: {1227 string: '0 days 0:0:21',1228 object: {1229 timeticks: 2188,1230 days: 0,1231 hours: 0,1232 minutes: 0,1233 seconds: 21,1234 miliseconds: 21880,1235 },1236 },1237 p_oper: 2,1238 p_speed: 1000,1239 cP_tag: '7',1240 cP_untag: '686',1241 cP_pvid: 686,1242 m_macs: [],1243 },1244 {1245 p_num: 42,1246 p_index: 17451,1247 p_admin: 1,1248 p_name: 'GigabitEthernet1/0/42',1249 p_in: 0,1250 p_in_error: 0,1251 p_out: 0,1252 p_out_error: 0,1253 change: {1254 string: '0 days 0:0:21',1255 object: {1256 timeticks: 2190,1257 days: 0,1258 hours: 0,1259 minutes: 0,1260 seconds: 21,1261 miliseconds: 21900,1262 },1263 },1264 p_oper: 2,1265 p_speed: 1000,1266 cP_tag: '7',1267 cP_untag: '686',1268 cP_pvid: 686,1269 m_macs: [],1270 },1271 {1272 p_num: 43,1273 p_index: 17452,1274 p_admin: 1,1275 p_name: 'GigabitEthernet1/0/43',1276 p_in: 0,1277 p_in_error: 0,1278 p_out: 0,1279 p_out_error: 0,1280 change: {1281 string: '0 days 0:0:21',1282 object: {1283 timeticks: 2192,1284 days: 0,1285 hours: 0,1286 minutes: 0,1287 seconds: 21,1288 miliseconds: 21920,1289 },1290 },1291 p_oper: 2,1292 p_speed: 1000,1293 cP_tag: '7',1294 cP_untag: '686',1295 cP_pvid: 686,1296 m_macs: [],1297 },1298 {1299 p_num: 44,1300 p_index: 17453,1301 p_admin: 1,1302 p_name: 'GigabitEthernet1/0/44',1303 p_in: 0,1304 p_in_error: 0,1305 p_out: 0,1306 p_out_error: 0,1307 change: {1308 string: '0 days 0:0:21',1309 object: {1310 timeticks: 2194,1311 days: 0,1312 hours: 0,1313 minutes: 0,1314 seconds: 21,1315 miliseconds: 21940,1316 },1317 },1318 p_oper: 2,1319 p_speed: 1000,1320 cP_tag: '7',1321 cP_untag: '686',1322 cP_pvid: 686,1323 m_macs: [],1324 },1325 {1326 p_num: 45,1327 p_index: 17454,1328 p_admin: 1,1329 p_name: 'GigabitEthernet1/0/45',1330 p_in: 0,1331 p_in_error: 0,1332 p_out: 0,1333 p_out_error: 0,1334 change: {1335 string: '1 days 5:57:8',1336 object: {1337 timeticks: 10782899,1338 days: 1,1339 hours: 5,1340 minutes: 57,1341 seconds: 8,1342 miliseconds: 107828990,1343 },1344 },1345 p_oper: 2,1346 p_speed: 10,1347 cP_tag: '',1348 cP_untag: '99',1349 cP_pvid: 99,1350 m_macs: [],1351 },1352 {1353 p_num: 46,1354 p_index: 17455,1355 p_admin: 1,1356 p_name: 'GigabitEthernet1/0/46',1357 p_in: 0,1358 p_in_error: 0,1359 p_out: 0,1360 p_out_error: 0,1361 change: {1362 string: '0 days 17:31:25',1363 object: {1364 timeticks: 6308554,1365 days: 0,1366 hours: 17,1367 minutes: 31,1368 seconds: 25,1369 miliseconds: 63085540,1370 },1371 },1372 p_oper: 2,1373 p_speed: 10,1374 cP_tag: '',1375 cP_untag: '99',1376 cP_pvid: 99,1377 m_macs: [],1378 },1379 {1380 p_num: 47,1381 p_index: 17456,1382 p_admin: 1,1383 p_name: 'GigabitEthernet1/0/47',1384 p_in: 0,1385 p_in_error: 285152,1386 p_out: 0,1387 p_out_error: 285152,1388 change: {1389 string: '0 days 0:3:0',1390 object: {1391 timeticks: 18071,1392 days: 0,1393 hours: 0,1394 minutes: 3,1395 seconds: 0,1396 miliseconds: 180710,1397 },1398 },1399 p_oper: 1,1400 p_speed: 10,1401 cP_tag: '',1402 cP_untag: '99',1403 cP_pvid: 99,1404 m_macs: [],1405 },1406 {1407 p_num: 48,1408 p_index: 17457,1409 p_admin: 1,1410 p_name: 'GigabitEthernet1/0/48',1411 p_in: 3358381,1412 p_in_error: 0,1413 p_out: 10352491,1414 p_out_error: 0,1415 change: {1416 string: '0 days 0:3:2',1417 object: {1418 timeticks: 18209,1419 days: 0,1420 hours: 0,1421 minutes: 3,1422 seconds: 2,1423 miliseconds: 182090,1424 },1425 },1426 p_oper: 1,1427 p_speed: 100,1428 cP_tag: '',1429 cP_untag: '4061',1430 cP_pvid: 4061,1431 m_macs: [1432 {1433 mac: '3071b2629ac5',1434 vlan: '4061',1435 },1436 ],1437 },1438 {1439 p_num: 49,1440 p_index: 17474,1441 p_admin: 1,1442 p_name: 'XGigabitEthernet1/1/1',1443 p_in: 638906818,1444 p_in_error: 0,1445 p_out: 923609914,1446 p_out_error: 0,1447 change: {1448 string: '0 days 0:3:0',1449 object: {1450 timeticks: 18037,1451 days: 0,1452 hours: 0,1453 minutes: 3,1454 seconds: 0,1455 miliseconds: 180370,1456 },1457 },1458 p_oper: 1,1459 p_speed: 10000,1460 cP_tag: '7,686-689,2046,4000,4061,4094',1461 cP_untag: '1',1462 cP_pvid: 1,1463 m_macs: [1464 {1465 mac: '803af430d553',1466 vlan: '1',1467 },1468 {1469 mac: '54be5384e3a7',1470 vlan: '7',1471 },1472 {1473 mac: '005e011',1474 vlan: '686',1475 },1476 {1477 mac: '005e012',1478 vlan: '686',1479 },1480 {1481 mac: '005e012',1482 vlan: '687',1483 },1484 {1485 mac: '8c6b3284e2b',1486 vlan: '687',1487 },1488 {1489 mac: '8c6b331a35b',1490 vlan: '687',1491 },1492 {1493 mac: '8c6b3bf98b1',1494 vlan: '687',1495 },1496 {1497 mac: '8c6b3c4229e',1498 vlan: '687',1499 },1500 {1501 mac: '28285dee7a9',1502 vlan: '687',1503 },1504 {1505 mac: '3c846ab63274',1506 vlan: '687',1507 },1508 {1509 mac: '58d56ea3380',1510 vlan: '687',1511 },1512 {1513 mac: '643e8c3fd54b',1514 vlan: '687',1515 },1516 {1517 mac: '7811dc1aad46',1518 vlan: '687',1519 },1520 {1521 mac: 'a0b3ccc62ad0',1522 vlan: '687',1523 },1524 {1525 mac: 'b0be762341e0',1526 vlan: '687',1527 },1528 {1529 mac: 'e0db55d5a9c',1530 vlan: '687',1531 },1532 {1533 mac: 'f0b4d2cfcfad',1534 vlan: '687',1535 },1536 {1537 mac: 'f4e5780becb',1538 vlan: '687',1539 },1540 {1541 mac: '005e011',1542 vlan: '688',1543 },1544 {1545 mac: '005e012',1546 vlan: '688',1547 },1548 {1549 mac: '0ad24df29cf',1550 vlan: '688',1551 },1552 {1553 mac: '85a1174cf78',1554 vlan: '688',1555 },1556 {1557 mac: '8c6b3b9e4da',1558 vlan: '689',1559 },1560 {1561 mac: '4ccc6af48e3c',1562 vlan: '689',1563 },1564 {1565 mac: '58d56e6f32a0',1566 vlan: '689',1567 },1568 {1569 mac: 'f0b4d2cb701d',1570 vlan: '689',1571 },1572 {1573 mac: 'f4e57883eaa',1574 vlan: '689',1575 },1576 {1577 mac: 'f4e578309788',1578 vlan: '689',1579 },1580 {1581 mac: '803af430eb7d',1582 vlan: '2046',1583 },1584 {1585 mac: 'd48cb5b62ec1',1586 vlan: '2046',1587 },1588 {1589 mac: '643e8c3fd54b',1590 vlan: '4000',1591 },1592 {1593 mac: '803af430d553',1594 vlan: '4000',1595 },1596 {1597 mac: '3071b2644637',1598 vlan: '4061',1599 },1600 {1601 mac: '3071b264a65e',1602 vlan: '4061',1603 },1604 {1605 mac: 'd48cb5b62ec1',1606 vlan: '4061',1607 },1608 ],1609 },1610 {1611 p_num: 50,1612 p_index: 17475,1613 p_admin: 1,1614 p_name: 'XGigabitEthernet1/1/2',1615 p_in: 2189219274,1616 p_in_error: 0,1617 p_out: 1763129677,1618 p_out_error: 0,1619 change: {1620 string: '0 days 0:3:0',1621 object: {1622 timeticks: 18059,1623 days: 0,1624 hours: 0,1625 minutes: 3,1626 seconds: 0,1627 miliseconds: 180590,1628 },1629 },1630 p_oper: 1,1631 p_speed: 1000,1632 cP_tag: '7,686-689,2046,4000,4061,4094',1633 cP_untag: '1',1634 cP_pvid: 1,1635 m_macs: [1636 {1637 mac: '803af430f3d7',1638 vlan: '1',1639 },1640 {1641 mac: '3c987212bba8',1642 vlan: '688',1643 },1644 {1645 mac: '74dada833dbd',1646 vlan: '688',1647 },1648 {1649 mac: '7898e8a593c',1650 vlan: '688',1651 },1652 {1653 mac: '84c9b28281d',1654 vlan: '688',1655 },1656 {1657 mac: '88c3975c46a',1658 vlan: '688',1659 },1660 {1661 mac: '98dac49454a7',1662 vlan: '688',1663 },1664 {1665 mac: 'bcf9a83749f',1666 vlan: '688',1667 },1668 {1669 mac: 'c04a0aa867d',1670 vlan: '688',1671 },1672 {1673 mac: 'f4e5785a4275',1674 vlan: '688',1675 },1676 {1677 mac: '803af430f3d7',1678 vlan: '2046',1679 },1680 {1681 mac: '3c987212bba8',1682 vlan: '4000',1683 },1684 {1685 mac: '7898e8a593c',1686 vlan: '4000',1687 },1688 {1689 mac: 'bcf9a83749f',1690 vlan: '4000',1691 },1692 {1693 mac: 'f4e5785a4275',1694 vlan: '4000',1695 },1696 {1697 mac: '02236fc186',1698 vlan: '4061',1699 },1700 ],1701 },1702 {1703 p_num: 51,1704 p_index: 17538,1705 p_admin: 1,1706 p_name: 'XGigabitEthernet1/2/1',1707 p_in: 0,1708 p_in_error: 0,1709 p_out: 0,1710 p_out_error: 0,1711 change: {1712 string: '0 days 0:0:22',1713 object: {1714 timeticks: 2204,1715 days: 0,1716 hours: 0,1717 minutes: 0,1718 seconds: 22,1719 miliseconds: 22040,1720 },1721 },1722 p_oper: 2,1723 p_speed: 10000,1724 cP_tag: '7,686-689,2046,4000,4061,4094',1725 cP_untag: '1',1726 cP_pvid: 1,1727 m_macs: [],1728 },1729 {1730 p_num: 52,1731 p_index: 17539,1732 p_admin: 1,1733 p_name: 'XGigabitEthernet1/2/2',1734 p_in: 0,1735 p_in_error: 0,1736 p_out: 0,1737 p_out_error: 0,1738 change: {1739 string: '0 days 0:0:22',1740 object: {1741 timeticks: 2207,1742 days: 0,1743 hours: 0,1744 minutes: 0,1745 seconds: 22,1746 miliseconds: 22070,1747 },1748 },1749 p_oper: 2,1750 p_speed: 10000,1751 cP_tag: '7,686-689,2046,4000,4061,4094',1752 cP_untag: '1',1753 cP_pvid: 1,1754 m_macs: [],1755 },1756 ],1757}1758const lldp = [1759 {1760 id: 58724,1761 host: '10.220.53.218',1762 lldp: {1763 status: 'fulfilled',1764 value: {1765 'XGigabitEthernet1/1/1': {1766 r_mac: '803af450f497',1767 r_port: 'XGigabitEthernet1/1/2',1768 r_name: 'Vikulova_28_7',1769 portSnmpIndex: '17474',1770 },1771 'XGigabitEthernet1/2/2': {1772 r_mac: '68e209a72a40',1773 r_port: 'XGigabitEthernet0/0/6',1774 r_name: '[2.192][AGG_Vikulova28b_sw3]',1775 portSnmpIndex: '17539',1776 },1777 },1778 },1779 },1780 {1781 id: 58723,1782 host: '10.220.53.217',1783 lldp: {1784 status: 'fulfilled',1785 value: {1786 'XGigabitEthernet1/1/1': {1787 r_mac: '803af430eb7d',1788 r_port: 'XGigabitEthernet1/1/2',1789 r_name: 'Tatisheva_125_2_2',1790 portSnmpIndex: '17474',1791 },1792 'XGigabitEthernet1/1/2': {1793 r_mac: '803af450f953',1794 r_port: 'XGigabitEthernet1/1/1',1795 r_name: 'Vikulova_28_3',1796 portSnmpIndex: '17475',1797 },1798 },1799 },1800 },1801 {1802 id: 58722,1803 host: '10.220.53.216',1804 lldp: {1805 status: 'fulfilled',1806 value: {1807 'XGigabitEthernet1/1/1': {1808 r_mac: '803af430f3d7',1809 r_port: 'XGigabitEthernet1/1/2',1810 r_name: 'Tatisheva_125_2_5',1811 portSnmpIndex: '17474',1812 },1813 'XGigabitEthernet1/1/2': {1814 r_mac: '803af450f497',1815 r_port: 'XGigabitEthernet1/1/1',1816 r_name: 'Vikulova_28_7',1817 portSnmpIndex: '17475',1818 },1819 },1820 },1821 },1822 {1823 id: 58721,1824 host: '10.220.53.215',1825 lldp: {1826 status: 'fulfilled',1827 value: {1828 'XGigabitEthernet1/1/1': {1829 r_mac: '803af450f48e',1830 r_port: 'XGigabitEthernet1/1/2',1831 r_name: 'Rabochih_11_2',1832 portSnmpIndex: '17474',1833 },1834 'XGigabitEthernet1/1/2': {1835 r_mac: '803af430eb7d',1836 r_port: 'XGigabitEthernet1/1/1',1837 r_name: 'Tatisheva_125_2_2',1838 portSnmpIndex: '17475',1839 },1840 },1841 },1842 },1843 {1844 id: 58720,1845 host: '10.220.53.212',1846 lldp: {1847 status: 'fulfilled',1848 value: {1849 'xgigabitethernet1/1/1': {1850 r_mac: '803af430d553',1851 r_port: 'xgigabitethernet1/1/2',1852 r_name: 'rabochih_9_1',1853 portSnmpIndex: '17474',1854 },1855 'xgigabitethernet1/1/2': {1856 r_mac: '803af430f3d7',1857 r_port: 'xgigabitethernet1/1/1',1858 r_name: 'tatisheva_125_2_5',1859 portSnmpIndex: '17475',1860 },1861 },1862 },1863 },1864 {1865 id: 58719,1866 host: '10.220.53.213',1867 lldp: {1868 status: 'fulfilled',1869 value: {1870 'xgigabitethernet1/1/1': {1871 r_mac: '803af430d3d1',1872 r_port: 'xgigabitethernet1/1/2',1873 r_name: 'rabochih_9_3',1874 portSnmpIndex: '17474',1875 },1876 'xgigabitethernet1/1/2': {1877 r_mac: '803af450f48e',1878 r_port: 'xgigabitethernet1/1/1',1879 r_name: 'rabochih_11_2',1880 portSnmpIndex: '17475',1881 },1882 },1883 },1884 },1885 {1886 id: 58718,1887 host: '10.220.53.214',1888 lldp: {1889 status: 'fulfilled',1890 value: {1891 'XGigabitEthernet1/1/1': {1892 r_mac: '68e209a726b0',1893 r_port: 'XGigabitEthernet0/0/6',1894 r_name: '2.194_AGG_Metallurgov50_sw1',1895 portSnmpIndex: '17474',1896 },1897 'XGigabitEthernet1/1/2': {1898 r_mac: '803af430d553',1899 r_port: 'XGigabitEthernet1/1/1',1900 r_name: 'Rabochih_9_1',1901 portSnmpIndex: '17475',1902 },1903 },1904 },1905 },1906]1907const sfpTest = [1908 {1909 portIndex: 17474,1910 vendor: 'FiberTrade',1911 date: '150929',1912 RX: 0,1913 TX: 0,1914 transceiverType: 'BASE-BX10_SFP',1915 partNum: 'FT-SFP-WDM-1,25-',1916 lengthWave: 1310,1917 distantion: 10000,1918 temperature: 0,1919 voltage: 0,1920 biasCurrent: 0,1921 },1922 {1923 portIndex: 17475,1924 vendor: 'FiberHome',1925 date: '200703',1926 RX: -40,1927 TX: -1.24,1928 transceiverType: '10G Base-LR_SFP',1929 partNum: '5044002-004',1930 lengthWave: 1310,1931 distantion: 10000,1932 temperature: 24,1933 voltage: 3.26,1934 biasCurrent: 39.5,1935 },1936 {1937 portIndex: 17538,1938 vendor: 'FiberHome',1939 date: '200723',1940 RX: -40,1941 TX: -1.05,1942 transceiverType: '10G Base-LR_SFP',1943 partNum: '5044002-008-D',1944 lengthWave: 1270,1945 distantion: 20000,1946 temperature: 33,1947 voltage: 3.17,1948 biasCurrent: 40.2,1949 },1950 {1951 portIndex: 17539,1952 vendor: 'FiberHome',1953 date: '201020',1954 RX: -40,1955 TX: -0.49,1956 transceiverType: '10G Base-LR_SFP',1957 partNum: '5044002-009',1958 lengthWave: 1330,1959 distantion: 20000,1960 temperature: 38,1961 voltage: 3.19,1962 biasCurrent: 30.89,1963 },1964]...

Full Screen

Full Screen

Jitter3DUtils.js

Source:Jitter3DUtils.js Github

copy

Full Screen

1// vector utils: javascript module for doing Jitter 3d stuff2// portions of the following are Copyright SGI -jkc 3/*4 * (c) Copyright 1993, 1994, Silicon Graphics, Inc.5 * ALL RIGHTS RESERVED6 * Permission to use, copy, modify, and distribute this software for7 * any purpose and without fee is hereby granted, provided that the above8 * copyright notice appear in all copies and that both the copyright notice9 * and this permission notice appear in supporting documentation, and that10 * the name of Silicon Graphics, Inc. not be used in advertising11 * or publicity pertaining to distribution of the software without specific,12 * written prior permission.13 *14 * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"15 * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR17 * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON18 * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,19 * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY20 * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,21 * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF22 * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN23 * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON24 * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE25 * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.26 *27 * US Government Users Restricted Rights28 * Use, duplication, or disclosure by the Government is subject to29 * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph30 * (c)(1)(ii) of the Rights in Technical Data and Computer Software31 * clause at DFARS 252.227-7013 and/or in similar or successor32 * clauses in the FAR or the DOD or NASA FAR Supplement.33 * Unpublished-- rights reserved under the copyright laws of the34 * United States. Contractor/manufacturer is Silicon Graphics,35 * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.36 *37 * OpenGL(TM) is a trademark of Silicon Graphics, Inc.38 */39/*40 * Trackball code:41 *42 * Implementation of a virtual trackball.43 * Implemented by Gavin Bell, lots of ideas from Thant Tessman and44 * the August '88 issue of Siggraph's "Computer Graphics," pp. 121-129.45 *46 * Vector manip code:47 *48 * Original code from:49 * David M. Ciemiewicz, Mark Grossman, Henry Moreton, and Paul Haeberli50 *51 * Much mucking with by:52 * Gavin Bell53 */54var Jitter3DUtils = new Jitter3dUtilsInterface();55function Jitter3dUtilsInterface()56{57 // if the ray defined by the line's two points intersects the sphere, 58 // set p1 to the closest point of intersection. 59 //60 // boolean return value61 //62 this.intersect_line_sphere = function (/*t_vec_3d*/ line_a, /*t_vec_3d*/ line_b, /*t_vec_3d*/ center, /*float*/ r, /*t_vec_3d*/ p1)63 {64 var result;65 var EO = new Array();66 var V = new Array(); 67 var v, disc, d, P;68 69 this.vsub(center, line_a, EO);70 this.vsub(line_b, line_a, V);71 this.vnormal(V);72 73 v = this.vdot(EO, V);74 disc = r*r - (this.vdot(EO, EO) - v*v);75 76 if (disc < 0)77 {78 result = false;79 }80 else81 {82 d = Math.sqrt(disc);83 this.vscale(V, v-d);84 this.vadd(V, line_a, p1);85 result = true;86 }87 return result;88 }89 // set p1 to the point on sphere closest to line segment90 //91 // (x3 - x1)(x2 - x1) + (y3 - y1)(y2 - y1) + (z3 - z1)(z2 - z1) 92 // ----------------------------------------------------------- 93 // (x2 - x1)(x2 - x1) + (y2 - y1)(y2 - y1) + (z2 - z1)(z2 - z1) 94 //95 // no return value96 //97 this.closest_line_sphere = function (/*t_vec_3d*/ line_a, /*t_vec_3d*/ line_b, /*t_vec_3d*/ center, /*float*/ r, /*t_vec_3d*/ p1)98 {99 var x1, x2, x3, y1, y2, y3, z1, z2, z3;100 var u;101 var ab = new Array();102 var p = new Array(); 103 104 x1 = line_a[0];105 y1 = line_a[1];106 z1 = line_a[2];107 108 x2 = line_b[0];109 y2 = line_b[1];110 z2 = line_b[2];111 112 x3 = center[0];113 y3 = center[1];114 z3 = center[2];115 116 u = ((x3 - x1)*(x2 - x1) + (y3 - y1)*(y2 - y1) + (z3 - z1)*(z2 - z1))/117 ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1) + (z2 - z1)*(z2 - z1));118 119 this.vsub(line_b, line_a, ab);120 this.vscale(ab, u);121 this.vadd(line_a, ab, p); // p is point on line seg closest to sphere122 123 this.vsub(p, center, p);124 this.vnormal(p);125 this.vscale(p, r);126 this.vadd(p, center, p1);127 }128 // return true if the ray defined by the line's two points intersects the quad. 129 // also sets p2 to the point of intersection with the quad plane in object unit 130 // coords, and p1 to the same point in world coords.131 // Quad is defined by the unit quad transformed by position, rotation, scale.132 //133 this.intersect_line_quad = function (line_a, line_b, pos, rot, scale, p1, p2)134 {135 var result;136 var slope = new Array();137 var z0 = new Array(); // point on ray at at z=0138 var xz0, yz0; // x and y at z=0139 var q = new Array(); 140 var m = new Array(); // rotation matrix141 var d2r = (Math.PI / 180.);142 var result;143 144 var axis = [rot[0], rot[1], rot[2], rot[3]];145 var a = [line_a[0], line_a[1], line_a[2]];146 var b = [line_b[0], line_b[1], line_b[2]];147 // transform to object unit coordinates 148 scale[2] = 1.; // only interested in plane z=0, so set scale[z] to unity;149 this.vsub(a, pos, a);150 this.vsub(b, pos, b);151 // rotate 152 this.axis_to_quat(axis, q); 153 this.build_rotmatrix(m, q);154 this.transform_point(a, m);155 this.transform_point(b, m);156 157 // scale158 this.vdiv(a, scale, a);159 this.vdiv(b, scale, b);160 161 // get line xy at z=0162 this.vsub(a, b, slope);163 this.vscale(slope, 1.0/slope[2]); // dx/dz, dy/dz, 1.164 this.vscale(slope, 0.-a[2]); 165 this.vadd(a, slope, z0);166 167 xz0 = z0[0];168 yz0 = z0[1];169 170 // send useful information even if no intersection171 {172 // set object scale out173 this.vcopy(z0, p2);174 // transform back to world175 this.vmul(z0, scale, z0);176 axis[0] = -axis[0];177 this.axis_to_quat(axis, q); 178 this.build_rotmatrix(m, q);179 this.transform_point(z0, m);180 this.vadd(z0, pos, z0);181 this.vcopy(z0, p1);182 }183 184 result = ((xz0 > 0)&&(xz0 < 1)&&(yz0 > 0)&&(yz0 < 1));185 return result;186 }187 // convert rotation in Euler angles (xyz) to angle/axis rotation.188 this.xyz_to_axis = function (xyz, axis)189 {190 var q1 = new Array();191 var q2 = new Array();192 var q3 = new Array();193 var q4 = new Array();194 var x = xyz[0];195 var y = xyz[1];196 var z = xyz[2];197 198 this.axis_to_quat([x,1.,0.,0.], q1); 199 this.axis_to_quat([y,0.,1.,0.], q2); 200 this.add_quats(q1,q2,q3);201 this.axis_to_quat([z,0.,0.,1.], q2); 202 this.add_quats(q3,q2,q4);203 204 this.quat_to_axis(q4, axis); 205 }206 // convert angle/axis rotation to quaternion.207 this.axis_to_quat = function (axis, quat)208 {209 var d2r = (Math.PI / 180.);210 var phi = axis[0]*d2r;211 var mag;212 var scale;213 mag = Math.sqrt(axis[1]*axis[1] + axis[2]*axis[2] + axis[3]*axis[3]);214 if (mag < 0.0005)215 mag = 1;216 scale = Math.sin(phi/2.0)/mag;217 quat[0] = axis[1]*scale;218 quat[1] = axis[2]*scale;219 quat[2] = axis[3]*scale;220 quat[3] = Math.cos(phi/2.0);221 }222 this.quat_to_axis = function (quat,axis)223 {224 var cos_a, sin_a;225 var r2d = (180. / Math.PI);226 cos_a = quat[3];227 axis[0] = (Math.acos(cos_a) * 2.)*r2d;228 sin_a = Math.sqrt(1.0 - cos_a * cos_a);229 230 if (Math.abs(sin_a) < 0.00005)231 sin_a = 1;232 233 axis[1] = quat[0] / sin_a;234 axis[2] = quat[1] / sin_a;235 axis[3] = quat[2] / sin_a;236 }237 this.add_quats = function (q1,q2,q3)238 {239 var t1 = new Array();240 var t2 = new Array();241 var t3 = new Array();242 var t4 = new Array();243 var tf = new Array();244 this.vcopy(q1,t1);245 this.vscale(t1,q2[3]);246 this.vcopy(q2,t2);247 this.vscale(t2,q1[3]);248 this.vcross(q2,q1,t3);249 this.vadd(t1,t2,tf);250 this.vadd(t3,tf,tf);251 tf[3] = q1[3] * q2[3] - this.vdot(q1,q2);252 q3[0] = tf[0];253 q3[1] = tf[1];254 q3[2] = tf[2];255 q3[3] = tf[3];256 this.normalize_quat(q3);257 }258 this.vzero = function (v)259 {260 v[0] = 0.0;261 v[1] = 0.0;262 v[2] = 0.0;263 }264 265 this.vset = function (v,x,y,z)266 {267 v[0] = x;268 v[1] = y;269 v[2] = z;270 }271 this.vadd = function (src1,src2,dst)272 {273 dst[0] = src1[0] + src2[0];274 dst[1] = src1[1] + src2[1];275 dst[2] = src1[2] + src2[2];276 }277 this.vsub = function (src1,src2,dst)278 {279 dst[0] = src1[0] - src2[0];280 dst[1] = src1[1] - src2[1];281 dst[2] = src1[2] - src2[2];282 }283 this.vmul = function (src1,src2,dst)284 {285 dst[0] = src1[0] * src2[0];286 dst[1] = src1[1] * src2[1];287 dst[2] = src1[2] * src2[2];288 }289 this.vdiv = function (src1,src2,dst)290 {291 dst[0] = src1[0] / src2[0];292 dst[1] = src1[1] / src2[1];293 dst[2] = src1[2] / src2[2];294 }295 this.vcopy = function (v1,v2)296 {297 for (var i=0;i<3;i++)298 v2[i] = v1[i];299 }300 this.vcross = function (v1,v2,cross)301 {302 var temp = new Array();303 temp[0] = (v1[1] * v2[2]) - (v1[2] * v2[1]);304 temp[1] = (v1[2] * v2[0]) - (v1[0] * v2[2]);305 temp[2] = (v1[0] * v2[1]) - (v1[1] * v2[0]);306 this.vcopy(temp, cross);307 }308 this.vlength = function (v)309 {310 return Math.sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);311 }312 // cheaper distance-squared function313 this.vlength2 = function (v)314 {315 return v[0]*v[0] + v[1]*v[1] + v[2]*v[2];316 }317 this.vscale = function (v,div)318 {319 v[0] *= div;320 v[1] *= div;321 v[2] *= div;322 }323 this.vnormal = function (v)324 {325 var len = this.vlength(v);326 327 if (len>0.00005)328 this.vscale(v,1.0/len);329 }330 this.vdot = function (v1,v2)331 {332 return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];333 }334 this.normalize_quat = function (q)335 {336 var mag = (q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3]);337 if (mag>0.00005) {338 mag = 1./mag;339 for (var i=0;i<4;i++)340 q[i] *= mag;341 }342 }343 // build rotation matrix m for the quaternion q.344 this.build_rotmatrix = function(m, q)345 {346 m[0] = 1.0 - 2.0 * (q[1] * q[1] + q[2] * q[2]);347 m[1] = 2.0 * (q[0] * q[1] - q[2] * q[3]);348 m[2] = 2.0 * (q[2] * q[0] + q[1] * q[3]);349 m[3] = 0.0;350 351 m[4] = 2.0 * (q[0] * q[1] + q[2] * q[3]);352 m[5] = 1.0 - 2.0 * (q[2] * q[2] + q[0] * q[0]);353 m[6] = 2.0 * (q[1] * q[2] - q[0] * q[3]);354 m[7] = 0.0;355 356 m[8] = 2.0 * (q[2] * q[0] - q[1] * q[3]);357 m[9] = 2.0 * (q[1] * q[2] + q[0] * q[3]);358 m[10] = 1.0 - 2.0 * (q[1] * q[1] + q[0] * q[0]);359 m[11] = 0.0;360 361 m[12] = 0.0;362 m[13] = 0.0;363 m[14] = 0.0;364 m[15] = 1.0;365 }366 367 this.transform_point = function(p_in, m)368 {369 var a, b, c, d;370 371 // not really homogeneous coords372 p_in[3] = 1;373 a = m[0] * p_in[0] + m[4] * p_in[1] + m[8] * p_in[2] + m[12] * p_in[3];374 b = m[1] * p_in[0] + m[5] * p_in[1] + m[9] * p_in[2] + m[13] * p_in[3];375 c = m[2] * p_in[0] + m[6] * p_in[1] + m[10] * p_in[2] + m[14] * p_in[3];376 d = m[3] * p_in[0] + m[7] * p_in[1] + m[11] * p_in[2] + m[15] * p_in[3];377 p_in[0] = a;378 p_in[1] = b;379 p_in[2] = c;380 p_in[3] = d;381 }...

Full Screen

Full Screen

predicate2v1.test.js

Source:predicate2v1.test.js Github

copy

Full Screen

1/* eslint-env mocha */2const assert = require('assert');3const predicate2v1 = require('./predicate2v1');4describe('Array', function () {5 describe('#predicate2v1()', function () {6 it('should strip pointless nesting', function () {7 const p_in = {8 "type": "and",9 "predicates": [10 {11 "type": "in",12 "key": "issue",13 "values": [14 "ZERO_COORDINATE"15 ]16 }17 ]18 };19 const p_expected = {20 "err": null,21 "predicate": {22 "type": "in",23 "key": "ISSUE",24 "values": [25 "ZERO_COORDINATE"26 ]27 }28 };29 predicate2v1();30 assert.deepEqual(predicate2v1(p_in), p_expected);31 });32 });33});34describe('Array', function () {35 describe('#predicate2v1()', function () {36 it('should handle not', function () {37 const p_in = {38 "type": "not",39 "predicate": {40 "type": "in",41 "key": "issue",42 "values": [43 "ZERO_COORDINATE"44 ]45 }46 }47 const p_expected = {48 err: null,49 predicate: {50 "type": "not",51 "predicate": {52 "type": "in",53 "key": "ISSUE",54 "values": [55 "ZERO_COORDINATE"56 ]57 }58 }59 };60 predicate2v1();61 assert.deepEqual(predicate2v1(p_in), p_expected);62 });63 });64});65describe('Array', function () {66 describe('#predicate2v1()', function () {67 it('should convert range types to an AND predicate', function () {68 const p_in = {69 "type": "range",70 "key": "year",71 "value": {72 gte: 1900,73 lte: 200074 }75 };76 const p_expected = {77 err: null,78 predicate: {79 "type": "and",80 "predicates": [81 {82 "type": "greaterThanOrEquals",83 "key": "YEAR",84 "value": 190085 },86 {87 "type": "lessThanOrEquals",88 "key": "YEAR",89 "value": 200090 },91 ]92 }93 };94 predicate2v1();95 assert.deepEqual(predicate2v1(p_in), p_expected);96 });97 });98});99describe('Array', function () {100 describe('#predicate2v1()', function () {101 it('should rename keys to CONSTANT_CASE', function () {102 const p_in = {103 "type": "equals",104 "key": "year",105 "value": "1900"106 };107 const p_expected = {108 err: null,109 predicate: {110 "type": "equals",111 "key": "YEAR",112 "value": "1900"113 }114 };115 predicate2v1();116 assert.deepEqual(predicate2v1(p_in), p_expected);117 });118 });119});120describe('Array', function () {121 describe('#predicate2v1()', function () {122 it('should refactor isNotNull predicates', function () {123 const p_in = {124 "type": "isNotNull",125 "key": "year"126 };127 const p_expected = {128 err: null,129 predicate: {130 "type": "isNotNull",131 "parameter": "YEAR"132 }133 };134 predicate2v1();135 assert.deepEqual(predicate2v1(p_in), p_expected);136 });137 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 }, function(err, data) {4 if (err) return console.error(err);5 console.log(data);6 wpt.getTestResults(data.data.testId, function(err, data) {7 if (err) return console.error(err);8 console.log(data);9 });10 });11{ statusCode: 400,12 { statusCode: 400,13 pollResults: 5 } }14{ statusCode: 400,15 { statusCode: 400,

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2console.log(result);3});4var wpt = require('wpt');5console.log(result);6});7var wpt = require('wpt');8console.log(result);9});10var wpt = require('wpt');11console.log(result);12});13var wpt = require('wpt');14console.log(result);15});16var wpt = require('wpt');17console.log(result);18});19var wpt = require('wpt');20console.log(result);21});22var wpt = require('wpt');23console.log(result);24});25var wpt = require('wpt');26console.log(result);27});28var wpt = require('wpt');29console.log(result);30});31var wpt = require('wpt');32console.log(result);33});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3var wpt = new WebPageTest('www.webpagetest.org', 'A.1234567890abcdef1234567890abcdef');4var wpt = new WebPageTest('www.webpagetest.org', 'A.1234567890abcdef1234567890abcdef', {protocol: 'https'});5var wpt = new WebPageTest('www.webpagetest.org', 'A.1234567890abcdef1234567890abcdef', {protocol: 'https', port: 443});6var wpt = new WebPageTest('www.webpagetest.org', 'A.1234567890abcdef1234567890abcdef', {protocol: 'https', port: 443, timeout: 300000});7 if (err) return console.error(err);8 console.log(data);9 wpt.getTestResults(data.data.testId, function(err, data) {10 if (err) return console.error(err);11 console.log(data);12 });13});14 if (err) return console.error(err);15 console.log(data);16 wpt.getTestResults(data.data.testId, function(err, data) {17 if (err) return console.error(err);18 console.log(data);19 });20});21 if (err) return console.error(err);22 console.log(data);23 wpt.getTestResults(data.data.testId, function(err, data) {24 if (err) return console.error(err);25 console.log(data);26 });27});28 if (err) return console.error(err);29 console.log(data);30 wpt.getTestResults(data.data.testId, function(err, data) {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require("wpt");2var obj = new wpt();3obj.p_in("test", function(err, data) {4 console.log("error: " + err);5 console.log("data: " + data);6});7var wpt = require("wpt");8var obj = new wpt();9obj.p_out("test", function(err, data) {10 console.log("error: " + err);11 console.log("data: " + data);12});13var wpt = require("wpt");14var obj = new wpt();15obj.p_err("test", function(err, data) {16 console.log("error: " + err);17 console.log("data: " + data);18});19var wpt = require("wpt");20var obj = new wpt();21obj.p_in("test", function(err, data) {22 console.log("error: " + err);23 console.log("data: " + data);24});25var wpt = require("wpt");26var obj = new wpt();27obj.p_out("test", function(err, data) {28 console.log("error: " + err);29 console.log("data: " + data);30});31var wpt = require("wpt");32var obj = new wpt();33obj.p_err("test", function(err, data) {34 console.log("error: " + err);35 console.log("data: " + data

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt');2var wpt = new wpt();3 console.log(data);4});5var wpt = require('./wpt');6var wpt = new wpt();7 console.log(data);8});9{ [Error: connect ECONNREFUSED] code: 'ECONNREFUSED', errno: 'ECONNREFUSED', syscall: 'connect' }

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wpt = new wpt('API_KEY');3var wpt = require('wpt');4var wpt = new wpt('API_KEY');5 if(err){6 console.log(err);7 }else{8 console.log(data);9 }10});11var wpt = require('wpt');12var wpt = new wpt('API_KEY');13 if(err){14 console.log(err);15 }else{16 console.log(data);17 }18}, 'xml');19var wpt = require('wpt');20var wpt = new wpt('API_KEY');21 if(err){22 console.log(err);23 }else{24 console.log(data);25 }26var wpt = require('wpt');27var wpt = new wpt('API_KEY');28 if(err){29 console.log(err);30 }else{31 console.log(data);32 }33var wpt = require('wpt');34var wpt = new wpt('API_KEY');35 if(err

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful