double2.gen.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  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.
  7. // </auto-generated>
  8. //------------------------------------------------------------------------------
  9. using System;
  10. using System.Runtime.CompilerServices;
  11. using System.Diagnostics;
  12. #pragma warning disable 0660, 0661
  13. namespace Unity.Mathematics
  14. {
  15. [DebuggerTypeProxy(typeof(double2.DebuggerProxy))]
  16. [System.Serializable]
  17. public partial struct double2 : System.IEquatable<double2>, IFormattable
  18. {
  19. public double x;
  20. public double y;
  21. /// <summary>double2 zero value.</summary>
  22. public static readonly double2 zero;
  23. /// <summary>Constructs a double2 vector from two double values.</summary>
  24. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  25. public double2(double x, double y)
  26. {
  27. this.x = x;
  28. this.y = y;
  29. }
  30. /// <summary>Constructs a double2 vector from a double2 vector.</summary>
  31. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  32. public double2(double2 xy)
  33. {
  34. this.x = xy.x;
  35. this.y = xy.y;
  36. }
  37. /// <summary>Constructs a double2 vector from a single double value by assigning it to every component.</summary>
  38. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  39. public double2(double v)
  40. {
  41. this.x = v;
  42. this.y = v;
  43. }
  44. /// <summary>Constructs a double2 vector from a single bool value by converting it to double and assigning it to every component.</summary>
  45. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  46. public double2(bool v)
  47. {
  48. this.x = v ? 1.0 : 0.0;
  49. this.y = v ? 1.0 : 0.0;
  50. }
  51. /// <summary>Constructs a double2 vector from a bool2 vector by componentwise conversion.</summary>
  52. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  53. public double2(bool2 v)
  54. {
  55. this.x = v.x ? 1.0 : 0.0;
  56. this.y = v.y ? 1.0 : 0.0;
  57. }
  58. /// <summary>Constructs a double2 vector from a single int value by converting it to double and assigning it to every component.</summary>
  59. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  60. public double2(int v)
  61. {
  62. this.x = v;
  63. this.y = v;
  64. }
  65. /// <summary>Constructs a double2 vector from a int2 vector by componentwise conversion.</summary>
  66. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  67. public double2(int2 v)
  68. {
  69. this.x = v.x;
  70. this.y = v.y;
  71. }
  72. /// <summary>Constructs a double2 vector from a single uint value by converting it to double and assigning it to every component.</summary>
  73. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  74. public double2(uint v)
  75. {
  76. this.x = v;
  77. this.y = v;
  78. }
  79. /// <summary>Constructs a double2 vector from a uint2 vector by componentwise conversion.</summary>
  80. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  81. public double2(uint2 v)
  82. {
  83. this.x = v.x;
  84. this.y = v.y;
  85. }
  86. /// <summary>Constructs a double2 vector from a single half value by converting it to double and assigning it to every component.</summary>
  87. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  88. public double2(half v)
  89. {
  90. this.x = v;
  91. this.y = v;
  92. }
  93. /// <summary>Constructs a double2 vector from a half2 vector by componentwise conversion.</summary>
  94. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  95. public double2(half2 v)
  96. {
  97. this.x = v.x;
  98. this.y = v.y;
  99. }
  100. /// <summary>Constructs a double2 vector from a single float value by converting it to double and assigning it to every component.</summary>
  101. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  102. public double2(float v)
  103. {
  104. this.x = v;
  105. this.y = v;
  106. }
  107. /// <summary>Constructs a double2 vector from a float2 vector by componentwise conversion.</summary>
  108. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  109. public double2(float2 v)
  110. {
  111. this.x = v.x;
  112. this.y = v.y;
  113. }
  114. /// <summary>Implicitly converts a single double value to a double2 vector by assigning it to every component.</summary>
  115. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  116. public static implicit operator double2(double v) { return new double2(v); }
  117. /// <summary>Explicitly converts a single bool value to a double2 vector by converting it to double and assigning it to every component.</summary>
  118. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  119. public static explicit operator double2(bool v) { return new double2(v); }
  120. /// <summary>Explicitly converts a bool2 vector to a double2 vector by componentwise conversion.</summary>
  121. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  122. public static explicit operator double2(bool2 v) { return new double2(v); }
  123. /// <summary>Implicitly converts a single int value to a double2 vector by converting it to double and assigning it to every component.</summary>
  124. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  125. public static implicit operator double2(int v) { return new double2(v); }
  126. /// <summary>Implicitly converts a int2 vector to a double2 vector by componentwise conversion.</summary>
  127. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  128. public static implicit operator double2(int2 v) { return new double2(v); }
  129. /// <summary>Implicitly converts a single uint value to a double2 vector by converting it to double and assigning it to every component.</summary>
  130. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  131. public static implicit operator double2(uint v) { return new double2(v); }
  132. /// <summary>Implicitly converts a uint2 vector to a double2 vector by componentwise conversion.</summary>
  133. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  134. public static implicit operator double2(uint2 v) { return new double2(v); }
  135. /// <summary>Implicitly converts a single half value to a double2 vector by converting it to double and assigning it to every component.</summary>
  136. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  137. public static implicit operator double2(half v) { return new double2(v); }
  138. /// <summary>Implicitly converts a half2 vector to a double2 vector by componentwise conversion.</summary>
  139. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  140. public static implicit operator double2(half2 v) { return new double2(v); }
  141. /// <summary>Implicitly converts a single float value to a double2 vector by converting it to double and assigning it to every component.</summary>
  142. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  143. public static implicit operator double2(float v) { return new double2(v); }
  144. /// <summary>Implicitly converts a float2 vector to a double2 vector by componentwise conversion.</summary>
  145. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  146. public static implicit operator double2(float2 v) { return new double2(v); }
  147. /// <summary>Returns the result of a componentwise multiplication operation on two double2 vectors.</summary>
  148. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  149. public static double2 operator * (double2 lhs, double2 rhs) { return new double2 (lhs.x * rhs.x, lhs.y * rhs.y); }
  150. /// <summary>Returns the result of a componentwise multiplication operation on a double2 vector and a double value.</summary>
  151. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  152. public static double2 operator * (double2 lhs, double rhs) { return new double2 (lhs.x * rhs, lhs.y * rhs); }
  153. /// <summary>Returns the result of a componentwise multiplication operation on a double value and a double2 vector.</summary>
  154. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  155. public static double2 operator * (double lhs, double2 rhs) { return new double2 (lhs * rhs.x, lhs * rhs.y); }
  156. /// <summary>Returns the result of a componentwise addition operation on two double2 vectors.</summary>
  157. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  158. public static double2 operator + (double2 lhs, double2 rhs) { return new double2 (lhs.x + rhs.x, lhs.y + rhs.y); }
  159. /// <summary>Returns the result of a componentwise addition operation on a double2 vector and a double value.</summary>
  160. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  161. public static double2 operator + (double2 lhs, double rhs) { return new double2 (lhs.x + rhs, lhs.y + rhs); }
  162. /// <summary>Returns the result of a componentwise addition operation on a double value and a double2 vector.</summary>
  163. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  164. public static double2 operator + (double lhs, double2 rhs) { return new double2 (lhs + rhs.x, lhs + rhs.y); }
  165. /// <summary>Returns the result of a componentwise subtraction operation on two double2 vectors.</summary>
  166. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  167. public static double2 operator - (double2 lhs, double2 rhs) { return new double2 (lhs.x - rhs.x, lhs.y - rhs.y); }
  168. /// <summary>Returns the result of a componentwise subtraction operation on a double2 vector and a double value.</summary>
  169. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  170. public static double2 operator - (double2 lhs, double rhs) { return new double2 (lhs.x - rhs, lhs.y - rhs); }
  171. /// <summary>Returns the result of a componentwise subtraction operation on a double value and a double2 vector.</summary>
  172. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  173. public static double2 operator - (double lhs, double2 rhs) { return new double2 (lhs - rhs.x, lhs - rhs.y); }
  174. /// <summary>Returns the result of a componentwise division operation on two double2 vectors.</summary>
  175. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  176. public static double2 operator / (double2 lhs, double2 rhs) { return new double2 (lhs.x / rhs.x, lhs.y / rhs.y); }
  177. /// <summary>Returns the result of a componentwise division operation on a double2 vector and a double value.</summary>
  178. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  179. public static double2 operator / (double2 lhs, double rhs) { return new double2 (lhs.x / rhs, lhs.y / rhs); }
  180. /// <summary>Returns the result of a componentwise division operation on a double value and a double2 vector.</summary>
  181. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  182. public static double2 operator / (double lhs, double2 rhs) { return new double2 (lhs / rhs.x, lhs / rhs.y); }
  183. /// <summary>Returns the result of a componentwise modulus operation on two double2 vectors.</summary>
  184. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  185. public static double2 operator % (double2 lhs, double2 rhs) { return new double2 (lhs.x % rhs.x, lhs.y % rhs.y); }
  186. /// <summary>Returns the result of a componentwise modulus operation on a double2 vector and a double value.</summary>
  187. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  188. public static double2 operator % (double2 lhs, double rhs) { return new double2 (lhs.x % rhs, lhs.y % rhs); }
  189. /// <summary>Returns the result of a componentwise modulus operation on a double value and a double2 vector.</summary>
  190. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  191. public static double2 operator % (double lhs, double2 rhs) { return new double2 (lhs % rhs.x, lhs % rhs.y); }
  192. /// <summary>Returns the result of a componentwise increment operation on a double2 vector.</summary>
  193. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  194. public static double2 operator ++ (double2 val) { return new double2 (++val.x, ++val.y); }
  195. /// <summary>Returns the result of a componentwise decrement operation on a double2 vector.</summary>
  196. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  197. public static double2 operator -- (double2 val) { return new double2 (--val.x, --val.y); }
  198. /// <summary>Returns the result of a componentwise less than operation on two double2 vectors.</summary>
  199. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  200. public static bool2 operator < (double2 lhs, double2 rhs) { return new bool2 (lhs.x < rhs.x, lhs.y < rhs.y); }
  201. /// <summary>Returns the result of a componentwise less than operation on a double2 vector and a double value.</summary>
  202. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  203. public static bool2 operator < (double2 lhs, double rhs) { return new bool2 (lhs.x < rhs, lhs.y < rhs); }
  204. /// <summary>Returns the result of a componentwise less than operation on a double value and a double2 vector.</summary>
  205. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  206. public static bool2 operator < (double lhs, double2 rhs) { return new bool2 (lhs < rhs.x, lhs < rhs.y); }
  207. /// <summary>Returns the result of a componentwise less or equal operation on two double2 vectors.</summary>
  208. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  209. public static bool2 operator <= (double2 lhs, double2 rhs) { return new bool2 (lhs.x <= rhs.x, lhs.y <= rhs.y); }
  210. /// <summary>Returns the result of a componentwise less or equal operation on a double2 vector and a double value.</summary>
  211. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  212. public static bool2 operator <= (double2 lhs, double rhs) { return new bool2 (lhs.x <= rhs, lhs.y <= rhs); }
  213. /// <summary>Returns the result of a componentwise less or equal operation on a double value and a double2 vector.</summary>
  214. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  215. public static bool2 operator <= (double lhs, double2 rhs) { return new bool2 (lhs <= rhs.x, lhs <= rhs.y); }
  216. /// <summary>Returns the result of a componentwise greater than operation on two double2 vectors.</summary>
  217. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  218. public static bool2 operator > (double2 lhs, double2 rhs) { return new bool2 (lhs.x > rhs.x, lhs.y > rhs.y); }
  219. /// <summary>Returns the result of a componentwise greater than operation on a double2 vector and a double value.</summary>
  220. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  221. public static bool2 operator > (double2 lhs, double rhs) { return new bool2 (lhs.x > rhs, lhs.y > rhs); }
  222. /// <summary>Returns the result of a componentwise greater than operation on a double value and a double2 vector.</summary>
  223. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  224. public static bool2 operator > (double lhs, double2 rhs) { return new bool2 (lhs > rhs.x, lhs > rhs.y); }
  225. /// <summary>Returns the result of a componentwise greater or equal operation on two double2 vectors.</summary>
  226. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  227. public static bool2 operator >= (double2 lhs, double2 rhs) { return new bool2 (lhs.x >= rhs.x, lhs.y >= rhs.y); }
  228. /// <summary>Returns the result of a componentwise greater or equal operation on a double2 vector and a double value.</summary>
  229. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  230. public static bool2 operator >= (double2 lhs, double rhs) { return new bool2 (lhs.x >= rhs, lhs.y >= rhs); }
  231. /// <summary>Returns the result of a componentwise greater or equal operation on a double value and a double2 vector.</summary>
  232. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  233. public static bool2 operator >= (double lhs, double2 rhs) { return new bool2 (lhs >= rhs.x, lhs >= rhs.y); }
  234. /// <summary>Returns the result of a componentwise unary minus operation on a double2 vector.</summary>
  235. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  236. public static double2 operator - (double2 val) { return new double2 (-val.x, -val.y); }
  237. /// <summary>Returns the result of a componentwise unary plus operation on a double2 vector.</summary>
  238. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  239. public static double2 operator + (double2 val) { return new double2 (+val.x, +val.y); }
  240. /// <summary>Returns the result of a componentwise equality operation on two double2 vectors.</summary>
  241. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  242. public static bool2 operator == (double2 lhs, double2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); }
  243. /// <summary>Returns the result of a componentwise equality operation on a double2 vector and a double value.</summary>
  244. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  245. public static bool2 operator == (double2 lhs, double rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); }
  246. /// <summary>Returns the result of a componentwise equality operation on a double value and a double2 vector.</summary>
  247. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  248. public static bool2 operator == (double lhs, double2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); }
  249. /// <summary>Returns the result of a componentwise not equal operation on two double2 vectors.</summary>
  250. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  251. public static bool2 operator != (double2 lhs, double2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); }
  252. /// <summary>Returns the result of a componentwise not equal operation on a double2 vector and a double value.</summary>
  253. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  254. public static bool2 operator != (double2 lhs, double rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); }
  255. /// <summary>Returns the result of a componentwise not equal operation on a double value and a double2 vector.</summary>
  256. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  257. public static bool2 operator != (double lhs, double2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); }
  258. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  259. public double4 xxxx
  260. {
  261. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  262. get { return new double4(x, x, x, x); }
  263. }
  264. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  265. public double4 xxxy
  266. {
  267. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  268. get { return new double4(x, x, x, y); }
  269. }
  270. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  271. public double4 xxyx
  272. {
  273. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  274. get { return new double4(x, x, y, x); }
  275. }
  276. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  277. public double4 xxyy
  278. {
  279. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  280. get { return new double4(x, x, y, y); }
  281. }
  282. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  283. public double4 xyxx
  284. {
  285. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  286. get { return new double4(x, y, x, x); }
  287. }
  288. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  289. public double4 xyxy
  290. {
  291. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  292. get { return new double4(x, y, x, y); }
  293. }
  294. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  295. public double4 xyyx
  296. {
  297. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  298. get { return new double4(x, y, y, x); }
  299. }
  300. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  301. public double4 xyyy
  302. {
  303. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  304. get { return new double4(x, y, y, y); }
  305. }
  306. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  307. public double4 yxxx
  308. {
  309. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  310. get { return new double4(y, x, x, x); }
  311. }
  312. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  313. public double4 yxxy
  314. {
  315. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  316. get { return new double4(y, x, x, y); }
  317. }
  318. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  319. public double4 yxyx
  320. {
  321. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  322. get { return new double4(y, x, y, x); }
  323. }
  324. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  325. public double4 yxyy
  326. {
  327. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  328. get { return new double4(y, x, y, y); }
  329. }
  330. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  331. public double4 yyxx
  332. {
  333. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  334. get { return new double4(y, y, x, x); }
  335. }
  336. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  337. public double4 yyxy
  338. {
  339. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  340. get { return new double4(y, y, x, y); }
  341. }
  342. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  343. public double4 yyyx
  344. {
  345. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  346. get { return new double4(y, y, y, x); }
  347. }
  348. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  349. public double4 yyyy
  350. {
  351. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  352. get { return new double4(y, y, y, y); }
  353. }
  354. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  355. public double3 xxx
  356. {
  357. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  358. get { return new double3(x, x, x); }
  359. }
  360. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  361. public double3 xxy
  362. {
  363. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  364. get { return new double3(x, x, y); }
  365. }
  366. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  367. public double3 xyx
  368. {
  369. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  370. get { return new double3(x, y, x); }
  371. }
  372. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  373. public double3 xyy
  374. {
  375. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  376. get { return new double3(x, y, y); }
  377. }
  378. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  379. public double3 yxx
  380. {
  381. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  382. get { return new double3(y, x, x); }
  383. }
  384. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  385. public double3 yxy
  386. {
  387. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  388. get { return new double3(y, x, y); }
  389. }
  390. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  391. public double3 yyx
  392. {
  393. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  394. get { return new double3(y, y, x); }
  395. }
  396. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  397. public double3 yyy
  398. {
  399. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  400. get { return new double3(y, y, y); }
  401. }
  402. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  403. public double2 xx
  404. {
  405. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  406. get { return new double2(x, x); }
  407. }
  408. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  409. public double2 xy
  410. {
  411. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  412. get { return new double2(x, y); }
  413. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  414. set { x = value.x; y = value.y; }
  415. }
  416. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  417. public double2 yx
  418. {
  419. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  420. get { return new double2(y, x); }
  421. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  422. set { y = value.x; x = value.y; }
  423. }
  424. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  425. public double2 yy
  426. {
  427. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  428. get { return new double2(y, y); }
  429. }
  430. /// <summary>Returns the double element at a specified index.</summary>
  431. unsafe public double this[int index]
  432. {
  433. get
  434. {
  435. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  436. if ((uint)index >= 2)
  437. throw new System.ArgumentException("index must be between[0...1]");
  438. #endif
  439. fixed (double2* array = &this) { return ((double*)array)[index]; }
  440. }
  441. set
  442. {
  443. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  444. if ((uint)index >= 2)
  445. throw new System.ArgumentException("index must be between[0...1]");
  446. #endif
  447. fixed (double* array = &x) { array[index] = value; }
  448. }
  449. }
  450. /// <summary>Returns true if the double2 is equal to a given double2, false otherwise.</summary>
  451. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  452. public bool Equals(double2 rhs) { return x == rhs.x && y == rhs.y; }
  453. /// <summary>Returns true if the double2 is equal to a given double2, false otherwise.</summary>
  454. public override bool Equals(object o) { return Equals((double2)o); }
  455. /// <summary>Returns a hash code for the double2.</summary>
  456. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  457. public override int GetHashCode() { return (int)math.hash(this); }
  458. /// <summary>Returns a string representation of the double2.</summary>
  459. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  460. public override string ToString()
  461. {
  462. return string.Format("double2({0}, {1})", x, y);
  463. }
  464. /// <summary>Returns a string representation of the double2 using a specified format and culture-specific format information.</summary>
  465. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  466. public string ToString(string format, IFormatProvider formatProvider)
  467. {
  468. return string.Format("double2({0}, {1})", x.ToString(format, formatProvider), y.ToString(format, formatProvider));
  469. }
  470. internal sealed class DebuggerProxy
  471. {
  472. public double x;
  473. public double y;
  474. public DebuggerProxy(double2 v)
  475. {
  476. x = v.x;
  477. y = v.y;
  478. }
  479. }
  480. }
  481. public static partial class math
  482. {
  483. /// <summary>Returns a double2 vector constructed from two double values.</summary>
  484. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  485. public static double2 double2(double x, double y) { return new double2(x, y); }
  486. /// <summary>Returns a double2 vector constructed from a double2 vector.</summary>
  487. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  488. public static double2 double2(double2 xy) { return new double2(xy); }
  489. /// <summary>Returns a double2 vector constructed from a single double value by assigning it to every component.</summary>
  490. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  491. public static double2 double2(double v) { return new double2(v); }
  492. /// <summary>Returns a double2 vector constructed from a single bool value by converting it to double and assigning it to every component.</summary>
  493. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  494. public static double2 double2(bool v) { return new double2(v); }
  495. /// <summary>Return a double2 vector constructed from a bool2 vector by componentwise conversion.</summary>
  496. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  497. public static double2 double2(bool2 v) { return new double2(v); }
  498. /// <summary>Returns a double2 vector constructed from a single int value by converting it to double and assigning it to every component.</summary>
  499. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  500. public static double2 double2(int v) { return new double2(v); }
  501. /// <summary>Return a double2 vector constructed from a int2 vector by componentwise conversion.</summary>
  502. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  503. public static double2 double2(int2 v) { return new double2(v); }
  504. /// <summary>Returns a double2 vector constructed from a single uint value by converting it to double and assigning it to every component.</summary>
  505. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  506. public static double2 double2(uint v) { return new double2(v); }
  507. /// <summary>Return a double2 vector constructed from a uint2 vector by componentwise conversion.</summary>
  508. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  509. public static double2 double2(uint2 v) { return new double2(v); }
  510. /// <summary>Returns a double2 vector constructed from a single half value by converting it to double and assigning it to every component.</summary>
  511. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  512. public static double2 double2(half v) { return new double2(v); }
  513. /// <summary>Return a double2 vector constructed from a half2 vector by componentwise conversion.</summary>
  514. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  515. public static double2 double2(half2 v) { return new double2(v); }
  516. /// <summary>Returns a double2 vector constructed from a single float value by converting it to double and assigning it to every component.</summary>
  517. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  518. public static double2 double2(float v) { return new double2(v); }
  519. /// <summary>Return a double2 vector constructed from a float2 vector by componentwise conversion.</summary>
  520. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  521. public static double2 double2(float2 v) { return new double2(v); }
  522. /// <summary>Returns a uint hash code of a double2 vector.</summary>
  523. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  524. public static uint hash(double2 v)
  525. {
  526. return csum(fold_to_uint(v) * uint2(0x9536A0F5u, 0xAF816615u)) + 0x9AF8D62Du;
  527. }
  528. /// <summary>
  529. /// Returns a uint2 vector hash code of a double2 vector.
  530. /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
  531. /// that are only reduced to a narrow uint hash at the very end instead of at every step.
  532. /// </summary>
  533. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  534. public static uint2 hashwide(double2 v)
  535. {
  536. return (fold_to_uint(v) * uint2(0xE3600729u, 0x5F17300Du)) + 0x670D6809u;
  537. }
  538. /// <summary>Returns the result of specified shuffling of the components from two double2 vectors into a double value.</summary>
  539. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  540. public static double shuffle(double2 a, double2 b, ShuffleComponent x)
  541. {
  542. return select_shuffle_component(a, b, x);
  543. }
  544. /// <summary>Returns the result of specified shuffling of the components from two double2 vectors into a double2 vector.</summary>
  545. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  546. public static double2 shuffle(double2 a, double2 b, ShuffleComponent x, ShuffleComponent y)
  547. {
  548. return double2(
  549. select_shuffle_component(a, b, x),
  550. select_shuffle_component(a, b, y));
  551. }
  552. /// <summary>Returns the result of specified shuffling of the components from two double2 vectors into a double3 vector.</summary>
  553. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  554. public static double3 shuffle(double2 a, double2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z)
  555. {
  556. return double3(
  557. select_shuffle_component(a, b, x),
  558. select_shuffle_component(a, b, y),
  559. select_shuffle_component(a, b, z));
  560. }
  561. /// <summary>Returns the result of specified shuffling of the components from two double2 vectors into a double4 vector.</summary>
  562. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  563. public static double4 shuffle(double2 a, double2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z, ShuffleComponent w)
  564. {
  565. return double4(
  566. select_shuffle_component(a, b, x),
  567. select_shuffle_component(a, b, y),
  568. select_shuffle_component(a, b, z),
  569. select_shuffle_component(a, b, w));
  570. }
  571. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  572. internal static double select_shuffle_component(double2 a, double2 b, ShuffleComponent component)
  573. {
  574. switch(component)
  575. {
  576. case ShuffleComponent.LeftX:
  577. return a.x;
  578. case ShuffleComponent.LeftY:
  579. return a.y;
  580. case ShuffleComponent.RightX:
  581. return b.x;
  582. case ShuffleComponent.RightY:
  583. return b.y;
  584. default:
  585. throw new System.ArgumentException("Invalid shuffle component: " + component);
  586. }
  587. }
  588. }
  589. }