TorusKnotGeometry.html 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:BufferGeometry] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. Creates a torus knot, the particular shape of which is defined by a pair
  14. of coprime integers, p and q. If p and q are not coprime, the result will
  15. be a torus link.
  16. </p>
  17. <iframe
  18. id="scene"
  19. src="scenes/geometry-browser.html#TorusKnotGeometry"
  20. ></iframe>
  21. <script>
  22. // iOS iframe auto-resize workaround
  23. if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
  24. const scene = document.getElementById( 'scene' );
  25. scene.style.width = getComputedStyle( scene ).width;
  26. scene.style.height = getComputedStyle( scene ).height;
  27. scene.setAttribute( 'scrolling', 'no' );
  28. }
  29. </script>
  30. <h2>Code Example</h2>
  31. <code>
  32. const geometry = new THREE.TorusKnotGeometry( 10, 3, 100, 16 );
  33. const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
  34. const torusKnot = new THREE.Mesh( geometry, material );
  35. scene.add( torusKnot );
  36. </code>
  37. <h2>Constructor</h2>
  38. <h3>
  39. [name]([param:Float radius], [param:Float tube], [param:Integer tubularSegments], [param:Integer radialSegments], [param:Integer p],
  40. [param:Integer q])
  41. </h3>
  42. <ul>
  43. <li>radius - Radius of the torus. Default is `1`.</li>
  44. <li>tube — Radius of the tube. Default is `0.4`.</li>
  45. <li>tubularSegments — Default is `64`.</li>
  46. <li>radialSegments — Default is `8`.</li>
  47. <li>
  48. p — This value determines, how many times the geometry winds around its
  49. axis of rotational symmetry. Default is `2`.
  50. </li>
  51. <li>
  52. q — This value determines, how many times the geometry winds around a
  53. circle in the interior of the torus. Default is `3`.
  54. </li>
  55. </ul>
  56. <h2>Properties</h2>
  57. <p>See the base [page:BufferGeometry] class for common properties.</p>
  58. <h3>[property:Object parameters]</h3>
  59. <p>
  60. An object with a property for each of the constructor parameters. Any
  61. modification after instantiation does not change the geometry.
  62. </p>
  63. <h2>Methods</h2>
  64. <p>See the base [page:BufferGeometry] class for common methods.</p>
  65. <h2>Source</h2>
  66. <p>
  67. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  68. </p>
  69. </body>
  70. </html>
粤ICP备19079148号