如何获取光纤对象记录坐标并显示为文本

时间:2014-02-24 13:47:58

标签: javascript webgl xtk

我有2个文件,“Tracts_1.trk”和“Tracts_1.txt”。

根据XTK库API,它只接受二进制格式文件“Tracts_1.trk”。

我知道「Tracts_1.trk」里面记录文件坐标。

如何获取光纤对象中的坐标并显示为文本,就像「Tracts_1.txt」一样?

我找不到任何属性或方法可以得到它,请帮助我。

我的文件夹:https://googledrive.com/host/0B7yrjtQvNRwocGV5Tzl6aHBMbTQ/

PS。以下是内容:

「Tracts_1.trk」:TRACKO_E @@@ LPSLPS ??èJqWXB¶¤-BUB÷©[BI /BýBRò^ B [1B¹PB=bBò3B; BEB *f4BijBÄêhB5BAB 4lBÆ´6BCÄB^zoB¿Ì7BpÁBÁrBuß8B!¾BüvBß9B{¹B- YB:Bs²Bº|B¾f ; B2©B和 BKó; B>BEÍB(gBUÕ¿BBB:¿BN¯B½B¤¾B'ÒBQúBÜæ½B-íB-B.½BøBsBBo¼BüB®jB媻BøBÈ{BàºBý÷BéBÛºBE Bª¤B@:¹BW9BÉB_¸B}BøBQ·B¶ýA1B¶B¹øAnB©μBWóAûª¡B''B,`îAJè¢BÑß³BF2éAA&¤Bû²BíäAñc¥B [²BYßAâ|ÖB°BMÚA«Ô§BÕ¯Bø¸ÕA©B

「Tracts_1.txt」:27.0427 21.7054 34.6493 27.458 21.9389 34.4976 27.8683 22.1695 34.3288 28.2801 22.3784 34.1369 28.6995 22.5499 33.9256 29.1146 22.6982 33.6897 29.5256 22.8383 33.4417 29.9347 22.975 33.1889 30.3445 23.1091 32.9357 30.7563 23.2339 32.6811 31.172 23.3401 32.4243 31.5911 23.4252 32.1652 32.0128 23.4938 31.9056 32.4505 23.5504 31.6704 32.9026 23.5942 31.4616 33.3617 23.6299 31.2668 33.825 23.6596 31.0809 34.2947 23.6797 30.9107 34.7727 23.6885 30.7644 35.2589 23.6863 30.6478 35.7514 23.6751 30.5625 36.2485 23.6643 30.5097 36.7482 23.6608 30.492 37.2482 23.6608 30.492 37.7482 23.6608 30.492 38.2482 23.6608 30.492 38.7482 23.6608 30.492 39.2479 23.6508 30.5066 39.745 23.6205 30.5504 40.2387 23.5895 30.6233 40.7281 23.5785 30.7253 41.2138 23.5777 30.8441 41.6995 23.5771 30.9627 42.1829 23.5697 31.0904 42.658 23.5429 31.2439 43.1223 23.4993 31.4242 43.5719 23.4442 31.6359 44.0053 23.3786 31.8764 44.4387 23.313 32.1169 44.8721 23.2474 32.3575 45.3055 23.1818 32.598 45.73 9 23.1162 32.8385 46.169 23.0409 33.0822 46.5873 22.948 33.3398 46.9918 22.8516 33.6175 47.398 22.747 33.8897 47.7997 22.6141 34.156 48.1472 22.4109 34.4527 48.3627 22.1129 34.7914 48.4428 21.7596 35.1361 48.4213 21.3814 35.4624 48.3381 20.9921 35.765 48.2274 20.6003 36.0551 48.0928 20.2152 36.3443 47.9583 19.8301 36.6334 47.8074 19.4606 36.9346 47.6461 19.1029 37.2444 47.4754 18.7408 37.5441 47.295 18.3713 37.8286 47.1088 17.9981 38.1042 46.9169 17.6211 38.3709 46.7188 17.2461 38.6357 46.5155 16.8815 38.9108 46.3069 16.528 39.1964 46.0931 16.1863 39.4923 45.8743 15.8571 39.7984 45.6465 15.5373 40.108 45.415 15.2196 40.417 45.1895 14.8985 40.7268 44.9686 14.5748 41.0374 44.7457 14.2522 41.3476 44.5052 13.9398 41.6552 44.239 13.6438 41.9577 43.9586 13.3577 42.2568 < / p>

1 个答案:

答案 0 :(得分:1)

我不确定你想要做什么。

对于道中的每个点,您想将其坐标显示为标题吗?

目前不支持。

解决方法是绕过你道路上的所有点,并为每个点创建一个带有相应标题的球体。

http://jsfiddle.net/HZ38F/

  for ( var j = 0; j < numberOfPoints - 1; j++) {
    var currentPoint = fibers.points.get(j);
    var currentColor = fibers.colors.get(j);

    var newSphere = new X.sphere();
    newSphere.center = [currentPoint[0], currentPoint[1], currentPoint[2]];
    newSphere.color = [currentColor[0], currentColor[1], currentColor[2]];
    newSphere.radius = .1;
    newSphere.caption = 'x:  '+String(currentPoint[0])+'<br>y: '+String(currentPoint[1])+'<br>z: '+String(currentPoint[2]);
    r.add(newSphere);
}