PCDLoader.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>PCDLoader - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="Loader.html">Loader</a> → </p>
  13. <h1 translate="no">PCDLoader</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A loader for the Point Cloud Data (PCD) format.</p>
  17. <p>PCDLoader supports ASCII and (compressed) binary files as well as the following PCD fields:</p>
  18. <ul>
  19. <li>x y z</li>
  20. <li>rgb</li>
  21. <li>normal_x normal_y normal_z</li>
  22. <li>intensity</li>
  23. <li>label</li>
  24. </ul></div>
  25. <h2>Code Example</h2>
  26. <div translate="no"><pre><code class="language-js">const loader = new PCDLoader();
  27. const points = await loader.loadAsync( './models/pcd/binary/Zaghetto.pcd' );
  28. points.geometry.center(); // optional
  29. points.geometry.rotateX( Math.PI ); // optional
  30. scene.add( points );
  31. </code></pre></div>
  32. </header>
  33. <article>
  34. <h2 class="subsection-title">Import</h2>
  35. <p><span translate="no">PCDLoader</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  36. <pre><code class="language-js">import { PCDLoader } from 'three/addons/loaders/PCDLoader.js';</code></pre>
  37. <div class="container-overview">
  38. <h2>Constructor</h2>
  39. <h3 class="name name-method" id="PCDLoader" translate="no">new <a href="#PCDLoader">PCDLoader</a><span class="signature">( manager : <span class="param-type">LoadingManager</span> )</span> </h3>
  40. <div class="method">
  41. <div class="description">
  42. <p>Constructs a new PCD loader.</p>
  43. </div>
  44. <table class="params">
  45. <tbody>
  46. <tr>
  47. <td class="name"><code>manager</code></td>
  48. <td class="description last"><p>The loading manager.</p></td>
  49. </tr>
  50. </tbody>
  51. </table>
  52. </div>
  53. </div>
  54. <h2 class="subsection-title">Properties</h2>
  55. <div class="member">
  56. <h3 class="name" id="littleEndian" translate="no">.<a href="#littleEndian">littleEndian</a><span class="type-signature"> : boolean</span> </h3>
  57. <div class="description">
  58. <p>Whether to use little Endian or not.<br/>Default is <code>true</code>.</p>
  59. </div>
  60. </div>
  61. <h2 class="subsection-title">Methods</h2>
  62. <h3 class="name name-method" id="_getDataView" translate="no">.<a href="#_getDataView">_getDataView</a><span class="signature">( dataview : <span class="param-type">DataView</span>, offset : <span class="param-type">number</span>, type : <span class="param-type">'F' | 'U' | 'I'</span>, size : <span class="param-type">number</span> )</span><span class="type-signature"> : number</span> </h3>
  63. <div class="method">
  64. <div class="description">
  65. <p>Get dataview value by field type and size.</p>
  66. </div>
  67. <table class="params">
  68. <tbody>
  69. <tr>
  70. <td class="name"><code>dataview</code></td>
  71. <td class="description last"><p>The DataView to read from.</p></td>
  72. </tr>
  73. <tr>
  74. <td class="name"><code>offset</code></td>
  75. <td class="description last"><p>The offset to start reading from.</p></td>
  76. </tr>
  77. <tr>
  78. <td class="name"><code>type</code></td>
  79. <td class="description last"><p>Field type.</p></td>
  80. </tr>
  81. <tr>
  82. <td class="name"><code>size</code></td>
  83. <td class="description last"><p>Field size.</p></td>
  84. </tr>
  85. </tbody>
  86. </table>
  87. <dl class="details">
  88. <dt class="tag-returns"><strong>Returns:</strong> Field value.</dt>
  89. </dl>
  90. </div>
  91. <h3 class="name name-method" id="load" translate="no">.<a href="#load">load</a><span class="signature">( url : <span class="param-type">string</span>, onLoad : <span class="param-type">function</span>, onProgress : <span class="param-type">onProgressCallback</span>, onError : <span class="param-type">onErrorCallback</span> )</span> </h3>
  92. <div class="method">
  93. <div class="description">
  94. <p>Starts loading from the given URL and passes the loaded PCD asset
  95. to the <code>onLoad()</code> callback.</p>
  96. </div>
  97. <table class="params">
  98. <tbody>
  99. <tr>
  100. <td class="name"><code>url</code></td>
  101. <td class="description last"><p>The path/URL of the file to be loaded. This can also be a data URI.</p></td>
  102. </tr>
  103. <tr>
  104. <td class="name"><code>onLoad</code></td>
  105. <td class="description last"><p>Executed when the loading process has been finished.</p></td>
  106. </tr>
  107. <tr>
  108. <td class="name"><code>onProgress</code></td>
  109. <td class="description last"><p>Executed while the loading is in progress.</p></td>
  110. </tr>
  111. <tr>
  112. <td class="name"><code>onError</code></td>
  113. <td class="description last"><p>Executed when errors occur.</p></td>
  114. </tr>
  115. </tbody>
  116. </table>
  117. <dl class="details">
  118. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#load">Loader#load</a></dt>
  119. </dl>
  120. </div>
  121. <h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( data : <span class="param-type">ArrayBuffer</span> )</span><span class="type-signature"> : <a href="Points.html">Points</a></span> </h3>
  122. <div class="method">
  123. <div class="description">
  124. <p>Parses the given PCD data and returns a point cloud.</p>
  125. </div>
  126. <table class="params">
  127. <tbody>
  128. <tr>
  129. <td class="name"><code>data</code></td>
  130. <td class="description last"><p>The raw PCD data as an array buffer.</p></td>
  131. </tr>
  132. </tbody>
  133. </table>
  134. <dl class="details">
  135. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#parse">Loader#parse</a></dt>
  136. </dl>
  137. <dl class="details">
  138. <dt class="tag-returns"><strong>Returns:</strong> The parsed point cloud.</dt>
  139. </dl>
  140. </div>
  141. <h2 class="subsection-title">Source</h2>
  142. <p>
  143. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PCDLoader.js" target="_blank" rel="noopener" translate="no">examples/jsm/loaders/PCDLoader.js</a>
  144. </p>
  145. </article>
  146. </section>
  147. <script src="../scripts/linenumber.js"></script>
  148. <script src="../scripts/page.js"></script>
  149. </body>
  150. </html>
粤ICP备19079148号