TorusKnotGeometry.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 ); scene.add( torusKnot );
  35. </code>
  36. <h2>Constructor</h2>
  37. <h3>
  38. [name]([param:Float radius], [param:Float tube], [param:Integer tubularSegments], [param:Integer radialSegments], [param:Integer p],
  39. [param:Integer q])
  40. </h3>
  41. <ul>
  42. <li>radius - Radius of the torus. Default is `1`.</li>
  43. <li>tube — Radius of the tube. Default is `0.4`.</li>
  44. <li>tubularSegments — Default is `64`.</li>
  45. <li>radialSegments — Default is `8`.</li>
  46. <li>
  47. p — This value determines, how many times the geometry winds around its
  48. axis of rotational symmetry. Default is `2`.
  49. </li>
  50. <li>
  51. q — This value determines, how many times the geometry winds around a
  52. circle in the interior of the torus. Default is `3`.
  53. </li>
  54. </ul>
  55. <h2>Properties</h2>
  56. <p>See the base [page:BufferGeometry] class for common properties.</p>
  57. <h3>[property:Object parameters]</h3>
  58. <p>
  59. An object with a property for each of the constructor parameters. Any
  60. modification after instantiation does not change the geometry.
  61. </p>
  62. <h2>Methods</h2>
  63. <p>See the base [page:BufferGeometry] class for common methods.</p>
  64. <h2>Source</h2>
  65. <p>
  66. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  67. </p>
  68. </body>
  69. </html>