Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

double2.gen.cs 53KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998
  1. //------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was generated by a tool.
  4. //
  5. // Changes to this file may cause incorrect behavior and will be lost if
  6. // the code is regenerated. To update the generation of this file, modify and re-run Unity.Mathematics.CodeGen.
  7. // </auto-generated>
  8. //------------------------------------------------------------------------------
  9. using System;
  10. using System.Runtime.CompilerServices;
  11. using System.Diagnostics;
  12. using Unity.IL2CPP.CompilerServices;
  13. #pragma warning disable 0660, 0661
  14. namespace Unity.Mathematics
  15. {
  16. /// <summary>A 2 component vector of doubles.</summary>
  17. [DebuggerTypeProxy(typeof(double2.DebuggerProxy))]
  18. [System.Serializable]
  19. [Il2CppEagerStaticClassConstruction]
  20. public partial struct double2 : System.IEquatable<double2>, IFormattable
  21. {
  22. /// <summary>x component of the vector.</summary>
  23. public double x;
  24. /// <summary>y component of the vector.</summary>
  25. public double y;
  26. /// <summary>double2 zero value.</summary>
  27. public static readonly double2 zero;
  28. /// <summary>Constructs a double2 vector from two double values.</summary>
  29. /// <param name="x">The constructed vector's x component will be set to this value.</param>
  30. /// <param name="y">The constructed vector's y component will be set to this value.</param>
  31. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  32. public double2(double x, double y)
  33. {
  34. this.x = x;
  35. this.y = y;
  36. }
  37. /// <summary>Constructs a double2 vector from a double2 vector.</summary>
  38. /// <param name="xy">The constructed vector's xy components will be set to this value.</param>
  39. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  40. public double2(double2 xy)
  41. {
  42. this.x = xy.x;
  43. this.y = xy.y;
  44. }
  45. /// <summary>Constructs a double2 vector from a single double value by assigning it to every component.</summary>
  46. /// <param name="v">double to convert to double2</param>
  47. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  48. public double2(double v)
  49. {
  50. this.x = v;
  51. this.y = v;
  52. }
  53. /// <summary>Constructs a double2 vector from a single bool value by converting it to double and assigning it to every component.</summary>
  54. /// <param name="v">bool to convert to double2</param>
  55. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  56. public double2(bool v)
  57. {
  58. this.x = v ? 1.0 : 0.0;
  59. this.y = v ? 1.0 : 0.0;
  60. }
  61. /// <summary>Constructs a double2 vector from a bool2 vector by componentwise conversion.</summary>
  62. /// <param name="v">bool2 to convert to double2</param>
  63. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  64. public double2(bool2 v)
  65. {
  66. this.x = v.x ? 1.0 : 0.0;
  67. this.y = v.y ? 1.0 : 0.0;
  68. }
  69. /// <summary>Constructs a double2 vector from a single int value by converting it to double and assigning it to every component.</summary>
  70. /// <param name="v">int to convert to double2</param>
  71. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  72. public double2(int v)
  73. {
  74. this.x = v;
  75. this.y = v;
  76. }
  77. /// <summary>Constructs a double2 vector from a int2 vector by componentwise conversion.</summary>
  78. /// <param name="v">int2 to convert to double2</param>
  79. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  80. public double2(int2 v)
  81. {
  82. this.x = v.x;
  83. this.y = v.y;
  84. }
  85. /// <summary>Constructs a double2 vector from a single uint value by converting it to double and assigning it to every component.</summary>
  86. /// <param name="v">uint to convert to double2</param>
  87. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  88. public double2(uint v)
  89. {
  90. this.x = v;
  91. this.y = v;
  92. }
  93. /// <summary>Constructs a double2 vector from a uint2 vector by componentwise conversion.</summary>
  94. /// <param name="v">uint2 to convert to double2</param>
  95. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  96. public double2(uint2 v)
  97. {
  98. this.x = v.x;
  99. this.y = v.y;
  100. }
  101. /// <summary>Constructs a double2 vector from a single half value by converting it to double and assigning it to every component.</summary>
  102. /// <param name="v">half to convert to double2</param>
  103. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  104. public double2(half v)
  105. {
  106. this.x = v;
  107. this.y = v;
  108. }
  109. /// <summary>Constructs a double2 vector from a half2 vector by componentwise conversion.</summary>
  110. /// <param name="v">half2 to convert to double2</param>
  111. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  112. public double2(half2 v)
  113. {
  114. this.x = v.x;
  115. this.y = v.y;
  116. }
  117. /// <summary>Constructs a double2 vector from a single float value by converting it to double and assigning it to every component.</summary>
  118. /// <param name="v">float to convert to double2</param>
  119. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  120. public double2(float v)
  121. {
  122. this.x = v;
  123. this.y = v;
  124. }
  125. /// <summary>Constructs a double2 vector from a float2 vector by componentwise conversion.</summary>
  126. /// <param name="v">float2 to convert to double2</param>
  127. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  128. public double2(float2 v)
  129. {
  130. this.x = v.x;
  131. this.y = v.y;
  132. }
  133. /// <summary>Implicitly converts a single double value to a double2 vector by assigning it to every component.</summary>
  134. /// <param name="v">double to convert to double2</param>
  135. /// <returns>Converted value.</returns>
  136. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  137. public static implicit operator double2(double v) { return new double2(v); }
  138. /// <summary>Explicitly converts a single bool value to a double2 vector by converting it to double and assigning it to every component.</summary>
  139. /// <param name="v">bool to convert to double2</param>
  140. /// <returns>Converted value.</returns>
  141. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  142. public static explicit operator double2(bool v) { return new double2(v); }
  143. /// <summary>Explicitly converts a bool2 vector to a double2 vector by componentwise conversion.</summary>
  144. /// <param name="v">bool2 to convert to double2</param>
  145. /// <returns>Converted value.</returns>
  146. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  147. public static explicit operator double2(bool2 v) { return new double2(v); }
  148. /// <summary>Implicitly converts a single int value to a double2 vector by converting it to double and assigning it to every component.</summary>
  149. /// <param name="v">int to convert to double2</param>
  150. /// <returns>Converted value.</returns>
  151. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  152. public static implicit operator double2(int v) { return new double2(v); }
  153. /// <summary>Implicitly converts a int2 vector to a double2 vector by componentwise conversion.</summary>
  154. /// <param name="v">int2 to convert to double2</param>
  155. /// <returns>Converted value.</returns>
  156. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  157. public static implicit operator double2(int2 v) { return new double2(v); }
  158. /// <summary>Implicitly converts a single uint value to a double2 vector by converting it to double and assigning it to every component.</summary>
  159. /// <param name="v">uint to convert to double2</param>
  160. /// <returns>Converted value.</returns>
  161. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  162. public static implicit operator double2(uint v) { return new double2(v); }
  163. /// <summary>Implicitly converts a uint2 vector to a double2 vector by componentwise conversion.</summary>
  164. /// <param name="v">uint2 to convert to double2</param>
  165. /// <returns>Converted value.</returns>
  166. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  167. public static implicit operator double2(uint2 v) { return new double2(v); }
  168. /// <summary>Implicitly converts a single half value to a double2 vector by converting it to double and assigning it to every component.</summary>
  169. /// <param name="v">half to convert to double2</param>
  170. /// <returns>Converted value.</returns>
  171. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  172. public static implicit operator double2(half v) { return new double2(v); }
  173. /// <summary>Implicitly converts a half2 vector to a double2 vector by componentwise conversion.</summary>
  174. /// <param name="v">half2 to convert to double2</param>
  175. /// <returns>Converted value.</returns>
  176. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  177. public static implicit operator double2(half2 v) { return new double2(v); }
  178. /// <summary>Implicitly converts a single float value to a double2 vector by converting it to double and assigning it to every component.</summary>
  179. /// <param name="v">float to convert to double2</param>
  180. /// <returns>Converted value.</returns>
  181. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  182. public static implicit operator double2(float v) { return new double2(v); }
  183. /// <summary>Implicitly converts a float2 vector to a double2 vector by componentwise conversion.</summary>
  184. /// <param name="v">float2 to convert to double2</param>
  185. /// <returns>Converted value.</returns>
  186. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  187. public static implicit operator double2(float2 v) { return new double2(v); }
  188. /// <summary>Returns the result of a componentwise multiplication operation on two double2 vectors.</summary>
  189. /// <param name="lhs">Left hand side double2 to use to compute componentwise multiplication.</param>
  190. /// <param name="rhs">Right hand side double2 to use to compute componentwise multiplication.</param>
  191. /// <returns>double2 result of the componentwise multiplication.</returns>
  192. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  193. public static double2 operator * (double2 lhs, double2 rhs) { return new double2 (lhs.x * rhs.x, lhs.y * rhs.y); }
  194. /// <summary>Returns the result of a componentwise multiplication operation on a double2 vector and a double value.</summary>
  195. /// <param name="lhs">Left hand side double2 to use to compute componentwise multiplication.</param>
  196. /// <param name="rhs">Right hand side double to use to compute componentwise multiplication.</param>
  197. /// <returns>double2 result of the componentwise multiplication.</returns>
  198. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  199. public static double2 operator * (double2 lhs, double rhs) { return new double2 (lhs.x * rhs, lhs.y * rhs); }
  200. /// <summary>Returns the result of a componentwise multiplication operation on a double value and a double2 vector.</summary>
  201. /// <param name="lhs">Left hand side double to use to compute componentwise multiplication.</param>
  202. /// <param name="rhs">Right hand side double2 to use to compute componentwise multiplication.</param>
  203. /// <returns>double2 result of the componentwise multiplication.</returns>
  204. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  205. public static double2 operator * (double lhs, double2 rhs) { return new double2 (lhs * rhs.x, lhs * rhs.y); }
  206. /// <summary>Returns the result of a componentwise addition operation on two double2 vectors.</summary>
  207. /// <param name="lhs">Left hand side double2 to use to compute componentwise addition.</param>
  208. /// <param name="rhs">Right hand side double2 to use to compute componentwise addition.</param>
  209. /// <returns>double2 result of the componentwise addition.</returns>
  210. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  211. public static double2 operator + (double2 lhs, double2 rhs) { return new double2 (lhs.x + rhs.x, lhs.y + rhs.y); }
  212. /// <summary>Returns the result of a componentwise addition operation on a double2 vector and a double value.</summary>
  213. /// <param name="lhs">Left hand side double2 to use to compute componentwise addition.</param>
  214. /// <param name="rhs">Right hand side double to use to compute componentwise addition.</param>
  215. /// <returns>double2 result of the componentwise addition.</returns>
  216. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  217. public static double2 operator + (double2 lhs, double rhs) { return new double2 (lhs.x + rhs, lhs.y + rhs); }
  218. /// <summary>Returns the result of a componentwise addition operation on a double value and a double2 vector.</summary>
  219. /// <param name="lhs">Left hand side double to use to compute componentwise addition.</param>
  220. /// <param name="rhs">Right hand side double2 to use to compute componentwise addition.</param>
  221. /// <returns>double2 result of the componentwise addition.</returns>
  222. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  223. public static double2 operator + (double lhs, double2 rhs) { return new double2 (lhs + rhs.x, lhs + rhs.y); }
  224. /// <summary>Returns the result of a componentwise subtraction operation on two double2 vectors.</summary>
  225. /// <param name="lhs">Left hand side double2 to use to compute componentwise subtraction.</param>
  226. /// <param name="rhs">Right hand side double2 to use to compute componentwise subtraction.</param>
  227. /// <returns>double2 result of the componentwise subtraction.</returns>
  228. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  229. public static double2 operator - (double2 lhs, double2 rhs) { return new double2 (lhs.x - rhs.x, lhs.y - rhs.y); }
  230. /// <summary>Returns the result of a componentwise subtraction operation on a double2 vector and a double value.</summary>
  231. /// <param name="lhs">Left hand side double2 to use to compute componentwise subtraction.</param>
  232. /// <param name="rhs">Right hand side double to use to compute componentwise subtraction.</param>
  233. /// <returns>double2 result of the componentwise subtraction.</returns>
  234. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  235. public static double2 operator - (double2 lhs, double rhs) { return new double2 (lhs.x - rhs, lhs.y - rhs); }
  236. /// <summary>Returns the result of a componentwise subtraction operation on a double value and a double2 vector.</summary>
  237. /// <param name="lhs">Left hand side double to use to compute componentwise subtraction.</param>
  238. /// <param name="rhs">Right hand side double2 to use to compute componentwise subtraction.</param>
  239. /// <returns>double2 result of the componentwise subtraction.</returns>
  240. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  241. public static double2 operator - (double lhs, double2 rhs) { return new double2 (lhs - rhs.x, lhs - rhs.y); }
  242. /// <summary>Returns the result of a componentwise division operation on two double2 vectors.</summary>
  243. /// <param name="lhs">Left hand side double2 to use to compute componentwise division.</param>
  244. /// <param name="rhs">Right hand side double2 to use to compute componentwise division.</param>
  245. /// <returns>double2 result of the componentwise division.</returns>
  246. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  247. public static double2 operator / (double2 lhs, double2 rhs) { return new double2 (lhs.x / rhs.x, lhs.y / rhs.y); }
  248. /// <summary>Returns the result of a componentwise division operation on a double2 vector and a double value.</summary>
  249. /// <param name="lhs">Left hand side double2 to use to compute componentwise division.</param>
  250. /// <param name="rhs">Right hand side double to use to compute componentwise division.</param>
  251. /// <returns>double2 result of the componentwise division.</returns>
  252. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  253. public static double2 operator / (double2 lhs, double rhs) { return new double2 (lhs.x / rhs, lhs.y / rhs); }
  254. /// <summary>Returns the result of a componentwise division operation on a double value and a double2 vector.</summary>
  255. /// <param name="lhs">Left hand side double to use to compute componentwise division.</param>
  256. /// <param name="rhs">Right hand side double2 to use to compute componentwise division.</param>
  257. /// <returns>double2 result of the componentwise division.</returns>
  258. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  259. public static double2 operator / (double lhs, double2 rhs) { return new double2 (lhs / rhs.x, lhs / rhs.y); }
  260. /// <summary>Returns the result of a componentwise modulus operation on two double2 vectors.</summary>
  261. /// <param name="lhs">Left hand side double2 to use to compute componentwise modulus.</param>
  262. /// <param name="rhs">Right hand side double2 to use to compute componentwise modulus.</param>
  263. /// <returns>double2 result of the componentwise modulus.</returns>
  264. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  265. public static double2 operator % (double2 lhs, double2 rhs) { return new double2 (lhs.x % rhs.x, lhs.y % rhs.y); }
  266. /// <summary>Returns the result of a componentwise modulus operation on a double2 vector and a double value.</summary>
  267. /// <param name="lhs">Left hand side double2 to use to compute componentwise modulus.</param>
  268. /// <param name="rhs">Right hand side double to use to compute componentwise modulus.</param>
  269. /// <returns>double2 result of the componentwise modulus.</returns>
  270. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  271. public static double2 operator % (double2 lhs, double rhs) { return new double2 (lhs.x % rhs, lhs.y % rhs); }
  272. /// <summary>Returns the result of a componentwise modulus operation on a double value and a double2 vector.</summary>
  273. /// <param name="lhs">Left hand side double to use to compute componentwise modulus.</param>
  274. /// <param name="rhs">Right hand side double2 to use to compute componentwise modulus.</param>
  275. /// <returns>double2 result of the componentwise modulus.</returns>
  276. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  277. public static double2 operator % (double lhs, double2 rhs) { return new double2 (lhs % rhs.x, lhs % rhs.y); }
  278. /// <summary>Returns the result of a componentwise increment operation on a double2 vector.</summary>
  279. /// <param name="val">Value to use when computing the componentwise increment.</param>
  280. /// <returns>double2 result of the componentwise increment.</returns>
  281. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  282. public static double2 operator ++ (double2 val) { return new double2 (++val.x, ++val.y); }
  283. /// <summary>Returns the result of a componentwise decrement operation on a double2 vector.</summary>
  284. /// <param name="val">Value to use when computing the componentwise decrement.</param>
  285. /// <returns>double2 result of the componentwise decrement.</returns>
  286. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  287. public static double2 operator -- (double2 val) { return new double2 (--val.x, --val.y); }
  288. /// <summary>Returns the result of a componentwise less than operation on two double2 vectors.</summary>
  289. /// <param name="lhs">Left hand side double2 to use to compute componentwise less than.</param>
  290. /// <param name="rhs">Right hand side double2 to use to compute componentwise less than.</param>
  291. /// <returns>bool2 result of the componentwise less than.</returns>
  292. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  293. public static bool2 operator < (double2 lhs, double2 rhs) { return new bool2 (lhs.x < rhs.x, lhs.y < rhs.y); }
  294. /// <summary>Returns the result of a componentwise less than operation on a double2 vector and a double value.</summary>
  295. /// <param name="lhs">Left hand side double2 to use to compute componentwise less than.</param>
  296. /// <param name="rhs">Right hand side double to use to compute componentwise less than.</param>
  297. /// <returns>bool2 result of the componentwise less than.</returns>
  298. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  299. public static bool2 operator < (double2 lhs, double rhs) { return new bool2 (lhs.x < rhs, lhs.y < rhs); }
  300. /// <summary>Returns the result of a componentwise less than operation on a double value and a double2 vector.</summary>
  301. /// <param name="lhs">Left hand side double to use to compute componentwise less than.</param>
  302. /// <param name="rhs">Right hand side double2 to use to compute componentwise less than.</param>
  303. /// <returns>bool2 result of the componentwise less than.</returns>
  304. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  305. public static bool2 operator < (double lhs, double2 rhs) { return new bool2 (lhs < rhs.x, lhs < rhs.y); }
  306. /// <summary>Returns the result of a componentwise less or equal operation on two double2 vectors.</summary>
  307. /// <param name="lhs">Left hand side double2 to use to compute componentwise less or equal.</param>
  308. /// <param name="rhs">Right hand side double2 to use to compute componentwise less or equal.</param>
  309. /// <returns>bool2 result of the componentwise less or equal.</returns>
  310. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  311. public static bool2 operator <= (double2 lhs, double2 rhs) { return new bool2 (lhs.x <= rhs.x, lhs.y <= rhs.y); }
  312. /// <summary>Returns the result of a componentwise less or equal operation on a double2 vector and a double value.</summary>
  313. /// <param name="lhs">Left hand side double2 to use to compute componentwise less or equal.</param>
  314. /// <param name="rhs">Right hand side double to use to compute componentwise less or equal.</param>
  315. /// <returns>bool2 result of the componentwise less or equal.</returns>
  316. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  317. public static bool2 operator <= (double2 lhs, double rhs) { return new bool2 (lhs.x <= rhs, lhs.y <= rhs); }
  318. /// <summary>Returns the result of a componentwise less or equal operation on a double value and a double2 vector.</summary>
  319. /// <param name="lhs">Left hand side double to use to compute componentwise less or equal.</param>
  320. /// <param name="rhs">Right hand side double2 to use to compute componentwise less or equal.</param>
  321. /// <returns>bool2 result of the componentwise less or equal.</returns>
  322. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  323. public static bool2 operator <= (double lhs, double2 rhs) { return new bool2 (lhs <= rhs.x, lhs <= rhs.y); }
  324. /// <summary>Returns the result of a componentwise greater than operation on two double2 vectors.</summary>
  325. /// <param name="lhs">Left hand side double2 to use to compute componentwise greater than.</param>
  326. /// <param name="rhs">Right hand side double2 to use to compute componentwise greater than.</param>
  327. /// <returns>bool2 result of the componentwise greater than.</returns>
  328. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  329. public static bool2 operator > (double2 lhs, double2 rhs) { return new bool2 (lhs.x > rhs.x, lhs.y > rhs.y); }
  330. /// <summary>Returns the result of a componentwise greater than operation on a double2 vector and a double value.</summary>
  331. /// <param name="lhs">Left hand side double2 to use to compute componentwise greater than.</param>
  332. /// <param name="rhs">Right hand side double to use to compute componentwise greater than.</param>
  333. /// <returns>bool2 result of the componentwise greater than.</returns>
  334. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  335. public static bool2 operator > (double2 lhs, double rhs) { return new bool2 (lhs.x > rhs, lhs.y > rhs); }
  336. /// <summary>Returns the result of a componentwise greater than operation on a double value and a double2 vector.</summary>
  337. /// <param name="lhs">Left hand side double to use to compute componentwise greater than.</param>
  338. /// <param name="rhs">Right hand side double2 to use to compute componentwise greater than.</param>
  339. /// <returns>bool2 result of the componentwise greater than.</returns>
  340. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  341. public static bool2 operator > (double lhs, double2 rhs) { return new bool2 (lhs > rhs.x, lhs > rhs.y); }
  342. /// <summary>Returns the result of a componentwise greater or equal operation on two double2 vectors.</summary>
  343. /// <param name="lhs">Left hand side double2 to use to compute componentwise greater or equal.</param>
  344. /// <param name="rhs">Right hand side double2 to use to compute componentwise greater or equal.</param>
  345. /// <returns>bool2 result of the componentwise greater or equal.</returns>
  346. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  347. public static bool2 operator >= (double2 lhs, double2 rhs) { return new bool2 (lhs.x >= rhs.x, lhs.y >= rhs.y); }
  348. /// <summary>Returns the result of a componentwise greater or equal operation on a double2 vector and a double value.</summary>
  349. /// <param name="lhs">Left hand side double2 to use to compute componentwise greater or equal.</param>
  350. /// <param name="rhs">Right hand side double to use to compute componentwise greater or equal.</param>
  351. /// <returns>bool2 result of the componentwise greater or equal.</returns>
  352. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  353. public static bool2 operator >= (double2 lhs, double rhs) { return new bool2 (lhs.x >= rhs, lhs.y >= rhs); }
  354. /// <summary>Returns the result of a componentwise greater or equal operation on a double value and a double2 vector.</summary>
  355. /// <param name="lhs">Left hand side double to use to compute componentwise greater or equal.</param>
  356. /// <param name="rhs">Right hand side double2 to use to compute componentwise greater or equal.</param>
  357. /// <returns>bool2 result of the componentwise greater or equal.</returns>
  358. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  359. public static bool2 operator >= (double lhs, double2 rhs) { return new bool2 (lhs >= rhs.x, lhs >= rhs.y); }
  360. /// <summary>Returns the result of a componentwise unary minus operation on a double2 vector.</summary>
  361. /// <param name="val">Value to use when computing the componentwise unary minus.</param>
  362. /// <returns>double2 result of the componentwise unary minus.</returns>
  363. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  364. public static double2 operator - (double2 val) { return new double2 (-val.x, -val.y); }
  365. /// <summary>Returns the result of a componentwise unary plus operation on a double2 vector.</summary>
  366. /// <param name="val">Value to use when computing the componentwise unary plus.</param>
  367. /// <returns>double2 result of the componentwise unary plus.</returns>
  368. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  369. public static double2 operator + (double2 val) { return new double2 (+val.x, +val.y); }
  370. /// <summary>Returns the result of a componentwise equality operation on two double2 vectors.</summary>
  371. /// <param name="lhs">Left hand side double2 to use to compute componentwise equality.</param>
  372. /// <param name="rhs">Right hand side double2 to use to compute componentwise equality.</param>
  373. /// <returns>bool2 result of the componentwise equality.</returns>
  374. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  375. public static bool2 operator == (double2 lhs, double2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); }
  376. /// <summary>Returns the result of a componentwise equality operation on a double2 vector and a double value.</summary>
  377. /// <param name="lhs">Left hand side double2 to use to compute componentwise equality.</param>
  378. /// <param name="rhs">Right hand side double to use to compute componentwise equality.</param>
  379. /// <returns>bool2 result of the componentwise equality.</returns>
  380. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  381. public static bool2 operator == (double2 lhs, double rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); }
  382. /// <summary>Returns the result of a componentwise equality operation on a double value and a double2 vector.</summary>
  383. /// <param name="lhs">Left hand side double to use to compute componentwise equality.</param>
  384. /// <param name="rhs">Right hand side double2 to use to compute componentwise equality.</param>
  385. /// <returns>bool2 result of the componentwise equality.</returns>
  386. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  387. public static bool2 operator == (double lhs, double2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); }
  388. /// <summary>Returns the result of a componentwise not equal operation on two double2 vectors.</summary>
  389. /// <param name="lhs">Left hand side double2 to use to compute componentwise not equal.</param>
  390. /// <param name="rhs">Right hand side double2 to use to compute componentwise not equal.</param>
  391. /// <returns>bool2 result of the componentwise not equal.</returns>
  392. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  393. public static bool2 operator != (double2 lhs, double2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); }
  394. /// <summary>Returns the result of a componentwise not equal operation on a double2 vector and a double value.</summary>
  395. /// <param name="lhs">Left hand side double2 to use to compute componentwise not equal.</param>
  396. /// <param name="rhs">Right hand side double to use to compute componentwise not equal.</param>
  397. /// <returns>bool2 result of the componentwise not equal.</returns>
  398. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  399. public static bool2 operator != (double2 lhs, double rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); }
  400. /// <summary>Returns the result of a componentwise not equal operation on a double value and a double2 vector.</summary>
  401. /// <param name="lhs">Left hand side double to use to compute componentwise not equal.</param>
  402. /// <param name="rhs">Right hand side double2 to use to compute componentwise not equal.</param>
  403. /// <returns>bool2 result of the componentwise not equal.</returns>
  404. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  405. public static bool2 operator != (double lhs, double2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); }
  406. /// <summary>Swizzles the vector.</summary>
  407. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  408. public double4 xxxx
  409. {
  410. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  411. get { return new double4(x, x, x, x); }
  412. }
  413. /// <summary>Swizzles the vector.</summary>
  414. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  415. public double4 xxxy
  416. {
  417. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  418. get { return new double4(x, x, x, y); }
  419. }
  420. /// <summary>Swizzles the vector.</summary>
  421. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  422. public double4 xxyx
  423. {
  424. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  425. get { return new double4(x, x, y, x); }
  426. }
  427. /// <summary>Swizzles the vector.</summary>
  428. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  429. public double4 xxyy
  430. {
  431. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  432. get { return new double4(x, x, y, y); }
  433. }
  434. /// <summary>Swizzles the vector.</summary>
  435. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  436. public double4 xyxx
  437. {
  438. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  439. get { return new double4(x, y, x, x); }
  440. }
  441. /// <summary>Swizzles the vector.</summary>
  442. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  443. public double4 xyxy
  444. {
  445. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  446. get { return new double4(x, y, x, y); }
  447. }
  448. /// <summary>Swizzles the vector.</summary>
  449. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  450. public double4 xyyx
  451. {
  452. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  453. get { return new double4(x, y, y, x); }
  454. }
  455. /// <summary>Swizzles the vector.</summary>
  456. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  457. public double4 xyyy
  458. {
  459. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  460. get { return new double4(x, y, y, y); }
  461. }
  462. /// <summary>Swizzles the vector.</summary>
  463. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  464. public double4 yxxx
  465. {
  466. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  467. get { return new double4(y, x, x, x); }
  468. }
  469. /// <summary>Swizzles the vector.</summary>
  470. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  471. public double4 yxxy
  472. {
  473. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  474. get { return new double4(y, x, x, y); }
  475. }
  476. /// <summary>Swizzles the vector.</summary>
  477. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  478. public double4 yxyx
  479. {
  480. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  481. get { return new double4(y, x, y, x); }
  482. }
  483. /// <summary>Swizzles the vector.</summary>
  484. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  485. public double4 yxyy
  486. {
  487. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  488. get { return new double4(y, x, y, y); }
  489. }
  490. /// <summary>Swizzles the vector.</summary>
  491. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  492. public double4 yyxx
  493. {
  494. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  495. get { return new double4(y, y, x, x); }
  496. }
  497. /// <summary>Swizzles the vector.</summary>
  498. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  499. public double4 yyxy
  500. {
  501. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  502. get { return new double4(y, y, x, y); }
  503. }
  504. /// <summary>Swizzles the vector.</summary>
  505. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  506. public double4 yyyx
  507. {
  508. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  509. get { return new double4(y, y, y, x); }
  510. }
  511. /// <summary>Swizzles the vector.</summary>
  512. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  513. public double4 yyyy
  514. {
  515. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  516. get { return new double4(y, y, y, y); }
  517. }
  518. /// <summary>Swizzles the vector.</summary>
  519. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  520. public double3 xxx
  521. {
  522. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  523. get { return new double3(x, x, x); }
  524. }
  525. /// <summary>Swizzles the vector.</summary>
  526. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  527. public double3 xxy
  528. {
  529. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  530. get { return new double3(x, x, y); }
  531. }
  532. /// <summary>Swizzles the vector.</summary>
  533. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  534. public double3 xyx
  535. {
  536. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  537. get { return new double3(x, y, x); }
  538. }
  539. /// <summary>Swizzles the vector.</summary>
  540. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  541. public double3 xyy
  542. {
  543. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  544. get { return new double3(x, y, y); }
  545. }
  546. /// <summary>Swizzles the vector.</summary>
  547. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  548. public double3 yxx
  549. {
  550. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  551. get { return new double3(y, x, x); }
  552. }
  553. /// <summary>Swizzles the vector.</summary>
  554. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  555. public double3 yxy
  556. {
  557. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  558. get { return new double3(y, x, y); }
  559. }
  560. /// <summary>Swizzles the vector.</summary>
  561. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  562. public double3 yyx
  563. {
  564. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  565. get { return new double3(y, y, x); }
  566. }
  567. /// <summary>Swizzles the vector.</summary>
  568. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  569. public double3 yyy
  570. {
  571. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  572. get { return new double3(y, y, y); }
  573. }
  574. /// <summary>Swizzles the vector.</summary>
  575. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  576. public double2 xx
  577. {
  578. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  579. get { return new double2(x, x); }
  580. }
  581. /// <summary>Swizzles the vector.</summary>
  582. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  583. public double2 xy
  584. {
  585. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  586. get { return new double2(x, y); }
  587. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  588. set { x = value.x; y = value.y; }
  589. }
  590. /// <summary>Swizzles the vector.</summary>
  591. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  592. public double2 yx
  593. {
  594. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  595. get { return new double2(y, x); }
  596. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  597. set { y = value.x; x = value.y; }
  598. }
  599. /// <summary>Swizzles the vector.</summary>
  600. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  601. public double2 yy
  602. {
  603. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  604. get { return new double2(y, y); }
  605. }
  606. /// <summary>Returns the double element at a specified index.</summary>
  607. unsafe public double this[int index]
  608. {
  609. get
  610. {
  611. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  612. if ((uint)index >= 2)
  613. throw new System.ArgumentException("index must be between[0...1]");
  614. #endif
  615. fixed (double2* array = &this) { return ((double*)array)[index]; }
  616. }
  617. set
  618. {
  619. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  620. if ((uint)index >= 2)
  621. throw new System.ArgumentException("index must be between[0...1]");
  622. #endif
  623. fixed (double* array = &x) { array[index] = value; }
  624. }
  625. }
  626. /// <summary>Returns true if the double2 is equal to a given double2, false otherwise.</summary>
  627. /// <param name="rhs">Right hand side argument to compare equality with.</param>
  628. /// <returns>The result of the equality comparison.</returns>
  629. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  630. public bool Equals(double2 rhs) { return x == rhs.x && y == rhs.y; }
  631. /// <summary>Returns true if the double2 is equal to a given double2, false otherwise.</summary>
  632. /// <param name="o">Right hand side argument to compare equality with.</param>
  633. /// <returns>The result of the equality comparison.</returns>
  634. public override bool Equals(object o) { return o is double2 converted && Equals(converted); }
  635. /// <summary>Returns a hash code for the double2.</summary>
  636. /// <returns>The computed hash code.</returns>
  637. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  638. public override int GetHashCode() { return (int)math.hash(this); }
  639. /// <summary>Returns a string representation of the double2.</summary>
  640. /// <returns>String representation of the value.</returns>
  641. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  642. public override string ToString()
  643. {
  644. return string.Format("double2({0}, {1})", x, y);
  645. }
  646. /// <summary>Returns a string representation of the double2 using a specified format and culture-specific format information.</summary>
  647. /// <param name="format">Format string to use during string formatting.</param>
  648. /// <param name="formatProvider">Format provider to use during string formatting.</param>
  649. /// <returns>String representation of the value.</returns>
  650. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  651. public string ToString(string format, IFormatProvider formatProvider)
  652. {
  653. return string.Format("double2({0}, {1})", x.ToString(format, formatProvider), y.ToString(format, formatProvider));
  654. }
  655. internal sealed class DebuggerProxy
  656. {
  657. public double x;
  658. public double y;
  659. public DebuggerProxy(double2 v)
  660. {
  661. x = v.x;
  662. y = v.y;
  663. }
  664. }
  665. }
  666. public static partial class math
  667. {
  668. /// <summary>Returns a double2 vector constructed from two double values.</summary>
  669. /// <param name="x">The constructed vector's x component will be set to this value.</param>
  670. /// <param name="y">The constructed vector's y component will be set to this value.</param>
  671. /// <returns>double2 constructed from arguments.</returns>
  672. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  673. public static double2 double2(double x, double y) { return new double2(x, y); }
  674. /// <summary>Returns a double2 vector constructed from a double2 vector.</summary>
  675. /// <param name="xy">The constructed vector's xy components will be set to this value.</param>
  676. /// <returns>double2 constructed from arguments.</returns>
  677. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  678. public static double2 double2(double2 xy) { return new double2(xy); }
  679. /// <summary>Returns a double2 vector constructed from a single double value by assigning it to every component.</summary>
  680. /// <param name="v">double to convert to double2</param>
  681. /// <returns>Converted value.</returns>
  682. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  683. public static double2 double2(double v) { return new double2(v); }
  684. /// <summary>Returns a double2 vector constructed from a single bool value by converting it to double and assigning it to every component.</summary>
  685. /// <param name="v">bool to convert to double2</param>
  686. /// <returns>Converted value.</returns>
  687. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  688. public static double2 double2(bool v) { return new double2(v); }
  689. /// <summary>Return a double2 vector constructed from a bool2 vector by componentwise conversion.</summary>
  690. /// <param name="v">bool2 to convert to double2</param>
  691. /// <returns>Converted value.</returns>
  692. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  693. public static double2 double2(bool2 v) { return new double2(v); }
  694. /// <summary>Returns a double2 vector constructed from a single int value by converting it to double and assigning it to every component.</summary>
  695. /// <param name="v">int to convert to double2</param>
  696. /// <returns>Converted value.</returns>
  697. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  698. public static double2 double2(int v) { return new double2(v); }
  699. /// <summary>Return a double2 vector constructed from a int2 vector by componentwise conversion.</summary>
  700. /// <param name="v">int2 to convert to double2</param>
  701. /// <returns>Converted value.</returns>
  702. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  703. public static double2 double2(int2 v) { return new double2(v); }
  704. /// <summary>Returns a double2 vector constructed from a single uint value by converting it to double and assigning it to every component.</summary>
  705. /// <param name="v">uint to convert to double2</param>
  706. /// <returns>Converted value.</returns>
  707. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  708. public static double2 double2(uint v) { return new double2(v); }
  709. /// <summary>Return a double2 vector constructed from a uint2 vector by componentwise conversion.</summary>
  710. /// <param name="v">uint2 to convert to double2</param>
  711. /// <returns>Converted value.</returns>
  712. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  713. public static double2 double2(uint2 v) { return new double2(v); }
  714. /// <summary>Returns a double2 vector constructed from a single half value by converting it to double and assigning it to every component.</summary>
  715. /// <param name="v">half to convert to double2</param>
  716. /// <returns>Converted value.</returns>
  717. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  718. public static double2 double2(half v) { return new double2(v); }
  719. /// <summary>Return a double2 vector constructed from a half2 vector by componentwise conversion.</summary>
  720. /// <param name="v">half2 to convert to double2</param>
  721. /// <returns>Converted value.</returns>
  722. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  723. public static double2 double2(half2 v) { return new double2(v); }
  724. /// <summary>Returns a double2 vector constructed from a single float value by converting it to double and assigning it to every component.</summary>
  725. /// <param name="v">float to convert to double2</param>
  726. /// <returns>Converted value.</returns>
  727. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  728. public static double2 double2(float v) { return new double2(v); }
  729. /// <summary>Return a double2 vector constructed from a float2 vector by componentwise conversion.</summary>
  730. /// <param name="v">float2 to convert to double2</param>
  731. /// <returns>Converted value.</returns>
  732. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  733. public static double2 double2(float2 v) { return new double2(v); }
  734. /// <summary>Returns a uint hash code of a double2 vector.</summary>
  735. /// <param name="v">Vector value to hash.</param>
  736. /// <returns>uint hash of the argument.</returns>
  737. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  738. public static uint hash(double2 v)
  739. {
  740. return csum(fold_to_uint(v) * uint2(0x9536A0F5u, 0xAF816615u)) + 0x9AF8D62Du;
  741. }
  742. /// <summary>
  743. /// Returns a uint2 vector hash code of a double2 vector.
  744. /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
  745. /// that are only reduced to a narrow uint hash at the very end instead of at every step.
  746. /// </summary>
  747. /// <param name="v">Vector value to hash.</param>
  748. /// <returns>uint2 hash of the argument.</returns>
  749. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  750. public static uint2 hashwide(double2 v)
  751. {
  752. return (fold_to_uint(v) * uint2(0xE3600729u, 0x5F17300Du)) + 0x670D6809u;
  753. }
  754. /// <summary>Returns the result of specified shuffling of the components from two double2 vectors into a double value.</summary>
  755. /// <param name="left">double2 to use as the left argument of the shuffle operation.</param>
  756. /// <param name="right">double2 to use as the right argument of the shuffle operation.</param>
  757. /// <param name="x">The ShuffleComponent to use when setting the resulting double.</param>
  758. /// <returns>double result of the shuffle operation.</returns>
  759. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  760. public static double shuffle(double2 left, double2 right, ShuffleComponent x)
  761. {
  762. return select_shuffle_component(left, right, x);
  763. }
  764. /// <summary>Returns the result of specified shuffling of the components from two double2 vectors into a double2 vector.</summary>
  765. /// <param name="left">double2 to use as the left argument of the shuffle operation.</param>
  766. /// <param name="right">double2 to use as the right argument of the shuffle operation.</param>
  767. /// <param name="x">The ShuffleComponent to use when setting the resulting double2 x component.</param>
  768. /// <param name="y">The ShuffleComponent to use when setting the resulting double2 y component.</param>
  769. /// <returns>double2 result of the shuffle operation.</returns>
  770. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  771. public static double2 shuffle(double2 left, double2 right, ShuffleComponent x, ShuffleComponent y)
  772. {
  773. return double2(
  774. select_shuffle_component(left, right, x),
  775. select_shuffle_component(left, right, y));
  776. }
  777. /// <summary>Returns the result of specified shuffling of the components from two double2 vectors into a double3 vector.</summary>
  778. /// <param name="left">double2 to use as the left argument of the shuffle operation.</param>
  779. /// <param name="right">double2 to use as the right argument of the shuffle operation.</param>
  780. /// <param name="x">The ShuffleComponent to use when setting the resulting double3 x component.</param>
  781. /// <param name="y">The ShuffleComponent to use when setting the resulting double3 y component.</param>
  782. /// <param name="z">The ShuffleComponent to use when setting the resulting double3 z component.</param>
  783. /// <returns>double3 result of the shuffle operation.</returns>
  784. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  785. public static double3 shuffle(double2 left, double2 right, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z)
  786. {
  787. return double3(
  788. select_shuffle_component(left, right, x),
  789. select_shuffle_component(left, right, y),
  790. select_shuffle_component(left, right, z));
  791. }
  792. /// <summary>Returns the result of specified shuffling of the components from two double2 vectors into a double4 vector.</summary>
  793. /// <param name="left">double2 to use as the left argument of the shuffle operation.</param>
  794. /// <param name="right">double2 to use as the right argument of the shuffle operation.</param>
  795. /// <param name="x">The ShuffleComponent to use when setting the resulting double4 x component.</param>
  796. /// <param name="y">The ShuffleComponent to use when setting the resulting double4 y component.</param>
  797. /// <param name="z">The ShuffleComponent to use when setting the resulting double4 z component.</param>
  798. /// <param name="w">The ShuffleComponent to use when setting the resulting double4 w component.</param>
  799. /// <returns>double4 result of the shuffle operation.</returns>
  800. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  801. public static double4 shuffle(double2 left, double2 right, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z, ShuffleComponent w)
  802. {
  803. return double4(
  804. select_shuffle_component(left, right, x),
  805. select_shuffle_component(left, right, y),
  806. select_shuffle_component(left, right, z),
  807. select_shuffle_component(left, right, w));
  808. }
  809. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  810. internal static double select_shuffle_component(double2 a, double2 b, ShuffleComponent component)
  811. {
  812. switch(component)
  813. {
  814. case ShuffleComponent.LeftX:
  815. return a.x;
  816. case ShuffleComponent.LeftY:
  817. return a.y;
  818. case ShuffleComponent.RightX:
  819. return b.x;
  820. case ShuffleComponent.RightY:
  821. return b.y;
  822. default:
  823. throw new System.ArgumentException("Invalid shuffle component: " + component);
  824. }
  825. }
  826. }
  827. }