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