TorusKnotGeometry.html 2.3 KB

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