int3x3.gen.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  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. #pragma warning disable 0660, 0661
  12. namespace Unity.Mathematics
  13. {
  14. [System.Serializable]
  15. public partial struct int3x3 : System.IEquatable<int3x3>, IFormattable
  16. {
  17. public int3 c0;
  18. public int3 c1;
  19. public int3 c2;
  20. /// <summary>int3x3 identity transform.</summary>
  21. public static readonly int3x3 identity = new int3x3(1, 0, 0, 0, 1, 0, 0, 0, 1);
  22. /// <summary>int3x3 zero value.</summary>
  23. public static readonly int3x3 zero;
  24. /// <summary>Constructs a int3x3 matrix from three int3 vectors.</summary>
  25. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  26. public int3x3(int3 c0, int3 c1, int3 c2)
  27. {
  28. this.c0 = c0;
  29. this.c1 = c1;
  30. this.c2 = c2;
  31. }
  32. /// <summary>Constructs a int3x3 matrix from 9 int values given in row-major order.</summary>
  33. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  34. public int3x3(int m00, int m01, int m02,
  35. int m10, int m11, int m12,
  36. int m20, int m21, int m22)
  37. {
  38. this.c0 = new int3(m00, m10, m20);
  39. this.c1 = new int3(m01, m11, m21);
  40. this.c2 = new int3(m02, m12, m22);
  41. }
  42. /// <summary>Constructs a int3x3 matrix from a single int value by assigning it to every component.</summary>
  43. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  44. public int3x3(int v)
  45. {
  46. this.c0 = v;
  47. this.c1 = v;
  48. this.c2 = v;
  49. }
  50. /// <summary>Constructs a int3x3 matrix from a single bool value by converting it to int and assigning it to every component.</summary>
  51. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  52. public int3x3(bool v)
  53. {
  54. this.c0 = math.select(new int3(0), new int3(1), v);
  55. this.c1 = math.select(new int3(0), new int3(1), v);
  56. this.c2 = math.select(new int3(0), new int3(1), v);
  57. }
  58. /// <summary>Constructs a int3x3 matrix from a bool3x3 matrix by componentwise conversion.</summary>
  59. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  60. public int3x3(bool3x3 v)
  61. {
  62. this.c0 = math.select(new int3(0), new int3(1), v.c0);
  63. this.c1 = math.select(new int3(0), new int3(1), v.c1);
  64. this.c2 = math.select(new int3(0), new int3(1), v.c2);
  65. }
  66. /// <summary>Constructs a int3x3 matrix from a single uint value by converting it to int and assigning it to every component.</summary>
  67. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  68. public int3x3(uint v)
  69. {
  70. this.c0 = (int3)v;
  71. this.c1 = (int3)v;
  72. this.c2 = (int3)v;
  73. }
  74. /// <summary>Constructs a int3x3 matrix from a uint3x3 matrix by componentwise conversion.</summary>
  75. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  76. public int3x3(uint3x3 v)
  77. {
  78. this.c0 = (int3)v.c0;
  79. this.c1 = (int3)v.c1;
  80. this.c2 = (int3)v.c2;
  81. }
  82. /// <summary>Constructs a int3x3 matrix from a single float value by converting it to int and assigning it to every component.</summary>
  83. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  84. public int3x3(float v)
  85. {
  86. this.c0 = (int3)v;
  87. this.c1 = (int3)v;
  88. this.c2 = (int3)v;
  89. }
  90. /// <summary>Constructs a int3x3 matrix from a float3x3 matrix by componentwise conversion.</summary>
  91. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  92. public int3x3(float3x3 v)
  93. {
  94. this.c0 = (int3)v.c0;
  95. this.c1 = (int3)v.c1;
  96. this.c2 = (int3)v.c2;
  97. }
  98. /// <summary>Constructs a int3x3 matrix from a single double value by converting it to int and assigning it to every component.</summary>
  99. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  100. public int3x3(double v)
  101. {
  102. this.c0 = (int3)v;
  103. this.c1 = (int3)v;
  104. this.c2 = (int3)v;
  105. }
  106. /// <summary>Constructs a int3x3 matrix from a double3x3 matrix by componentwise conversion.</summary>
  107. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  108. public int3x3(double3x3 v)
  109. {
  110. this.c0 = (int3)v.c0;
  111. this.c1 = (int3)v.c1;
  112. this.c2 = (int3)v.c2;
  113. }
  114. /// <summary>Implicitly converts a single int value to a int3x3 matrix by assigning it to every component.</summary>
  115. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  116. public static implicit operator int3x3(int v) { return new int3x3(v); }
  117. /// <summary>Explicitly converts a single bool value to a int3x3 matrix by converting it to int and assigning it to every component.</summary>
  118. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  119. public static explicit operator int3x3(bool v) { return new int3x3(v); }
  120. /// <summary>Explicitly converts a bool3x3 matrix to a int3x3 matrix by componentwise conversion.</summary>
  121. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  122. public static explicit operator int3x3(bool3x3 v) { return new int3x3(v); }
  123. /// <summary>Explicitly converts a single uint value to a int3x3 matrix by converting it to int and assigning it to every component.</summary>
  124. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  125. public static explicit operator int3x3(uint v) { return new int3x3(v); }
  126. /// <summary>Explicitly converts a uint3x3 matrix to a int3x3 matrix by componentwise conversion.</summary>
  127. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  128. public static explicit operator int3x3(uint3x3 v) { return new int3x3(v); }
  129. /// <summary>Explicitly converts a single float value to a int3x3 matrix by converting it to int and assigning it to every component.</summary>
  130. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  131. public static explicit operator int3x3(float v) { return new int3x3(v); }
  132. /// <summary>Explicitly converts a float3x3 matrix to a int3x3 matrix by componentwise conversion.</summary>
  133. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  134. public static explicit operator int3x3(float3x3 v) { return new int3x3(v); }
  135. /// <summary>Explicitly converts a single double value to a int3x3 matrix by converting it to int and assigning it to every component.</summary>
  136. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  137. public static explicit operator int3x3(double v) { return new int3x3(v); }
  138. /// <summary>Explicitly converts a double3x3 matrix to a int3x3 matrix by componentwise conversion.</summary>
  139. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  140. public static explicit operator int3x3(double3x3 v) { return new int3x3(v); }
  141. /// <summary>Returns the result of a componentwise multiplication operation on two int3x3 matrices.</summary>
  142. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  143. public static int3x3 operator * (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); }
  144. /// <summary>Returns the result of a componentwise multiplication operation on an int3x3 matrix and an int value.</summary>
  145. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  146. public static int3x3 operator * (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); }
  147. /// <summary>Returns the result of a componentwise multiplication operation on an int value and an int3x3 matrix.</summary>
  148. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  149. public static int3x3 operator * (int lhs, int3x3 rhs) { return new int3x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); }
  150. /// <summary>Returns the result of a componentwise addition operation on two int3x3 matrices.</summary>
  151. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  152. public static int3x3 operator + (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); }
  153. /// <summary>Returns the result of a componentwise addition operation on an int3x3 matrix and an int value.</summary>
  154. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  155. public static int3x3 operator + (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); }
  156. /// <summary>Returns the result of a componentwise addition operation on an int value and an int3x3 matrix.</summary>
  157. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  158. public static int3x3 operator + (int lhs, int3x3 rhs) { return new int3x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); }
  159. /// <summary>Returns the result of a componentwise subtraction operation on two int3x3 matrices.</summary>
  160. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  161. public static int3x3 operator - (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); }
  162. /// <summary>Returns the result of a componentwise subtraction operation on an int3x3 matrix and an int value.</summary>
  163. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  164. public static int3x3 operator - (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); }
  165. /// <summary>Returns the result of a componentwise subtraction operation on an int value and an int3x3 matrix.</summary>
  166. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  167. public static int3x3 operator - (int lhs, int3x3 rhs) { return new int3x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); }
  168. /// <summary>Returns the result of a componentwise division operation on two int3x3 matrices.</summary>
  169. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  170. public static int3x3 operator / (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); }
  171. /// <summary>Returns the result of a componentwise division operation on an int3x3 matrix and an int value.</summary>
  172. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  173. public static int3x3 operator / (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); }
  174. /// <summary>Returns the result of a componentwise division operation on an int value and an int3x3 matrix.</summary>
  175. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  176. public static int3x3 operator / (int lhs, int3x3 rhs) { return new int3x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); }
  177. /// <summary>Returns the result of a componentwise modulus operation on two int3x3 matrices.</summary>
  178. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  179. public static int3x3 operator % (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2); }
  180. /// <summary>Returns the result of a componentwise modulus operation on an int3x3 matrix and an int value.</summary>
  181. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  182. public static int3x3 operator % (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); }
  183. /// <summary>Returns the result of a componentwise modulus operation on an int value and an int3x3 matrix.</summary>
  184. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  185. public static int3x3 operator % (int lhs, int3x3 rhs) { return new int3x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); }
  186. /// <summary>Returns the result of a componentwise increment operation on an int3x3 matrix.</summary>
  187. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  188. public static int3x3 operator ++ (int3x3 val) { return new int3x3 (++val.c0, ++val.c1, ++val.c2); }
  189. /// <summary>Returns the result of a componentwise decrement operation on an int3x3 matrix.</summary>
  190. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  191. public static int3x3 operator -- (int3x3 val) { return new int3x3 (--val.c0, --val.c1, --val.c2); }
  192. /// <summary>Returns the result of a componentwise less than operation on two int3x3 matrices.</summary>
  193. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  194. public static bool3x3 operator < (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); }
  195. /// <summary>Returns the result of a componentwise less than operation on an int3x3 matrix and an int value.</summary>
  196. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  197. public static bool3x3 operator < (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); }
  198. /// <summary>Returns the result of a componentwise less than operation on an int value and an int3x3 matrix.</summary>
  199. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  200. public static bool3x3 operator < (int lhs, int3x3 rhs) { return new bool3x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); }
  201. /// <summary>Returns the result of a componentwise less or equal operation on two int3x3 matrices.</summary>
  202. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  203. public static bool3x3 operator <= (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); }
  204. /// <summary>Returns the result of a componentwise less or equal operation on an int3x3 matrix and an int value.</summary>
  205. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  206. public static bool3x3 operator <= (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); }
  207. /// <summary>Returns the result of a componentwise less or equal operation on an int value and an int3x3 matrix.</summary>
  208. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  209. public static bool3x3 operator <= (int lhs, int3x3 rhs) { return new bool3x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); }
  210. /// <summary>Returns the result of a componentwise greater than operation on two int3x3 matrices.</summary>
  211. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  212. public static bool3x3 operator > (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); }
  213. /// <summary>Returns the result of a componentwise greater than operation on an int3x3 matrix and an int value.</summary>
  214. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  215. public static bool3x3 operator > (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); }
  216. /// <summary>Returns the result of a componentwise greater than operation on an int value and an int3x3 matrix.</summary>
  217. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  218. public static bool3x3 operator > (int lhs, int3x3 rhs) { return new bool3x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); }
  219. /// <summary>Returns the result of a componentwise greater or equal operation on two int3x3 matrices.</summary>
  220. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  221. public static bool3x3 operator >= (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); }
  222. /// <summary>Returns the result of a componentwise greater or equal operation on an int3x3 matrix and an int value.</summary>
  223. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  224. public static bool3x3 operator >= (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); }
  225. /// <summary>Returns the result of a componentwise greater or equal operation on an int value and an int3x3 matrix.</summary>
  226. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  227. public static bool3x3 operator >= (int lhs, int3x3 rhs) { return new bool3x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); }
  228. /// <summary>Returns the result of a componentwise unary minus operation on an int3x3 matrix.</summary>
  229. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  230. public static int3x3 operator - (int3x3 val) { return new int3x3 (-val.c0, -val.c1, -val.c2); }
  231. /// <summary>Returns the result of a componentwise unary plus operation on an int3x3 matrix.</summary>
  232. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  233. public static int3x3 operator + (int3x3 val) { return new int3x3 (+val.c0, +val.c1, +val.c2); }
  234. /// <summary>Returns the result of a componentwise left shift operation on an int3x3 matrix by a number of bits specified by a single int.</summary>
  235. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  236. public static int3x3 operator << (int3x3 x, int n) { return new int3x3 (x.c0 << n, x.c1 << n, x.c2 << n); }
  237. /// <summary>Returns the result of a componentwise right shift operation on an int3x3 matrix by a number of bits specified by a single int.</summary>
  238. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  239. public static int3x3 operator >> (int3x3 x, int n) { return new int3x3 (x.c0 >> n, x.c1 >> n, x.c2 >> n); }
  240. /// <summary>Returns the result of a componentwise equality operation on two int3x3 matrices.</summary>
  241. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  242. public static bool3x3 operator == (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
  243. /// <summary>Returns the result of a componentwise equality operation on an int3x3 matrix and an int value.</summary>
  244. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  245. public static bool3x3 operator == (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
  246. /// <summary>Returns the result of a componentwise equality operation on an int value and an int3x3 matrix.</summary>
  247. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  248. public static bool3x3 operator == (int lhs, int3x3 rhs) { return new bool3x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
  249. /// <summary>Returns the result of a componentwise not equal operation on two int3x3 matrices.</summary>
  250. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  251. public static bool3x3 operator != (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
  252. /// <summary>Returns the result of a componentwise not equal operation on an int3x3 matrix and an int value.</summary>
  253. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  254. public static bool3x3 operator != (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
  255. /// <summary>Returns the result of a componentwise not equal operation on an int value and an int3x3 matrix.</summary>
  256. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  257. public static bool3x3 operator != (int lhs, int3x3 rhs) { return new bool3x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
  258. /// <summary>Returns the result of a componentwise bitwise not operation on an int3x3 matrix.</summary>
  259. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  260. public static int3x3 operator ~ (int3x3 val) { return new int3x3 (~val.c0, ~val.c1, ~val.c2); }
  261. /// <summary>Returns the result of a componentwise bitwise and operation on two int3x3 matrices.</summary>
  262. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  263. public static int3x3 operator & (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2); }
  264. /// <summary>Returns the result of a componentwise bitwise and operation on an int3x3 matrix and an int value.</summary>
  265. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  266. public static int3x3 operator & (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs); }
  267. /// <summary>Returns the result of a componentwise bitwise and operation on an int value and an int3x3 matrix.</summary>
  268. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  269. public static int3x3 operator & (int lhs, int3x3 rhs) { return new int3x3 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2); }
  270. /// <summary>Returns the result of a componentwise bitwise or operation on two int3x3 matrices.</summary>
  271. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  272. public static int3x3 operator | (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2); }
  273. /// <summary>Returns the result of a componentwise bitwise or operation on an int3x3 matrix and an int value.</summary>
  274. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  275. public static int3x3 operator | (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs); }
  276. /// <summary>Returns the result of a componentwise bitwise or operation on an int value and an int3x3 matrix.</summary>
  277. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  278. public static int3x3 operator | (int lhs, int3x3 rhs) { return new int3x3 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2); }
  279. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on two int3x3 matrices.</summary>
  280. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  281. public static int3x3 operator ^ (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2); }
  282. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int3x3 matrix and an int value.</summary>
  283. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  284. public static int3x3 operator ^ (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs); }
  285. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int value and an int3x3 matrix.</summary>
  286. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  287. public static int3x3 operator ^ (int lhs, int3x3 rhs) { return new int3x3 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2); }
  288. /// <summary>Returns the int3 element at a specified index.</summary>
  289. unsafe public ref int3 this[int index]
  290. {
  291. get
  292. {
  293. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  294. if ((uint)index >= 3)
  295. throw new System.ArgumentException("index must be between[0...2]");
  296. #endif
  297. fixed (int3x3* array = &this) { return ref ((int3*)array)[index]; }
  298. }
  299. }
  300. /// <summary>Returns true if the int3x3 is equal to a given int3x3, false otherwise.</summary>
  301. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  302. public bool Equals(int3x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
  303. /// <summary>Returns true if the int3x3 is equal to a given int3x3, false otherwise.</summary>
  304. public override bool Equals(object o) { return Equals((int3x3)o); }
  305. /// <summary>Returns a hash code for the int3x3.</summary>
  306. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  307. public override int GetHashCode() { return (int)math.hash(this); }
  308. /// <summary>Returns a string representation of the int3x3.</summary>
  309. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  310. public override string ToString()
  311. {
  312. return string.Format("int3x3({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8})", c0.x, c1.x, c2.x, c0.y, c1.y, c2.y, c0.z, c1.z, c2.z);
  313. }
  314. /// <summary>Returns a string representation of the int3x3 using a specified format and culture-specific format information.</summary>
  315. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  316. public string ToString(string format, IFormatProvider formatProvider)
  317. {
  318. return string.Format("int3x3({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider), c2.z.ToString(format, formatProvider));
  319. }
  320. }
  321. public static partial class math
  322. {
  323. /// <summary>Returns a int3x3 matrix constructed from three int3 vectors.</summary>
  324. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  325. public static int3x3 int3x3(int3 c0, int3 c1, int3 c2) { return new int3x3(c0, c1, c2); }
  326. /// <summary>Returns a int3x3 matrix constructed from from 9 int values given in row-major order.</summary>
  327. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  328. public static int3x3 int3x3(int m00, int m01, int m02,
  329. int m10, int m11, int m12,
  330. int m20, int m21, int m22)
  331. {
  332. return new int3x3(m00, m01, m02,
  333. m10, m11, m12,
  334. m20, m21, m22);
  335. }
  336. /// <summary>Returns a int3x3 matrix constructed from a single int value by assigning it to every component.</summary>
  337. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  338. public static int3x3 int3x3(int v) { return new int3x3(v); }
  339. /// <summary>Returns a int3x3 matrix constructed from a single bool value by converting it to int and assigning it to every component.</summary>
  340. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  341. public static int3x3 int3x3(bool v) { return new int3x3(v); }
  342. /// <summary>Return a int3x3 matrix constructed from a bool3x3 matrix by componentwise conversion.</summary>
  343. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  344. public static int3x3 int3x3(bool3x3 v) { return new int3x3(v); }
  345. /// <summary>Returns a int3x3 matrix constructed from a single uint value by converting it to int and assigning it to every component.</summary>
  346. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  347. public static int3x3 int3x3(uint v) { return new int3x3(v); }
  348. /// <summary>Return a int3x3 matrix constructed from a uint3x3 matrix by componentwise conversion.</summary>
  349. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  350. public static int3x3 int3x3(uint3x3 v) { return new int3x3(v); }
  351. /// <summary>Returns a int3x3 matrix constructed from a single float value by converting it to int and assigning it to every component.</summary>
  352. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  353. public static int3x3 int3x3(float v) { return new int3x3(v); }
  354. /// <summary>Return a int3x3 matrix constructed from a float3x3 matrix by componentwise conversion.</summary>
  355. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  356. public static int3x3 int3x3(float3x3 v) { return new int3x3(v); }
  357. /// <summary>Returns a int3x3 matrix constructed from a single double value by converting it to int and assigning it to every component.</summary>
  358. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  359. public static int3x3 int3x3(double v) { return new int3x3(v); }
  360. /// <summary>Return a int3x3 matrix constructed from a double3x3 matrix by componentwise conversion.</summary>
  361. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  362. public static int3x3 int3x3(double3x3 v) { return new int3x3(v); }
  363. /// <summary>Return the int3x3 transpose of a int3x3 matrix.</summary>
  364. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  365. public static int3x3 transpose(int3x3 v)
  366. {
  367. return int3x3(
  368. v.c0.x, v.c0.y, v.c0.z,
  369. v.c1.x, v.c1.y, v.c1.z,
  370. v.c2.x, v.c2.y, v.c2.z);
  371. }
  372. /// <summary>Returns the determinant of a int3x3 matrix.</summary>
  373. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  374. public static int determinant(int3x3 m)
  375. {
  376. int3 c0 = m.c0;
  377. int3 c1 = m.c1;
  378. int3 c2 = m.c2;
  379. int m00 = c1.y * c2.z - c1.z * c2.y;
  380. int m01 = c0.y * c2.z - c0.z * c2.y;
  381. int m02 = c0.y * c1.z - c0.z * c1.y;
  382. return c0.x * m00 - c1.x * m01 + c2.x * m02;
  383. }
  384. /// <summary>Returns a uint hash code of a int3x3 vector.</summary>
  385. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  386. public static uint hash(int3x3 v)
  387. {
  388. return csum(asuint(v.c0) * uint3(0x93C30C2Bu, 0xDCAF0351u, 0x6E050B01u) +
  389. asuint(v.c1) * uint3(0x750FDBF5u, 0x7F3DD499u, 0x52EAAEBBu) +
  390. asuint(v.c2) * uint3(0x4599C793u, 0x83B5E729u, 0xC267163Fu)) + 0x67BC9149u;
  391. }
  392. /// <summary>
  393. /// Returns a uint3 vector hash code of a int3x3 vector.
  394. /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
  395. /// that are only reduced to a narrow uint hash at the very end instead of at every step.
  396. /// </summary>
  397. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  398. public static uint3 hashwide(int3x3 v)
  399. {
  400. return (asuint(v.c0) * uint3(0xAD7C5EC1u, 0x822A7D6Du, 0xB492BF15u) +
  401. asuint(v.c1) * uint3(0xD37220E3u, 0x7AA2C2BDu, 0xE16BC89Du) +
  402. asuint(v.c2) * uint3(0x7AA07CD3u, 0xAF642BA9u, 0xA8F2213Bu)) + 0x9F3FDC37u;
  403. }
  404. }
  405. }