No Description
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.

int3x3.gen.cs 49KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  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 Unity.IL2CPP.CompilerServices;
  12. #pragma warning disable 0660, 0661
  13. namespace Unity.Mathematics
  14. {
  15. /// <summary>A 3x3 matrix of ints.</summary>
  16. [System.Serializable]
  17. [Il2CppEagerStaticClassConstruction]
  18. public partial struct int3x3 : System.IEquatable<int3x3>, IFormattable
  19. {
  20. /// <summary>Column 0 of the matrix.</summary>
  21. public int3 c0;
  22. /// <summary>Column 1 of the matrix.</summary>
  23. public int3 c1;
  24. /// <summary>Column 2 of the matrix.</summary>
  25. public int3 c2;
  26. /// <summary>int3x3 identity transform.</summary>
  27. public static readonly int3x3 identity = new int3x3(1, 0, 0, 0, 1, 0, 0, 0, 1);
  28. /// <summary>int3x3 zero value.</summary>
  29. public static readonly int3x3 zero;
  30. /// <summary>Constructs a int3x3 matrix from three int3 vectors.</summary>
  31. /// <param name="c0">The matrix column c0 will be set to this value.</param>
  32. /// <param name="c1">The matrix column c1 will be set to this value.</param>
  33. /// <param name="c2">The matrix column c2 will be set to this value.</param>
  34. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  35. public int3x3(int3 c0, int3 c1, int3 c2)
  36. {
  37. this.c0 = c0;
  38. this.c1 = c1;
  39. this.c2 = c2;
  40. }
  41. /// <summary>Constructs a int3x3 matrix from 9 int values given in row-major order.</summary>
  42. /// <param name="m00">The matrix at row 0, column 0 will be set to this value.</param>
  43. /// <param name="m01">The matrix at row 0, column 1 will be set to this value.</param>
  44. /// <param name="m02">The matrix at row 0, column 2 will be set to this value.</param>
  45. /// <param name="m10">The matrix at row 1, column 0 will be set to this value.</param>
  46. /// <param name="m11">The matrix at row 1, column 1 will be set to this value.</param>
  47. /// <param name="m12">The matrix at row 1, column 2 will be set to this value.</param>
  48. /// <param name="m20">The matrix at row 2, column 0 will be set to this value.</param>
  49. /// <param name="m21">The matrix at row 2, column 1 will be set to this value.</param>
  50. /// <param name="m22">The matrix at row 2, column 2 will be set to this value.</param>
  51. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  52. public int3x3(int m00, int m01, int m02,
  53. int m10, int m11, int m12,
  54. int m20, int m21, int m22)
  55. {
  56. this.c0 = new int3(m00, m10, m20);
  57. this.c1 = new int3(m01, m11, m21);
  58. this.c2 = new int3(m02, m12, m22);
  59. }
  60. /// <summary>Constructs a int3x3 matrix from a single int value by assigning it to every component.</summary>
  61. /// <param name="v">int to convert to int3x3</param>
  62. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  63. public int3x3(int v)
  64. {
  65. this.c0 = v;
  66. this.c1 = v;
  67. this.c2 = v;
  68. }
  69. /// <summary>Constructs a int3x3 matrix from a single bool value by converting it to int and assigning it to every component.</summary>
  70. /// <param name="v">bool to convert to int3x3</param>
  71. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  72. public int3x3(bool v)
  73. {
  74. this.c0 = math.select(new int3(0), new int3(1), v);
  75. this.c1 = math.select(new int3(0), new int3(1), v);
  76. this.c2 = math.select(new int3(0), new int3(1), v);
  77. }
  78. /// <summary>Constructs a int3x3 matrix from a bool3x3 matrix by componentwise conversion.</summary>
  79. /// <param name="v">bool3x3 to convert to int3x3</param>
  80. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  81. public int3x3(bool3x3 v)
  82. {
  83. this.c0 = math.select(new int3(0), new int3(1), v.c0);
  84. this.c1 = math.select(new int3(0), new int3(1), v.c1);
  85. this.c2 = math.select(new int3(0), new int3(1), v.c2);
  86. }
  87. /// <summary>Constructs a int3x3 matrix from a single uint value by converting it to int and assigning it to every component.</summary>
  88. /// <param name="v">uint to convert to int3x3</param>
  89. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  90. public int3x3(uint v)
  91. {
  92. this.c0 = (int3)v;
  93. this.c1 = (int3)v;
  94. this.c2 = (int3)v;
  95. }
  96. /// <summary>Constructs a int3x3 matrix from a uint3x3 matrix by componentwise conversion.</summary>
  97. /// <param name="v">uint3x3 to convert to int3x3</param>
  98. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  99. public int3x3(uint3x3 v)
  100. {
  101. this.c0 = (int3)v.c0;
  102. this.c1 = (int3)v.c1;
  103. this.c2 = (int3)v.c2;
  104. }
  105. /// <summary>Constructs a int3x3 matrix from a single float value by converting it to int and assigning it to every component.</summary>
  106. /// <param name="v">float to convert to int3x3</param>
  107. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  108. public int3x3(float v)
  109. {
  110. this.c0 = (int3)v;
  111. this.c1 = (int3)v;
  112. this.c2 = (int3)v;
  113. }
  114. /// <summary>Constructs a int3x3 matrix from a float3x3 matrix by componentwise conversion.</summary>
  115. /// <param name="v">float3x3 to convert to int3x3</param>
  116. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  117. public int3x3(float3x3 v)
  118. {
  119. this.c0 = (int3)v.c0;
  120. this.c1 = (int3)v.c1;
  121. this.c2 = (int3)v.c2;
  122. }
  123. /// <summary>Constructs a int3x3 matrix from a single double value by converting it to int and assigning it to every component.</summary>
  124. /// <param name="v">double to convert to int3x3</param>
  125. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  126. public int3x3(double v)
  127. {
  128. this.c0 = (int3)v;
  129. this.c1 = (int3)v;
  130. this.c2 = (int3)v;
  131. }
  132. /// <summary>Constructs a int3x3 matrix from a double3x3 matrix by componentwise conversion.</summary>
  133. /// <param name="v">double3x3 to convert to int3x3</param>
  134. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  135. public int3x3(double3x3 v)
  136. {
  137. this.c0 = (int3)v.c0;
  138. this.c1 = (int3)v.c1;
  139. this.c2 = (int3)v.c2;
  140. }
  141. /// <summary>Implicitly converts a single int value to a int3x3 matrix by assigning it to every component.</summary>
  142. /// <param name="v">int to convert to int3x3</param>
  143. /// <returns>Converted value.</returns>
  144. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  145. public static implicit operator int3x3(int v) { return new int3x3(v); }
  146. /// <summary>Explicitly converts a single bool value to a int3x3 matrix by converting it to int and assigning it to every component.</summary>
  147. /// <param name="v">bool to convert to int3x3</param>
  148. /// <returns>Converted value.</returns>
  149. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  150. public static explicit operator int3x3(bool v) { return new int3x3(v); }
  151. /// <summary>Explicitly converts a bool3x3 matrix to a int3x3 matrix by componentwise conversion.</summary>
  152. /// <param name="v">bool3x3 to convert to int3x3</param>
  153. /// <returns>Converted value.</returns>
  154. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  155. public static explicit operator int3x3(bool3x3 v) { return new int3x3(v); }
  156. /// <summary>Explicitly converts a single uint value to a int3x3 matrix by converting it to int and assigning it to every component.</summary>
  157. /// <param name="v">uint to convert to int3x3</param>
  158. /// <returns>Converted value.</returns>
  159. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  160. public static explicit operator int3x3(uint v) { return new int3x3(v); }
  161. /// <summary>Explicitly converts a uint3x3 matrix to a int3x3 matrix by componentwise conversion.</summary>
  162. /// <param name="v">uint3x3 to convert to int3x3</param>
  163. /// <returns>Converted value.</returns>
  164. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  165. public static explicit operator int3x3(uint3x3 v) { return new int3x3(v); }
  166. /// <summary>Explicitly converts a single float value to a int3x3 matrix by converting it to int and assigning it to every component.</summary>
  167. /// <param name="v">float to convert to int3x3</param>
  168. /// <returns>Converted value.</returns>
  169. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  170. public static explicit operator int3x3(float v) { return new int3x3(v); }
  171. /// <summary>Explicitly converts a float3x3 matrix to a int3x3 matrix by componentwise conversion.</summary>
  172. /// <param name="v">float3x3 to convert to int3x3</param>
  173. /// <returns>Converted value.</returns>
  174. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  175. public static explicit operator int3x3(float3x3 v) { return new int3x3(v); }
  176. /// <summary>Explicitly converts a single double value to a int3x3 matrix by converting it to int and assigning it to every component.</summary>
  177. /// <param name="v">double to convert to int3x3</param>
  178. /// <returns>Converted value.</returns>
  179. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  180. public static explicit operator int3x3(double v) { return new int3x3(v); }
  181. /// <summary>Explicitly converts a double3x3 matrix to a int3x3 matrix by componentwise conversion.</summary>
  182. /// <param name="v">double3x3 to convert to int3x3</param>
  183. /// <returns>Converted value.</returns>
  184. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  185. public static explicit operator int3x3(double3x3 v) { return new int3x3(v); }
  186. /// <summary>Returns the result of a componentwise multiplication operation on two int3x3 matrices.</summary>
  187. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise multiplication.</param>
  188. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise multiplication.</param>
  189. /// <returns>int3x3 result of the componentwise multiplication.</returns>
  190. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  191. public static int3x3 operator * (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); }
  192. /// <summary>Returns the result of a componentwise multiplication operation on an int3x3 matrix and an int value.</summary>
  193. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise multiplication.</param>
  194. /// <param name="rhs">Right hand side int to use to compute componentwise multiplication.</param>
  195. /// <returns>int3x3 result of the componentwise multiplication.</returns>
  196. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  197. public static int3x3 operator * (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); }
  198. /// <summary>Returns the result of a componentwise multiplication operation on an int value and an int3x3 matrix.</summary>
  199. /// <param name="lhs">Left hand side int to use to compute componentwise multiplication.</param>
  200. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise multiplication.</param>
  201. /// <returns>int3x3 result of the componentwise multiplication.</returns>
  202. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  203. public static int3x3 operator * (int lhs, int3x3 rhs) { return new int3x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); }
  204. /// <summary>Returns the result of a componentwise addition operation on two int3x3 matrices.</summary>
  205. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise addition.</param>
  206. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise addition.</param>
  207. /// <returns>int3x3 result of the componentwise addition.</returns>
  208. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  209. public static int3x3 operator + (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); }
  210. /// <summary>Returns the result of a componentwise addition operation on an int3x3 matrix and an int value.</summary>
  211. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise addition.</param>
  212. /// <param name="rhs">Right hand side int to use to compute componentwise addition.</param>
  213. /// <returns>int3x3 result of the componentwise addition.</returns>
  214. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  215. public static int3x3 operator + (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); }
  216. /// <summary>Returns the result of a componentwise addition operation on an int value and an int3x3 matrix.</summary>
  217. /// <param name="lhs">Left hand side int to use to compute componentwise addition.</param>
  218. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise addition.</param>
  219. /// <returns>int3x3 result of the componentwise addition.</returns>
  220. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  221. public static int3x3 operator + (int lhs, int3x3 rhs) { return new int3x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); }
  222. /// <summary>Returns the result of a componentwise subtraction operation on two int3x3 matrices.</summary>
  223. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise subtraction.</param>
  224. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise subtraction.</param>
  225. /// <returns>int3x3 result of the componentwise subtraction.</returns>
  226. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  227. public static int3x3 operator - (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); }
  228. /// <summary>Returns the result of a componentwise subtraction operation on an int3x3 matrix and an int value.</summary>
  229. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise subtraction.</param>
  230. /// <param name="rhs">Right hand side int to use to compute componentwise subtraction.</param>
  231. /// <returns>int3x3 result of the componentwise subtraction.</returns>
  232. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  233. public static int3x3 operator - (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); }
  234. /// <summary>Returns the result of a componentwise subtraction operation on an int value and an int3x3 matrix.</summary>
  235. /// <param name="lhs">Left hand side int to use to compute componentwise subtraction.</param>
  236. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise subtraction.</param>
  237. /// <returns>int3x3 result of the componentwise subtraction.</returns>
  238. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  239. public static int3x3 operator - (int lhs, int3x3 rhs) { return new int3x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); }
  240. /// <summary>Returns the result of a componentwise division operation on two int3x3 matrices.</summary>
  241. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise division.</param>
  242. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise division.</param>
  243. /// <returns>int3x3 result of the componentwise division.</returns>
  244. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  245. public static int3x3 operator / (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); }
  246. /// <summary>Returns the result of a componentwise division operation on an int3x3 matrix and an int value.</summary>
  247. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise division.</param>
  248. /// <param name="rhs">Right hand side int to use to compute componentwise division.</param>
  249. /// <returns>int3x3 result of the componentwise division.</returns>
  250. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  251. public static int3x3 operator / (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); }
  252. /// <summary>Returns the result of a componentwise division operation on an int value and an int3x3 matrix.</summary>
  253. /// <param name="lhs">Left hand side int to use to compute componentwise division.</param>
  254. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise division.</param>
  255. /// <returns>int3x3 result of the componentwise division.</returns>
  256. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  257. public static int3x3 operator / (int lhs, int3x3 rhs) { return new int3x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); }
  258. /// <summary>Returns the result of a componentwise modulus operation on two int3x3 matrices.</summary>
  259. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise modulus.</param>
  260. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise modulus.</param>
  261. /// <returns>int3x3 result of the componentwise modulus.</returns>
  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 modulus operation on an int3x3 matrix and an int value.</summary>
  265. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise modulus.</param>
  266. /// <param name="rhs">Right hand side int to use to compute componentwise modulus.</param>
  267. /// <returns>int3x3 result of the componentwise modulus.</returns>
  268. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  269. public static int3x3 operator % (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); }
  270. /// <summary>Returns the result of a componentwise modulus operation on an int value and an int3x3 matrix.</summary>
  271. /// <param name="lhs">Left hand side int to use to compute componentwise modulus.</param>
  272. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise modulus.</param>
  273. /// <returns>int3x3 result of the componentwise modulus.</returns>
  274. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  275. public static int3x3 operator % (int lhs, int3x3 rhs) { return new int3x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); }
  276. /// <summary>Returns the result of a componentwise increment operation on an int3x3 matrix.</summary>
  277. /// <param name="val">Value to use when computing the componentwise increment.</param>
  278. /// <returns>int3x3 result of the componentwise increment.</returns>
  279. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  280. public static int3x3 operator ++ (int3x3 val) { return new int3x3 (++val.c0, ++val.c1, ++val.c2); }
  281. /// <summary>Returns the result of a componentwise decrement operation on an int3x3 matrix.</summary>
  282. /// <param name="val">Value to use when computing the componentwise decrement.</param>
  283. /// <returns>int3x3 result of the componentwise decrement.</returns>
  284. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  285. public static int3x3 operator -- (int3x3 val) { return new int3x3 (--val.c0, --val.c1, --val.c2); }
  286. /// <summary>Returns the result of a componentwise less than operation on two int3x3 matrices.</summary>
  287. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise less than.</param>
  288. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise less than.</param>
  289. /// <returns>bool3x3 result of the componentwise less than.</returns>
  290. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  291. public static bool3x3 operator < (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); }
  292. /// <summary>Returns the result of a componentwise less than operation on an int3x3 matrix and an int value.</summary>
  293. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise less than.</param>
  294. /// <param name="rhs">Right hand side int to use to compute componentwise less than.</param>
  295. /// <returns>bool3x3 result of the componentwise less than.</returns>
  296. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  297. public static bool3x3 operator < (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); }
  298. /// <summary>Returns the result of a componentwise less than operation on an int value and an int3x3 matrix.</summary>
  299. /// <param name="lhs">Left hand side int to use to compute componentwise less than.</param>
  300. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise less than.</param>
  301. /// <returns>bool3x3 result of the componentwise less than.</returns>
  302. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  303. public static bool3x3 operator < (int lhs, int3x3 rhs) { return new bool3x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); }
  304. /// <summary>Returns the result of a componentwise less or equal operation on two int3x3 matrices.</summary>
  305. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise less or equal.</param>
  306. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise less or equal.</param>
  307. /// <returns>bool3x3 result of the componentwise less or equal.</returns>
  308. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  309. public static bool3x3 operator <= (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); }
  310. /// <summary>Returns the result of a componentwise less or equal operation on an int3x3 matrix and an int value.</summary>
  311. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise less or equal.</param>
  312. /// <param name="rhs">Right hand side int to use to compute componentwise less or equal.</param>
  313. /// <returns>bool3x3 result of the componentwise less or equal.</returns>
  314. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  315. public static bool3x3 operator <= (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); }
  316. /// <summary>Returns the result of a componentwise less or equal operation on an int value and an int3x3 matrix.</summary>
  317. /// <param name="lhs">Left hand side int to use to compute componentwise less or equal.</param>
  318. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise less or equal.</param>
  319. /// <returns>bool3x3 result of the componentwise less or equal.</returns>
  320. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  321. public static bool3x3 operator <= (int lhs, int3x3 rhs) { return new bool3x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); }
  322. /// <summary>Returns the result of a componentwise greater than operation on two int3x3 matrices.</summary>
  323. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise greater than.</param>
  324. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise greater than.</param>
  325. /// <returns>bool3x3 result of the componentwise greater than.</returns>
  326. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  327. public static bool3x3 operator > (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); }
  328. /// <summary>Returns the result of a componentwise greater than operation on an int3x3 matrix and an int value.</summary>
  329. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise greater than.</param>
  330. /// <param name="rhs">Right hand side int to use to compute componentwise greater than.</param>
  331. /// <returns>bool3x3 result of the componentwise greater than.</returns>
  332. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  333. public static bool3x3 operator > (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); }
  334. /// <summary>Returns the result of a componentwise greater than operation on an int value and an int3x3 matrix.</summary>
  335. /// <param name="lhs">Left hand side int to use to compute componentwise greater than.</param>
  336. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise greater than.</param>
  337. /// <returns>bool3x3 result of the componentwise greater than.</returns>
  338. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  339. public static bool3x3 operator > (int lhs, int3x3 rhs) { return new bool3x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); }
  340. /// <summary>Returns the result of a componentwise greater or equal operation on two int3x3 matrices.</summary>
  341. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise greater or equal.</param>
  342. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise greater or equal.</param>
  343. /// <returns>bool3x3 result of the componentwise greater or equal.</returns>
  344. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  345. public static bool3x3 operator >= (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); }
  346. /// <summary>Returns the result of a componentwise greater or equal operation on an int3x3 matrix and an int value.</summary>
  347. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise greater or equal.</param>
  348. /// <param name="rhs">Right hand side int to use to compute componentwise greater or equal.</param>
  349. /// <returns>bool3x3 result of the componentwise greater or equal.</returns>
  350. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  351. public static bool3x3 operator >= (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); }
  352. /// <summary>Returns the result of a componentwise greater or equal operation on an int value and an int3x3 matrix.</summary>
  353. /// <param name="lhs">Left hand side int to use to compute componentwise greater or equal.</param>
  354. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise greater or equal.</param>
  355. /// <returns>bool3x3 result of the componentwise greater or equal.</returns>
  356. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  357. public static bool3x3 operator >= (int lhs, int3x3 rhs) { return new bool3x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); }
  358. /// <summary>Returns the result of a componentwise unary minus operation on an int3x3 matrix.</summary>
  359. /// <param name="val">Value to use when computing the componentwise unary minus.</param>
  360. /// <returns>int3x3 result of the componentwise unary minus.</returns>
  361. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  362. public static int3x3 operator - (int3x3 val) { return new int3x3 (-val.c0, -val.c1, -val.c2); }
  363. /// <summary>Returns the result of a componentwise unary plus operation on an int3x3 matrix.</summary>
  364. /// <param name="val">Value to use when computing the componentwise unary plus.</param>
  365. /// <returns>int3x3 result of the componentwise unary plus.</returns>
  366. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  367. public static int3x3 operator + (int3x3 val) { return new int3x3 (+val.c0, +val.c1, +val.c2); }
  368. /// <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>
  369. /// <param name="x">The matrix to left shift.</param>
  370. /// <param name="n">The number of bits to left shift.</param>
  371. /// <returns>The result of the componentwise left shift.</returns>
  372. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  373. public static int3x3 operator << (int3x3 x, int n) { return new int3x3 (x.c0 << n, x.c1 << n, x.c2 << n); }
  374. /// <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>
  375. /// <param name="x">The matrix to right shift.</param>
  376. /// <param name="n">The number of bits to right shift.</param>
  377. /// <returns>The result of the componentwise right shift.</returns>
  378. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  379. public static int3x3 operator >> (int3x3 x, int n) { return new int3x3 (x.c0 >> n, x.c1 >> n, x.c2 >> n); }
  380. /// <summary>Returns the result of a componentwise equality operation on two int3x3 matrices.</summary>
  381. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise equality.</param>
  382. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise equality.</param>
  383. /// <returns>bool3x3 result of the componentwise equality.</returns>
  384. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  385. public static bool3x3 operator == (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
  386. /// <summary>Returns the result of a componentwise equality operation on an int3x3 matrix and an int value.</summary>
  387. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise equality.</param>
  388. /// <param name="rhs">Right hand side int to use to compute componentwise equality.</param>
  389. /// <returns>bool3x3 result of the componentwise equality.</returns>
  390. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  391. public static bool3x3 operator == (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
  392. /// <summary>Returns the result of a componentwise equality operation on an int value and an int3x3 matrix.</summary>
  393. /// <param name="lhs">Left hand side int to use to compute componentwise equality.</param>
  394. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise equality.</param>
  395. /// <returns>bool3x3 result of the componentwise equality.</returns>
  396. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  397. public static bool3x3 operator == (int lhs, int3x3 rhs) { return new bool3x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
  398. /// <summary>Returns the result of a componentwise not equal operation on two int3x3 matrices.</summary>
  399. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise not equal.</param>
  400. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise not equal.</param>
  401. /// <returns>bool3x3 result of the componentwise not equal.</returns>
  402. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  403. public static bool3x3 operator != (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
  404. /// <summary>Returns the result of a componentwise not equal operation on an int3x3 matrix and an int value.</summary>
  405. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise not equal.</param>
  406. /// <param name="rhs">Right hand side int to use to compute componentwise not equal.</param>
  407. /// <returns>bool3x3 result of the componentwise not equal.</returns>
  408. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  409. public static bool3x3 operator != (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
  410. /// <summary>Returns the result of a componentwise not equal operation on an int value and an int3x3 matrix.</summary>
  411. /// <param name="lhs">Left hand side int to use to compute componentwise not equal.</param>
  412. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise not equal.</param>
  413. /// <returns>bool3x3 result of the componentwise not equal.</returns>
  414. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  415. public static bool3x3 operator != (int lhs, int3x3 rhs) { return new bool3x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
  416. /// <summary>Returns the result of a componentwise bitwise not operation on an int3x3 matrix.</summary>
  417. /// <param name="val">Value to use when computing the componentwise bitwise not.</param>
  418. /// <returns>int3x3 result of the componentwise bitwise not.</returns>
  419. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  420. public static int3x3 operator ~ (int3x3 val) { return new int3x3 (~val.c0, ~val.c1, ~val.c2); }
  421. /// <summary>Returns the result of a componentwise bitwise and operation on two int3x3 matrices.</summary>
  422. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise bitwise and.</param>
  423. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise bitwise and.</param>
  424. /// <returns>int3x3 result of the componentwise bitwise and.</returns>
  425. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  426. public static int3x3 operator & (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2); }
  427. /// <summary>Returns the result of a componentwise bitwise and operation on an int3x3 matrix and an int value.</summary>
  428. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise bitwise and.</param>
  429. /// <param name="rhs">Right hand side int to use to compute componentwise bitwise and.</param>
  430. /// <returns>int3x3 result of the componentwise bitwise and.</returns>
  431. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  432. public static int3x3 operator & (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs); }
  433. /// <summary>Returns the result of a componentwise bitwise and operation on an int value and an int3x3 matrix.</summary>
  434. /// <param name="lhs">Left hand side int to use to compute componentwise bitwise and.</param>
  435. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise bitwise and.</param>
  436. /// <returns>int3x3 result of the componentwise bitwise and.</returns>
  437. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  438. public static int3x3 operator & (int lhs, int3x3 rhs) { return new int3x3 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2); }
  439. /// <summary>Returns the result of a componentwise bitwise or operation on two int3x3 matrices.</summary>
  440. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise bitwise or.</param>
  441. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise bitwise or.</param>
  442. /// <returns>int3x3 result of the componentwise bitwise or.</returns>
  443. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  444. public static int3x3 operator | (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2); }
  445. /// <summary>Returns the result of a componentwise bitwise or operation on an int3x3 matrix and an int value.</summary>
  446. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise bitwise or.</param>
  447. /// <param name="rhs">Right hand side int to use to compute componentwise bitwise or.</param>
  448. /// <returns>int3x3 result of the componentwise bitwise or.</returns>
  449. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  450. public static int3x3 operator | (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs); }
  451. /// <summary>Returns the result of a componentwise bitwise or operation on an int value and an int3x3 matrix.</summary>
  452. /// <param name="lhs">Left hand side int to use to compute componentwise bitwise or.</param>
  453. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise bitwise or.</param>
  454. /// <returns>int3x3 result of the componentwise bitwise or.</returns>
  455. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  456. public static int3x3 operator | (int lhs, int3x3 rhs) { return new int3x3 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2); }
  457. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on two int3x3 matrices.</summary>
  458. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise bitwise exclusive or.</param>
  459. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise bitwise exclusive or.</param>
  460. /// <returns>int3x3 result of the componentwise bitwise exclusive or.</returns>
  461. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  462. public static int3x3 operator ^ (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2); }
  463. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int3x3 matrix and an int value.</summary>
  464. /// <param name="lhs">Left hand side int3x3 to use to compute componentwise bitwise exclusive or.</param>
  465. /// <param name="rhs">Right hand side int to use to compute componentwise bitwise exclusive or.</param>
  466. /// <returns>int3x3 result of the componentwise bitwise exclusive or.</returns>
  467. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  468. public static int3x3 operator ^ (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs); }
  469. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int value and an int3x3 matrix.</summary>
  470. /// <param name="lhs">Left hand side int to use to compute componentwise bitwise exclusive or.</param>
  471. /// <param name="rhs">Right hand side int3x3 to use to compute componentwise bitwise exclusive or.</param>
  472. /// <returns>int3x3 result of the componentwise bitwise exclusive or.</returns>
  473. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  474. public static int3x3 operator ^ (int lhs, int3x3 rhs) { return new int3x3 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2); }
  475. /// <summary>Returns the int3 element at a specified index.</summary>
  476. unsafe public ref int3 this[int index]
  477. {
  478. get
  479. {
  480. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  481. if ((uint)index >= 3)
  482. throw new System.ArgumentException("index must be between[0...2]");
  483. #endif
  484. fixed (int3x3* array = &this) { return ref ((int3*)array)[index]; }
  485. }
  486. }
  487. /// <summary>Returns true if the int3x3 is equal to a given int3x3, false otherwise.</summary>
  488. /// <param name="rhs">Right hand side argument to compare equality with.</param>
  489. /// <returns>The result of the equality comparison.</returns>
  490. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  491. public bool Equals(int3x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
  492. /// <summary>Returns true if the int3x3 is equal to a given int3x3, false otherwise.</summary>
  493. /// <param name="o">Right hand side argument to compare equality with.</param>
  494. /// <returns>The result of the equality comparison.</returns>
  495. public override bool Equals(object o) { return o is int3x3 converted && Equals(converted); }
  496. /// <summary>Returns a hash code for the int3x3.</summary>
  497. /// <returns>The computed hash code.</returns>
  498. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  499. public override int GetHashCode() { return (int)math.hash(this); }
  500. /// <summary>Returns a string representation of the int3x3.</summary>
  501. /// <returns>String representation of the value.</returns>
  502. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  503. public override string ToString()
  504. {
  505. 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);
  506. }
  507. /// <summary>Returns a string representation of the int3x3 using a specified format and culture-specific format information.</summary>
  508. /// <param name="format">Format string to use during string formatting.</param>
  509. /// <param name="formatProvider">Format provider to use during string formatting.</param>
  510. /// <returns>String representation of the value.</returns>
  511. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  512. public string ToString(string format, IFormatProvider formatProvider)
  513. {
  514. 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));
  515. }
  516. }
  517. public static partial class math
  518. {
  519. /// <summary>Returns a int3x3 matrix constructed from three int3 vectors.</summary>
  520. /// <param name="c0">The matrix column c0 will be set to this value.</param>
  521. /// <param name="c1">The matrix column c1 will be set to this value.</param>
  522. /// <param name="c2">The matrix column c2 will be set to this value.</param>
  523. /// <returns>int3x3 constructed from arguments.</returns>
  524. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  525. public static int3x3 int3x3(int3 c0, int3 c1, int3 c2) { return new int3x3(c0, c1, c2); }
  526. /// <summary>Returns a int3x3 matrix constructed from from 9 int values given in row-major order.</summary>
  527. /// <param name="m00">The matrix at row 0, column 0 will be set to this value.</param>
  528. /// <param name="m01">The matrix at row 0, column 1 will be set to this value.</param>
  529. /// <param name="m02">The matrix at row 0, column 2 will be set to this value.</param>
  530. /// <param name="m10">The matrix at row 1, column 0 will be set to this value.</param>
  531. /// <param name="m11">The matrix at row 1, column 1 will be set to this value.</param>
  532. /// <param name="m12">The matrix at row 1, column 2 will be set to this value.</param>
  533. /// <param name="m20">The matrix at row 2, column 0 will be set to this value.</param>
  534. /// <param name="m21">The matrix at row 2, column 1 will be set to this value.</param>
  535. /// <param name="m22">The matrix at row 2, column 2 will be set to this value.</param>
  536. /// <returns>int3x3 constructed from arguments.</returns>
  537. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  538. public static int3x3 int3x3(int m00, int m01, int m02,
  539. int m10, int m11, int m12,
  540. int m20, int m21, int m22)
  541. {
  542. return new int3x3(m00, m01, m02,
  543. m10, m11, m12,
  544. m20, m21, m22);
  545. }
  546. /// <summary>Returns a int3x3 matrix constructed from a single int value by assigning it to every component.</summary>
  547. /// <param name="v">int to convert to int3x3</param>
  548. /// <returns>Converted value.</returns>
  549. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  550. public static int3x3 int3x3(int v) { return new int3x3(v); }
  551. /// <summary>Returns a int3x3 matrix constructed from a single bool value by converting it to int and assigning it to every component.</summary>
  552. /// <param name="v">bool to convert to int3x3</param>
  553. /// <returns>Converted value.</returns>
  554. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  555. public static int3x3 int3x3(bool v) { return new int3x3(v); }
  556. /// <summary>Return a int3x3 matrix constructed from a bool3x3 matrix by componentwise conversion.</summary>
  557. /// <param name="v">bool3x3 to convert to int3x3</param>
  558. /// <returns>Converted value.</returns>
  559. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  560. public static int3x3 int3x3(bool3x3 v) { return new int3x3(v); }
  561. /// <summary>Returns a int3x3 matrix constructed from a single uint value by converting it to int and assigning it to every component.</summary>
  562. /// <param name="v">uint to convert to int3x3</param>
  563. /// <returns>Converted value.</returns>
  564. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  565. public static int3x3 int3x3(uint v) { return new int3x3(v); }
  566. /// <summary>Return a int3x3 matrix constructed from a uint3x3 matrix by componentwise conversion.</summary>
  567. /// <param name="v">uint3x3 to convert to int3x3</param>
  568. /// <returns>Converted value.</returns>
  569. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  570. public static int3x3 int3x3(uint3x3 v) { return new int3x3(v); }
  571. /// <summary>Returns a int3x3 matrix constructed from a single float value by converting it to int and assigning it to every component.</summary>
  572. /// <param name="v">float to convert to int3x3</param>
  573. /// <returns>Converted value.</returns>
  574. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  575. public static int3x3 int3x3(float v) { return new int3x3(v); }
  576. /// <summary>Return a int3x3 matrix constructed from a float3x3 matrix by componentwise conversion.</summary>
  577. /// <param name="v">float3x3 to convert to int3x3</param>
  578. /// <returns>Converted value.</returns>
  579. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  580. public static int3x3 int3x3(float3x3 v) { return new int3x3(v); }
  581. /// <summary>Returns a int3x3 matrix constructed from a single double value by converting it to int and assigning it to every component.</summary>
  582. /// <param name="v">double to convert to int3x3</param>
  583. /// <returns>Converted value.</returns>
  584. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  585. public static int3x3 int3x3(double v) { return new int3x3(v); }
  586. /// <summary>Return a int3x3 matrix constructed from a double3x3 matrix by componentwise conversion.</summary>
  587. /// <param name="v">double3x3 to convert to int3x3</param>
  588. /// <returns>Converted value.</returns>
  589. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  590. public static int3x3 int3x3(double3x3 v) { return new int3x3(v); }
  591. /// <summary>Return the int3x3 transpose of a int3x3 matrix.</summary>
  592. /// <param name="v">Value to transpose.</param>
  593. /// <returns>Transposed value.</returns>
  594. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  595. public static int3x3 transpose(int3x3 v)
  596. {
  597. return int3x3(
  598. v.c0.x, v.c0.y, v.c0.z,
  599. v.c1.x, v.c1.y, v.c1.z,
  600. v.c2.x, v.c2.y, v.c2.z);
  601. }
  602. /// <summary>Returns the determinant of a int3x3 matrix.</summary>
  603. /// <param name="m">Matrix to use when computing determinant.</param>
  604. /// <returns>The determinant of the matrix.</returns>
  605. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  606. public static int determinant(int3x3 m)
  607. {
  608. int3 c0 = m.c0;
  609. int3 c1 = m.c1;
  610. int3 c2 = m.c2;
  611. int m00 = c1.y * c2.z - c1.z * c2.y;
  612. int m01 = c0.y * c2.z - c0.z * c2.y;
  613. int m02 = c0.y * c1.z - c0.z * c1.y;
  614. return c0.x * m00 - c1.x * m01 + c2.x * m02;
  615. }
  616. /// <summary>Returns a uint hash code of a int3x3 matrix.</summary>
  617. /// <param name="v">Matrix value to hash.</param>
  618. /// <returns>uint hash of the argument.</returns>
  619. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  620. public static uint hash(int3x3 v)
  621. {
  622. return csum(asuint(v.c0) * uint3(0x93C30C2Bu, 0xDCAF0351u, 0x6E050B01u) +
  623. asuint(v.c1) * uint3(0x750FDBF5u, 0x7F3DD499u, 0x52EAAEBBu) +
  624. asuint(v.c2) * uint3(0x4599C793u, 0x83B5E729u, 0xC267163Fu)) + 0x67BC9149u;
  625. }
  626. /// <summary>
  627. /// Returns a uint3 vector hash code of a int3x3 matrix.
  628. /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
  629. /// that are only reduced to a narrow uint hash at the very end instead of at every step.
  630. /// </summary>
  631. /// <param name="v">Matrix value to hash.</param>
  632. /// <returns>uint3 hash of the argument.</returns>
  633. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  634. public static uint3 hashwide(int3x3 v)
  635. {
  636. return (asuint(v.c0) * uint3(0xAD7C5EC1u, 0x822A7D6Du, 0xB492BF15u) +
  637. asuint(v.c1) * uint3(0xD37220E3u, 0x7AA2C2BDu, 0xE16BC89Du) +
  638. asuint(v.c2) * uint3(0x7AA07CD3u, 0xAF642BA9u, 0xA8F2213Bu)) + 0x9F3FDC37u;
  639. }
  640. }
  641. }