mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
538 lines
22 KiB
ReStructuredText
538 lines
22 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. _class_Line2D:
|
|
|
|
Line2D
|
|
======
|
|
|
|
**繼承:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
|
|
|
可以選擇紋理的 2D 折線。
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
說明
|
|
----
|
|
|
|
該節點繪製一條 2D 折線,即由線段連接的多個點組成的形狀。\ **Line2D** 不是數學折線,即線段不是無限細的。它的目的是算繪,它可以著色,也可以選擇紋理。
|
|
|
|
\ **警告:**\ 某些配置可能無法很好地繪製,例如非常銳利的角度。在這些情況下,節點使用後備繪製邏輯來看起來不錯。
|
|
|
|
\ **注意:** **Line2D** 使用 2D 網格繪製。
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
教學
|
|
----
|
|
|
|
- `矩陣變換示範 <https://godotengine.org/asset-library/asset/2787>`__
|
|
|
|
- `2.5D 遊戲示範 <https://godotengine.org/asset-library/asset/2783>`__
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
屬性
|
|
----
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`antialiased<class_Line2D_property_antialiased>` | ``false`` |
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
| :ref:`LineCapMode<enum_Line2D_LineCapMode>` | :ref:`begin_cap_mode<class_Line2D_property_begin_cap_mode>` | ``0`` |
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`closed<class_Line2D_property_closed>` | ``false`` |
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
| :ref:`Color<class_Color>` | :ref:`default_color<class_Line2D_property_default_color>` | ``Color(1, 1, 1, 1)`` |
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
| :ref:`LineCapMode<enum_Line2D_LineCapMode>` | :ref:`end_cap_mode<class_Line2D_property_end_cap_mode>` | ``0`` |
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
| :ref:`Gradient<class_Gradient>` | :ref:`gradient<class_Line2D_property_gradient>` | |
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
| :ref:`LineJointMode<enum_Line2D_LineJointMode>` | :ref:`joint_mode<class_Line2D_property_joint_mode>` | ``0`` |
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
| :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`points<class_Line2D_property_points>` | ``PackedVector2Array()`` |
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
| :ref:`int<class_int>` | :ref:`round_precision<class_Line2D_property_round_precision>` | ``8`` |
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
| :ref:`float<class_float>` | :ref:`sharp_limit<class_Line2D_property_sharp_limit>` | ``2.0`` |
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
| :ref:`Texture2D<class_Texture2D>` | :ref:`texture<class_Line2D_property_texture>` | |
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
| :ref:`LineTextureMode<enum_Line2D_LineTextureMode>` | :ref:`texture_mode<class_Line2D_property_texture_mode>` | ``0`` |
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
| :ref:`float<class_float>` | :ref:`width<class_Line2D_property_width>` | ``10.0`` |
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
| :ref:`Curve<class_Curve>` | :ref:`width_curve<class_Line2D_property_width_curve>` | |
|
|
+-----------------------------------------------------+---------------------------------------------------------------+--------------------------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
方法
|
|
----
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`add_point<class_Line2D_method_add_point>`\ (\ position\: :ref:`Vector2<class_Vector2>`, index\: :ref:`int<class_int>` = -1\ ) |
|
|
+-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`clear_points<class_Line2D_method_clear_points>`\ (\ ) |
|
|
+-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_point_count<class_Line2D_method_get_point_count>`\ (\ ) |const| |
|
|
+-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_Vector2>` | :ref:`get_point_position<class_Line2D_method_get_point_position>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
|
|
+-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`remove_point<class_Line2D_method_remove_point>`\ (\ index\: :ref:`int<class_int>`\ ) |
|
|
+-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_point_position<class_Line2D_method_set_point_position>`\ (\ index\: :ref:`int<class_int>`, position\: :ref:`Vector2<class_Vector2>`\ ) |
|
|
+-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
列舉
|
|
----
|
|
|
|
.. _enum_Line2D_LineJointMode:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
enum **LineJointMode**: :ref:`🔗<enum_Line2D_LineJointMode>`
|
|
|
|
.. _class_Line2D_constant_LINE_JOINT_SHARP:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`LineJointMode<enum_Line2D_LineJointMode>` **LINE_JOINT_SHARP** = ``0``
|
|
|
|
使折線的關節成為尖頭,透過延伸兩個線段的側面直到它們相交來連接它們。如果關節的旋轉太大(基於\ :ref:`sharp_limit<class_Line2D_property_sharp_limit>`\ ),則關節回落到\ :ref:`LINE_JOINT_BEVEL<class_Line2D_constant_LINE_JOINT_BEVEL>` 以防止過長的斜接。
|
|
|
|
.. _class_Line2D_constant_LINE_JOINT_BEVEL:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`LineJointMode<enum_Line2D_LineJointMode>` **LINE_JOINT_BEVEL** = ``1``
|
|
|
|
使多段線的接頭傾斜/倒角,用一條簡單的線連接兩個線段的側面。
|
|
|
|
.. _class_Line2D_constant_LINE_JOINT_ROUND:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`LineJointMode<enum_Line2D_LineJointMode>` **LINE_JOINT_ROUND** = ``2``
|
|
|
|
使折線的關節變圓,用圓弧連接兩個線段的側面。此圓弧的細部取決於\ :ref:`round_precision<class_Line2D_property_round_precision>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _enum_Line2D_LineCapMode:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
enum **LineCapMode**: :ref:`🔗<enum_Line2D_LineCapMode>`
|
|
|
|
.. _class_Line2D_constant_LINE_CAP_NONE:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`LineCapMode<enum_Line2D_LineCapMode>` **LINE_CAP_NONE** = ``0``
|
|
|
|
不繪製線條的端點。
|
|
|
|
.. _class_Line2D_constant_LINE_CAP_BOX:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`LineCapMode<enum_Line2D_LineCapMode>` **LINE_CAP_BOX** = ``1``
|
|
|
|
將線帽繪製為盒子,稍微延伸第一個/最後一個線段。
|
|
|
|
.. _class_Line2D_constant_LINE_CAP_ROUND:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`LineCapMode<enum_Line2D_LineCapMode>` **LINE_CAP_ROUND** = ``2``
|
|
|
|
將線條端點繪製為圓形。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _enum_Line2D_LineTextureMode:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
enum **LineTextureMode**: :ref:`🔗<enum_Line2D_LineTextureMode>`
|
|
|
|
.. _class_Line2D_constant_LINE_TEXTURE_NONE:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`LineTextureMode<enum_Line2D_LineTextureMode>` **LINE_TEXTURE_NONE** = ``0``
|
|
|
|
獲取紋理的左側圖元並在整個線條上算繪它。
|
|
|
|
.. _class_Line2D_constant_LINE_TEXTURE_TILE:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`LineTextureMode<enum_Line2D_LineTextureMode>` **LINE_TEXTURE_TILE** = ``1``
|
|
|
|
將紋理平鋪在該線條上。該 **Line2D** 節點的 :ref:`CanvasItem.texture_repeat<class_CanvasItem_property_texture_repeat>` 必須為 :ref:`CanvasItem.TEXTURE_REPEAT_ENABLED<class_CanvasItem_constant_TEXTURE_REPEAT_ENABLED>` 或 :ref:`CanvasItem.TEXTURE_REPEAT_MIRROR<class_CanvasItem_constant_TEXTURE_REPEAT_MIRROR>`\ ,才能正常工作。
|
|
|
|
.. _class_Line2D_constant_LINE_TEXTURE_STRETCH:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`LineTextureMode<enum_Line2D_LineTextureMode>` **LINE_TEXTURE_STRETCH** = ``2``
|
|
|
|
沿該線條拉伸紋理。該 **Line2D** 節點的 :ref:`CanvasItem.texture_repeat<class_CanvasItem_property_texture_repeat>` 必須為 :ref:`CanvasItem.TEXTURE_REPEAT_DISABLED<class_CanvasItem_constant_TEXTURE_REPEAT_DISABLED>`\ ,以獲得最佳效果。
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
屬性說明
|
|
--------
|
|
|
|
.. _class_Line2D_property_antialiased:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`bool<class_bool>` **antialiased** = ``false`` :ref:`🔗<class_Line2D_property_antialiased>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_antialiased**\ (\ value\: :ref:`bool<class_bool>`\ )
|
|
- :ref:`bool<class_bool>` **get_antialiased**\ (\ )
|
|
|
|
如果為 ``true``\ ,則線條的邊界將使用抗鋸齒。
|
|
|
|
\ **注意:**\ Line2D 在使用抗鋸齒時,不會通過批次處理來加速。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_property_begin_cap_mode:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`LineCapMode<enum_Line2D_LineCapMode>` **begin_cap_mode** = ``0`` :ref:`🔗<class_Line2D_property_begin_cap_mode>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_begin_cap_mode**\ (\ value\: :ref:`LineCapMode<enum_Line2D_LineCapMode>`\ )
|
|
- :ref:`LineCapMode<enum_Line2D_LineCapMode>` **get_begin_cap_mode**\ (\ )
|
|
|
|
The style of the beginning of the polyline, if :ref:`closed<class_Line2D_property_closed>` is ``false``.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_property_closed:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`bool<class_bool>` **closed** = ``false`` :ref:`🔗<class_Line2D_property_closed>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_closed**\ (\ value\: :ref:`bool<class_bool>`\ )
|
|
- :ref:`bool<class_bool>` **is_closed**\ (\ )
|
|
|
|
如果 ``true`` 且折線有超過 2 個點,則最後一個點和第一個點將透過線段連接。
|
|
|
|
\ **注意:**\ 如果提供了\ :ref:`width_curve<class_Line2D_property_width_curve>`\ ,則不保證閉合線段的形狀是無縫的。
|
|
|
|
\ **注意:**\ 首先繪製結束線段和第一線段之間的連接點,並在開始時對\ :ref:`gradient<class_Line2D_property_gradient>`\ 和\ :ref:`width_curve<class_Line2D_property_width_curve>`\ 進行取樣。這是未來版本中可能會變更的實作細節。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_property_default_color:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Color<class_Color>` **default_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_Line2D_property_default_color>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_default_color**\ (\ value\: :ref:`Color<class_Color>`\ )
|
|
- :ref:`Color<class_Color>` **get_default_color**\ (\ )
|
|
|
|
線條的顏色。如果設定了漸變,則不會生效。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_property_end_cap_mode:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`LineCapMode<enum_Line2D_LineCapMode>` **end_cap_mode** = ``0`` :ref:`🔗<class_Line2D_property_end_cap_mode>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_end_cap_mode**\ (\ value\: :ref:`LineCapMode<enum_Line2D_LineCapMode>`\ )
|
|
- :ref:`LineCapMode<enum_Line2D_LineCapMode>` **get_end_cap_mode**\ (\ )
|
|
|
|
The style of the end of the polyline, if :ref:`closed<class_Line2D_property_closed>` is ``false``.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_property_gradient:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Gradient<class_Gradient>` **gradient** :ref:`🔗<class_Line2D_property_gradient>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_gradient**\ (\ value\: :ref:`Gradient<class_Gradient>`\ )
|
|
- :ref:`Gradient<class_Gradient>` **get_gradient**\ (\ )
|
|
|
|
從頭到尾貫穿整條線的漸變色。如果設定了漸變,則不會使用預設顏色。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_property_joint_mode:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`LineJointMode<enum_Line2D_LineJointMode>` **joint_mode** = ``0`` :ref:`🔗<class_Line2D_property_joint_mode>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_joint_mode**\ (\ value\: :ref:`LineJointMode<enum_Line2D_LineJointMode>`\ )
|
|
- :ref:`LineJointMode<enum_Line2D_LineJointMode>` **get_joint_mode**\ (\ )
|
|
|
|
The style of the connections between segments of the polyline.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_property_points:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`PackedVector2Array<class_PackedVector2Array>` **points** = ``PackedVector2Array()`` :ref:`🔗<class_Line2D_property_points>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_points**\ (\ value\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ )
|
|
- :ref:`PackedVector2Array<class_PackedVector2Array>` **get_points**\ (\ )
|
|
|
|
折線的點,以局部 2D 座標解釋。線段在此陣列中的相鄰點之間繪製。
|
|
|
|
**Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedVector2Array<class_PackedVector2Array>` for more details.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_property_round_precision:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **round_precision** = ``8`` :ref:`🔗<class_Line2D_property_round_precision>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_round_precision**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_round_precision**\ (\ )
|
|
|
|
用於圓角接頭和帽的平滑度。值越高,邊角越平滑,但算繪和更新的要求更高。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_property_sharp_limit:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **sharp_limit** = ``2.0`` :ref:`🔗<class_Line2D_property_sharp_limit>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_sharp_limit**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_sharp_limit**\ (\ )
|
|
|
|
決定折線的斜接限制。通常,當 :ref:`joint_mode<class_Line2D_property_joint_mode>` 設定為 :ref:`LINE_JOINT_SHARP<class_Line2D_constant_LINE_JOINT_SHARP>` 時,銳角會退回到使用 :ref:`LINE_JOINT_BEVEL<class_Line2D_constant_LINE_JOINT_BEVEL>` 關節的邏輯來防止非常長長的斜接。此屬性的值較高意味著會以更尖銳的角度退回到斜角接頭。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_property_texture:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Texture2D<class_Texture2D>` **texture** :ref:`🔗<class_Line2D_property_texture>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_texture**\ (\ value\: :ref:`Texture2D<class_Texture2D>`\ )
|
|
- :ref:`Texture2D<class_Texture2D>` **get_texture**\ (\ )
|
|
|
|
The texture used for the polyline. Uses :ref:`texture_mode<class_Line2D_property_texture_mode>` for drawing style.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_property_texture_mode:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`LineTextureMode<enum_Line2D_LineTextureMode>` **texture_mode** = ``0`` :ref:`🔗<class_Line2D_property_texture_mode>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_texture_mode**\ (\ value\: :ref:`LineTextureMode<enum_Line2D_LineTextureMode>`\ )
|
|
- :ref:`LineTextureMode<enum_Line2D_LineTextureMode>` **get_texture_mode**\ (\ )
|
|
|
|
The style to render the :ref:`texture<class_Line2D_property_texture>` of the polyline.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_property_width:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **width** = ``10.0`` :ref:`🔗<class_Line2D_property_width>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_width**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_width**\ (\ )
|
|
|
|
多邊形的寬度。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_property_width_curve:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Curve<class_Curve>` **width_curve** :ref:`🔗<class_Line2D_property_width_curve>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_curve**\ (\ value\: :ref:`Curve<class_Curve>`\ )
|
|
- :ref:`Curve<class_Curve>` **get_curve**\ (\ )
|
|
|
|
The polyline's width curve. The width of the polyline over its length will be equivalent to the value of the width curve over its domain. The width curve should be a unit :ref:`Curve<class_Curve>`.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
方法說明
|
|
--------
|
|
|
|
.. _class_Line2D_method_add_point:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **add_point**\ (\ position\: :ref:`Vector2<class_Vector2>`, index\: :ref:`int<class_int>` = -1\ ) :ref:`🔗<class_Line2D_method_add_point>`
|
|
|
|
在指定的位置 ``position`` 新增一個點,該位置相對於該線段自身的位置。新的點會被加入到點的列表末尾。
|
|
|
|
如果給出 ``index``\ ,則將新點插入到由索引 ``index`` 標識的已有點之前。從 ``index`` 開始的每個已有點都會進一步向下移動點列表。索引必須大於或等於 ``0``\ ,並且不得超過線段中已有點的數量。請參閱 :ref:`get_point_count()<class_Line2D_method_get_point_count>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_method_clear_points:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **clear_points**\ (\ ) :ref:`🔗<class_Line2D_method_clear_points>`
|
|
|
|
移除直線上的所有點。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_method_get_point_count:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`int<class_int>` **get_point_count**\ (\ ) |const| :ref:`🔗<class_Line2D_method_get_point_count>`
|
|
|
|
返回該直線中的點的數量。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_method_get_point_position:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`Vector2<class_Vector2>` **get_point_position**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Line2D_method_get_point_position>`
|
|
|
|
返回索引為 ``index`` 的點的位置。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_method_remove_point:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **remove_point**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Line2D_method_remove_point>`
|
|
|
|
移除該直線中索引為 ``index`` 的點。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Line2D_method_set_point_position:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_point_position**\ (\ index\: :ref:`int<class_int>`, position\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_Line2D_method_set_point_position>`
|
|
|
|
用提供的 ``position`` 覆蓋索引 ``index`` 處的點的位置。
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (本方法通常需要使用者覆寫才能生效。)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |const| replace:: :abbr:`const (本方法沒有副作用。不會修改該實例的任何成員變數。)`
|
|
.. |vararg| replace:: :abbr:`vararg (本方法除了這裡描述的參數外,還可以接受任意數量的參數。)`
|
|
.. |constructor| replace:: :abbr:`constructor (本方法用於建構一個型別。)`
|
|
.. |static| replace:: :abbr:`static (本方法無需實例即可呼叫,因此可以直接使用類別名稱呼叫。)`
|
|
.. |operator| replace:: :abbr:`operator (本方法描述將本型別作為左運算元時可用的有效運算子。)`
|
|
.. |bitfield| replace:: :abbr:`BitField (此值是由下列旗標組成的位元遮罩整數。)`
|
|
.. |void| replace:: :abbr:`void (無回傳值。)`
|