TubeGeometry.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <!DOCTYPE html>
  2. <html lang="ar">
  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 class="rtl">
  10. [page:BufferGeometry] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">ينشئ أنبوبًا يُبثق على طول منحنى ثلاثي الأبعاد.</p>
  13. <iframe id="scene" src="scenes/geometry-browser.html#TubeGeometry"></iframe>
  14. <script>
  15. // iOS iframe auto-resize workaround
  16. if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
  17. const scene = document.getElementById( 'scene' );
  18. scene.style.width = getComputedStyle( scene ).width;
  19. scene.style.height = getComputedStyle( scene ).height;
  20. scene.setAttribute( 'scrolling', 'no' );
  21. }
  22. </script>
  23. <h2>مثال الكود</h2>
  24. <code>
  25. class CustomSinCurve extends THREE.Curve {
  26. constructor( scale = 1 ) {
  27. super();
  28. this.scale = scale;
  29. }
  30. getPoint( t, optionalTarget = new THREE.Vector3() ) {
  31. const tx = t * 3 - 1.5;
  32. const ty = Math.sin( 2 * Math.PI * t );
  33. const tz = 0;
  34. return optionalTarget.set( tx, ty, tz ).multiplyScalar( this.scale );
  35. }
  36. }
  37. const path = new CustomSinCurve( 10 );
  38. const geometry = new THREE.TubeGeometry( path, 20, 2, 8, false );
  39. const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
  40. const mesh = new THREE.Mesh( geometry, material );
  41. scene.add( mesh );
  42. </code>
  43. <h2>المنشئ (Constructor)</h2>
  44. <h3>
  45. [name]([param:Curve path], [param:Integer tubularSegments], [param:Float radius], [param:Integer radialSegments], [param:Boolean closed])
  46. </h3>
  47. <p>
  48. path — [page:Curve] - مسار ثلاثي الأبعاد يرث من فئة [page:Curve] الأساسية
  49. . الافتراضي هو منحنى بيزير رباعي.<br />
  50. tubularSegments — [page:Integer] - عدد القطاعات التي تشكل
  51. الأنبوب. الافتراضي هو `64`.<br />
  52. radius — [page:Float] - نصف قطر الأنبوب. الافتراضي هو `1`.<br />
  53. radialSegments — [page:Integer] - عدد القطاعات التي تشكل
  54. المقطع العرضي. الافتراضي هو `8`.<br />
  55. closed — [page:Boolean] هل الأنبوب مفتوح أم مغلق. الافتراضي هو `false`.<br />
  56. </p>
  57. <h2>الخصائص (Properties)</h2>
  58. <p>انظر فئة [page:BufferGeometry] الأساسية للخصائص المشتركة.</p>
  59. <h3>[property:Object parameters]</h3>
  60. <p>
  61. كائن به خاصية لكل من معلمات المُنشئ. أي تعديل بعد التجسيد لا يغير الهندسة.
  62. </p>
  63. <h3>[property:Array tangents]</h3>
  64. <p>مصفوفة من المماسات [page:Vector3]</p>
  65. <h3>[property:Array normals]</h3>
  66. <p>مصفوفة من المعايير [page:Vector3]</p>
  67. <h3>[property:Array binormals]</h3>
  68. <p>مصفوفة من المعايير المزدوجة [page:Vector3]</p>
  69. <h2>الطرق (Methods)</h2>
  70. <p>انظر فئة [page:BufferGeometry] الأساسية للطرق المشتركة.</p>
  71. <h2>المصدر (Source)</h2>
  72. <p>
  73. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  74. </p>
  75. </body>
  76. </html>