double3x3.gen.cs 27 KB

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