暫無描述
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.

bool3x3.gen.cs 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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 bools.</summary>
  16. [System.Serializable]
  17. [Il2CppEagerStaticClassConstruction]
  18. public partial struct bool3x3 : System.IEquatable<bool3x3>
  19. {
  20. /// <summary>Column 0 of the matrix.</summary>
  21. public bool3 c0;
  22. /// <summary>Column 1 of the matrix.</summary>
  23. public bool3 c1;
  24. /// <summary>Column 2 of the matrix.</summary>
  25. public bool3 c2;
  26. /// <summary>Constructs a bool3x3 matrix from three bool3 vectors.</summary>
  27. /// <param name="c0">The matrix column c0 will be set to this value.</param>
  28. /// <param name="c1">The matrix column c1 will be set to this value.</param>
  29. /// <param name="c2">The matrix column c2 will be set to this value.</param>
  30. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  31. public bool3x3(bool3 c0, bool3 c1, bool3 c2)
  32. {
  33. this.c0 = c0;
  34. this.c1 = c1;
  35. this.c2 = c2;
  36. }
  37. /// <summary>Constructs a bool3x3 matrix from 9 bool values given in row-major order.</summary>
  38. /// <param name="m00">The matrix at row 0, column 0 will be set to this value.</param>
  39. /// <param name="m01">The matrix at row 0, column 1 will be set to this value.</param>
  40. /// <param name="m02">The matrix at row 0, column 2 will be set to this value.</param>
  41. /// <param name="m10">The matrix at row 1, column 0 will be set to this value.</param>
  42. /// <param name="m11">The matrix at row 1, column 1 will be set to this value.</param>
  43. /// <param name="m12">The matrix at row 1, column 2 will be set to this value.</param>
  44. /// <param name="m20">The matrix at row 2, column 0 will be set to this value.</param>
  45. /// <param name="m21">The matrix at row 2, column 1 will be set to this value.</param>
  46. /// <param name="m22">The matrix at row 2, column 2 will be set to this value.</param>
  47. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  48. public bool3x3(bool m00, bool m01, bool m02,
  49. bool m10, bool m11, bool m12,
  50. bool m20, bool m21, bool m22)
  51. {
  52. this.c0 = new bool3(m00, m10, m20);
  53. this.c1 = new bool3(m01, m11, m21);
  54. this.c2 = new bool3(m02, m12, m22);
  55. }
  56. /// <summary>Constructs a bool3x3 matrix from a single bool value by assigning it to every component.</summary>
  57. /// <param name="v">bool to convert to bool3x3</param>
  58. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  59. public bool3x3(bool v)
  60. {
  61. this.c0 = v;
  62. this.c1 = v;
  63. this.c2 = v;
  64. }
  65. /// <summary>Implicitly converts a single bool value to a bool3x3 matrix by assigning it to every component.</summary>
  66. /// <param name="v">bool to convert to bool3x3</param>
  67. /// <returns>Converted value.</returns>
  68. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  69. public static implicit operator bool3x3(bool v) { return new bool3x3(v); }
  70. /// <summary>Returns the result of a componentwise equality operation on two bool3x3 matrices.</summary>
  71. /// <param name="lhs">Left hand side bool3x3 to use to compute componentwise equality.</param>
  72. /// <param name="rhs">Right hand side bool3x3 to use to compute componentwise equality.</param>
  73. /// <returns>bool3x3 result of the componentwise equality.</returns>
  74. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  75. public static bool3x3 operator == (bool3x3 lhs, bool3x3 rhs) { return new bool3x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
  76. /// <summary>Returns the result of a componentwise equality operation on a bool3x3 matrix and a bool value.</summary>
  77. /// <param name="lhs">Left hand side bool3x3 to use to compute componentwise equality.</param>
  78. /// <param name="rhs">Right hand side bool to use to compute componentwise equality.</param>
  79. /// <returns>bool3x3 result of the componentwise equality.</returns>
  80. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  81. public static bool3x3 operator == (bool3x3 lhs, bool rhs) { return new bool3x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
  82. /// <summary>Returns the result of a componentwise equality operation on a bool value and a bool3x3 matrix.</summary>
  83. /// <param name="lhs">Left hand side bool to use to compute componentwise equality.</param>
  84. /// <param name="rhs">Right hand side bool3x3 to use to compute componentwise equality.</param>
  85. /// <returns>bool3x3 result of the componentwise equality.</returns>
  86. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  87. public static bool3x3 operator == (bool lhs, bool3x3 rhs) { return new bool3x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
  88. /// <summary>Returns the result of a componentwise not equal operation on two bool3x3 matrices.</summary>
  89. /// <param name="lhs">Left hand side bool3x3 to use to compute componentwise not equal.</param>
  90. /// <param name="rhs">Right hand side bool3x3 to use to compute componentwise not equal.</param>
  91. /// <returns>bool3x3 result of the componentwise not equal.</returns>
  92. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  93. public static bool3x3 operator != (bool3x3 lhs, bool3x3 rhs) { return new bool3x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
  94. /// <summary>Returns the result of a componentwise not equal operation on a bool3x3 matrix and a bool value.</summary>
  95. /// <param name="lhs">Left hand side bool3x3 to use to compute componentwise not equal.</param>
  96. /// <param name="rhs">Right hand side bool to use to compute componentwise not equal.</param>
  97. /// <returns>bool3x3 result of the componentwise not equal.</returns>
  98. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  99. public static bool3x3 operator != (bool3x3 lhs, bool rhs) { return new bool3x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
  100. /// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool3x3 matrix.</summary>
  101. /// <param name="lhs">Left hand side bool to use to compute componentwise not equal.</param>
  102. /// <param name="rhs">Right hand side bool3x3 to use to compute componentwise not equal.</param>
  103. /// <returns>bool3x3 result of the componentwise not equal.</returns>
  104. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  105. public static bool3x3 operator != (bool lhs, bool3x3 rhs) { return new bool3x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
  106. /// <summary>Returns the result of a componentwise not operation on a bool3x3 matrix.</summary>
  107. /// <param name="val">Value to use when computing the componentwise not.</param>
  108. /// <returns>bool3x3 result of the componentwise not.</returns>
  109. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  110. public static bool3x3 operator ! (bool3x3 val) { return new bool3x3 (!val.c0, !val.c1, !val.c2); }
  111. /// <summary>Returns the result of a componentwise bitwise and operation on two bool3x3 matrices.</summary>
  112. /// <param name="lhs">Left hand side bool3x3 to use to compute componentwise bitwise and.</param>
  113. /// <param name="rhs">Right hand side bool3x3 to use to compute componentwise bitwise and.</param>
  114. /// <returns>bool3x3 result of the componentwise bitwise and.</returns>
  115. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  116. public static bool3x3 operator & (bool3x3 lhs, bool3x3 rhs) { return new bool3x3 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2); }
  117. /// <summary>Returns the result of a componentwise bitwise and operation on a bool3x3 matrix and a bool value.</summary>
  118. /// <param name="lhs">Left hand side bool3x3 to use to compute componentwise bitwise and.</param>
  119. /// <param name="rhs">Right hand side bool to use to compute componentwise bitwise and.</param>
  120. /// <returns>bool3x3 result of the componentwise bitwise and.</returns>
  121. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  122. public static bool3x3 operator & (bool3x3 lhs, bool rhs) { return new bool3x3 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs); }
  123. /// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool3x3 matrix.</summary>
  124. /// <param name="lhs">Left hand side bool to use to compute componentwise bitwise and.</param>
  125. /// <param name="rhs">Right hand side bool3x3 to use to compute componentwise bitwise and.</param>
  126. /// <returns>bool3x3 result of the componentwise bitwise and.</returns>
  127. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  128. public static bool3x3 operator & (bool lhs, bool3x3 rhs) { return new bool3x3 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2); }
  129. /// <summary>Returns the result of a componentwise bitwise or operation on two bool3x3 matrices.</summary>
  130. /// <param name="lhs">Left hand side bool3x3 to use to compute componentwise bitwise or.</param>
  131. /// <param name="rhs">Right hand side bool3x3 to use to compute componentwise bitwise or.</param>
  132. /// <returns>bool3x3 result of the componentwise bitwise or.</returns>
  133. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  134. public static bool3x3 operator | (bool3x3 lhs, bool3x3 rhs) { return new bool3x3 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2); }
  135. /// <summary>Returns the result of a componentwise bitwise or operation on a bool3x3 matrix and a bool value.</summary>
  136. /// <param name="lhs">Left hand side bool3x3 to use to compute componentwise bitwise or.</param>
  137. /// <param name="rhs">Right hand side bool to use to compute componentwise bitwise or.</param>
  138. /// <returns>bool3x3 result of the componentwise bitwise or.</returns>
  139. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  140. public static bool3x3 operator | (bool3x3 lhs, bool rhs) { return new bool3x3 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs); }
  141. /// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool3x3 matrix.</summary>
  142. /// <param name="lhs">Left hand side bool to use to compute componentwise bitwise or.</param>
  143. /// <param name="rhs">Right hand side bool3x3 to use to compute componentwise bitwise or.</param>
  144. /// <returns>bool3x3 result of the componentwise bitwise or.</returns>
  145. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  146. public static bool3x3 operator | (bool lhs, bool3x3 rhs) { return new bool3x3 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2); }
  147. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool3x3 matrices.</summary>
  148. /// <param name="lhs">Left hand side bool3x3 to use to compute componentwise bitwise exclusive or.</param>
  149. /// <param name="rhs">Right hand side bool3x3 to use to compute componentwise bitwise exclusive or.</param>
  150. /// <returns>bool3x3 result of the componentwise bitwise exclusive or.</returns>
  151. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  152. public static bool3x3 operator ^ (bool3x3 lhs, bool3x3 rhs) { return new bool3x3 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2); }
  153. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool3x3 matrix and a bool value.</summary>
  154. /// <param name="lhs">Left hand side bool3x3 to use to compute componentwise bitwise exclusive or.</param>
  155. /// <param name="rhs">Right hand side bool to use to compute componentwise bitwise exclusive or.</param>
  156. /// <returns>bool3x3 result of the componentwise bitwise exclusive or.</returns>
  157. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  158. public static bool3x3 operator ^ (bool3x3 lhs, bool rhs) { return new bool3x3 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs); }
  159. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool3x3 matrix.</summary>
  160. /// <param name="lhs">Left hand side bool to use to compute componentwise bitwise exclusive or.</param>
  161. /// <param name="rhs">Right hand side bool3x3 to use to compute componentwise bitwise exclusive or.</param>
  162. /// <returns>bool3x3 result of the componentwise bitwise exclusive or.</returns>
  163. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  164. public static bool3x3 operator ^ (bool lhs, bool3x3 rhs) { return new bool3x3 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2); }
  165. /// <summary>Returns the bool3 element at a specified index.</summary>
  166. unsafe public ref bool3 this[int index]
  167. {
  168. get
  169. {
  170. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  171. if ((uint)index >= 3)
  172. throw new System.ArgumentException("index must be between[0...2]");
  173. #endif
  174. fixed (bool3x3* array = &this) { return ref ((bool3*)array)[index]; }
  175. }
  176. }
  177. /// <summary>Returns true if the bool3x3 is equal to a given bool3x3, false otherwise.</summary>
  178. /// <param name="rhs">Right hand side argument to compare equality with.</param>
  179. /// <returns>The result of the equality comparison.</returns>
  180. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  181. public bool Equals(bool3x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
  182. /// <summary>Returns true if the bool3x3 is equal to a given bool3x3, false otherwise.</summary>
  183. /// <param name="o">Right hand side argument to compare equality with.</param>
  184. /// <returns>The result of the equality comparison.</returns>
  185. public override bool Equals(object o) { return o is bool3x3 converted && Equals(converted); }
  186. /// <summary>Returns a hash code for the bool3x3.</summary>
  187. /// <returns>The computed hash code.</returns>
  188. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  189. public override int GetHashCode() { return (int)math.hash(this); }
  190. /// <summary>Returns a string representation of the bool3x3.</summary>
  191. /// <returns>String representation of the value.</returns>
  192. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  193. public override string ToString()
  194. {
  195. return string.Format("bool3x3({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);
  196. }
  197. }
  198. public static partial class math
  199. {
  200. /// <summary>Returns a bool3x3 matrix constructed from three bool3 vectors.</summary>
  201. /// <param name="c0">The matrix column c0 will be set to this value.</param>
  202. /// <param name="c1">The matrix column c1 will be set to this value.</param>
  203. /// <param name="c2">The matrix column c2 will be set to this value.</param>
  204. /// <returns>bool3x3 constructed from arguments.</returns>
  205. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  206. public static bool3x3 bool3x3(bool3 c0, bool3 c1, bool3 c2) { return new bool3x3(c0, c1, c2); }
  207. /// <summary>Returns a bool3x3 matrix constructed from from 9 bool values given in row-major order.</summary>
  208. /// <param name="m00">The matrix at row 0, column 0 will be set to this value.</param>
  209. /// <param name="m01">The matrix at row 0, column 1 will be set to this value.</param>
  210. /// <param name="m02">The matrix at row 0, column 2 will be set to this value.</param>
  211. /// <param name="m10">The matrix at row 1, column 0 will be set to this value.</param>
  212. /// <param name="m11">The matrix at row 1, column 1 will be set to this value.</param>
  213. /// <param name="m12">The matrix at row 1, column 2 will be set to this value.</param>
  214. /// <param name="m20">The matrix at row 2, column 0 will be set to this value.</param>
  215. /// <param name="m21">The matrix at row 2, column 1 will be set to this value.</param>
  216. /// <param name="m22">The matrix at row 2, column 2 will be set to this value.</param>
  217. /// <returns>bool3x3 constructed from arguments.</returns>
  218. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  219. public static bool3x3 bool3x3(bool m00, bool m01, bool m02,
  220. bool m10, bool m11, bool m12,
  221. bool m20, bool m21, bool m22)
  222. {
  223. return new bool3x3(m00, m01, m02,
  224. m10, m11, m12,
  225. m20, m21, m22);
  226. }
  227. /// <summary>Returns a bool3x3 matrix constructed from a single bool value by assigning it to every component.</summary>
  228. /// <param name="v">bool to convert to bool3x3</param>
  229. /// <returns>Converted value.</returns>
  230. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  231. public static bool3x3 bool3x3(bool v) { return new bool3x3(v); }
  232. /// <summary>Return the bool3x3 transpose of a bool3x3 matrix.</summary>
  233. /// <param name="v">Value to transpose.</param>
  234. /// <returns>Transposed value.</returns>
  235. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  236. public static bool3x3 transpose(bool3x3 v)
  237. {
  238. return bool3x3(
  239. v.c0.x, v.c0.y, v.c0.z,
  240. v.c1.x, v.c1.y, v.c1.z,
  241. v.c2.x, v.c2.y, v.c2.z);
  242. }
  243. /// <summary>Returns a uint hash code of a bool3x3 matrix.</summary>
  244. /// <param name="v">Matrix value to hash.</param>
  245. /// <returns>uint hash of the argument.</returns>
  246. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  247. public static uint hash(bool3x3 v)
  248. {
  249. return csum(select(uint3(0xE7579997u, 0xEF7D56C7u, 0x66F38F0Bu), uint3(0x624256A3u, 0x5292ADE1u, 0xD2E590E5u), v.c0) +
  250. select(uint3(0xF25BE857u, 0x9BC17CE7u, 0xC8B86851u), uint3(0x64095221u, 0xADF428FFu, 0xA3977109u), v.c1) +
  251. select(uint3(0x745ED837u, 0x9CDC88F5u, 0xFA62D721u), uint3(0x7E4DB1CFu, 0x68EEE0F5u, 0xBC3B0A59u), v.c2));
  252. }
  253. /// <summary>
  254. /// Returns a uint3 vector hash code of a bool3x3 matrix.
  255. /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
  256. /// that are only reduced to a narrow uint hash at the very end instead of at every step.
  257. /// </summary>
  258. /// <param name="v">Matrix value to hash.</param>
  259. /// <returns>uint3 hash of the argument.</returns>
  260. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  261. public static uint3 hashwide(bool3x3 v)
  262. {
  263. return (select(uint3(0x816EFB5Du, 0xA24E82B7u, 0x45A22087u), uint3(0xFC104C3Bu, 0x5FFF6B19u, 0x5E6CBF3Bu), v.c0) +
  264. select(uint3(0xB546F2A5u, 0xBBCF63E7u, 0xC53F4755u), uint3(0x6985C229u, 0xE133B0B3u, 0xC3E0A3B9u), v.c1) +
  265. select(uint3(0xFE31134Fu, 0x712A34D7u, 0x9D77A59Bu), uint3(0x4942CA39u, 0xB40EC62Du, 0x565ED63Fu), v.c2));
  266. }
  267. }
  268. }