class_vector4i.rst 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Vector4i.xml.
  6. .. _class_Vector4i:
  7. Vector4i
  8. ========
  9. Vector used for 4D math using integer coordinates.
  10. .. rst-class:: classref-introduction-group
  11. Description
  12. -----------
  13. 4-element structure that can be used to represent 4D grid coordinates or sets of integers.
  14. It uses integer coordinates and is therefore preferable to :ref:`Vector4<class_Vector4>` when exact precision is required. Note that the values are limited to 32 bits, and unlike :ref:`Vector4<class_Vector4>` this cannot be configured with an engine build option. Use :ref:`int<class_int>` or :ref:`PackedInt64Array<class_PackedInt64Array>` if 64-bit values are needed.
  15. .. rst-class:: classref-reftable-group
  16. Properties
  17. ----------
  18. .. table::
  19. :widths: auto
  20. +-----------------------+-------------------------------------+-------+
  21. | :ref:`int<class_int>` | :ref:`w<class_Vector4i_property_w>` | ``0`` |
  22. +-----------------------+-------------------------------------+-------+
  23. | :ref:`int<class_int>` | :ref:`x<class_Vector4i_property_x>` | ``0`` |
  24. +-----------------------+-------------------------------------+-------+
  25. | :ref:`int<class_int>` | :ref:`y<class_Vector4i_property_y>` | ``0`` |
  26. +-----------------------+-------------------------------------+-------+
  27. | :ref:`int<class_int>` | :ref:`z<class_Vector4i_property_z>` | ``0`` |
  28. +-----------------------+-------------------------------------+-------+
  29. .. rst-class:: classref-reftable-group
  30. Constructors
  31. ------------
  32. .. table::
  33. :widths: auto
  34. +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Vector4i<class_Vector4i>` | :ref:`Vector4i<class_Vector4i_constructor_Vector4i>` **(** **)** |
  36. +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`Vector4i<class_Vector4i>` | :ref:`Vector4i<class_Vector4i_constructor_Vector4i>` **(** :ref:`Vector4i<class_Vector4i>` from **)** |
  38. +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`Vector4i<class_Vector4i>` | :ref:`Vector4i<class_Vector4i_constructor_Vector4i>` **(** :ref:`Vector4<class_Vector4>` from **)** |
  40. +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Vector4i<class_Vector4i>` | :ref:`Vector4i<class_Vector4i_constructor_Vector4i>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z, :ref:`int<class_int>` w **)** |
  42. +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. .. rst-class:: classref-reftable-group
  44. Methods
  45. -------
  46. .. table::
  47. :widths: auto
  48. +---------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Vector4i<class_Vector4i>` | :ref:`abs<class_Vector4i_method_abs>` **(** **)** |const| |
  50. +---------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`Vector4i<class_Vector4i>` | :ref:`clamp<class_Vector4i_method_clamp>` **(** :ref:`Vector4i<class_Vector4i>` min, :ref:`Vector4i<class_Vector4i>` max **)** |const| |
  52. +---------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`float<class_float>` | :ref:`length<class_Vector4i_method_length>` **(** **)** |const| |
  54. +---------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`int<class_int>` | :ref:`length_squared<class_Vector4i_method_length_squared>` **(** **)** |const| |
  56. +---------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`int<class_int>` | :ref:`max_axis_index<class_Vector4i_method_max_axis_index>` **(** **)** |const| |
  58. +---------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`int<class_int>` | :ref:`min_axis_index<class_Vector4i_method_min_axis_index>` **(** **)** |const| |
  60. +---------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`Vector4i<class_Vector4i>` | :ref:`sign<class_Vector4i_method_sign>` **(** **)** |const| |
  62. +---------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`Vector4i<class_Vector4i>` | :ref:`snapped<class_Vector4i_method_snapped>` **(** :ref:`Vector4i<class_Vector4i>` step **)** |const| |
  64. +---------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  65. .. rst-class:: classref-reftable-group
  66. Operators
  67. ---------
  68. .. table::
  69. :widths: auto
  70. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  71. | :ref:`bool<class_bool>` | :ref:`operator !=<class_Vector4i_operator_neq_Vector4i>` **(** :ref:`Vector4i<class_Vector4i>` right **)** |
  72. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  73. | :ref:`Vector4i<class_Vector4i>` | :ref:`operator %<class_Vector4i_operator_mod_Vector4i>` **(** :ref:`Vector4i<class_Vector4i>` right **)** |
  74. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  75. | :ref:`Vector4i<class_Vector4i>` | :ref:`operator %<class_Vector4i_operator_mod_int>` **(** :ref:`int<class_int>` right **)** |
  76. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  77. | :ref:`Vector4i<class_Vector4i>` | :ref:`operator *<class_Vector4i_operator_mul_Vector4i>` **(** :ref:`Vector4i<class_Vector4i>` right **)** |
  78. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  79. | :ref:`Vector4<class_Vector4>` | :ref:`operator *<class_Vector4i_operator_mul_float>` **(** :ref:`float<class_float>` right **)** |
  80. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  81. | :ref:`Vector4i<class_Vector4i>` | :ref:`operator *<class_Vector4i_operator_mul_int>` **(** :ref:`int<class_int>` right **)** |
  82. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  83. | :ref:`Vector4i<class_Vector4i>` | :ref:`operator +<class_Vector4i_operator_sum_Vector4i>` **(** :ref:`Vector4i<class_Vector4i>` right **)** |
  84. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  85. | :ref:`Vector4i<class_Vector4i>` | :ref:`operator -<class_Vector4i_operator_dif_Vector4i>` **(** :ref:`Vector4i<class_Vector4i>` right **)** |
  86. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  87. | :ref:`Vector4i<class_Vector4i>` | :ref:`operator /<class_Vector4i_operator_div_Vector4i>` **(** :ref:`Vector4i<class_Vector4i>` right **)** |
  88. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  89. | :ref:`Vector4<class_Vector4>` | :ref:`operator /<class_Vector4i_operator_div_float>` **(** :ref:`float<class_float>` right **)** |
  90. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  91. | :ref:`Vector4i<class_Vector4i>` | :ref:`operator /<class_Vector4i_operator_div_int>` **(** :ref:`int<class_int>` right **)** |
  92. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  93. | :ref:`bool<class_bool>` | :ref:`operator \<<class_Vector4i_operator_lt_Vector4i>` **(** :ref:`Vector4i<class_Vector4i>` right **)** |
  94. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  95. | :ref:`bool<class_bool>` | :ref:`operator \<=<class_Vector4i_operator_lte_Vector4i>` **(** :ref:`Vector4i<class_Vector4i>` right **)** |
  96. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  97. | :ref:`bool<class_bool>` | :ref:`operator ==<class_Vector4i_operator_eq_Vector4i>` **(** :ref:`Vector4i<class_Vector4i>` right **)** |
  98. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  99. | :ref:`bool<class_bool>` | :ref:`operator ><class_Vector4i_operator_gt_Vector4i>` **(** :ref:`Vector4i<class_Vector4i>` right **)** |
  100. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  101. | :ref:`bool<class_bool>` | :ref:`operator >=<class_Vector4i_operator_gte_Vector4i>` **(** :ref:`Vector4i<class_Vector4i>` right **)** |
  102. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  103. | :ref:`int<class_int>` | :ref:`operator []<class_Vector4i_operator_idx_int>` **(** :ref:`int<class_int>` index **)** |
  104. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  105. | :ref:`Vector4i<class_Vector4i>` | :ref:`operator unary+<class_Vector4i_operator_unplus>` **(** **)** |
  106. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  107. | :ref:`Vector4i<class_Vector4i>` | :ref:`operator unary-<class_Vector4i_operator_unminus>` **(** **)** |
  108. +---------------------------------+-------------------------------------------------------------------------------------------------------------+
  109. .. rst-class:: classref-section-separator
  110. ----
  111. .. rst-class:: classref-descriptions-group
  112. Constants
  113. ---------
  114. .. _class_Vector4i_constant_AXIS_X:
  115. .. rst-class:: classref-constant
  116. **AXIS_X** = ``0``
  117. Enumerated value for the X axis. Returned by :ref:`max_axis_index<class_Vector4i_method_max_axis_index>` and :ref:`min_axis_index<class_Vector4i_method_min_axis_index>`.
  118. .. _class_Vector4i_constant_AXIS_Y:
  119. .. rst-class:: classref-constant
  120. **AXIS_Y** = ``1``
  121. Enumerated value for the Y axis. Returned by :ref:`max_axis_index<class_Vector4i_method_max_axis_index>` and :ref:`min_axis_index<class_Vector4i_method_min_axis_index>`.
  122. .. _class_Vector4i_constant_AXIS_Z:
  123. .. rst-class:: classref-constant
  124. **AXIS_Z** = ``2``
  125. Enumerated value for the Z axis. Returned by :ref:`max_axis_index<class_Vector4i_method_max_axis_index>` and :ref:`min_axis_index<class_Vector4i_method_min_axis_index>`.
  126. .. _class_Vector4i_constant_AXIS_W:
  127. .. rst-class:: classref-constant
  128. **AXIS_W** = ``3``
  129. Enumerated value for the W axis. Returned by :ref:`max_axis_index<class_Vector4i_method_max_axis_index>` and :ref:`min_axis_index<class_Vector4i_method_min_axis_index>`.
  130. .. _class_Vector4i_constant_ZERO:
  131. .. rst-class:: classref-constant
  132. **ZERO** = ``Vector4i(0, 0, 0, 0)``
  133. Zero vector, a vector with all components set to ``0``.
  134. .. _class_Vector4i_constant_ONE:
  135. .. rst-class:: classref-constant
  136. **ONE** = ``Vector4i(1, 1, 1, 1)``
  137. One vector, a vector with all components set to ``1``.
  138. .. rst-class:: classref-section-separator
  139. ----
  140. .. rst-class:: classref-descriptions-group
  141. Property Descriptions
  142. ---------------------
  143. .. _class_Vector4i_property_w:
  144. .. rst-class:: classref-property
  145. :ref:`int<class_int>` **w** = ``0``
  146. The vector's W component. Also accessible by using the index position ``[3]``.
  147. .. rst-class:: classref-item-separator
  148. ----
  149. .. _class_Vector4i_property_x:
  150. .. rst-class:: classref-property
  151. :ref:`int<class_int>` **x** = ``0``
  152. The vector's X component. Also accessible by using the index position ``[0]``.
  153. .. rst-class:: classref-item-separator
  154. ----
  155. .. _class_Vector4i_property_y:
  156. .. rst-class:: classref-property
  157. :ref:`int<class_int>` **y** = ``0``
  158. The vector's Y component. Also accessible by using the index position ``[1]``.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_Vector4i_property_z:
  162. .. rst-class:: classref-property
  163. :ref:`int<class_int>` **z** = ``0``
  164. The vector's Z component. Also accessible by using the index position ``[2]``.
  165. .. rst-class:: classref-section-separator
  166. ----
  167. .. rst-class:: classref-descriptions-group
  168. Constructor Descriptions
  169. ------------------------
  170. .. _class_Vector4i_constructor_Vector4i:
  171. .. rst-class:: classref-constructor
  172. :ref:`Vector4i<class_Vector4i>` **Vector4i** **(** **)**
  173. Constructs a default-initialized **Vector4i** with all components set to ``0``.
  174. .. rst-class:: classref-item-separator
  175. ----
  176. .. rst-class:: classref-constructor
  177. :ref:`Vector4i<class_Vector4i>` **Vector4i** **(** :ref:`Vector4i<class_Vector4i>` from **)**
  178. Constructs a **Vector4i** as a copy of the given **Vector4i**.
  179. .. rst-class:: classref-item-separator
  180. ----
  181. .. rst-class:: classref-constructor
  182. :ref:`Vector4i<class_Vector4i>` **Vector4i** **(** :ref:`Vector4<class_Vector4>` from **)**
  183. Constructs a new **Vector4i** from the given :ref:`Vector4<class_Vector4>`.
  184. .. rst-class:: classref-item-separator
  185. ----
  186. .. rst-class:: classref-constructor
  187. :ref:`Vector4i<class_Vector4i>` **Vector4i** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z, :ref:`int<class_int>` w **)**
  188. Returns a **Vector4i** with the given components.
  189. .. rst-class:: classref-section-separator
  190. ----
  191. .. rst-class:: classref-descriptions-group
  192. Method Descriptions
  193. -------------------
  194. .. _class_Vector4i_method_abs:
  195. .. rst-class:: classref-method
  196. :ref:`Vector4i<class_Vector4i>` **abs** **(** **)** |const|
  197. Returns a new vector with all components in absolute values (i.e. positive).
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. _class_Vector4i_method_clamp:
  201. .. rst-class:: classref-method
  202. :ref:`Vector4i<class_Vector4i>` **clamp** **(** :ref:`Vector4i<class_Vector4i>` min, :ref:`Vector4i<class_Vector4i>` max **)** |const|
  203. Returns a new vector with all components clamped between the components of ``min`` and ``max``, by running :ref:`@GlobalScope.clamp<class_@GlobalScope_method_clamp>` on each component.
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_Vector4i_method_length:
  207. .. rst-class:: classref-method
  208. :ref:`float<class_float>` **length** **(** **)** |const|
  209. Returns the length (magnitude) of this vector.
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_Vector4i_method_length_squared:
  213. .. rst-class:: classref-method
  214. :ref:`int<class_int>` **length_squared** **(** **)** |const|
  215. Returns the squared length (squared magnitude) of this vector. This method runs faster than :ref:`length<class_Vector4i_method_length>`.
  216. .. rst-class:: classref-item-separator
  217. ----
  218. .. _class_Vector4i_method_max_axis_index:
  219. .. rst-class:: classref-method
  220. :ref:`int<class_int>` **max_axis_index** **(** **)** |const|
  221. Returns the axis of the vector's highest value. See ``AXIS_*`` constants. If all components are equal, this method returns :ref:`AXIS_X<class_Vector4i_constant_AXIS_X>`.
  222. .. rst-class:: classref-item-separator
  223. ----
  224. .. _class_Vector4i_method_min_axis_index:
  225. .. rst-class:: classref-method
  226. :ref:`int<class_int>` **min_axis_index** **(** **)** |const|
  227. Returns the axis of the vector's lowest value. See ``AXIS_*`` constants. If all components are equal, this method returns :ref:`AXIS_W<class_Vector4i_constant_AXIS_W>`.
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_Vector4i_method_sign:
  231. .. rst-class:: classref-method
  232. :ref:`Vector4i<class_Vector4i>` **sign** **(** **)** |const|
  233. Returns a new vector with each component set to ``1`` if it's positive, ``-1`` if it's negative, and ``0`` if it's zero. The result is identical to calling :ref:`@GlobalScope.sign<class_@GlobalScope_method_sign>` on each component.
  234. .. rst-class:: classref-item-separator
  235. ----
  236. .. _class_Vector4i_method_snapped:
  237. .. rst-class:: classref-method
  238. :ref:`Vector4i<class_Vector4i>` **snapped** **(** :ref:`Vector4i<class_Vector4i>` step **)** |const|
  239. Returns a new vector with each component snapped to the closest multiple of the corresponding component in ``step``.
  240. .. rst-class:: classref-section-separator
  241. ----
  242. .. rst-class:: classref-descriptions-group
  243. Operator Descriptions
  244. ---------------------
  245. .. _class_Vector4i_operator_neq_Vector4i:
  246. .. rst-class:: classref-operator
  247. :ref:`bool<class_bool>` **operator !=** **(** :ref:`Vector4i<class_Vector4i>` right **)**
  248. Returns ``true`` if the vectors are not equal.
  249. .. rst-class:: classref-item-separator
  250. ----
  251. .. _class_Vector4i_operator_mod_Vector4i:
  252. .. rst-class:: classref-operator
  253. :ref:`Vector4i<class_Vector4i>` **operator %** **(** :ref:`Vector4i<class_Vector4i>` right **)**
  254. Gets the remainder of each component of the **Vector4i** with the components of the given **Vector4i**. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using :ref:`@GlobalScope.posmod<class_@GlobalScope_method_posmod>` instead if you want to handle negative numbers.
  255. ::
  256. print(Vector4i(10, -20, 30, -40) % Vector4i(7, 8, 9, 10)) # Prints "(3, -4, 3, 0)"
  257. .. rst-class:: classref-item-separator
  258. ----
  259. .. _class_Vector4i_operator_mod_int:
  260. .. rst-class:: classref-operator
  261. :ref:`Vector4i<class_Vector4i>` **operator %** **(** :ref:`int<class_int>` right **)**
  262. Gets the remainder of each component of the **Vector4i** with the the given :ref:`int<class_int>`. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using :ref:`@GlobalScope.posmod<class_@GlobalScope_method_posmod>` instead if you want to handle negative numbers.
  263. ::
  264. print(Vector4i(10, -20, 30, -40) % 7) # Prints "(3, -6, 2, -5)"
  265. .. rst-class:: classref-item-separator
  266. ----
  267. .. _class_Vector4i_operator_mul_Vector4i:
  268. .. rst-class:: classref-operator
  269. :ref:`Vector4i<class_Vector4i>` **operator *** **(** :ref:`Vector4i<class_Vector4i>` right **)**
  270. Multiplies each component of the **Vector4i** by the components of the given **Vector4i**.
  271. ::
  272. print(Vector4i(10, 20, 30, 40) * Vector4i(3, 4, 5, 6)) # Prints "(30, 80, 150, 240)"
  273. .. rst-class:: classref-item-separator
  274. ----
  275. .. _class_Vector4i_operator_mul_float:
  276. .. rst-class:: classref-operator
  277. :ref:`Vector4<class_Vector4>` **operator *** **(** :ref:`float<class_float>` right **)**
  278. Multiplies each component of the **Vector4i** by the given :ref:`float<class_float>`.
  279. Returns a Vector4 value due to floating-point operations.
  280. ::
  281. print(Vector4i(10, 20, 30, 40) * 2) # Prints "(20, 40, 60, 80)"
  282. .. rst-class:: classref-item-separator
  283. ----
  284. .. _class_Vector4i_operator_mul_int:
  285. .. rst-class:: classref-operator
  286. :ref:`Vector4i<class_Vector4i>` **operator *** **(** :ref:`int<class_int>` right **)**
  287. Multiplies each component of the **Vector4i** by the given :ref:`int<class_int>`.
  288. .. rst-class:: classref-item-separator
  289. ----
  290. .. _class_Vector4i_operator_sum_Vector4i:
  291. .. rst-class:: classref-operator
  292. :ref:`Vector4i<class_Vector4i>` **operator +** **(** :ref:`Vector4i<class_Vector4i>` right **)**
  293. Adds each component of the **Vector4i** by the components of the given **Vector4i**.
  294. ::
  295. print(Vector4i(10, 20, 30, 40) + Vector4i(3, 4, 5, 6)) # Prints "(13, 24, 35, 46)"
  296. .. rst-class:: classref-item-separator
  297. ----
  298. .. _class_Vector4i_operator_dif_Vector4i:
  299. .. rst-class:: classref-operator
  300. :ref:`Vector4i<class_Vector4i>` **operator -** **(** :ref:`Vector4i<class_Vector4i>` right **)**
  301. Subtracts each component of the **Vector4i** by the components of the given **Vector4i**.
  302. ::
  303. print(Vector4i(10, 20, 30, 40) - Vector4i(3, 4, 5, 6)) # Prints "(7, 16, 25, 34)"
  304. .. rst-class:: classref-item-separator
  305. ----
  306. .. _class_Vector4i_operator_div_Vector4i:
  307. .. rst-class:: classref-operator
  308. :ref:`Vector4i<class_Vector4i>` **operator /** **(** :ref:`Vector4i<class_Vector4i>` right **)**
  309. Divides each component of the **Vector4i** by the components of the given **Vector4i**.
  310. ::
  311. print(Vector4i(10, 20, 30, 40) / Vector4i(2, 5, 3, 4)) # Prints "(5, 4, 10, 10)"
  312. .. rst-class:: classref-item-separator
  313. ----
  314. .. _class_Vector4i_operator_div_float:
  315. .. rst-class:: classref-operator
  316. :ref:`Vector4<class_Vector4>` **operator /** **(** :ref:`float<class_float>` right **)**
  317. Divides each component of the **Vector4i** by the given :ref:`float<class_float>`.
  318. Returns a Vector4 value due to floating-point operations.
  319. ::
  320. print(Vector4i(10, 20, 30, 40) / 2 # Prints "(5, 10, 15, 20)"
  321. .. rst-class:: classref-item-separator
  322. ----
  323. .. _class_Vector4i_operator_div_int:
  324. .. rst-class:: classref-operator
  325. :ref:`Vector4i<class_Vector4i>` **operator /** **(** :ref:`int<class_int>` right **)**
  326. Divides each component of the **Vector4i** by the given :ref:`int<class_int>`.
  327. .. rst-class:: classref-item-separator
  328. ----
  329. .. _class_Vector4i_operator_lt_Vector4i:
  330. .. rst-class:: classref-operator
  331. :ref:`bool<class_bool>` **operator <** **(** :ref:`Vector4i<class_Vector4i>` right **)**
  332. Compares two **Vector4i** vectors by first checking if the X value of the left vector is less than the X value of the ``right`` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, Z values of the two vectors, and then with the W values. This operator is useful for sorting vectors.
  333. .. rst-class:: classref-item-separator
  334. ----
  335. .. _class_Vector4i_operator_lte_Vector4i:
  336. .. rst-class:: classref-operator
  337. :ref:`bool<class_bool>` **operator <=** **(** :ref:`Vector4i<class_Vector4i>` right **)**
  338. Compares two **Vector4i** vectors by first checking if the X value of the left vector is less than or equal to the X value of the ``right`` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, Z values of the two vectors, and then with the W values. This operator is useful for sorting vectors.
  339. .. rst-class:: classref-item-separator
  340. ----
  341. .. _class_Vector4i_operator_eq_Vector4i:
  342. .. rst-class:: classref-operator
  343. :ref:`bool<class_bool>` **operator ==** **(** :ref:`Vector4i<class_Vector4i>` right **)**
  344. Returns ``true`` if the vectors are exactly equal.
  345. .. rst-class:: classref-item-separator
  346. ----
  347. .. _class_Vector4i_operator_gt_Vector4i:
  348. .. rst-class:: classref-operator
  349. :ref:`bool<class_bool>` **operator >** **(** :ref:`Vector4i<class_Vector4i>` right **)**
  350. Compares two **Vector4i** vectors by first checking if the X value of the left vector is greater than the X value of the ``right`` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, Z values of the two vectors, and then with the W values. This operator is useful for sorting vectors.
  351. .. rst-class:: classref-item-separator
  352. ----
  353. .. _class_Vector4i_operator_gte_Vector4i:
  354. .. rst-class:: classref-operator
  355. :ref:`bool<class_bool>` **operator >=** **(** :ref:`Vector4i<class_Vector4i>` right **)**
  356. Compares two **Vector4i** vectors by first checking if the X value of the left vector is greater than or equal to the X value of the ``right`` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, Z values of the two vectors, and then with the W values. This operator is useful for sorting vectors.
  357. .. rst-class:: classref-item-separator
  358. ----
  359. .. _class_Vector4i_operator_idx_int:
  360. .. rst-class:: classref-operator
  361. :ref:`int<class_int>` **operator []** **(** :ref:`int<class_int>` index **)**
  362. Access vector components using their ``index``. ``v[0]`` is equivalent to ``v.x``, ``v[1]`` is equivalent to ``v.y``, ``v[2]`` is equivalent to ``v.z``, and ``v[3]`` is equivalent to ``v.w``.
  363. .. rst-class:: classref-item-separator
  364. ----
  365. .. _class_Vector4i_operator_unplus:
  366. .. rst-class:: classref-operator
  367. :ref:`Vector4i<class_Vector4i>` **operator unary+** **(** **)**
  368. Returns the same value as if the ``+`` was not there. Unary ``+`` does nothing, but sometimes it can make your code more readable.
  369. .. rst-class:: classref-item-separator
  370. ----
  371. .. _class_Vector4i_operator_unminus:
  372. .. rst-class:: classref-operator
  373. :ref:`Vector4i<class_Vector4i>` **operator unary-** **(** **)**
  374. Returns the negative value of the **Vector4i**. This is the same as writing ``Vector4i(-v.x, -v.y, -v.z, -v.w)``. This operation flips the direction of the vector while keeping the same magnitude.
  375. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  376. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  377. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  378. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  379. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  380. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`