class_vector4.rst 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  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/Vector4.xml.
  6. .. _class_Vector4:
  7. Vector4
  8. =======
  9. Vector used for 4D math using floating point coordinates.
  10. Description
  11. -----------
  12. 4-element structure that can be used to represent any quadruplet of numeric values.
  13. It uses floating-point coordinates. See :ref:`Vector4i<class_Vector4i>` for its integer counterpart.
  14. \ **Note:** In a boolean context, a Vector4 will evaluate to ``false`` if it's equal to ``Vector4(0, 0, 0, 0)``. Otherwise, a Vector4 will always evaluate to ``true``.
  15. Properties
  16. ----------
  17. +---------------------------+------------------------------------+---------+
  18. | :ref:`float<class_float>` | :ref:`w<class_Vector4_property_w>` | ``0.0`` |
  19. +---------------------------+------------------------------------+---------+
  20. | :ref:`float<class_float>` | :ref:`x<class_Vector4_property_x>` | ``0.0`` |
  21. +---------------------------+------------------------------------+---------+
  22. | :ref:`float<class_float>` | :ref:`y<class_Vector4_property_y>` | ``0.0`` |
  23. +---------------------------+------------------------------------+---------+
  24. | :ref:`float<class_float>` | :ref:`z<class_Vector4_property_z>` | ``0.0`` |
  25. +---------------------------+------------------------------------+---------+
  26. Constructors
  27. ------------
  28. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`Vector4<class_Vector4>` | :ref:`Vector4<class_Vector4_constructor_Vector4>` **(** **)** |
  30. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`Vector4<class_Vector4>` | :ref:`Vector4<class_Vector4_constructor_Vector4>` **(** :ref:`Vector4<class_Vector4>` from **)** |
  32. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`Vector4<class_Vector4>` | :ref:`Vector4<class_Vector4_constructor_Vector4>` **(** :ref:`Vector4i<class_Vector4i>` from **)** |
  34. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Vector4<class_Vector4>` | :ref:`Vector4<class_Vector4_constructor_Vector4>` **(** :ref:`float<class_float>` x, :ref:`float<class_float>` y, :ref:`float<class_float>` z, :ref:`float<class_float>` w **)** |
  36. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. Methods
  38. -------
  39. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`Vector4<class_Vector4>` | :ref:`abs<class_Vector4_method_abs>` **(** **)** |const| |
  41. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`Vector4<class_Vector4>` | :ref:`ceil<class_Vector4_method_ceil>` **(** **)** |const| |
  43. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Vector4<class_Vector4>` | :ref:`clamp<class_Vector4_method_clamp>` **(** :ref:`Vector4<class_Vector4>` min, :ref:`Vector4<class_Vector4>` max **)** |const| |
  45. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`float<class_float>` | :ref:`dot<class_Vector4_method_dot>` **(** :ref:`Vector4<class_Vector4>` with **)** |const| |
  47. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`Vector4<class_Vector4>` | :ref:`floor<class_Vector4_method_floor>` **(** **)** |const| |
  49. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Vector4<class_Vector4>` | :ref:`inverse<class_Vector4_method_inverse>` **(** **)** |const| |
  51. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`bool<class_bool>` | :ref:`is_equal_approx<class_Vector4_method_is_equal_approx>` **(** :ref:`Vector4<class_Vector4>` with **)** |const| |
  53. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`bool<class_bool>` | :ref:`is_normalized<class_Vector4_method_is_normalized>` **(** **)** |const| |
  55. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`float<class_float>` | :ref:`length<class_Vector4_method_length>` **(** **)** |const| |
  57. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`float<class_float>` | :ref:`length_squared<class_Vector4_method_length_squared>` **(** **)** |const| |
  59. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`Vector4<class_Vector4>` | :ref:`lerp<class_Vector4_method_lerp>` **(** :ref:`Vector4<class_Vector4>` to, :ref:`float<class_float>` weight **)** |const| |
  61. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`int<class_int>` | :ref:`max_axis_index<class_Vector4_method_max_axis_index>` **(** **)** |const| |
  63. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`int<class_int>` | :ref:`min_axis_index<class_Vector4_method_min_axis_index>` **(** **)** |const| |
  65. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`Vector4<class_Vector4>` | :ref:`normalized<class_Vector4_method_normalized>` **(** **)** |const| |
  67. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`Vector4<class_Vector4>` | :ref:`round<class_Vector4_method_round>` **(** **)** |const| |
  69. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`Vector4<class_Vector4>` | :ref:`sign<class_Vector4_method_sign>` **(** **)** |const| |
  71. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  72. Operators
  73. ---------
  74. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  75. | :ref:`bool<class_bool>` | :ref:`operator !=<class_Vector4_operator_neq_bool>` **(** :ref:`Vector4<class_Vector4>` right **)** |
  76. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  77. | :ref:`Vector4<class_Vector4>` | :ref:`operator *<class_Vector4_operator_mul_Vector4>` **(** :ref:`Projection<class_Projection>` right **)** |
  78. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  79. | :ref:`Vector4<class_Vector4>` | :ref:`operator *<class_Vector4_operator_mul_Vector4>` **(** :ref:`Vector4<class_Vector4>` right **)** |
  80. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  81. | :ref:`Vector4<class_Vector4>` | :ref:`operator *<class_Vector4_operator_mul_Vector4>` **(** :ref:`float<class_float>` right **)** |
  82. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  83. | :ref:`Vector4<class_Vector4>` | :ref:`operator *<class_Vector4_operator_mul_Vector4>` **(** :ref:`int<class_int>` right **)** |
  84. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  85. | :ref:`Vector4<class_Vector4>` | :ref:`operator +<class_Vector4_operator_sum_Vector4>` **(** :ref:`Vector4<class_Vector4>` right **)** |
  86. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  87. | :ref:`Vector4<class_Vector4>` | :ref:`operator -<class_Vector4_operator_dif_Vector4>` **(** :ref:`Vector4<class_Vector4>` right **)** |
  88. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  89. | :ref:`Vector4<class_Vector4>` | :ref:`operator /<class_Vector4_operator_div_Vector4>` **(** :ref:`Vector4<class_Vector4>` right **)** |
  90. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  91. | :ref:`Vector4<class_Vector4>` | :ref:`operator /<class_Vector4_operator_div_Vector4>` **(** :ref:`float<class_float>` right **)** |
  92. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  93. | :ref:`Vector4<class_Vector4>` | :ref:`operator /<class_Vector4_operator_div_Vector4>` **(** :ref:`int<class_int>` right **)** |
  94. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  95. | :ref:`bool<class_bool>` | :ref:`operator <<class_Vector4_operator_lt_bool>` **(** :ref:`Vector4<class_Vector4>` right **)** |
  96. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  97. | :ref:`bool<class_bool>` | :ref:`operator <=<class_Vector4_operator_lte_bool>` **(** :ref:`Vector4<class_Vector4>` right **)** |
  98. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  99. | :ref:`bool<class_bool>` | :ref:`operator ==<class_Vector4_operator_eq_bool>` **(** :ref:`Vector4<class_Vector4>` right **)** |
  100. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  101. | :ref:`bool<class_bool>` | :ref:`operator ><class_Vector4_operator_gt_bool>` **(** :ref:`Vector4<class_Vector4>` right **)** |
  102. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  103. | :ref:`bool<class_bool>` | :ref:`operator >=<class_Vector4_operator_gte_bool>` **(** :ref:`Vector4<class_Vector4>` right **)** |
  104. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  105. | :ref:`float<class_float>` | :ref:`operator []<class_Vector4_operator_idx_float>` **(** :ref:`int<class_int>` index **)** |
  106. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  107. | :ref:`Vector4<class_Vector4>` | :ref:`operator unary+<class_Vector4_operator_unplus_Vector4>` **(** **)** |
  108. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  109. | :ref:`Vector4<class_Vector4>` | :ref:`operator unary-<class_Vector4_operator_unminus_Vector4>` **(** **)** |
  110. +-------------------------------+-------------------------------------------------------------------------------------------------------------+
  111. Constants
  112. ---------
  113. .. _class_Vector4_constant_AXIS_X:
  114. .. _class_Vector4_constant_AXIS_Y:
  115. .. _class_Vector4_constant_AXIS_Z:
  116. .. _class_Vector4_constant_AXIS_W:
  117. .. _class_Vector4_constant_ZERO:
  118. .. _class_Vector4_constant_ONE:
  119. .. _class_Vector4_constant_INF:
  120. - **AXIS_X** = **0** --- Enumerated value for the X axis. Returned by :ref:`max_axis_index<class_Vector4_method_max_axis_index>` and :ref:`min_axis_index<class_Vector4_method_min_axis_index>`.
  121. - **AXIS_Y** = **1** --- Enumerated value for the Y axis. Returned by :ref:`max_axis_index<class_Vector4_method_max_axis_index>` and :ref:`min_axis_index<class_Vector4_method_min_axis_index>`.
  122. - **AXIS_Z** = **2** --- Enumerated value for the Z axis. Returned by :ref:`max_axis_index<class_Vector4_method_max_axis_index>` and :ref:`min_axis_index<class_Vector4_method_min_axis_index>`.
  123. - **AXIS_W** = **3** --- Enumerated value for the W axis. Returned by :ref:`max_axis_index<class_Vector4_method_max_axis_index>` and :ref:`min_axis_index<class_Vector4_method_min_axis_index>`.
  124. - **ZERO** = **Vector4(0, 0, 0)** --- Zero vector, a vector with all components set to ``0``.
  125. - **ONE** = **Vector4(1, 1, 1)** --- One vector, a vector with all components set to ``1``.
  126. - **INF** = **Vector4(inf, inf, inf)** --- Infinity vector, a vector with all components set to :ref:`@GDScript.INF<class_@GDScript_constant_INF>`.
  127. Property Descriptions
  128. ---------------------
  129. .. _class_Vector4_property_w:
  130. - :ref:`float<class_float>` **w**
  131. +-----------+---------+
  132. | *Default* | ``0.0`` |
  133. +-----------+---------+
  134. The vector's W component. Also accessible by using the index position ``[3]``.
  135. ----
  136. .. _class_Vector4_property_x:
  137. - :ref:`float<class_float>` **x**
  138. +-----------+---------+
  139. | *Default* | ``0.0`` |
  140. +-----------+---------+
  141. The vector's X component. Also accessible by using the index position ``[0]``.
  142. ----
  143. .. _class_Vector4_property_y:
  144. - :ref:`float<class_float>` **y**
  145. +-----------+---------+
  146. | *Default* | ``0.0`` |
  147. +-----------+---------+
  148. The vector's Y component. Also accessible by using the index position ``[1]``.
  149. ----
  150. .. _class_Vector4_property_z:
  151. - :ref:`float<class_float>` **z**
  152. +-----------+---------+
  153. | *Default* | ``0.0`` |
  154. +-----------+---------+
  155. The vector's Z component. Also accessible by using the index position ``[2]``.
  156. Constructor Descriptions
  157. ------------------------
  158. .. _class_Vector4_constructor_Vector4:
  159. - :ref:`Vector4<class_Vector4>` **Vector4** **(** **)**
  160. Constructs a default-initialized ``Vector4`` with all components set to ``0``.
  161. ----
  162. - :ref:`Vector4<class_Vector4>` **Vector4** **(** :ref:`Vector4<class_Vector4>` from **)**
  163. Constructs a ``Vector4`` as a copy of the given ``Vector4``.
  164. ----
  165. - :ref:`Vector4<class_Vector4>` **Vector4** **(** :ref:`Vector4i<class_Vector4i>` from **)**
  166. Constructs a new ``Vector4`` from :ref:`Vector4i<class_Vector4i>`.
  167. ----
  168. - :ref:`Vector4<class_Vector4>` **Vector4** **(** :ref:`float<class_float>` x, :ref:`float<class_float>` y, :ref:`float<class_float>` z, :ref:`float<class_float>` w **)**
  169. Returns a ``Vector4`` with the given components.
  170. Method Descriptions
  171. -------------------
  172. .. _class_Vector4_method_abs:
  173. - :ref:`Vector4<class_Vector4>` **abs** **(** **)** |const|
  174. Returns a new vector with all components in absolute values (i.e. positive).
  175. ----
  176. .. _class_Vector4_method_ceil:
  177. - :ref:`Vector4<class_Vector4>` **ceil** **(** **)** |const|
  178. Returns a new vector with all components rounded up (towards positive infinity).
  179. ----
  180. .. _class_Vector4_method_clamp:
  181. - :ref:`Vector4<class_Vector4>` **clamp** **(** :ref:`Vector4<class_Vector4>` min, :ref:`Vector4<class_Vector4>` max **)** |const|
  182. 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.
  183. ----
  184. .. _class_Vector4_method_dot:
  185. - :ref:`float<class_float>` **dot** **(** :ref:`Vector4<class_Vector4>` with **)** |const|
  186. Returns the dot product of this vector and ``with``.
  187. ----
  188. .. _class_Vector4_method_floor:
  189. - :ref:`Vector4<class_Vector4>` **floor** **(** **)** |const|
  190. Returns a new vector with all components rounded down (towards negative infinity).
  191. ----
  192. .. _class_Vector4_method_inverse:
  193. - :ref:`Vector4<class_Vector4>` **inverse** **(** **)** |const|
  194. Returns the inverse of the vector. This is the same as ``Vector4(1.0 / v.x, 1.0 / v.y, 1.0 / v.z, 1.0 / v.w)``.
  195. ----
  196. .. _class_Vector4_method_is_equal_approx:
  197. - :ref:`bool<class_bool>` **is_equal_approx** **(** :ref:`Vector4<class_Vector4>` with **)** |const|
  198. Returns ``true`` if this vector and ``v`` are approximately equal, by running :ref:`@GlobalScope.is_equal_approx<class_@GlobalScope_method_is_equal_approx>` on each component.
  199. ----
  200. .. _class_Vector4_method_is_normalized:
  201. - :ref:`bool<class_bool>` **is_normalized** **(** **)** |const|
  202. Returns ``true`` if the vector is normalized, i.e. its length is equal to 1.
  203. ----
  204. .. _class_Vector4_method_length:
  205. - :ref:`float<class_float>` **length** **(** **)** |const|
  206. Returns the length (magnitude) of this vector.
  207. ----
  208. .. _class_Vector4_method_length_squared:
  209. - :ref:`float<class_float>` **length_squared** **(** **)** |const|
  210. Returns the squared length (squared magnitude) of this vector. This method runs faster than :ref:`length<class_Vector4_method_length>`.
  211. ----
  212. .. _class_Vector4_method_lerp:
  213. - :ref:`Vector4<class_Vector4>` **lerp** **(** :ref:`Vector4<class_Vector4>` to, :ref:`float<class_float>` weight **)** |const|
  214. Returns the result of the linear interpolation between this vector and ``to`` by amount ``weight``. ``weight`` is on the range of ``0.0`` to ``1.0``, representing the amount of interpolation.
  215. ----
  216. .. _class_Vector4_method_max_axis_index:
  217. - :ref:`int<class_int>` **max_axis_index** **(** **)** |const|
  218. Returns the axis of the vector's highest value. See ``AXIS_*`` constants. If all components are equal, this method returns :ref:`AXIS_X<class_Vector4_constant_AXIS_X>`.
  219. ----
  220. .. _class_Vector4_method_min_axis_index:
  221. - :ref:`int<class_int>` **min_axis_index** **(** **)** |const|
  222. Returns the axis of the vector's lowest value. See ``AXIS_*`` constants. If all components are equal, this method returns :ref:`AXIS_W<class_Vector4_constant_AXIS_W>`.
  223. ----
  224. .. _class_Vector4_method_normalized:
  225. - :ref:`Vector4<class_Vector4>` **normalized** **(** **)** |const|
  226. Returns the vector scaled to unit length. Equivalent to ``v / v.length()``.
  227. ----
  228. .. _class_Vector4_method_round:
  229. - :ref:`Vector4<class_Vector4>` **round** **(** **)** |const|
  230. Returns a new vector with all components rounded to the nearest integer, with halfway cases rounded away from zero.
  231. ----
  232. .. _class_Vector4_method_sign:
  233. - :ref:`Vector4<class_Vector4>` **sign** **(** **)** |const|
  234. Returns a new vector with each component set to one or negative one, depending on the signs of the components, or zero if the component is zero, by calling :ref:`@GlobalScope.sign<class_@GlobalScope_method_sign>` on each component.
  235. Operator Descriptions
  236. ---------------------
  237. .. _class_Vector4_operator_neq_bool:
  238. - :ref:`bool<class_bool>` **operator !=** **(** :ref:`Vector4<class_Vector4>` right **)**
  239. Returns ``true`` if the vectors are not equal.
  240. \ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx<class_Vector4_method_is_equal_approx>` instead, which is more reliable.
  241. ----
  242. .. _class_Vector4_operator_mul_Vector4:
  243. - :ref:`Vector4<class_Vector4>` **operator *** **(** :ref:`Projection<class_Projection>` right **)**
  244. Inversely transforms (multiplies) the ``Vector4`` by the given :ref:`Projection<class_Projection>` matrix.
  245. ----
  246. - :ref:`Vector4<class_Vector4>` **operator *** **(** :ref:`Vector4<class_Vector4>` right **)**
  247. Multiplies each component of the ``Vector4`` by the components of the given ``Vector4``.
  248. ::
  249. print(Vector4(10, 20, 30, 40) * Vector4(3, 4, 5, 6)) # Prints "(30, 80, 150, 240)"
  250. ----
  251. - :ref:`Vector4<class_Vector4>` **operator *** **(** :ref:`float<class_float>` right **)**
  252. Multiplies each component of the ``Vector4`` by the given :ref:`float<class_float>`.
  253. ::
  254. print(Vector4(10, 20, 30, 40) * 2) # Prints "(20, 40, 60, 80)"
  255. ----
  256. - :ref:`Vector4<class_Vector4>` **operator *** **(** :ref:`int<class_int>` right **)**
  257. Multiplies each component of the ``Vector4`` by the given :ref:`int<class_int>`.
  258. ----
  259. .. _class_Vector4_operator_sum_Vector4:
  260. - :ref:`Vector4<class_Vector4>` **operator +** **(** :ref:`Vector4<class_Vector4>` right **)**
  261. Adds each component of the ``Vector4`` by the components of the given ``Vector4``.
  262. ::
  263. print(Vector4(10, 20, 30, 40) + Vector4(3, 4, 5, 6)) # Prints "(13, 24, 35, 46)"
  264. ----
  265. .. _class_Vector4_operator_dif_Vector4:
  266. - :ref:`Vector4<class_Vector4>` **operator -** **(** :ref:`Vector4<class_Vector4>` right **)**
  267. Subtracts each component of the ``Vector4`` by the components of the given ``Vector4``.
  268. ::
  269. print(Vector4(10, 20, 30, 40) - Vector4(3, 4, 5, 6)) # Prints "(7, 16, 25, 34)"
  270. ----
  271. .. _class_Vector4_operator_div_Vector4:
  272. - :ref:`Vector4<class_Vector4>` **operator /** **(** :ref:`Vector4<class_Vector4>` right **)**
  273. Divides each component of the ``Vector4`` by the components of the given ``Vector4``.
  274. ::
  275. print(Vector4(10, 20, 30, 40) / Vector4(2, 5, 3, 4)) # Prints "(5, 4, 10, 10)"
  276. ----
  277. - :ref:`Vector4<class_Vector4>` **operator /** **(** :ref:`float<class_float>` right **)**
  278. Divides each component of the ``Vector4`` by the given :ref:`float<class_float>`.
  279. ::
  280. print(Vector4(10, 20, 30, 40) / 2 # Prints "(5, 10, 15, 20)"
  281. ----
  282. - :ref:`Vector4<class_Vector4>` **operator /** **(** :ref:`int<class_int>` right **)**
  283. Divides each component of the ``Vector4`` by the given :ref:`int<class_int>`.
  284. ----
  285. .. _class_Vector4_operator_lt_bool:
  286. - :ref:`bool<class_bool>` **operator <** **(** :ref:`Vector4<class_Vector4>` right **)**
  287. Compares two ``Vector4`` 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.
  288. ----
  289. .. _class_Vector4_operator_lte_bool:
  290. - :ref:`bool<class_bool>` **operator <=** **(** :ref:`Vector4<class_Vector4>` right **)**
  291. Compares two ``Vector4`` 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.
  292. ----
  293. .. _class_Vector4_operator_eq_bool:
  294. - :ref:`bool<class_bool>` **operator ==** **(** :ref:`Vector4<class_Vector4>` right **)**
  295. Returns ``true`` if the vectors are exactly equal.
  296. \ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx<class_Vector4_method_is_equal_approx>` instead, which is more reliable.
  297. ----
  298. .. _class_Vector4_operator_gt_bool:
  299. - :ref:`bool<class_bool>` **operator >** **(** :ref:`Vector4<class_Vector4>` right **)**
  300. Compares two ``Vector4`` 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.
  301. ----
  302. .. _class_Vector4_operator_gte_bool:
  303. - :ref:`bool<class_bool>` **operator >=** **(** :ref:`Vector4<class_Vector4>` right **)**
  304. Access vector components using their index. ``v[0]`` is equivalent to ``v.x``, ``v[1]`` is equivalent to ``v.y``, and ``v[2]`` is equivalent to ``v.z``.
  305. ----
  306. .. _class_Vector4_operator_idx_float:
  307. - :ref:`float<class_float>` **operator []** **(** :ref:`int<class_int>` index **)**
  308. 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``.
  309. ----
  310. .. _class_Vector4_operator_unplus_Vector4:
  311. - :ref:`Vector4<class_Vector4>` **operator unary+** **(** **)**
  312. Returns the same value as if the ``+`` was not there. Unary ``+`` does nothing, but sometimes it can make your code more readable.
  313. ----
  314. .. _class_Vector4_operator_unminus_Vector4:
  315. - :ref:`Vector4<class_Vector4>` **operator unary-** **(** **)**
  316. Returns the negative value of the ``Vector4``. This is the same as writing ``Vector4(-v.x, -v.y, -v.z, -v.w)``. This operation flips the direction of the vector while keeping the same magnitude. With floats, the number zero can be either positive or negative.
  317. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  318. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  319. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  320. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  321. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  322. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`