[page:Curve] →

[name]

قم بإنشاء منحنى شريط 3d ناعم من سلسلة من النقاط باستخدام [link:https://en.wikipedia.org/wiki/Centripetal_Catmull-Rom_spline Catmull-Rom] خوارزمية.

مثال الكود

// إنشاء حلقة مغلقة متموجة const curve = new THREE.CatmullRomCurve3( [ new THREE.Vector3( -10, 0, 10 ), new THREE.Vector3( -5, 5, 5 ), new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 5, -5, 5 ), new THREE.Vector3( 10, 0, 10 ) ] ); const points = curve.getPoints( 50 ); const geometry = new THREE.BufferGeometry().setFromPoints( points ); const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); // إنشاء الكائن النهائي لإضافته إلى المشهد const curveObject = new THREE.Line( geometry, material );

أمثلة (Examples)

[example:webgl_geometry_extrude_splines WebGL / geometry / extrude / splines]

المنشئ (Constructor)

[name]( [param:Array points], [param:Boolean closed], [param:String curveType], [param:Float tension] )

points – مصفوفة من نقاط [page:Vector3]
closed – ما إذا كان المنحنى مغلقًا. الافتراضي هو `false`.
curveType – نوع المنحنى. الافتراضي هو `centripetal`.
tension – توتر المنحنى. الافتراضي هو `0.5`.

الخصائص (Properties)

راجع فئة [page:Curve] الأساسية للحصول على الخصائص المشتركة.

[property:Array points]

مصفوفة من نقاط [page:Vector3] التي تحدد المنحنى. يحتاج على الأقل إلى دخولين.

[property:Boolean closed]

سيعود المنحنى إلى نفسه عندما يكون هذا صحيحًا.

[property:String curveType]

القيم الممكنة هي `centripetal` و `chordal` و `catmullrom`.

[property:Float tension]

عندما يكون [page:.curveType] هو `catmullrom` ، يعرف توتر catmullrom.

الوظائف (Methods)

راجع فئة [page:Curve] الأساسية للحصول على طرق مشتركة.

المصدر (Source)

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]