This commit is contained in:
2021-06-13 10:28:03 +02:00
parent eb70603c85
commit df2d24cbd3
7487 changed files with 943244 additions and 0 deletions

View File

@@ -0,0 +1,320 @@
using System;
using System.Runtime.CompilerServices;
using static Unity.Mathematics.math;
namespace Unity.Mathematics.Geometry
{
/// <summary>
/// Axis aligned bounding box (AABB) stored in min and max form.
/// </summary>
/// <remarks>
/// Axis aligned bounding boxes (AABB) are boxes where each side is parallel with one of the Cartesian coordinate axes
/// X, Y, and Z. AABBs are useful for approximating the region an object (or collection of objects) occupies and quickly
/// testing whether or not that object (or collection of objects) is relevant. Because they are axis aligned, they
/// are very cheap to construct and perform overlap tests with them.
/// </remarks>
[System.Serializable]
internal struct MinMaxAABB : IEquatable<MinMaxAABB>
{
/// <summary>
/// The minimum point contained by the AABB.
/// </summary>
/// <remarks>
/// If any component of <see cref="Min"/> is greater than <see cref="Max"/> then this AABB is invalid.
/// </remarks>
/// <seealso cref="IsValid"/>
public float3 Min;
/// <summary>
/// The maximum point contained by the AABB.
/// </summary>
/// <remarks>
/// If any component of <see cref="Max"/> is less than <see cref="Min"/> then this AABB is invalid.
/// </remarks>
/// <seealso cref="IsValid"/>
public float3 Max;
/// <summary>
/// Constructs the AABB with the given minimum and maximum.
/// </summary>
/// <remarks>
/// If you have a center and extents, you can call <see cref="CreateFromCenterAndExtents"/> or <see cref="CreateFromCenterAndHalfExtents"/>
/// to create the AABB.
/// </remarks>
/// <param name="min">Minimum point inside AABB.</param>
/// <param name="max">Maximum point inside AABB.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public MinMaxAABB(float3 min, float3 max)
{
Min = min;
Max = max;
}
/// <summary>
/// Creates the AABB from a center and extents.
/// </summary>
/// <remarks>
/// This function takes full extents. It is the distance between <see cref="Min"/> and <see cref="Max"/>.
/// If you have half extents, you can call <see cref="CreateFromCenterAndHalfExtents"/>.
/// </remarks>
/// <param name="center">Center of AABB.</param>
/// <param name="extents">Full extents of AABB.</param>
/// <returns>AABB created from inputs.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static MinMaxAABB CreateFromCenterAndExtents(float3 center, float3 extents)
{
return CreateFromCenterAndHalfExtents(center, extents * 0.5f);
}
/// <summary>
/// Creates the AABB from a center and half extents.
/// </summary>
/// <remarks>
/// This function takes half extents. It is half the distance between <see cref="Min"/> and <see cref="Max"/>.
/// If you have full extents, you can call <see cref="CreateFromCenterAndExtents"/>.
/// </remarks>
/// <param name="center">Center of AABB.</param>
/// <param name="halfExtents">Half extents of AABB.</param>
/// <returns>AABB created from inputs.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static MinMaxAABB CreateFromCenterAndHalfExtents(float3 center, float3 halfExtents)
{
return new MinMaxAABB(center - halfExtents, center + halfExtents);
}
/// <summary>
/// Computes the extents of the AABB.
/// </summary>
/// <remarks>
/// Extents is the componentwise distance between min and max.
/// </remarks>
public float3 Extents => Max - Min;
/// <summary>
/// Computes the half extents of the AABB.
/// </summary>
/// <remarks>
/// HalfExtents is half of the componentwise distance between min and max. Subtracting HalfExtents from Center
/// gives Min and adding HalfExtents to Center gives Max.
/// </remarks>
public float3 HalfExtents => (Max - Min) * 0.5f;
/// <summary>
/// Computes the center of the AABB.
/// </summary>
public float3 Center => (Max + Min) * 0.5f;
/// <summary>
/// Check if the AABB is valid.
/// </summary>
/// <remarks>
/// An AABB is considered valid if <see cref="Min"/> is componentwise less than or equal to <see cref="Max"/>.
/// </remarks>
/// <returns>True if <see cref="Min"/> is componentwise less than or equal to <see cref="Max"/>.</returns>
public bool IsValid => math.all(Min <= Max);
/// <summary>
/// Computes the surface area for this axis aligned bounding box.
/// </summary>
public float SurfaceArea
{
get
{
float3 diff = Max - Min;
return 2 * math.dot(diff, diff.yzx);
}
}
/// <summary>
/// Tests if the input point is contained by the AABB.
/// </summary>
/// <param name="point">Point to test.</param>
/// <returns>True if AABB contains the input point.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Contains(float3 point) => math.all(point >= Min & point <= Max);
/// <summary>
/// Tests if the input AABB is contained entirely by this AABB.
/// </summary>
/// <param name="aabb">AABB to test.</param>
/// <returns>True if input AABB is contained entirely by this AABB.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Contains(MinMaxAABB aabb) => math.all((Min <= aabb.Min) & (Max >= aabb.Max));
/// <summary>
/// Tests if the input AABB overlaps this AABB.
/// </summary>
/// <param name="aabb">AABB to test.</param>
/// <returns>True if input AABB overlaps with this AABB.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Overlaps(MinMaxAABB aabb)
{
return math.all(Max >= aabb.Min & Min <= aabb.Max);
}
/// <summary>
/// Expands the AABB by the given signed distance.
/// </summary>
/// <remarks>
/// Positive distance expands the AABB while negative distance shrinks the AABB.
/// </remarks>
/// <param name="signedDistance">Signed distance to expand the AABB with.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Expand(float signedDistance)
{
Min -= signedDistance;
Max += signedDistance;
}
/// <summary>
/// Encapsulates the given AABB.
/// </summary>
/// <remarks>
/// Modifies this AABB so that it contains the given AABB. If the given AABB is already contained by this AABB,
/// then this AABB doesn't change.
/// </remarks>
/// <seealso cref="Contains(Unity.Mathematics.Geometry.MinMaxAABB)"/>
/// <param name="aabb">AABB to encapsulate.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Encapsulate(MinMaxAABB aabb)
{
Min = math.min(Min, aabb.Min);
Max = math.max(Max, aabb.Max);
}
/// <summary>
/// Encapsulate the given point.
/// </summary>
/// <remarks>
/// Modifies this AABB so that it contains the given point. If the given point is already contained by this AABB,
/// then this AABB doesn't change.
/// </remarks>
/// <seealso cref="Contains(Unity.Mathematics.float3)"/>
/// <param name="point">Point to encapsulate.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Encapsulate(float3 point)
{
Min = math.min(Min, point);
Max = math.max(Max, point);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(MinMaxAABB other)
{
return Min.Equals(other.Min) && Max.Equals(other.Max);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("MinMaxAABB({0}, {1})", Min, Max);
}
}
internal static partial class Math
{
/// <summary>
/// Transforms the AABB with the given transform.
/// </summary>
/// <remarks>
/// The resulting AABB encapsulates the transformed AABB which may not be axis aligned after the transformation.
/// </remarks>
/// <param name="transform">Transform to apply to AABB.</param>
/// <param name="aabb">AABB to be transformed.</param>
/// <returns>Transformed AABB.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static MinMaxAABB Transform(RigidTransform transform, MinMaxAABB aabb)
{
float3 halfExtentsInA = aabb.HalfExtents;
// Rotate each axis individually and find their new positions in the rotated space.
float3 x = math.rotate(transform.rot, new float3(halfExtentsInA.x, 0, 0));
float3 y = math.rotate(transform.rot, new float3(0, halfExtentsInA.y, 0));
float3 z = math.rotate(transform.rot, new float3(0, 0, halfExtentsInA.z));
// Find the new max corner by summing the rotated axes. Absolute value of each axis
// since we are trying to find the max corner.
float3 halfExtentsInB = math.abs(x) + math.abs(y) + math.abs(z);
float3 centerInB = math.transform(transform, aabb.Center);
return new MinMaxAABB(centerInB - halfExtentsInB, centerInB + halfExtentsInB);
}
/// <summary>
/// Transforms the AABB with the given transform.
/// </summary>
/// <remarks>
/// The resulting AABB encapsulates the transformed AABB which may not be axis aligned after the transformation.
/// </remarks>
/// <param name="transform">Transform to apply to AABB.</param>
/// <param name="aabb">AABB to be transformed.</param>
/// <returns>Transformed AABB.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static MinMaxAABB Transform(float4x4 transform, MinMaxAABB aabb)
{
var transformed = Transform(new float3x3(transform), aabb);
transformed.Min += transform.c3.xyz;
transformed.Max += transform.c3.xyz;
return transformed;
}
/// <summary>
/// Transforms the AABB with the given transform.
/// </summary>
/// <remarks>
/// The resulting AABB encapsulates the transformed AABB which may not be axis aligned after the transformation.
/// </remarks>
/// <param name="transform">Transform to apply to AABB.</param>
/// <param name="aabb">AABB to be transformed.</param>
/// <returns>Transformed AABB.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static MinMaxAABB Transform(float3x3 transform, MinMaxAABB aabb)
{
// From Christer Ericson's Real-Time Collision Detection on page 86 and 87.
// We want the transformed minimum and maximums of the AABB. Multiplying a 3x3 matrix on the left of a
// column vector looks like so:
//
// [ c0.x c1.x c2.x ] [ x ] [ c0.x * x + c1.x * y + c2.x * z ]
// [ c0.y c1.y c2.y ] [ y ] = [ c0.y * x + c1.y * y + c2.y * z ]
// [ c0.z c1.z c2.z ] [ z ] [ c0.z * x + c1.z * y + c2.z * z ]
//
// The column vectors we will use are the input AABB's min and max. Simply multiplying those two vectors
// with the transformation matrix won't guarantee we get the new min and max since those are only two
// points out of eight in the AABB and one of the other six may set the new min or max.
//
// To ensure we get the correct min and max, we must transform all eight points. But it's not necessary
// to actually perform eight matrix multiplies to get our final result. Instead, we can build the min and
// max incrementally by computing each term in the above matrix multiply separately then summing the min
// (or max). For instance, to find the new minimum contributed by the original min and max x component, we
// compute this:
//
// newMin.x = min(c0.x * Min.x, c0.x * Max.x);
// newMin.y = min(c0.y * Min.x, c0.y * Max.x);
// newMin.z = min(c0.z * Min.x, c0.z * Max.x);
//
// Then we add minimum contributed by the original min and max y components:
//
// newMin.x += min(c1.x * Min.y, c1.x * Max.y);
// newMin.y += min(c1.y * Min.y, c1.y * Max.y);
// newMin.z += min(c1.z * Min.y, c1.z * Max.y);
//
// And so on. Translation can be handled by simply initializing the new min and max with the translation
// amount since it does not affect the min and max bounds in local space.
var t1 = transform.c0.xyz * aabb.Min.xxx;
var t2 = transform.c0.xyz * aabb.Max.xxx;
var minMask = t1 < t2;
var transformed = new MinMaxAABB(select(t2, t1, minMask), select(t2, t1, !minMask));
t1 = transform.c1.xyz * aabb.Min.yyy;
t2 = transform.c1.xyz * aabb.Max.yyy;
minMask = t1 < t2;
transformed.Min += select(t2, t1, minMask);
transformed.Max += select(t2, t1, !minMask);
t1 = transform.c2.xyz * aabb.Min.zzz;
t2 = transform.c2.xyz * aabb.Max.zzz;
minMask = t1 < t2;
transformed.Min += select(t2, t1, minMask);
transformed.Max += select(t2, t1, !minMask);
return transformed;
}
}
}

View File

@@ -0,0 +1,232 @@
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace Unity.Mathematics.Geometry
{
/// <summary>
/// A plane represented by a normal vector and a distance along the normal from the origin.
/// </summary>
/// <remarks>
/// A plane splits the 3D space in half. The normal vector points to the positive half and the other half is
/// considered negative.
/// </remarks>
[DebuggerDisplay("{Normal}, {Distance}")]
[Serializable]
internal struct Plane
{
/// <summary>
/// A plane in the form Ax + By + Cz + Dw = 0.
/// </summary>
/// <remarks>
/// Stores the plane coefficients A, B, C, D where (A, B, C) is a unit normal vector and D is the distance
/// from the origin. A plane stored with a unit normal vector is called a normalized plane.
/// </remarks>
public float4 NormalAndDistance;
/// <summary>
/// Constructs a Plane from arbitrary coefficients A, B, C, D of the plane equation Ax + By + Cz + Dw = 0.
/// </summary>
/// <remarks>
/// The constructed plane will be the normalized form of the plane specified by the given coefficients.
/// </remarks>
/// <param name="coefficientA">Coefficient A from plane equation.</param>
/// <param name="coefficientB">Coefficient B from plane equation.</param>
/// <param name="coefficientC">Coefficient C from plane equation.</param>
/// <param name="coefficientD">Coefficient D from plane equation.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Plane(float coefficientA, float coefficientB, float coefficientC, float coefficientD)
{
NormalAndDistance = Normalize(new float4(coefficientA, coefficientB, coefficientC, coefficientD));
}
/// <summary>
/// Constructs a plane with a normal vector and distance from the origin.
/// </summary>
/// <remarks>
/// The constructed plane will be the normalized form of the plane specified by the inputs.
/// </remarks>
/// <param name="normal">A non-zero vector that is perpendicular to the plane. It may be any length.</param>
/// <param name="distance">Distance from the origin along the normal. A negative value moves the plane in the
/// same direction as the normal while a positive value moves it in the opposite direction.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Plane(float3 normal, float distance)
{
NormalAndDistance = Normalize(new float4(normal, distance));
}
/// <summary>
/// Constructs a plane with a normal vector and a point that lies in the plane.
/// </summary>
/// <remarks>
/// The constructed plane will be the normalized form of the plane specified by the inputs.
/// </remarks>
/// <param name="normal">A non-zero vector that is perpendicular to the plane. It may be any length.</param>
/// <param name="pointInPlane">A point that lies in the plane.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Plane(float3 normal, float3 pointInPlane)
: this(normal, -math.dot(normal, pointInPlane))
{
}
/// <summary>
/// Constructs a plane with two vectors and a point that all lie in the plane.
/// </summary>
/// <remarks>
/// The constructed plane will be the normalized form of the plane specified by the inputs.
/// </remarks>
/// <param name="vector1InPlane">A non-zero vector that lies in the plane. It may be any length.</param>
/// <param name="vector2InPlane">A non-zero vector that lies in the plane. It may be any length and must not be a scalar multiple of <paramref name="vector1InPlane"/>.</param>
/// <param name="pointInPlane">A point that lies in the plane.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Plane(float3 vector1InPlane, float3 vector2InPlane, float3 pointInPlane)
: this(math.cross(vector1InPlane, vector2InPlane), pointInPlane)
{
}
/// <summary>
/// Creates a normalized Plane directly without normalization cost.
/// </summary>
/// <remarks>
/// If you have a unit length normal vector, you can create a Plane faster than using one of its constructors
/// by calling this function.
/// </remarks>
/// <param name="unitNormal">A non-zero vector that is perpendicular to the plane. It must be unit length.</param>
/// <param name="distance">Distance from the origin along the normal. A negative value moves the plane in the
/// same direction as the normal while a positive value moves it in the opposite direction.</param>
/// <returns>Normalized Plane constructed from given inputs.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Plane CreateFromUnitNormalAndDistance(float3 unitNormal, float distance)
{
return new Plane { NormalAndDistance = new float4(unitNormal, distance) };
}
/// <summary>
/// Creates a normalized Plane without normalization cost.
/// </summary>
/// <remarks>
/// If you have a unit length normal vector, you can create a Plane faster than using one of its constructors
/// by calling this function.
/// </remarks>
/// <param name="unitNormal">A non-zero vector that is perpendicular to the plane. It must be unit length.</param>
/// <param name="pointInPlane">A point that lies in the plane.</param>
/// <returns>Normalized Plane constructed from given inputs.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Plane CreateFromUnitNormalAndPointInPlane(float3 unitNormal, float3 pointInPlane)
{
return new Plane { NormalAndDistance = new float4(unitNormal, -math.dot(unitNormal, pointInPlane)) };
}
/// <summary>
/// Get/set the normal vector of the plane.
/// </summary>
/// <remarks>
/// It is assumed that the normal is unit length. If you set a new plane such that Ax + By + Cz + Dw = 0 but
/// (A, B, C) is not unit length, then you must normalize the plane by calling <see cref="Normalize(Unity.Mathematics.Extras.Plane)"/>.
/// </remarks>
public float3 Normal
{
get => NormalAndDistance.xyz;
set => NormalAndDistance.xyz = value;
}
/// <summary>
/// Get/set the distance of the plane from the origin. May be a negative value.
/// </summary>
/// <remarks>
/// It is assumed that the normal is unit length. If you set a new plane such that Ax + By + Cz + Dw = 0 but
/// (A, B, C) is not unit length, then you must normalize the plane by calling <see cref="Normalize(Unity.Mathematics.Extras.Plane)"/>.
/// </remarks>
public float Distance
{
get => NormalAndDistance.w;
set => NormalAndDistance.w = value;
}
/// <summary>
/// Normalizes the given Plane.
/// </summary>
/// <param name="plane">Plane to normalize.</param>
/// <returns>Normalized Plane.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Plane Normalize(Plane plane)
{
return new Plane { NormalAndDistance = Normalize(plane.NormalAndDistance) };
}
/// <summary>
/// Normalizes the plane represented by the given plane coefficients.
/// </summary>
/// <remarks>
/// The plane coefficients are A, B, C, D and stored in that order in the <see cref="float4"/>.
/// </remarks>
/// <param name="planeCoefficients">Plane coefficients A, B, C, D stored in x, y, z, w (respectively).</param>
/// <returns>Normalized plane coefficients.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4 Normalize(float4 planeCoefficients)
{
float recipLength = math.rsqrt(math.lengthsq(planeCoefficients.xyz));
return new Plane { NormalAndDistance = planeCoefficients * recipLength };
}
/// <summary>
/// Get the signed distance from the point to the plane.
/// </summary>
/// <remarks>
/// Plane must be normalized prior to calling this function. Distance is positive if point is on side of the
/// plane the normal points to, negative if on the opposite side and zero if the point lies in the plane.
/// Avoid comparing equality with 0.0f when testing if a point lies exactly in the plane and use an approximate
/// comparison instead.
/// </remarks>
/// <param name="point">Point to find the signed distance with.</param>
/// <returns>Signed distance of the point from the plane.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float SignedDistanceToPoint(float3 point)
{
CheckPlaneIsNormalized();
return math.dot(NormalAndDistance, new float4(point, 1.0f));
}
/// <summary>
/// Projects the given point onto the plane.
/// </summary>
/// <remarks>
/// Plane must be normalized prior to calling this function. The result is the position closest to the point
/// that still lies in the plane.
/// </remarks>
/// <param name="point">Point to project onto the plane.</param>
/// <returns>Projected point that's inside the plane.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3 Projection(float3 point)
{
CheckPlaneIsNormalized();
return point - Normal * SignedDistanceToPoint(point);
}
/// <summary>
/// Flips the plane so the normal points in the opposite direction.
/// </summary>
public Plane Flipped => new Plane { NormalAndDistance = -NormalAndDistance };
/// <summary>
/// Implicitly converts a <see cref="Plane"/> to <see cref="float4"/>.
/// </summary>
/// <param name="plane">Plane to convert.</param>
/// <returns>A <see cref="float4"/> representing the plane.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4(Plane plane) => plane.NormalAndDistance;
[Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")]
void CheckPlaneIsNormalized()
{
float ll = math.lengthsq(Normal.xyz);
const float lowerBound = 0.999f * 0.999f;
const float upperBound = 1.001f * 1.001f;
if (ll < lowerBound || ll > upperBound)
{
throw new System.ArgumentException("Plane must be normalized. Call Plane.Normalize() to normalize plane.");
}
}
}
}

View File

@@ -0,0 +1,20 @@
Copyright (C) 2011 by Ashima Arts (Simplex noise)
Copyright (C) 2011-2016 by Stefan Gustavson (Classic noise and others)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,16 @@
These files contain noise functions that are compatible with all
current versions of GLSL (1.20 and up), and all you need to use them
is provided in the source file. There is no external data, and no
setup procedure. Just cut and paste and call the function.
GLSL has a very rudimentary linker, so some helper functions are
included in several of the files with the same name. If you want to
use more than one of these functions in the same shader, you may run
into problems with redefinition of the functions mod289() and permute().
If that happens, just delete any superfluous definitions.
-----
Source: https://github.com/ashima/webgl-noise
Changes:
- 10 April 2018, Unity Technologies, Ported to HPC#

View File

@@ -0,0 +1,58 @@
// Cellular noise ("Worley noise") in 2D in GLSL.
// Copyright (c) Stefan Gustavson 2011-04-19. All rights reserved.
// This code is released under the conditions of the MIT license.
// See LICENSE file for details.
// https://github.com/stegu/webgl-noise
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
public static partial class noise
{
// Cellular noise, returning F1 and F2 in a float2.
// Standard 3x3 search window for good F1 and F2 values
public static float2 cellular(float2 P)
{
const float K = 0.142857142857f; // 1/7
const float Ko = 0.428571428571f; // 3/7
const float jitter = 1.0f; // Less gives more regular pattern
float2 Pi = mod289(floor(P));
float2 Pf = frac(P);
float3 oi = float3(-1.0f, 0.0f, 1.0f);
float3 of = float3(-0.5f, 0.5f, 1.5f);
float3 px = permute(Pi.x + oi);
float3 p = permute(px.x + Pi.y + oi); // p11, p12, p13
float3 ox = frac(p * K) - Ko;
float3 oy = mod7(floor(p * K)) * K - Ko;
float3 dx = Pf.x + 0.5f + jitter * ox;
float3 dy = Pf.y - of + jitter * oy;
float3 d1 = dx * dx + dy * dy; // d11, d12 and d13, squared
p = permute(px.y + Pi.y + oi); // p21, p22, p23
ox = frac(p * K) - Ko;
oy = mod7(floor(p * K)) * K - Ko;
dx = Pf.x - 0.5f + jitter * ox;
dy = Pf.y - of + jitter * oy;
float3 d2 = dx * dx + dy * dy; // d21, d22 and d23, squared
p = permute(px.z + Pi.y + oi); // p31, p32, p33
ox = frac(p * K) - Ko;
oy = mod7(floor(p * K)) * K - Ko;
dx = Pf.x - 1.5f + jitter * ox;
dy = Pf.y - of + jitter * oy;
float3 d3 = dx * dx + dy * dy; // d31, d32 and d33, squared
// Sort out the two smallest distances (F1, F2)
float3 d1a = min(d1, d2);
d2 = max(d1, d2); // Swap to keep candidates for F2
d2 = min(d2, d3); // neither F1 nor F2 are now in d3
d1 = min(d1a, d2); // F1 is now in d1
d2 = max(d1a, d2); // Swap to keep candidates for F2
d1.xy = (d1.x < d1.y) ? d1.xy : d1.yx; // Swap if smaller
d1.xz = (d1.x < d1.z) ? d1.xz : d1.zx; // F1 is in d1.x
d1.yz = min(d1.yz, d2.yz); // F2 is now not in d2.yz
d1.y = min(d1.y, d1.z); // nor in d1.z
d1.y = min(d1.y, d2.x); // F2 is in d1.y, we're done.
return sqrt(d1.xy);
}
}
}

View File

@@ -0,0 +1,46 @@
// Cellular noise ("Worley noise") in 2D in GLSL.
// Copyright (c) Stefan Gustavson 2011-04-19. All rights reserved.
// This code is released under the conditions of the MIT license.
// See LICENSE file for details.
// https://github.com/stegu/webgl-noise
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
public static partial class noise
{
// Cellular noise, returning F1 and F2 in a float2.
// Speeded up by umath.sing 2x2 search window instead of 3x3,
// at the expense of some strong pattern artifacts.
// F2 is often wrong and has sharp discontinuities.
// If you need a smooth F2, use the slower 3x3 version.
// F1 is sometimes wrong, too, but OK for most purposes.
public static float2 cellular2x2(float2 P)
{
const float K = 0.142857142857f; // 1/7
const float K2 = 0.0714285714285f; // K/2
const float jitter = 0.8f; // jitter 1.0 makes F1 wrong more often
float2 Pi = mod289(floor(P));
float2 Pf = frac(P);
float4 Pfx = Pf.x + float4(-0.5f, -1.5f, -0.5f, -1.5f);
float4 Pfy = Pf.y + float4(-0.5f, -0.5f, -1.5f, -1.5f);
float4 p = permute(Pi.x + float4(0.0f, 1.0f, 0.0f, 1.0f));
p = permute(p + Pi.y + float4(0.0f, 0.0f, 1.0f, 1.0f));
float4 ox = mod7(p) * K + K2;
float4 oy = mod7(floor(p * K)) * K + K2;
float4 dx = Pfx + jitter * ox;
float4 dy = Pfy + jitter * oy;
float4 d = dx * dx + dy * dy; // d11, d12, d21 and d22, squared
// Sort out the two smallest distances
// Do it right and find both F1 and F2
d.xy = (d.x < d.y) ? d.xy : d.yx; // Swap if smaller
d.xz = (d.x < d.z) ? d.xz : d.zx;
d.xw = (d.x < d.w) ? d.xw : d.wx;
d.y = min(d.y, d.z);
d.y = min(d.y, d.w);
return sqrt(d.xy);
}
}
}

View File

@@ -0,0 +1,65 @@
// Cellular noise ("Worley noise") in 3D in GLSL.
// Copyright (c) Stefan Gustavson 2011-04-19. All rights reserved.
// This code is released under the conditions of the MIT license.
// See LICENSE file for details.
// https://github.com/stegu/webgl-noise
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
public static partial class noise
{
// Cellular noise, returning F1 and F2 in a float2.
// Speeded up by umath.sing 2x2x2 search window instead of 3x3x3,
// at the expense of some pattern artifacts.
// F2 is often wrong and has sharp discontinuities.
// If you need a good F2, use the slower 3x3x3 version.
public static float2 cellular2x2x2(float3 P)
{
const float K = 0.142857142857f; // 1/7
const float Ko = 0.428571428571f; // 1/2-K/2
const float K2 = 0.020408163265306f; // 1/(7*7)
const float Kz = 0.166666666667f; // 1/6
const float Kzo = 0.416666666667f; // 1/2-1/6*2
const float jitter = 0.8f; // smaller jitter gives less errors in F2
float3 Pi = mod289(floor(P));
float3 Pf = frac(P);
float4 Pfx = Pf.x + float4(0.0f, -1.0f, 0.0f, -1.0f);
float4 Pfy = Pf.y + float4(0.0f, 0.0f, -1.0f, -1.0f);
float4 p = permute(Pi.x + float4(0.0f, 1.0f, 0.0f, 1.0f));
p = permute(p + Pi.y + float4(0.0f, 0.0f, 1.0f, 1.0f));
float4 p1 = permute(p + Pi.z); // z+0
float4 p2 = permute(p + Pi.z + float4(1.0f,1.0f,1.0f,1.0f)); // z+1
float4 ox1 = frac(p1 * K) - Ko;
float4 oy1 = mod7(floor(p1 * K)) * K - Ko;
float4 oz1 = floor(p1 * K2) * Kz - Kzo; // p1 < 289 guaranteed
float4 ox2 = frac(p2 * K) - Ko;
float4 oy2 = mod7(floor(p2 * K)) * K - Ko;
float4 oz2 = floor(p2 * K2) * Kz - Kzo;
float4 dx1 = Pfx + jitter * ox1;
float4 dy1 = Pfy + jitter * oy1;
float4 dz1 = Pf.z + jitter * oz1;
float4 dx2 = Pfx + jitter * ox2;
float4 dy2 = Pfy + jitter * oy2;
float4 dz2 = Pf.z - 1.0f + jitter * oz2;
float4 d1 = dx1 * dx1 + dy1 * dy1 + dz1 * dz1; // z+0
float4 d2 = dx2 * dx2 + dy2 * dy2 + dz2 * dz2; // z+1
// Sort out the two smallest distances (F1, F2)
// Do it right and sort out both F1 and F2
float4 d = min(d1,d2); // F1 is now in d
d2 = max(d1,d2); // Make sure we keep all candidates for F2
d.xy = (d.x < d.y) ? d.xy : d.yx; // Swap smallest to d.x
d.xz = (d.x < d.z) ? d.xz : d.zx;
d.xw = (d.x < d.w) ? d.xw : d.wx; // F1 is now in d.x
d.yzw = min(d.yzw, d2.yzw); // F2 now not in d2.yzw
d.y = min(d.y, d.z); // nor in d.z
d.y = min(d.y, d.w); // nor in d.w
d.y = min(d.y, d2.x); // F2 is now in d.y
return sqrt(d.xy); // F1 and F2
}
}
}

View File

@@ -0,0 +1,169 @@
// Cellular noise ("Worley noise") in 3D in GLSL.
// Copyright (c) Stefan Gustavson 2011-04-19. All rights reserved.
// This code is released under the conditions of the MIT license.
// See LICENSE file for details.
// https://github.com/stegu/webgl-noise
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
public static partial class noise
{
// Cellular noise, returning F1 and F2 in a float2.
// 3x3x3 search region for good F2 everywhere, but a lot
// slower than the 2x2x2 version.
// The code below is a bit scary even to its author,
// but it has at least half decent performance on a
// math.modern GPU. In any case, it beats any software
// implementation of Worley noise hands down.
public static float2 cellular(float3 P)
{
const float K = 0.142857142857f; // 1/7
const float Ko = 0.428571428571f; // 1/2-K/2
const float K2 = 0.020408163265306f; // 1/(7*7)
const float Kz = 0.166666666667f; // 1/6
const float Kzo = 0.416666666667f; // 1/2-1/6*2
const float jitter = 1.0f; // smaller jitter gives more regular pattern
float3 Pi = mod289(floor(P));
float3 Pf = frac(P) - 0.5f;
float3 Pfx = Pf.x + float3(1.0f, 0.0f, -1.0f);
float3 Pfy = Pf.y + float3(1.0f, 0.0f, -1.0f);
float3 Pfz = Pf.z + float3(1.0f, 0.0f, -1.0f);
float3 p = permute(Pi.x + float3(-1.0f, 0.0f, 1.0f));
float3 p1 = permute(p + Pi.y - 1.0f);
float3 p2 = permute(p + Pi.y);
float3 p3 = permute(p + Pi.y + 1.0f);
float3 p11 = permute(p1 + Pi.z - 1.0f);
float3 p12 = permute(p1 + Pi.z);
float3 p13 = permute(p1 + Pi.z + 1.0f);
float3 p21 = permute(p2 + Pi.z - 1.0f);
float3 p22 = permute(p2 + Pi.z);
float3 p23 = permute(p2 + Pi.z + 1.0f);
float3 p31 = permute(p3 + Pi.z - 1.0f);
float3 p32 = permute(p3 + Pi.z);
float3 p33 = permute(p3 + Pi.z + 1.0f);
float3 ox11 = frac(p11 * K) - Ko;
float3 oy11 = mod7(floor(p11 * K)) * K - Ko;
float3 oz11 = floor(p11 * K2) * Kz - Kzo; // p11 < 289 guaranteed
float3 ox12 = frac(p12 * K) - Ko;
float3 oy12 = mod7(floor(p12 * K)) * K - Ko;
float3 oz12 = floor(p12 * K2) * Kz - Kzo;
float3 ox13 = frac(p13 * K) - Ko;
float3 oy13 = mod7(floor(p13 * K)) * K - Ko;
float3 oz13 = floor(p13 * K2) * Kz - Kzo;
float3 ox21 = frac(p21 * K) - Ko;
float3 oy21 = mod7(floor(p21 * K)) * K - Ko;
float3 oz21 = floor(p21 * K2) * Kz - Kzo;
float3 ox22 = frac(p22 * K) - Ko;
float3 oy22 = mod7(floor(p22 * K)) * K - Ko;
float3 oz22 = floor(p22 * K2) * Kz - Kzo;
float3 ox23 = frac(p23 * K) - Ko;
float3 oy23 = mod7(floor(p23 * K)) * K - Ko;
float3 oz23 = floor(p23 * K2) * Kz - Kzo;
float3 ox31 = frac(p31 * K) - Ko;
float3 oy31 = mod7(floor(p31 * K)) * K - Ko;
float3 oz31 = floor(p31 * K2) * Kz - Kzo;
float3 ox32 = frac(p32 * K) - Ko;
float3 oy32 = mod7(floor(p32 * K)) * K - Ko;
float3 oz32 = floor(p32 * K2) * Kz - Kzo;
float3 ox33 = frac(p33 * K) - Ko;
float3 oy33 = mod7(floor(p33 * K)) * K - Ko;
float3 oz33 = floor(p33 * K2) * Kz - Kzo;
float3 dx11 = Pfx + jitter * ox11;
float3 dy11 = Pfy.x + jitter * oy11;
float3 dz11 = Pfz.x + jitter * oz11;
float3 dx12 = Pfx + jitter * ox12;
float3 dy12 = Pfy.x + jitter * oy12;
float3 dz12 = Pfz.y + jitter * oz12;
float3 dx13 = Pfx + jitter * ox13;
float3 dy13 = Pfy.x + jitter * oy13;
float3 dz13 = Pfz.z + jitter * oz13;
float3 dx21 = Pfx + jitter * ox21;
float3 dy21 = Pfy.y + jitter * oy21;
float3 dz21 = Pfz.x + jitter * oz21;
float3 dx22 = Pfx + jitter * ox22;
float3 dy22 = Pfy.y + jitter * oy22;
float3 dz22 = Pfz.y + jitter * oz22;
float3 dx23 = Pfx + jitter * ox23;
float3 dy23 = Pfy.y + jitter * oy23;
float3 dz23 = Pfz.z + jitter * oz23;
float3 dx31 = Pfx + jitter * ox31;
float3 dy31 = Pfy.z + jitter * oy31;
float3 dz31 = Pfz.x + jitter * oz31;
float3 dx32 = Pfx + jitter * ox32;
float3 dy32 = Pfy.z + jitter * oy32;
float3 dz32 = Pfz.y + jitter * oz32;
float3 dx33 = Pfx + jitter * ox33;
float3 dy33 = Pfy.z + jitter * oy33;
float3 dz33 = Pfz.z + jitter * oz33;
float3 d11 = dx11 * dx11 + dy11 * dy11 + dz11 * dz11;
float3 d12 = dx12 * dx12 + dy12 * dy12 + dz12 * dz12;
float3 d13 = dx13 * dx13 + dy13 * dy13 + dz13 * dz13;
float3 d21 = dx21 * dx21 + dy21 * dy21 + dz21 * dz21;
float3 d22 = dx22 * dx22 + dy22 * dy22 + dz22 * dz22;
float3 d23 = dx23 * dx23 + dy23 * dy23 + dz23 * dz23;
float3 d31 = dx31 * dx31 + dy31 * dy31 + dz31 * dz31;
float3 d32 = dx32 * dx32 + dy32 * dy32 + dz32 * dz32;
float3 d33 = dx33 * dx33 + dy33 * dy33 + dz33 * dz33;
// Sort out the two smallest distances (F1, F2)
// Do it right and sort out both F1 and F2
float3 d1a = min(d11, d12);
d12 = max(d11, d12);
d11 = min(d1a, d13); // Smallest now not in d12 or d13
d13 = max(d1a, d13);
d12 = min(d12, d13); // 2nd smallest now not in d13
float3 d2a = min(d21, d22);
d22 = max(d21, d22);
d21 = min(d2a, d23); // Smallest now not in d22 or d23
d23 = max(d2a, d23);
d22 = min(d22, d23); // 2nd smallest now not in d23
float3 d3a = min(d31, d32);
d32 = max(d31, d32);
d31 = min(d3a, d33); // Smallest now not in d32 or d33
d33 = max(d3a, d33);
d32 = min(d32, d33); // 2nd smallest now not in d33
float3 da = min(d11, d21);
d21 = max(d11, d21);
d11 = min(da, d31); // Smallest now in d11
d31 = max(da, d31); // 2nd smallest now not in d31
d11.xy = (d11.x < d11.y) ? d11.xy : d11.yx;
d11.xz = (d11.x < d11.z) ? d11.xz : d11.zx; // d11.x now smallest
d12 = min(d12, d21); // 2nd smallest now not in d21
d12 = min(d12, d22); // nor in d22
d12 = min(d12, d31); // nor in d31
d12 = min(d12, d32); // nor in d32
d11.yz = min(d11.yz, d12.xy); // nor in d12.yz
d11.y = min(d11.y, d12.z); // Only two more to go
d11.y = min(d11.y, d11.z); // Done! (Phew!)
return sqrt(d11.xy); // F1, F2
}
}
}

View File

@@ -0,0 +1,102 @@
//
// GLSL textureless classic 2D noise "cnoise",
// with an RSL-style periodic variant "pnoise".
// Author: Stefan Gustavson (stefan.gustavson@liu.se)
// Version: 2011-08-22
//
// Many thanks to Ian McEwan of Ashima Arts for the
// ideas for permutation and gradient selection.
//
// Copyright (c) 2011 Stefan Gustavson. All rights reserved.
// Distributed under the MIT license. See LICENSE file.
// https://github.com/stegu/webgl-noise
//
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
public static partial class noise
{
// Classic Perlin noise
public static float cnoise(float2 P)
{
float4 Pi = floor(P.xyxy) + float4(0.0f, 0.0f, 1.0f, 1.0f);
float4 Pf = frac(P.xyxy) - float4(0.0f, 0.0f, 1.0f, 1.0f);
Pi = mod289(Pi); // To avoid truncation effects in permutation
float4 ix = Pi.xzxz;
float4 iy = Pi.yyww;
float4 fx = Pf.xzxz;
float4 fy = Pf.yyww;
float4 i = permute(permute(ix) + iy);
float4 gx = frac(i * (1.0f / 41.0f)) * 2.0f - 1.0f;
float4 gy = abs(gx) - 0.5f;
float4 tx = floor(gx + 0.5f);
gx = gx - tx;
float2 g00 = float2(gx.x, gy.x);
float2 g10 = float2(gx.y, gy.y);
float2 g01 = float2(gx.z, gy.z);
float2 g11 = float2(gx.w, gy.w);
float4 norm = taylorInvSqrt(float4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
g00 *= norm.x;
g01 *= norm.y;
g10 *= norm.z;
g11 *= norm.w;
float n00 = dot(g00, float2(fx.x, fy.x));
float n10 = dot(g10, float2(fx.y, fy.y));
float n01 = dot(g01, float2(fx.z, fy.z));
float n11 = dot(g11, float2(fx.w, fy.w));
float2 fade_xy = fade(Pf.xy);
float2 n_x = lerp(float2(n00, n01), float2(n10, n11), fade_xy.x);
float n_xy = lerp(n_x.x, n_x.y, fade_xy.y);
return 2.3f * n_xy;
}
// Classic Perlin noise, periodic variant
public static float pnoise(float2 P, float2 rep)
{
float4 Pi = floor(P.xyxy) + float4(0.0f, 0.0f, 1.0f, 1.0f);
float4 Pf = frac(P.xyxy) - float4(0.0f, 0.0f, 1.0f, 1.0f);
Pi = fmod(Pi, rep.xyxy); // To create noise with explicit period
Pi = mod289(Pi); // To avoid truncation effects in permutation
float4 ix = Pi.xzxz;
float4 iy = Pi.yyww;
float4 fx = Pf.xzxz;
float4 fy = Pf.yyww;
float4 i = permute(permute(ix) + iy);
float4 gx = frac(i * (1.0f / 41.0f)) * 2.0f - 1.0f;
float4 gy = abs(gx) - 0.5f;
float4 tx = floor(gx + 0.5f);
gx = gx - tx;
float2 g00 = float2(gx.x, gy.x);
float2 g10 = float2(gx.y, gy.y);
float2 g01 = float2(gx.z, gy.z);
float2 g11 = float2(gx.w, gy.w);
float4 norm = taylorInvSqrt(float4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
g00 *= norm.x;
g01 *= norm.y;
g10 *= norm.z;
g11 *= norm.w;
float n00 = dot(g00, float2(fx.x, fy.x));
float n10 = dot(g10, float2(fx.y, fy.y));
float n01 = dot(g01, float2(fx.z, fy.z));
float n11 = dot(g11, float2(fx.w, fy.w));
float2 fade_xy = fade(Pf.xy);
float2 n_x = lerp(float2(n00, n01), float2(n10, n11), fade_xy.x);
float n_xy = lerp(n_x.x, n_x.y, fade_xy.y);
return 2.3f * n_xy;
}
}
}

View File

@@ -0,0 +1,161 @@
//
// GLSL textureless classic 3D noise "cnoise",
// with an RSL-style periodic variant "pnoise".
// Author: Stefan Gustavson (stefan.gustavson@liu.se)
// Version: 2011-10-11
//
// Many thanks to Ian McEwan of Ashima Arts for the
// ideas for permutation and gradient selection.
//
// Copyright (c) 2011 Stefan Gustavson. All rights reserved.
// Distributed under the MIT license. See LICENSE file.
// https://github.com/stegu/webgl-noise
//
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
public static partial class noise
{
// Classic Perlin noise
public static float cnoise(float3 P)
{
float3 Pi0 = floor(P); // Integer part for indexing
float3 Pi1 = Pi0 + float3(1.0f); // Integer part + 1
Pi0 = mod289(Pi0);
Pi1 = mod289(Pi1);
float3 Pf0 = frac(P); // Fractional part for interpolation
float3 Pf1 = Pf0 - float3(1.0f); // Fractional part - 1.0
float4 ix = float4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
float4 iy = float4(Pi0.yy, Pi1.yy);
float4 iz0 = Pi0.zzzz;
float4 iz1 = Pi1.zzzz;
float4 ixy = permute(permute(ix) + iy);
float4 ixy0 = permute(ixy + iz0);
float4 ixy1 = permute(ixy + iz1);
float4 gx0 = ixy0 * (1.0f / 7.0f);
float4 gy0 = frac(floor(gx0) * (1.0f / 7.0f)) - 0.5f;
gx0 = frac(gx0);
float4 gz0 = float4(0.5f) - abs(gx0) - abs(gy0);
float4 sz0 = step(gz0, float4(0.0f));
gx0 -= sz0 * (step(0.0f, gx0) - 0.5f);
gy0 -= sz0 * (step(0.0f, gy0) - 0.5f);
float4 gx1 = ixy1 * (1.0f / 7.0f);
float4 gy1 = frac(floor(gx1) * (1.0f / 7.0f)) - 0.5f;
gx1 = frac(gx1);
float4 gz1 = float4(0.5f) - abs(gx1) - abs(gy1);
float4 sz1 = step(gz1, float4(0.0f));
gx1 -= sz1 * (step(0.0f, gx1) - 0.5f);
gy1 -= sz1 * (step(0.0f, gy1) - 0.5f);
float3 g000 = float3(gx0.x, gy0.x, gz0.x);
float3 g100 = float3(gx0.y, gy0.y, gz0.y);
float3 g010 = float3(gx0.z, gy0.z, gz0.z);
float3 g110 = float3(gx0.w, gy0.w, gz0.w);
float3 g001 = float3(gx1.x, gy1.x, gz1.x);
float3 g101 = float3(gx1.y, gy1.y, gz1.y);
float3 g011 = float3(gx1.z, gy1.z, gz1.z);
float3 g111 = float3(gx1.w, gy1.w, gz1.w);
float4 norm0 = taylorInvSqrt(float4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
g000 *= norm0.x;
g010 *= norm0.y;
g100 *= norm0.z;
g110 *= norm0.w;
float4 norm1 = taylorInvSqrt(float4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
g001 *= norm1.x;
g011 *= norm1.y;
g101 *= norm1.z;
g111 *= norm1.w;
float n000 = dot(g000, Pf0);
float n100 = dot(g100, float3(Pf1.x, Pf0.yz));
float n010 = dot(g010, float3(Pf0.x, Pf1.y, Pf0.z));
float n110 = dot(g110, float3(Pf1.xy, Pf0.z));
float n001 = dot(g001, float3(Pf0.xy, Pf1.z));
float n101 = dot(g101, float3(Pf1.x, Pf0.y, Pf1.z));
float n011 = dot(g011, float3(Pf0.x, Pf1.yz));
float n111 = dot(g111, Pf1);
float3 fade_xyz = fade(Pf0);
float4 n_z = lerp(float4(n000, n100, n010, n110), float4(n001, n101, n011, n111), fade_xyz.z);
float2 n_yz = lerp(n_z.xy, n_z.zw, fade_xyz.y);
float n_xyz = lerp(n_yz.x, n_yz.y, fade_xyz.x);
return 2.2f * n_xyz;
}
// Classic Perlin noise, periodic variant
public static float pnoise(float3 P, float3 rep)
{
float3 Pi0 = fmod(floor(P), rep); // Integer part, math.modulo period
float3 Pi1 = fmod(Pi0 + float3(1.0f), rep); // Integer part + 1, math.mod period
Pi0 = mod289(Pi0);
Pi1 = mod289(Pi1);
float3 Pf0 = frac(P); // Fractional part for interpolation
float3 Pf1 = Pf0 - float3(1.0f); // Fractional part - 1.0
float4 ix = float4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
float4 iy = float4(Pi0.yy, Pi1.yy);
float4 iz0 = Pi0.zzzz;
float4 iz1 = Pi1.zzzz;
float4 ixy = permute(permute(ix) + iy);
float4 ixy0 = permute(ixy + iz0);
float4 ixy1 = permute(ixy + iz1);
float4 gx0 = ixy0 * (1.0f / 7.0f);
float4 gy0 = frac(floor(gx0) * (1.0f / 7.0f)) - 0.5f;
gx0 = frac(gx0);
float4 gz0 = float4(0.5f) - abs(gx0) - abs(gy0);
float4 sz0 = step(gz0, float4(0.0f));
gx0 -= sz0 * (step(0.0f, gx0) - 0.5f);
gy0 -= sz0 * (step(0.0f, gy0) - 0.5f);
float4 gx1 = ixy1 * (1.0f / 7.0f);
float4 gy1 = frac(floor(gx1) * (1.0f / 7.0f)) - 0.5f;
gx1 = frac(gx1);
float4 gz1 = float4(0.5f) - abs(gx1) - abs(gy1);
float4 sz1 = step(gz1, float4(0.0f));
gx1 -= sz1 * (step(0.0f, gx1) - 0.5f);
gy1 -= sz1 * (step(0.0f, gy1) - 0.5f);
float3 g000 = float3(gx0.x, gy0.x, gz0.x);
float3 g100 = float3(gx0.y, gy0.y, gz0.y);
float3 g010 = float3(gx0.z, gy0.z, gz0.z);
float3 g110 = float3(gx0.w, gy0.w, gz0.w);
float3 g001 = float3(gx1.x, gy1.x, gz1.x);
float3 g101 = float3(gx1.y, gy1.y, gz1.y);
float3 g011 = float3(gx1.z, gy1.z, gz1.z);
float3 g111 = float3(gx1.w, gy1.w, gz1.w);
float4 norm0 = taylorInvSqrt(float4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
g000 *= norm0.x;
g010 *= norm0.y;
g100 *= norm0.z;
g110 *= norm0.w;
float4 norm1 = taylorInvSqrt(float4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
g001 *= norm1.x;
g011 *= norm1.y;
g101 *= norm1.z;
g111 *= norm1.w;
float n000 = dot(g000, Pf0);
float n100 = dot(g100, float3(Pf1.x, Pf0.yz));
float n010 = dot(g010, float3(Pf0.x, Pf1.y, Pf0.z));
float n110 = dot(g110, float3(Pf1.xy, Pf0.z));
float n001 = dot(g001, float3(Pf0.xy, Pf1.z));
float n101 = dot(g101, float3(Pf1.x, Pf0.y, Pf1.z));
float n011 = dot(g011, float3(Pf0.x, Pf1.yz));
float n111 = dot(g111, Pf1);
float3 fade_xyz = fade(Pf0);
float4 n_z = lerp(float4(n000, n100, n010, n110), float4(n001, n101, n011, n111), fade_xyz.z);
float2 n_yz = lerp(n_z.xy, n_z.zw, fade_xyz.y);
float n_xyz = lerp(n_yz.x, n_yz.y, fade_xyz.x);
return 2.2f * n_xyz;
}
}
}

View File

@@ -0,0 +1,291 @@
//
// GLSL textureless classic 4D noise "cnoise",
// with an RSL-style periodic variant "pnoise".
// Author: Stefan Gustavson (stefan.gustavson@liu.se)
// Version: 2011-08-22
//
// Many thanks to Ian McEwan of Ashima Arts for the
// ideas for permutation and gradient selection.
//
// Copyright (c) 2011 Stefan Gustavson. All rights reserved.
// Distributed under the MIT license. See LICENSE file.
// https://github.com/stegu/webgl-noise
//
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
public static partial class noise
{
// Classic Perlin noise
public static float cnoise(float4 P)
{
float4 Pi0 = floor(P); // Integer part for indexing
float4 Pi1 = Pi0 + 1.0f; // Integer part + 1
Pi0 = mod289(Pi0);
Pi1 = mod289(Pi1);
float4 Pf0 = frac(P); // Fractional part for interpolation
float4 Pf1 = Pf0 - 1.0f; // Fractional part - 1.0
float4 ix = float4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
float4 iy = float4(Pi0.yy, Pi1.yy);
float4 iz0 = float4(Pi0.zzzz);
float4 iz1 = float4(Pi1.zzzz);
float4 iw0 = float4(Pi0.wwww);
float4 iw1 = float4(Pi1.wwww);
float4 ixy = permute(permute(ix) + iy);
float4 ixy0 = permute(ixy + iz0);
float4 ixy1 = permute(ixy + iz1);
float4 ixy00 = permute(ixy0 + iw0);
float4 ixy01 = permute(ixy0 + iw1);
float4 ixy10 = permute(ixy1 + iw0);
float4 ixy11 = permute(ixy1 + iw1);
float4 gx00 = ixy00 * (1.0f / 7.0f);
float4 gy00 = floor(gx00) * (1.0f / 7.0f);
float4 gz00 = floor(gy00) * (1.0f / 6.0f);
gx00 = frac(gx00) - 0.5f;
gy00 = frac(gy00) - 0.5f;
gz00 = frac(gz00) - 0.5f;
float4 gw00 = float4(0.75f) - abs(gx00) - abs(gy00) - abs(gz00);
float4 sw00 = step(gw00, float4(0.0f));
gx00 -= sw00 * (step(0.0f, gx00) - 0.5f);
gy00 -= sw00 * (step(0.0f, gy00) - 0.5f);
float4 gx01 = ixy01 * (1.0f / 7.0f);
float4 gy01 = floor(gx01) * (1.0f / 7.0f);
float4 gz01 = floor(gy01) * (1.0f / 6.0f);
gx01 = frac(gx01) - 0.5f;
gy01 = frac(gy01) - 0.5f;
gz01 = frac(gz01) - 0.5f;
float4 gw01 = float4(0.75f) - abs(gx01) - abs(gy01) - abs(gz01);
float4 sw01 = step(gw01, float4(0.0f));
gx01 -= sw01 * (step(0.0f, gx01) - 0.5f);
gy01 -= sw01 * (step(0.0f, gy01) - 0.5f);
float4 gx10 = ixy10 * (1.0f / 7.0f);
float4 gy10 = floor(gx10) * (1.0f / 7.0f);
float4 gz10 = floor(gy10) * (1.0f / 6.0f);
gx10 = frac(gx10) - 0.5f;
gy10 = frac(gy10) - 0.5f;
gz10 = frac(gz10) - 0.5f;
float4 gw10 = float4(0.75f) - abs(gx10) - abs(gy10) - abs(gz10);
float4 sw10 = step(gw10, float4(0.0f));
gx10 -= sw10 * (step(0.0f, gx10) - 0.5f);
gy10 -= sw10 * (step(0.0f, gy10) - 0.5f);
float4 gx11 = ixy11 * (1.0f / 7.0f);
float4 gy11 = floor(gx11) * (1.0f / 7.0f);
float4 gz11 = floor(gy11) * (1.0f / 6.0f);
gx11 = frac(gx11) - 0.5f;
gy11 = frac(gy11) - 0.5f;
gz11 = frac(gz11) - 0.5f;
float4 gw11 = float4(0.75f) - abs(gx11) - abs(gy11) - abs(gz11);
float4 sw11 = step(gw11, float4(0.0f));
gx11 -= sw11 * (step(0.0f, gx11) - 0.5f);
gy11 -= sw11 * (step(0.0f, gy11) - 0.5f);
float4 g0000 = float4(gx00.x, gy00.x, gz00.x, gw00.x);
float4 g1000 = float4(gx00.y, gy00.y, gz00.y, gw00.y);
float4 g0100 = float4(gx00.z, gy00.z, gz00.z, gw00.z);
float4 g1100 = float4(gx00.w, gy00.w, gz00.w, gw00.w);
float4 g0010 = float4(gx10.x, gy10.x, gz10.x, gw10.x);
float4 g1010 = float4(gx10.y, gy10.y, gz10.y, gw10.y);
float4 g0110 = float4(gx10.z, gy10.z, gz10.z, gw10.z);
float4 g1110 = float4(gx10.w, gy10.w, gz10.w, gw10.w);
float4 g0001 = float4(gx01.x, gy01.x, gz01.x, gw01.x);
float4 g1001 = float4(gx01.y, gy01.y, gz01.y, gw01.y);
float4 g0101 = float4(gx01.z, gy01.z, gz01.z, gw01.z);
float4 g1101 = float4(gx01.w, gy01.w, gz01.w, gw01.w);
float4 g0011 = float4(gx11.x, gy11.x, gz11.x, gw11.x);
float4 g1011 = float4(gx11.y, gy11.y, gz11.y, gw11.y);
float4 g0111 = float4(gx11.z, gy11.z, gz11.z, gw11.z);
float4 g1111 = float4(gx11.w, gy11.w, gz11.w, gw11.w);
float4 norm00 = taylorInvSqrt(float4(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));
g0000 *= norm00.x;
g0100 *= norm00.y;
g1000 *= norm00.z;
g1100 *= norm00.w;
float4 norm01 = taylorInvSqrt(float4(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));
g0001 *= norm01.x;
g0101 *= norm01.y;
g1001 *= norm01.z;
g1101 *= norm01.w;
float4 norm10 = taylorInvSqrt(float4(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110)));
g0010 *= norm10.x;
g0110 *= norm10.y;
g1010 *= norm10.z;
g1110 *= norm10.w;
float4 norm11 = taylorInvSqrt(float4(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111)));
g0011 *= norm11.x;
g0111 *= norm11.y;
g1011 *= norm11.z;
g1111 *= norm11.w;
float n0000 = dot(g0000, Pf0);
float n1000 = dot(g1000, float4(Pf1.x, Pf0.yzw));
float n0100 = dot(g0100, float4(Pf0.x, Pf1.y, Pf0.zw));
float n1100 = dot(g1100, float4(Pf1.xy, Pf0.zw));
float n0010 = dot(g0010, float4(Pf0.xy, Pf1.z, Pf0.w));
float n1010 = dot(g1010, float4(Pf1.x, Pf0.y, Pf1.z, Pf0.w));
float n0110 = dot(g0110, float4(Pf0.x, Pf1.yz, Pf0.w));
float n1110 = dot(g1110, float4(Pf1.xyz, Pf0.w));
float n0001 = dot(g0001, float4(Pf0.xyz, Pf1.w));
float n1001 = dot(g1001, float4(Pf1.x, Pf0.yz, Pf1.w));
float n0101 = dot(g0101, float4(Pf0.x, Pf1.y, Pf0.z, Pf1.w));
float n1101 = dot(g1101, float4(Pf1.xy, Pf0.z, Pf1.w));
float n0011 = dot(g0011, float4(Pf0.xy, Pf1.zw));
float n1011 = dot(g1011, float4(Pf1.x, Pf0.y, Pf1.zw));
float n0111 = dot(g0111, float4(Pf0.x, Pf1.yzw));
float n1111 = dot(g1111, Pf1);
float4 fade_xyzw = fade(Pf0);
float4 n_0w = lerp(float4(n0000, n1000, n0100, n1100), float4(n0001, n1001, n0101, n1101), fade_xyzw.w);
float4 n_1w = lerp(float4(n0010, n1010, n0110, n1110), float4(n0011, n1011, n0111, n1111), fade_xyzw.w);
float4 n_zw = lerp(n_0w, n_1w, fade_xyzw.z);
float2 n_yzw = lerp(n_zw.xy, n_zw.zw, fade_xyzw.y);
float n_xyzw = lerp(n_yzw.x, n_yzw.y, fade_xyzw.x);
return 2.2f * n_xyzw;
}
// Classic Perlin noise, periodic version
public static float pnoise(float4 P, float4 rep)
{
float4 Pi0 = fmod(floor(P), rep); // Integer part math.modulo rep
float4 Pi1 = fmod(Pi0 + 1.0f, rep); // Integer part + 1 math.mod rep
Pi0 = mod289(Pi0);
Pi1 = mod289(Pi1);
float4 Pf0 = frac(P); // Fractional part for interpolation
float4 Pf1 = Pf0 - 1.0f; // Fractional part - 1.0
float4 ix = float4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
float4 iy = float4(Pi0.yy, Pi1.yy);
float4 iz0 = float4(Pi0.zzzz);
float4 iz1 = float4(Pi1.zzzz);
float4 iw0 = float4(Pi0.wwww);
float4 iw1 = float4(Pi1.wwww);
float4 ixy = permute(permute(ix) + iy);
float4 ixy0 = permute(ixy + iz0);
float4 ixy1 = permute(ixy + iz1);
float4 ixy00 = permute(ixy0 + iw0);
float4 ixy01 = permute(ixy0 + iw1);
float4 ixy10 = permute(ixy1 + iw0);
float4 ixy11 = permute(ixy1 + iw1);
float4 gx00 = ixy00 * (1.0f / 7.0f);
float4 gy00 = floor(gx00) * (1.0f / 7.0f);
float4 gz00 = floor(gy00) * (1.0f / 6.0f);
gx00 = frac(gx00) - 0.5f;
gy00 = frac(gy00) - 0.5f;
gz00 = frac(gz00) - 0.5f;
float4 gw00 = float4(0.75f) - abs(gx00) - abs(gy00) - abs(gz00);
float4 sw00 = step(gw00, float4(0.0f));
gx00 -= sw00 * (step(0.0f, gx00) - 0.5f);
gy00 -= sw00 * (step(0.0f, gy00) - 0.5f);
float4 gx01 = ixy01 * (1.0f / 7.0f);
float4 gy01 = floor(gx01) * (1.0f / 7.0f);
float4 gz01 = floor(gy01) * (1.0f / 6.0f);
gx01 = frac(gx01) - 0.5f;
gy01 = frac(gy01) - 0.5f;
gz01 = frac(gz01) - 0.5f;
float4 gw01 = float4(0.75f) - abs(gx01) - abs(gy01) - abs(gz01);
float4 sw01 = step(gw01, float4(0.0f));
gx01 -= sw01 * (step(0.0f, gx01) - 0.5f);
gy01 -= sw01 * (step(0.0f, gy01) - 0.5f);
float4 gx10 = ixy10 * (1.0f / 7.0f);
float4 gy10 = floor(gx10) * (1.0f / 7.0f);
float4 gz10 = floor(gy10) * (1.0f / 6.0f);
gx10 = frac(gx10) - 0.5f;
gy10 = frac(gy10) - 0.5f;
gz10 = frac(gz10) - 0.5f;
float4 gw10 = float4(0.75f) - abs(gx10) - abs(gy10) - abs(gz10);
float4 sw10 = step(gw10, float4(0.0f));
gx10 -= sw10 * (step(0.0f, gx10) - 0.5f);
gy10 -= sw10 * (step(0.0f, gy10) - 0.5f);
float4 gx11 = ixy11 * (1.0f / 7.0f);
float4 gy11 = floor(gx11) * (1.0f / 7.0f);
float4 gz11 = floor(gy11) * (1.0f / 6.0f);
gx11 = frac(gx11) - 0.5f;
gy11 = frac(gy11) - 0.5f;
gz11 = frac(gz11) - 0.5f;
float4 gw11 = float4(0.75f) - abs(gx11) - abs(gy11) - abs(gz11);
float4 sw11 = step(gw11, float4(0.0f));
gx11 -= sw11 * (step(0.0f, gx11) - 0.5f);
gy11 -= sw11 * (step(0.0f, gy11) - 0.5f);
float4 g0000 = float4(gx00.x, gy00.x, gz00.x, gw00.x);
float4 g1000 = float4(gx00.y, gy00.y, gz00.y, gw00.y);
float4 g0100 = float4(gx00.z, gy00.z, gz00.z, gw00.z);
float4 g1100 = float4(gx00.w, gy00.w, gz00.w, gw00.w);
float4 g0010 = float4(gx10.x, gy10.x, gz10.x, gw10.x);
float4 g1010 = float4(gx10.y, gy10.y, gz10.y, gw10.y);
float4 g0110 = float4(gx10.z, gy10.z, gz10.z, gw10.z);
float4 g1110 = float4(gx10.w, gy10.w, gz10.w, gw10.w);
float4 g0001 = float4(gx01.x, gy01.x, gz01.x, gw01.x);
float4 g1001 = float4(gx01.y, gy01.y, gz01.y, gw01.y);
float4 g0101 = float4(gx01.z, gy01.z, gz01.z, gw01.z);
float4 g1101 = float4(gx01.w, gy01.w, gz01.w, gw01.w);
float4 g0011 = float4(gx11.x, gy11.x, gz11.x, gw11.x);
float4 g1011 = float4(gx11.y, gy11.y, gz11.y, gw11.y);
float4 g0111 = float4(gx11.z, gy11.z, gz11.z, gw11.z);
float4 g1111 = float4(gx11.w, gy11.w, gz11.w, gw11.w);
float4 norm00 = taylorInvSqrt(float4(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));
g0000 *= norm00.x;
g0100 *= norm00.y;
g1000 *= norm00.z;
g1100 *= norm00.w;
float4 norm01 = taylorInvSqrt(float4(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));
g0001 *= norm01.x;
g0101 *= norm01.y;
g1001 *= norm01.z;
g1101 *= norm01.w;
float4 norm10 = taylorInvSqrt(float4(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110)));
g0010 *= norm10.x;
g0110 *= norm10.y;
g1010 *= norm10.z;
g1110 *= norm10.w;
float4 norm11 = taylorInvSqrt(float4(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111)));
g0011 *= norm11.x;
g0111 *= norm11.y;
g1011 *= norm11.z;
g1111 *= norm11.w;
float n0000 = dot(g0000, Pf0);
float n1000 = dot(g1000, float4(Pf1.x, Pf0.yzw));
float n0100 = dot(g0100, float4(Pf0.x, Pf1.y, Pf0.zw));
float n1100 = dot(g1100, float4(Pf1.xy, Pf0.zw));
float n0010 = dot(g0010, float4(Pf0.xy, Pf1.z, Pf0.w));
float n1010 = dot(g1010, float4(Pf1.x, Pf0.y, Pf1.z, Pf0.w));
float n0110 = dot(g0110, float4(Pf0.x, Pf1.yz, Pf0.w));
float n1110 = dot(g1110, float4(Pf1.xyz, Pf0.w));
float n0001 = dot(g0001, float4(Pf0.xyz, Pf1.w));
float n1001 = dot(g1001, float4(Pf1.x, Pf0.yz, Pf1.w));
float n0101 = dot(g0101, float4(Pf0.x, Pf1.y, Pf0.z, Pf1.w));
float n1101 = dot(g1101, float4(Pf1.xy, Pf0.z, Pf1.w));
float n0011 = dot(g0011, float4(Pf0.xy, Pf1.zw));
float n1011 = dot(g1011, float4(Pf1.x, Pf0.y, Pf1.zw));
float n0111 = dot(g0111, float4(Pf0.x, Pf1.yzw));
float n1111 = dot(g1111, Pf1);
float4 fade_xyzw = fade(Pf0);
float4 n_0w = lerp(float4(n0000, n1000, n0100, n1100), float4(n0001, n1001, n0101, n1101), fade_xyzw.w);
float4 n_1w = lerp(float4(n0010, n1010, n0110, n1110), float4(n0011, n1011, n0111, n1111), fade_xyzw.w);
float4 n_zw = lerp(n_0w, n_1w, fade_xyzw.z);
float2 n_yzw = lerp(n_zw.xy, n_zw.zw, fade_xyzw.y);
float n_xyzw = lerp(n_yzw.x, n_yzw.y, fade_xyzw.x);
return 2.2f * n_xyzw;
}
}
}

View File

@@ -0,0 +1,50 @@
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
public static partial class noise
{
// Modulo 289 without a division (only multiplications)
static float mod289(float x) { return x - floor(x * (1.0f / 289.0f)) * 289.0f; }
static float2 mod289(float2 x) { return x - floor(x * (1.0f / 289.0f)) * 289.0f; }
static float3 mod289(float3 x) { return x - floor(x * (1.0f / 289.0f)) * 289.0f; }
static float4 mod289(float4 x) { return x - floor(x * (1.0f / 289.0f)) * 289.0f; }
// Modulo 7 without a division
static float3 mod7(float3 x) { return x - floor(x * (1.0f / 7.0f)) * 7.0f; }
static float4 mod7(float4 x) { return x - floor(x * (1.0f / 7.0f)) * 7.0f; }
// Permutation polynomial: (34x^2 + x) math.mod 289
static float permute(float x) { return mod289((34.0f * x + 1.0f) * x); }
static float3 permute(float3 x) { return mod289((34.0f * x + 1.0f) * x); }
static float4 permute(float4 x) { return mod289((34.0f * x + 1.0f) * x); }
static float taylorInvSqrt(float r) { return 1.79284291400159f - 0.85373472095314f * r; }
static float4 taylorInvSqrt(float4 r) { return 1.79284291400159f - 0.85373472095314f * r; }
static float2 fade(float2 t) { return t*t*t*(t*(t*6.0f-15.0f)+10.0f); }
static float3 fade(float3 t) { return t*t*t*(t*(t*6.0f-15.0f)+10.0f); }
static float4 fade(float4 t) { return t*t*t*(t*(t*6.0f-15.0f)+10.0f); }
static float4 grad4(float j, float4 ip)
{
float4 ones = float4(1.0f, 1.0f, 1.0f, -1.0f);
float3 pxyz = floor(frac(float3(j) * ip.xyz) * 7.0f) * ip.z - 1.0f;
float pw = 1.5f - dot(abs(pxyz), ones.xyz);
float4 p = float4(pxyz, pw);
float4 s = float4(p < 0.0f);
p.xyz = p.xyz + (s.xyz*2.0f - 1.0f) * s.www;
return p;
}
// Hashed 2-D gradients with an extra rotation.
// (The constant 0.0243902439 is 1/41)
static float2 rgrad2(float2 p, float rot)
{
// For more isotropic gradients, math.sin/math.cos can be used instead.
float u = permute(permute(p.x) + p.y) * 0.0243902439f + rot; // Rotate by shift
u = frac(u) * 6.28318530718f; // 2*pi
return float2(cos(u), sin(u));
}
}
}

View File

@@ -0,0 +1,68 @@
//
// Description : Array and textureless GLSL 2D simplex noise function.
// Author : Ian McEwan, Ashima Arts.
// Maintainer : stegu
// Lastmath.mod : 20110822 (ijm)
// License : Copyright (C) 2011 Ashima Arts. All rights reserved.
// Distributed under the MIT License. See LICENSE file.
// https://github.com/ashima/webgl-noise
// https://github.com/stegu/webgl-noise
//
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
public static partial class noise
{
public static float snoise(float2 v)
{
float4 C = float4(0.211324865405187f, // (3.0-math.sqrt(3.0))/6.0
0.366025403784439f, // 0.5*(math.sqrt(3.0)-1.0)
-0.577350269189626f, // -1.0 + 2.0 * C.x
0.024390243902439f); // 1.0 / 41.0
// First corner
float2 i = floor(v + dot(v, C.yy));
float2 x0 = v - i + dot(i, C.xx);
// Other corners
float2 i1;
//i1.x = math.step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0
//i1.y = 1.0 - i1.x;
i1 = (x0.x > x0.y) ? float2(1.0f, 0.0f) : float2(0.0f, 1.0f);
// x0 = x0 - 0.0 + 0.0 * C.xx ;
// x1 = x0 - i1 + 1.0 * C.xx ;
// x2 = x0 - 1.0 + 2.0 * C.xx ;
float4 x12 = x0.xyxy + C.xxzz;
x12.xy -= i1;
// Permutations
i = mod289(i); // Avoid truncation effects in permutation
float3 p = permute(permute(i.y + float3(0.0f, i1.y, 1.0f)) + i.x + float3(0.0f, i1.x, 1.0f));
float3 m = max(0.5f - float3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0f);
m = m * m;
m = m * m;
// Gradients: 41 points uniformly over a line, mapped onto a diamond.
// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)
float3 x = 2.0f * frac(p * C.www) - 1.0f;
float3 h = abs(x) - 0.5f;
float3 ox = floor(x + 0.5f);
float3 a0 = x - ox;
// Normalise gradients implicitly by scaling m
// Approximation of: m *= inversemath.sqrt( a0*a0 + h*h );
m *= 1.79284291400159f - 0.85373472095314f * (a0 * a0 + h * h);
// Compute final noise value at P
float gx = a0.x * x0.x + h.x * x0.y;
float2 gyz = a0.yz * x12.xz + h.yz * x12.yw;
float3 g = float3(gx,gyz);
return 130.0f * dot(m, g);
}
}
}

View File

@@ -0,0 +1,93 @@
//
// Description : Array and textureless GLSL 2D/3D/4D simplex
// noise functions.
// Author : Ian McEwan, Ashima Arts.
// Maintainer : stegu
// Lastmath.mod : 20110822 (ijm)
// License : Copyright (C) 2011 Ashima Arts. All rights reserved.
// Distributed under the MIT License. See LICENSE file.
// https://github.com/ashima/webgl-noise
// https://github.com/stegu/webgl-noise
//
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
public static partial class noise
{
public static float snoise(float3 v)
{
float2 C = float2(1.0f / 6.0f, 1.0f / 3.0f);
float4 D = float4(0.0f, 0.5f, 1.0f, 2.0f);
// First corner
float3 i = floor(v + dot(v, C.yyy));
float3 x0 = v - i + dot(i, C.xxx);
// Other corners
float3 g = step(x0.yzx, x0.xyz);
float3 l = 1.0f - g;
float3 i1 = min(g.xyz, l.zxy);
float3 i2 = max(g.xyz, l.zxy);
// x0 = x0 - 0.0 + 0.0 * C.xxx;
// x1 = x0 - i1 + 1.0 * C.xxx;
// x2 = x0 - i2 + 2.0 * C.xxx;
// x3 = x0 - 1.0 + 3.0 * C.xxx;
float3 x1 = x0 - i1 + C.xxx;
float3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y
float3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y
// Permutations
i = mod289(i);
float4 p = permute(permute(permute(
i.z + float4(0.0f, i1.z, i2.z, 1.0f))
+ i.y + float4(0.0f, i1.y, i2.y, 1.0f))
+ i.x + float4(0.0f, i1.x, i2.x, 1.0f));
// Gradients: 7x7 points over a square, mapped onto an octahedron.
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
float n_ = 0.142857142857f; // 1.0/7.0
float3 ns = n_ * D.wyz - D.xzx;
float4 j = p - 49.0f * floor(p * ns.z * ns.z); // math.mod(p,7*7)
float4 x_ = floor(j * ns.z);
float4 y_ = floor(j - 7.0f * x_); // math.mod(j,N)
float4 x = x_ * ns.x + ns.yyyy;
float4 y = y_ * ns.x + ns.yyyy;
float4 h = 1.0f - abs(x) - abs(y);
float4 b0 = float4(x.xy, y.xy);
float4 b1 = float4(x.zw, y.zw);
//float4 s0 = float4(math.lessThan(b0,0.0))*2.0 - 1.0;
//float4 s1 = float4(math.lessThan(b1,0.0))*2.0 - 1.0;
float4 s0 = floor(b0) * 2.0f + 1.0f;
float4 s1 = floor(b1) * 2.0f + 1.0f;
float4 sh = -step(h, float4(0.0f));
float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
float4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
float3 p0 = float3(a0.xy, h.x);
float3 p1 = float3(a0.zw, h.y);
float3 p2 = float3(a1.xy, h.z);
float3 p3 = float3(a1.zw, h.w);
//Normalise gradients
float4 norm = taylorInvSqrt(float4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
// Mix final noise value
float4 m = max(0.6f - float4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0f);
m = m * m;
return 42.0f * dot(m * m, float4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
}
}
}

View File

@@ -0,0 +1,102 @@
//
// Description : Array and textureless GLSL 2D/3D/4D simplex
// noise functions.
// Author : Ian McEwan, Ashima Arts.
// Maintainer : stegu
// Lastmath.mod : 20110822 (ijm)
// License : Copyright (C) 2011 Ashima Arts. All rights reserved.
// Distributed under the MIT License. See LICENSE file.
// https://github.com/ashima/webgl-noise
// https://github.com/stegu/webgl-noise
//
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
public static partial class noise
{
public static float snoise(float3 v, out float3 gradient)
{
float2 C = float2(1.0f / 6.0f, 1.0f / 3.0f);
float4 D = float4(0.0f, 0.5f, 1.0f, 2.0f);
// First corner
float3 i = floor(v + dot(v, C.yyy));
float3 x0 = v - i + dot(i, C.xxx);
// Other corners
float3 g = step(x0.yzx, x0.xyz);
float3 l = 1.0f - g;
float3 i1 = min(g.xyz, l.zxy);
float3 i2 = max(g.xyz, l.zxy);
// x0 = x0 - 0.0 + 0.0 * C.xxx;
// x1 = x0 - i1 + 1.0 * C.xxx;
// x2 = x0 - i2 + 2.0 * C.xxx;
// x3 = x0 - 1.0 + 3.0 * C.xxx;
float3 x1 = x0 - i1 + C.xxx;
float3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y
float3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y
// Permutations
i = mod289(i);
float4 p = permute(permute(permute(
i.z + float4(0.0f, i1.z, i2.z, 1.0f))
+ i.y + float4(0.0f, i1.y, i2.y, 1.0f))
+ i.x + float4(0.0f, i1.x, i2.x, 1.0f));
// Gradients: 7x7 points over a square, mapped onto an octahedron.
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
float n_ = 0.142857142857f; // 1.0/7.0
float3 ns = n_ * D.wyz - D.xzx;
float4 j = p - 49.0f * floor(p * ns.z * ns.z); // math.mod(p,7*7)
float4 x_ = floor(j * ns.z);
float4 y_ = floor(j - 7.0f * x_); // math.mod(j,N)
float4 x = x_ * ns.x + ns.yyyy;
float4 y = y_ * ns.x + ns.yyyy;
float4 h = 1.0f - abs(x) - abs(y);
float4 b0 = float4(x.xy, y.xy);
float4 b1 = float4(x.zw, y.zw);
//float4 s0 = float4(math.lessThan(b0,0.0))*2.0 - 1.0;
//float4 s1 = float4(math.lessThan(b1,0.0))*2.0 - 1.0;
float4 s0 = floor(b0) * 2.0f + 1.0f;
float4 s1 = floor(b1) * 2.0f + 1.0f;
float4 sh = -step(h, float4(0.0f));
float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
float4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
float3 p0 = float3(a0.xy, h.x);
float3 p1 = float3(a0.zw, h.y);
float3 p2 = float3(a1.xy, h.z);
float3 p3 = float3(a1.zw, h.w);
//Normalise gradients
float4 norm = taylorInvSqrt(float4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
// Mix final noise value
float4 m = max(0.6f - float4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0f);
float4 m2 = m * m;
float4 m4 = m2 * m2;
float4 pdotx = float4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3));
// Determath.mine noise gradient
float4 temp = m2 * m * pdotx;
gradient = -8.0f * (temp.x * x0 + temp.y * x1 + temp.z * x2 + temp.w * x3);
gradient += m4.x * p0 + m4.y * p1 + m4.z * p2 + m4.w * p3;
gradient *= 42.0f;
return 42.0f * dot(m4, pdotx);
}
}
}

View File

@@ -0,0 +1,99 @@
//
// Description : Array and textureless GLSL 2D/3D/4D simplex
// noise functions.
// Author : Ian McEwan, Ashima Arts.
// Maintainer : stegu
// Lastmath.mod : 20110822 (ijm)
// License : Copyright (C) 2011 Ashima Arts. All rights reserved.
// Distributed under the MIT License. See LICENSE file.
// https://github.com/ashima/webgl-noise
// https://github.com/stegu/webgl-noise
//
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
public static partial class noise
{
public static float snoise(float4 v)
{
// (math.sqrt(5) - 1)/4 = F4, used once below
const float F4 = 0.309016994374947451f;
float4 C = float4( 0.138196601125011f, // (5 - math.sqrt(5))/20 G4
0.276393202250021f, // 2 * G4
0.414589803375032f, // 3 * G4
-0.447213595499958f); // -1 + 4 * G4
// First corner
float4 i = floor(v + dot(v, float4(F4)) );
float4 x0 = v - i + dot(i, C.xxxx);
// Other corners
// Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)
float4 i0 = float4(0.0f);
float3 isX = step( x0.yzw, x0.xxx );
float3 isYZ = step( x0.zww, x0.yyz );
// i0.x = math.dot( isX, float3( 1.0 ) );
i0.x = isX.x + isX.y + isX.z;
i0.yzw = 1.0f - isX;
// i0.y += math.dot( isYZ.xy, float2( 1.0 ) );
i0.y += isYZ.x + isYZ.y;
i0.zw += 1.0f - isYZ.xy;
i0.z += isYZ.z;
i0.w += 1.0f - isYZ.z;
// i0 now contains the unique values 0,1,2,3 in each channel
float4 i3 = clamp( i0, 0.0f, 1.0f );
float4 i2 = clamp( i0-1.0f, 0.0f, 1.0f );
float4 i1 = clamp( i0-2.0f, 0.0f, 1.0f );
// x0 = x0 - 0.0 + 0.0 * C.xxxx
// x1 = x0 - i1 + 1.0 * C.xxxx
// x2 = x0 - i2 + 2.0 * C.xxxx
// x3 = x0 - i3 + 3.0 * C.xxxx
// x4 = x0 - 1.0 + 4.0 * C.xxxx
float4 x1 = x0 - i1 + C.xxxx;
float4 x2 = x0 - i2 + C.yyyy;
float4 x3 = x0 - i3 + C.zzzz;
float4 x4 = x0 + C.wwww;
// Permutations
i = mod289(i);
float j0 = permute( permute( permute( permute(i.w) + i.z) + i.y) + i.x);
float4 j1 = permute( permute( permute( permute (
i.w + float4(i1.w, i2.w, i3.w, 1.0f ))
+ i.z + float4(i1.z, i2.z, i3.z, 1.0f ))
+ i.y + float4(i1.y, i2.y, i3.y, 1.0f ))
+ i.x + float4(i1.x, i2.x, i3.x, 1.0f ));
// Gradients: 7x7x6 points over a cube, mapped onto a 4-cross polytope
// 7*7*6 = 294, which is close to the ring size 17*17 = 289.
float4 ip = float4(1.0f/294.0f, 1.0f/49.0f, 1.0f/7.0f, 0.0f) ;
float4 p0 = grad4(j0, ip);
float4 p1 = grad4(j1.x, ip);
float4 p2 = grad4(j1.y, ip);
float4 p3 = grad4(j1.z, ip);
float4 p4 = grad4(j1.w, ip);
// Normalise gradients
float4 norm = taylorInvSqrt(float4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
p4 *= taylorInvSqrt(dot(p4,p4));
// Mix contributions from the five corners
float3 m0 = max(0.6f - float3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0f);
float2 m1 = max(0.6f - float2(dot(x3,x3), dot(x4,x4) ), 0.0f);
m0 = m0 * m0;
m1 = m1 * m1;
return 49.0f * ( dot(m0*m0, float3( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 )))
+ dot(m1*m1, float2( dot( p3, x3 ), dot( p4, x4 ) ) ) ) ;
}
}
}

View File

@@ -0,0 +1,439 @@
//
// float3 psrdnoise(float2 pos, float2 per, float rot)
// float3 psrdnoise(float2 pos, float2 per)
// float psrnoise(float2 pos, float2 per, float rot)
// float psrnoise(float2 pos, float2 per)
// float3 srdnoise(float2 pos, float rot)
// float3 srdnoise(float2 pos)
// float srnoise(float2 pos, float rot)
// float srnoise(float2 pos)
//
// Periodic (tiling) 2-D simplex noise (hexagonal lattice gradient noise)
// with rotating gradients and analytic derivatives.
// Variants also without the derivative (no "d" in the name), without
// the tiling property (no "p" in the name) and without the rotating
// gradients (no "r" in the name).
//
// This is (yet) another variation on simplex noise. It's similar to the
// version presented by Ken Perlin, but the grid is axis-aligned and
// slightly stretched in the y direction to permit rectangular tiling.
//
// The noise can be made to tile seamlessly to any integer period in x and
// any even integer period in y. Odd periods may be specified for y, but
// then the actual tiling period will be twice that number.
//
// The rotating gradients give the appearance of a swirling motion, and can
// serve a similar purpose for animation as motion along z in 3-D noise.
// The rotating gradients in conjunction with the analytic derivatives
// can make "flow noise" effects as presented by Perlin and Neyret.
//
// float3 {p}s{r}dnoise(float2 pos {, float2 per} {, float rot})
// "pos" is the input (x,y) coordinate
// "per" is the x and y period, where per.x is a positive integer
// and per.y is a positive even integer
// "rot" is the angle to rotate the gradients (any float value,
// where 0.0 is no rotation and 1.0 is one full turn)
// The first component of the 3-element return vector is the noise value.
// The second and third components are the x and y partial derivatives.
//
// float {p}s{r}noise(float2 pos {, float2 per} {, float rot})
// "pos" is the input (x,y) coordinate
// "per" is the x and y period, where per.x is a positive integer
// and per.y is a positive even integer
// "rot" is the angle to rotate the gradients (any float value,
// where 0.0 is no rotation and 1.0 is one full turn)
// The return value is the noise value.
// Partial derivatives are not computed, making these functions faster.
//
// Author: Stefan Gustavson (stefan.gustavson@gmail.com)
// Version 2016-05-10.
//
// Many thanks to Ian McEwan of Ashima Arts for the
// idea of umath.sing a permutation polynomial.
//
// Copyright (c) 2016 Stefan Gustavson. All rights reserved.
// Distributed under the MIT license. See LICENSE file.
// https://github.com/stegu/webgl-noise
//
//
// TODO: One-pixel wide artefacts used to occur due to precision issues with
// the gradient indexing. This is specific to this variant of noise, because
// one axis of the simplex grid is perfectly aligned with the input x axis.
// The errors were rare, and they are now very unlikely to ever be visible
// after a quick fix was introduced: a small offset is added to the y coordinate.
// A proper fix would involve umath.sing round() instead of math.floor() in selected
// places, but the quick fix works fine.
// (If you run into problems with this, please let me know.)
//
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
public static partial class noise
{
//
// 2-D tiling simplex noise with rotating gradients and analytical derivative.
// The first component of the 3-element return vector is the noise value,
// and the second and third components are the x and y partial derivatives.
//
public static float3 psrdnoise(float2 pos, float2 per, float rot)
{
// Hack: offset y slightly to hide some rare artifacts
pos.y += 0.01f;
// Skew to hexagonal grid
float2 uv = float2(pos.x + pos.y * 0.5f, pos.y);
float2 i0 = floor(uv);
float2 f0 = frac(uv);
// Traversal order
float2 i1 = (f0.x > f0.y) ? float2(1.0f, 0.0f) : float2(0.0f, 1.0f);
// Unskewed grid points in (x,y) space
float2 p0 = float2(i0.x - i0.y * 0.5f, i0.y);
float2 p1 = float2(p0.x + i1.x - i1.y * 0.5f, p0.y + i1.y);
float2 p2 = float2(p0.x + 0.5f, p0.y + 1.0f);
// Vectors in unskewed (x,y) coordinates from
// each of the simplex corners to the evaluation point
float2 d0 = pos - p0;
float2 d1 = pos - p1;
float2 d2 = pos - p2;
// Wrap p0, p1 and p2 to the desired period before gradient hashing:
// wrap points in (x,y), map to (u,v)
float3 xw = fmod(float3(p0.x, p1.x, p2.x), per.x);
float3 yw = fmod(float3(p0.y, p1.y, p2.y), per.y);
float3 iuw = xw + 0.5f * yw;
float3 ivw = yw;
// Create gradients from indices
float2 g0 = rgrad2(float2(iuw.x, ivw.x), rot);
float2 g1 = rgrad2(float2(iuw.y, ivw.y), rot);
float2 g2 = rgrad2(float2(iuw.z, ivw.z), rot);
// Gradients math.dot vectors to corresponding corners
// (The derivatives of this are simply the gradients)
float3 w = float3(dot(g0, d0), dot(g1, d1), dot(g2, d2));
// Radial weights from corners
// 0.8 is the square of 2/math.sqrt(5), the distance from
// a grid point to the nearest simplex boundary
float3 t = 0.8f - float3(dot(d0, d0), dot(d1, d1), dot(d2, d2));
// Partial derivatives for analytical gradient computation
float3 dtdx = -2.0f * float3(d0.x, d1.x, d2.x);
float3 dtdy = -2.0f * float3(d0.y, d1.y, d2.y);
// Set influence of each surflet to zero outside radius math.sqrt(0.8)
if (t.x < 0.0f)
{
dtdx.x = 0.0f;
dtdy.x = 0.0f;
t.x = 0.0f;
}
if (t.y < 0.0f)
{
dtdx.y = 0.0f;
dtdy.y = 0.0f;
t.y = 0.0f;
}
if (t.z < 0.0f)
{
dtdx.z = 0.0f;
dtdy.z = 0.0f;
t.z = 0.0f;
}
// Fourth power of t (and third power for derivative)
float3 t2 = t * t;
float3 t4 = t2 * t2;
float3 t3 = t2 * t;
// Final noise value is:
// sum of ((radial weights) times (gradient math.dot vector from corner))
float n = dot(t4, w);
// Final analytical derivative (gradient of a sum of scalar products)
float2 dt0 = float2(dtdx.x, dtdy.x) * 4.0f * t3.x;
float2 dn0 = t4.x * g0 + dt0 * w.x;
float2 dt1 = float2(dtdx.y, dtdy.y) * 4.0f * t3.y;
float2 dn1 = t4.y * g1 + dt1 * w.y;
float2 dt2 = float2(dtdx.z, dtdy.z) * 4.0f * t3.z;
float2 dn2 = t4.z * g2 + dt2 * w.z;
return 11.0f * float3(n, dn0 + dn1 + dn2);
}
//
// 2-D tiling simplex noise with fixed gradients
// and analytical derivative.
// This function is implemented as a wrapper to "psrdnoise",
// at the math.minimal math.cost of three extra additions.
//
public static float3 psrdnoise(float2 pos, float2 per)
{
return psrdnoise(pos, per, 0.0f);
}
//
// 2-D tiling simplex noise with rotating gradients,
// but without the analytical derivative.
//
public static float psrnoise(float2 pos, float2 per, float rot)
{
// Offset y slightly to hide some rare artifacts
pos.y += 0.001f;
// Skew to hexagonal grid
float2 uv = float2(pos.x + pos.y * 0.5f, pos.y);
float2 i0 = floor(uv);
float2 f0 = frac(uv);
// Traversal order
float2 i1 = (f0.x > f0.y) ? float2(1.0f, 0.0f) : float2(0.0f, 1.0f);
// Unskewed grid points in (x,y) space
float2 p0 = float2(i0.x - i0.y * 0.5f, i0.y);
float2 p1 = float2(p0.x + i1.x - i1.y * 0.5f, p0.y + i1.y);
float2 p2 = float2(p0.x + 0.5f, p0.y + 1.0f);
// Vectors in unskewed (x,y) coordinates from
// each of the simplex corners to the evaluation point
float2 d0 = pos - p0;
float2 d1 = pos - p1;
float2 d2 = pos - p2;
// Wrap p0, p1 and p2 to the desired period before gradient hashing:
// wrap points in (x,y), map to (u,v)
float3 xw = fmod(float3(p0.x, p1.x, p2.x), per.x);
float3 yw = fmod(float3(p0.y, p1.y, p2.y), per.y);
float3 iuw = xw + 0.5f * yw;
float3 ivw = yw;
// Create gradients from indices
float2 g0 = rgrad2(float2(iuw.x, ivw.x), rot);
float2 g1 = rgrad2(float2(iuw.y, ivw.y), rot);
float2 g2 = rgrad2(float2(iuw.z, ivw.z), rot);
// Gradients math.dot vectors to corresponding corners
// (The derivatives of this are simply the gradients)
float3 w = float3(dot(g0, d0), dot(g1, d1), dot(g2, d2));
// Radial weights from corners
// 0.8 is the square of 2/math.sqrt(5), the distance from
// a grid point to the nearest simplex boundary
float3 t = 0.8f - float3(dot(d0, d0), dot(d1, d1), dot(d2, d2));
// Set influence of each surflet to zero outside radius math.sqrt(0.8)
t = max(t, 0.0f);
// Fourth power of t
float3 t2 = t * t;
float3 t4 = t2 * t2;
// Final noise value is:
// sum of ((radial weights) times (gradient math.dot vector from corner))
float n = dot(t4, w);
// Rescale to cover the range [-1,1] reasonably well
return 11.0f * n;
}
//
// 2-D tiling simplex noise with fixed gradients,
// without the analytical derivative.
// This function is implemented as a wrapper to "psrnoise",
// at the math.minimal math.cost of three extra additions.
//
public static float psrnoise(float2 pos, float2 per)
{
return psrnoise(pos, per, 0.0f);
}
//
// 2-D non-tiling simplex noise with rotating gradients and analytical derivative.
// The first component of the 3-element return vector is the noise value,
// and the second and third components are the x and y partial derivatives.
//
public static float3 srdnoise(float2 pos, float rot)
{
// Offset y slightly to hide some rare artifacts
pos.y += 0.001f;
// Skew to hexagonal grid
float2 uv = float2(pos.x + pos.y * 0.5f, pos.y);
float2 i0 = floor(uv);
float2 f0 = frac(uv);
// Traversal order
float2 i1 = (f0.x > f0.y) ? float2(1.0f, 0.0f) : float2(0.0f, 1.0f);
// Unskewed grid points in (x,y) space
float2 p0 = float2(i0.x - i0.y * 0.5f, i0.y);
float2 p1 = float2(p0.x + i1.x - i1.y * 0.5f, p0.y + i1.y);
float2 p2 = float2(p0.x + 0.5f, p0.y + 1.0f);
// Vectors in unskewed (x,y) coordinates from
// each of the simplex corners to the evaluation point
float2 d0 = pos - p0;
float2 d1 = pos - p1;
float2 d2 = pos - p2;
float3 x = float3(p0.x, p1.x, p2.x);
float3 y = float3(p0.y, p1.y, p2.y);
float3 iuw = x + 0.5f * y;
float3 ivw = y;
// Avoid precision issues in permutation
iuw = mod289(iuw);
ivw = mod289(ivw);
// Create gradients from indices
float2 g0 = rgrad2(float2(iuw.x, ivw.x), rot);
float2 g1 = rgrad2(float2(iuw.y, ivw.y), rot);
float2 g2 = rgrad2(float2(iuw.z, ivw.z), rot);
// Gradients math.dot vectors to corresponding corners
// (The derivatives of this are simply the gradients)
float3 w = float3(dot(g0, d0), dot(g1, d1), dot(g2, d2));
// Radial weights from corners
// 0.8 is the square of 2/math.sqrt(5), the distance from
// a grid point to the nearest simplex boundary
float3 t = 0.8f - float3(dot(d0, d0), dot(d1, d1), dot(d2, d2));
// Partial derivatives for analytical gradient computation
float3 dtdx = -2.0f * float3(d0.x, d1.x, d2.x);
float3 dtdy = -2.0f * float3(d0.y, d1.y, d2.y);
// Set influence of each surflet to zero outside radius math.sqrt(0.8)
if (t.x < 0.0f)
{
dtdx.x = 0.0f;
dtdy.x = 0.0f;
t.x = 0.0f;
}
if (t.y < 0.0f)
{
dtdx.y = 0.0f;
dtdy.y = 0.0f;
t.y = 0.0f;
}
if (t.z < 0.0f)
{
dtdx.z = 0.0f;
dtdy.z = 0.0f;
t.z = 0.0f;
}
// Fourth power of t (and third power for derivative)
float3 t2 = t * t;
float3 t4 = t2 * t2;
float3 t3 = t2 * t;
// Final noise value is:
// sum of ((radial weights) times (gradient math.dot vector from corner))
float n = dot(t4, w);
// Final analytical derivative (gradient of a sum of scalar products)
float2 dt0 = float2(dtdx.x, dtdy.x) * 4.0f * t3.x;
float2 dn0 = t4.x * g0 + dt0 * w.x;
float2 dt1 = float2(dtdx.y, dtdy.y) * 4.0f * t3.y;
float2 dn1 = t4.y * g1 + dt1 * w.y;
float2 dt2 = float2(dtdx.z, dtdy.z) * 4.0f * t3.z;
float2 dn2 = t4.z * g2 + dt2 * w.z;
return 11.0f * float3(n, dn0 + dn1 + dn2);
}
//
// 2-D non-tiling simplex noise with fixed gradients and analytical derivative.
// This function is implemented as a wrapper to "srdnoise",
// at the math.minimal math.cost of three extra additions.
//
public static float3 srdnoise(float2 pos)
{
return srdnoise(pos, 0.0f);
}
//
// 2-D non-tiling simplex noise with rotating gradients,
// without the analytical derivative.
//
public static float srnoise(float2 pos, float rot)
{
// Offset y slightly to hide some rare artifacts
pos.y += 0.001f;
// Skew to hexagonal grid
float2 uv = float2(pos.x + pos.y * 0.5f, pos.y);
float2 i0 = floor(uv);
float2 f0 = frac(uv);
// Traversal order
float2 i1 = (f0.x > f0.y) ? float2(1.0f, 0.0f) : float2(0.0f, 1.0f);
// Unskewed grid points in (x,y) space
float2 p0 = float2(i0.x - i0.y * 0.5f, i0.y);
float2 p1 = float2(p0.x + i1.x - i1.y * 0.5f, p0.y + i1.y);
float2 p2 = float2(p0.x + 0.5f, p0.y + 1.0f);
// Vectors in unskewed (x,y) coordinates from
// each of the simplex corners to the evaluation point
float2 d0 = pos - p0;
float2 d1 = pos - p1;
float2 d2 = pos - p2;
float3 x = float3(p0.x, p1.x, p2.x);
float3 y = float3(p0.y, p1.y, p2.y);
float3 iuw = x + 0.5f * y;
float3 ivw = y;
// Avoid precision issues in permutation
iuw = mod289(iuw);
ivw = mod289(ivw);
// Create gradients from indices
float2 g0 = rgrad2(float2(iuw.x, ivw.x), rot);
float2 g1 = rgrad2(float2(iuw.y, ivw.y), rot);
float2 g2 = rgrad2(float2(iuw.z, ivw.z), rot);
// Gradients math.dot vectors to corresponding corners
// (The derivatives of this are simply the gradients)
float3 w = float3(dot(g0, d0), dot(g1, d1), dot(g2, d2));
// Radial weights from corners
// 0.8 is the square of 2/math.sqrt(5), the distance from
// a grid point to the nearest simplex boundary
float3 t = 0.8f - float3(dot(d0, d0), dot(d1, d1), dot(d2, d2));
// Set influence of each surflet to zero outside radius math.sqrt(0.8)
t = max(t, 0.0f);
// Fourth power of t
float3 t2 = t * t;
float3 t4 = t2 * t2;
// Final noise value is:
// sum of ((radial weights) times (gradient math.dot vector from corner))
float n = dot(t4, w);
// Rescale to cover the range [-1,1] reasonably well
return 11.0f * n;
}
//
// 2-D non-tiling simplex noise with fixed gradients,
// without the analytical derivative.
// This function is implemented as a wrapper to "srnoise",
// at the math.minimal math.cost of three extra additions.
// Note: if this kind of noise is all you want, there are faster
// GLSL implementations of non-tiling simplex noise out there.
// This one is included mainly for completeness and compatibility
// with the other functions in the file.
//
public static float srnoise(float2 pos)
{
return srnoise(pos, 0.0f);
}
}
}

View File

@@ -0,0 +1,47 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
#if !UNITY_DOTSPLAYER
using System.Reflection;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Unity.Mathematics")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Unity.Mathematics")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("19810344-7387-4155-935F-BDD5CC61F0BF")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
#endif
[assembly: InternalsVisibleTo("Unity.Mathematics.Tests")]
[assembly: InternalsVisibleTo("Unity.Mathematics.PerformanceTests")]
[assembly: InternalsVisibleTo("btests")]

View File

@@ -0,0 +1,6 @@
namespace Unity.Mathematics
{
public class PostNormalizeAttribute : UnityEngine.PropertyAttribute {}
public class DoNotNormalizeAttribute : UnityEngine.PropertyAttribute {}
}

View File

@@ -0,0 +1,4 @@
{
"name": "Unity.Mathematics",
"allowUnsafeCode": true
}

View File

@@ -0,0 +1,501 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Diagnostics;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[DebuggerTypeProxy(typeof(bool2.DebuggerProxy))]
[System.Serializable]
public partial struct bool2 : System.IEquatable<bool2>
{
[MarshalAs(UnmanagedType.U1)]
public bool x;
[MarshalAs(UnmanagedType.U1)]
public bool y;
/// <summary>Constructs a bool2 vector from two bool values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool2(bool x, bool y)
{
this.x = x;
this.y = y;
}
/// <summary>Constructs a bool2 vector from a bool2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool2(bool2 xy)
{
this.x = xy.x;
this.y = xy.y;
}
/// <summary>Constructs a bool2 vector from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool2(bool v)
{
this.x = v;
this.y = v;
}
/// <summary>Implicitly converts a single bool value to a bool2 vector by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator bool2(bool v) { return new bool2(v); }
/// <summary>Returns the result of a componentwise equality operation on two bool2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); }
/// <summary>Returns the result of a componentwise equality operation on a bool2 vector and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (bool2 lhs, bool rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a bool value and a bool2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (bool lhs, bool2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); }
/// <summary>Returns the result of a componentwise not equal operation on two bool2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); }
/// <summary>Returns the result of a componentwise not equal operation on a bool2 vector and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (bool2 lhs, bool rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (bool lhs, bool2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); }
/// <summary>Returns the result of a componentwise not operation on a bool2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator ! (bool2 val) { return new bool2 (!val.x, !val.y); }
/// <summary>Returns the result of a componentwise bitwise and operation on two bool2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator & (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x & rhs.x, lhs.y & rhs.y); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool2 vector and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator & (bool2 lhs, bool rhs) { return new bool2 (lhs.x & rhs, lhs.y & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator & (bool lhs, bool2 rhs) { return new bool2 (lhs & rhs.x, lhs & rhs.y); }
/// <summary>Returns the result of a componentwise bitwise or operation on two bool2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator | (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x | rhs.x, lhs.y | rhs.y); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool2 vector and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator | (bool2 lhs, bool rhs) { return new bool2 (lhs.x | rhs, lhs.y | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator | (bool lhs, bool2 rhs) { return new bool2 (lhs | rhs.x, lhs | rhs.y); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator ^ (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x ^ rhs.x, lhs.y ^ rhs.y); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool2 vector and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator ^ (bool2 lhs, bool rhs) { return new bool2 (lhs.x ^ rhs, lhs.y ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator ^ (bool lhs, bool2 rhs) { return new bool2 (lhs ^ rhs.x, lhs ^ rhs.y); }
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 xxxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(x, x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 xxxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(x, x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 xxyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(x, x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 xxyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(x, x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 xyxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(x, y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 xyxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(x, y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 xyyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(x, y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 xyyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(x, y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 yxxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(y, x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 yxxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(y, x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 yxyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(y, x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 yxyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(y, x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 yyxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(y, y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 yyxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(y, y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 yyyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(y, y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool4 yyyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool4(y, y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool3 xxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool3(x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool3 xxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool3(x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool3 xyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool3(x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool3 xyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool3(x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool3 yxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool3(y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool3 yxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool3(y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool3 yyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool3(y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool3 yyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool3(y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool2 xx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool2(x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool2 xy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool2(x, y); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set { x = value.x; y = value.y; }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool2 yx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool2(y, x); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set { y = value.x; x = value.y; }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public bool2 yy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new bool2(y, y); }
}
/// <summary>Returns the bool element at a specified index.</summary>
unsafe public bool this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (bool2* array = &this) { return ((bool*)array)[index]; }
}
set
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (bool* array = &x) { array[index] = value; }
}
}
/// <summary>Returns true if the bool2 is equal to a given bool2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(bool2 rhs) { return x == rhs.x && y == rhs.y; }
/// <summary>Returns true if the bool2 is equal to a given bool2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((bool2)o); }
/// <summary>Returns a hash code for the bool2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the bool2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("bool2({0}, {1})", x, y);
}
internal sealed class DebuggerProxy
{
public bool x;
public bool y;
public DebuggerProxy(bool2 v)
{
x = v.x;
y = v.y;
}
}
}
public static partial class math
{
/// <summary>Returns a bool2 vector constructed from two bool values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 bool2(bool x, bool y) { return new bool2(x, y); }
/// <summary>Returns a bool2 vector constructed from a bool2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 bool2(bool2 xy) { return new bool2(xy); }
/// <summary>Returns a bool2 vector constructed from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 bool2(bool v) { return new bool2(v); }
/// <summary>Returns a uint hash code of a bool2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(bool2 v)
{
return csum(select(uint2(0x90A285BBu, 0x5D19E1D5u), uint2(0xFAAF07DDu, 0x625C45BDu), v));
}
/// <summary>
/// Returns a uint2 vector hash code of a bool2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(bool2 v)
{
return (select(uint2(0xC9F27FCBu, 0x6D2523B1u), uint2(0x6E2BF6A9u, 0xCC74B3B7u), v));
}
/// <summary>Returns the result of specified shuffling of the components from two bool2 vectors into a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool shuffle(bool2 a, bool2 b, ShuffleComponent x)
{
return select_shuffle_component(a, b, x);
}
/// <summary>Returns the result of specified shuffling of the components from two bool2 vectors into a bool2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 shuffle(bool2 a, bool2 b, ShuffleComponent x, ShuffleComponent y)
{
return bool2(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y));
}
/// <summary>Returns the result of specified shuffling of the components from two bool2 vectors into a bool3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3 shuffle(bool2 a, bool2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z)
{
return bool3(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y),
select_shuffle_component(a, b, z));
}
/// <summary>Returns the result of specified shuffling of the components from two bool2 vectors into a bool4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4 shuffle(bool2 a, bool2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z, ShuffleComponent w)
{
return bool4(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y),
select_shuffle_component(a, b, z),
select_shuffle_component(a, b, w));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static bool select_shuffle_component(bool2 a, bool2 b, ShuffleComponent component)
{
switch(component)
{
case ShuffleComponent.LeftX:
return a.x;
case ShuffleComponent.LeftY:
return a.y;
case ShuffleComponent.RightX:
return b.x;
case ShuffleComponent.RightY:
return b.y;
default:
throw new System.ArgumentException("Invalid shuffle component: " + component);
}
}
}
}

View File

@@ -0,0 +1,209 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct bool2x2 : System.IEquatable<bool2x2>
{
public bool2 c0;
public bool2 c1;
/// <summary>Constructs a bool2x2 matrix from two bool2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool2x2(bool2 c0, bool2 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a bool2x2 matrix from 4 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool2x2(bool m00, bool m01,
bool m10, bool m11)
{
this.c0 = new bool2(m00, m10);
this.c1 = new bool2(m01, m11);
}
/// <summary>Constructs a bool2x2 matrix from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool2x2(bool v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Implicitly converts a single bool value to a bool2x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator bool2x2(bool v) { return new bool2x2(v); }
/// <summary>Returns the result of a componentwise equality operation on two bool2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (bool2x2 lhs, bool2x2 rhs) { return new bool2x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on a bool2x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (bool2x2 lhs, bool rhs) { return new bool2x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a bool value and a bool2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (bool lhs, bool2x2 rhs) { return new bool2x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two bool2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (bool2x2 lhs, bool2x2 rhs) { return new bool2x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on a bool2x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (bool2x2 lhs, bool rhs) { return new bool2x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (bool lhs, bool2x2 rhs) { return new bool2x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the result of a componentwise not operation on a bool2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator ! (bool2x2 val) { return new bool2x2 (!val.c0, !val.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on two bool2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator & (bool2x2 lhs, bool2x2 rhs) { return new bool2x2 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool2x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator & (bool2x2 lhs, bool rhs) { return new bool2x2 (lhs.c0 & rhs, lhs.c1 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator & (bool lhs, bool2x2 rhs) { return new bool2x2 (lhs & rhs.c0, lhs & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on two bool2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator | (bool2x2 lhs, bool2x2 rhs) { return new bool2x2 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool2x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator | (bool2x2 lhs, bool rhs) { return new bool2x2 (lhs.c0 | rhs, lhs.c1 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator | (bool lhs, bool2x2 rhs) { return new bool2x2 (lhs | rhs.c0, lhs | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator ^ (bool2x2 lhs, bool2x2 rhs) { return new bool2x2 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool2x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator ^ (bool2x2 lhs, bool rhs) { return new bool2x2 (lhs.c0 ^ rhs, lhs.c1 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator ^ (bool lhs, bool2x2 rhs) { return new bool2x2 (lhs ^ rhs.c0, lhs ^ rhs.c1); }
/// <summary>Returns the bool2 element at a specified index.</summary>
unsafe public ref bool2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (bool2x2* array = &this) { return ref ((bool2*)array)[index]; }
}
}
/// <summary>Returns true if the bool2x2 is equal to a given bool2x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(bool2x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the bool2x2 is equal to a given bool2x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((bool2x2)o); }
/// <summary>Returns a hash code for the bool2x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the bool2x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("bool2x2({0}, {1}, {2}, {3})", c0.x, c1.x, c0.y, c1.y);
}
}
public static partial class math
{
/// <summary>Returns a bool2x2 matrix constructed from two bool2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 bool2x2(bool2 c0, bool2 c1) { return new bool2x2(c0, c1); }
/// <summary>Returns a bool2x2 matrix constructed from from 4 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 bool2x2(bool m00, bool m01,
bool m10, bool m11)
{
return new bool2x2(m00, m01,
m10, m11);
}
/// <summary>Returns a bool2x2 matrix constructed from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 bool2x2(bool v) { return new bool2x2(v); }
/// <summary>Return the bool2x2 transpose of a bool2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 transpose(bool2x2 v)
{
return bool2x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y);
}
/// <summary>Returns a uint hash code of a bool2x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(bool2x2 v)
{
return csum(select(uint2(0x7AF32C49u, 0xAE131389u), uint2(0x5D1B165Bu, 0x87096CD7u), v.c0) +
select(uint2(0x4C7F6DD1u, 0x4822A3E9u), uint2(0xAAC3C25Du, 0xD21D0945u), v.c1));
}
/// <summary>
/// Returns a uint2 vector hash code of a bool2x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(bool2x2 v)
{
return (select(uint2(0x88FCAB2Du, 0x614DA60Du), uint2(0x5BA2C50Bu, 0x8C455ACBu), v.c0) +
select(uint2(0xCD266C89u, 0xF1852A33u), uint2(0x77E35E77u, 0x863E3729u), v.c1));
}
}
}

View File

@@ -0,0 +1,216 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct bool2x3 : System.IEquatable<bool2x3>
{
public bool2 c0;
public bool2 c1;
public bool2 c2;
/// <summary>Constructs a bool2x3 matrix from three bool2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool2x3(bool2 c0, bool2 c1, bool2 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a bool2x3 matrix from 6 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool2x3(bool m00, bool m01, bool m02,
bool m10, bool m11, bool m12)
{
this.c0 = new bool2(m00, m10);
this.c1 = new bool2(m01, m11);
this.c2 = new bool2(m02, m12);
}
/// <summary>Constructs a bool2x3 matrix from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool2x3(bool v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Implicitly converts a single bool value to a bool2x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator bool2x3(bool v) { return new bool2x3(v); }
/// <summary>Returns the result of a componentwise equality operation on two bool2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (bool2x3 lhs, bool2x3 rhs) { return new bool2x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on a bool2x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (bool2x3 lhs, bool rhs) { return new bool2x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a bool value and a bool2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (bool lhs, bool2x3 rhs) { return new bool2x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two bool2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (bool2x3 lhs, bool2x3 rhs) { return new bool2x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on a bool2x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (bool2x3 lhs, bool rhs) { return new bool2x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (bool lhs, bool2x3 rhs) { return new bool2x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the result of a componentwise not operation on a bool2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator ! (bool2x3 val) { return new bool2x3 (!val.c0, !val.c1, !val.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on two bool2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator & (bool2x3 lhs, bool2x3 rhs) { return new bool2x3 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool2x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator & (bool2x3 lhs, bool rhs) { return new bool2x3 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator & (bool lhs, bool2x3 rhs) { return new bool2x3 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on two bool2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator | (bool2x3 lhs, bool2x3 rhs) { return new bool2x3 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool2x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator | (bool2x3 lhs, bool rhs) { return new bool2x3 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator | (bool lhs, bool2x3 rhs) { return new bool2x3 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator ^ (bool2x3 lhs, bool2x3 rhs) { return new bool2x3 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool2x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator ^ (bool2x3 lhs, bool rhs) { return new bool2x3 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator ^ (bool lhs, bool2x3 rhs) { return new bool2x3 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2); }
/// <summary>Returns the bool2 element at a specified index.</summary>
unsafe public ref bool2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (bool2x3* array = &this) { return ref ((bool2*)array)[index]; }
}
}
/// <summary>Returns true if the bool2x3 is equal to a given bool2x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(bool2x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the bool2x3 is equal to a given bool2x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((bool2x3)o); }
/// <summary>Returns a hash code for the bool2x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the bool2x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("bool2x3({0}, {1}, {2}, {3}, {4}, {5})", c0.x, c1.x, c2.x, c0.y, c1.y, c2.y);
}
}
public static partial class math
{
/// <summary>Returns a bool2x3 matrix constructed from three bool2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 bool2x3(bool2 c0, bool2 c1, bool2 c2) { return new bool2x3(c0, c1, c2); }
/// <summary>Returns a bool2x3 matrix constructed from from 6 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 bool2x3(bool m00, bool m01, bool m02,
bool m10, bool m11, bool m12)
{
return new bool2x3(m00, m01, m02,
m10, m11, m12);
}
/// <summary>Returns a bool2x3 matrix constructed from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 bool2x3(bool v) { return new bool2x3(v); }
/// <summary>Return the bool3x2 transpose of a bool2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 transpose(bool2x3 v)
{
return bool3x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y,
v.c2.x, v.c2.y);
}
/// <summary>Returns a uint hash code of a bool2x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(bool2x3 v)
{
return csum(select(uint2(0x7BE39F3Bu, 0xFAB9913Fu), uint2(0xB4501269u, 0xE04B89FDu), v.c0) +
select(uint2(0xDB3DE101u, 0x7B6D1B4Bu), uint2(0x58399E77u, 0x5EAC29C9u), v.c1) +
select(uint2(0xFC6014F9u, 0x6BF6693Fu), uint2(0x9D1B1D9Bu, 0xF842F5C1u), v.c2));
}
/// <summary>
/// Returns a uint2 vector hash code of a bool2x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(bool2x3 v)
{
return (select(uint2(0xA47EC335u, 0xA477DF57u), uint2(0xC4B1493Fu, 0xBA0966D3u), v.c0) +
select(uint2(0xAFBEE253u, 0x5B419C01u), uint2(0x515D90F5u, 0xEC9F68F3u), v.c1) +
select(uint2(0xF9EA92D5u, 0xC2FAFCB9u), uint2(0x616E9CA1u, 0xC5C5394Bu), v.c2));
}
}
}

View File

@@ -0,0 +1,223 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct bool2x4 : System.IEquatable<bool2x4>
{
public bool2 c0;
public bool2 c1;
public bool2 c2;
public bool2 c3;
/// <summary>Constructs a bool2x4 matrix from four bool2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool2x4(bool2 c0, bool2 c1, bool2 c2, bool2 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a bool2x4 matrix from 8 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool2x4(bool m00, bool m01, bool m02, bool m03,
bool m10, bool m11, bool m12, bool m13)
{
this.c0 = new bool2(m00, m10);
this.c1 = new bool2(m01, m11);
this.c2 = new bool2(m02, m12);
this.c3 = new bool2(m03, m13);
}
/// <summary>Constructs a bool2x4 matrix from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool2x4(bool v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Implicitly converts a single bool value to a bool2x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator bool2x4(bool v) { return new bool2x4(v); }
/// <summary>Returns the result of a componentwise equality operation on two bool2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (bool2x4 lhs, bool2x4 rhs) { return new bool2x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on a bool2x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (bool2x4 lhs, bool rhs) { return new bool2x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a bool value and a bool2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (bool lhs, bool2x4 rhs) { return new bool2x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two bool2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (bool2x4 lhs, bool2x4 rhs) { return new bool2x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on a bool2x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (bool2x4 lhs, bool rhs) { return new bool2x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (bool lhs, bool2x4 rhs) { return new bool2x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the result of a componentwise not operation on a bool2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator ! (bool2x4 val) { return new bool2x4 (!val.c0, !val.c1, !val.c2, !val.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on two bool2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator & (bool2x4 lhs, bool2x4 rhs) { return new bool2x4 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2, lhs.c3 & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool2x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator & (bool2x4 lhs, bool rhs) { return new bool2x4 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs, lhs.c3 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator & (bool lhs, bool2x4 rhs) { return new bool2x4 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2, lhs & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on two bool2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator | (bool2x4 lhs, bool2x4 rhs) { return new bool2x4 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2, lhs.c3 | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool2x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator | (bool2x4 lhs, bool rhs) { return new bool2x4 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs, lhs.c3 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator | (bool lhs, bool2x4 rhs) { return new bool2x4 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2, lhs | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator ^ (bool2x4 lhs, bool2x4 rhs) { return new bool2x4 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2, lhs.c3 ^ rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool2x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator ^ (bool2x4 lhs, bool rhs) { return new bool2x4 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs, lhs.c3 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator ^ (bool lhs, bool2x4 rhs) { return new bool2x4 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2, lhs ^ rhs.c3); }
/// <summary>Returns the bool2 element at a specified index.</summary>
unsafe public ref bool2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (bool2x4* array = &this) { return ref ((bool2*)array)[index]; }
}
}
/// <summary>Returns true if the bool2x4 is equal to a given bool2x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(bool2x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the bool2x4 is equal to a given bool2x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((bool2x4)o); }
/// <summary>Returns a hash code for the bool2x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the bool2x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("bool2x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y);
}
}
public static partial class math
{
/// <summary>Returns a bool2x4 matrix constructed from four bool2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 bool2x4(bool2 c0, bool2 c1, bool2 c2, bool2 c3) { return new bool2x4(c0, c1, c2, c3); }
/// <summary>Returns a bool2x4 matrix constructed from from 8 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 bool2x4(bool m00, bool m01, bool m02, bool m03,
bool m10, bool m11, bool m12, bool m13)
{
return new bool2x4(m00, m01, m02, m03,
m10, m11, m12, m13);
}
/// <summary>Returns a bool2x4 matrix constructed from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 bool2x4(bool v) { return new bool2x4(v); }
/// <summary>Return the bool4x2 transpose of a bool2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 transpose(bool2x4 v)
{
return bool4x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y,
v.c2.x, v.c2.y,
v.c3.x, v.c3.y);
}
/// <summary>Returns a uint hash code of a bool2x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(bool2x4 v)
{
return csum(select(uint2(0x45A22087u, 0xFC104C3Bu), uint2(0x5FFF6B19u, 0x5E6CBF3Bu), v.c0) +
select(uint2(0xB546F2A5u, 0xBBCF63E7u), uint2(0xC53F4755u, 0x6985C229u), v.c1) +
select(uint2(0xE133B0B3u, 0xC3E0A3B9u), uint2(0xFE31134Fu, 0x712A34D7u), v.c2) +
select(uint2(0x9D77A59Bu, 0x4942CA39u), uint2(0xB40EC62Du, 0x565ED63Fu), v.c3));
}
/// <summary>
/// Returns a uint2 vector hash code of a bool2x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(bool2x4 v)
{
return (select(uint2(0x93C30C2Bu, 0xDCAF0351u), uint2(0x6E050B01u, 0x750FDBF5u), v.c0) +
select(uint2(0x7F3DD499u, 0x52EAAEBBu), uint2(0x4599C793u, 0x83B5E729u), v.c1) +
select(uint2(0xC267163Fu, 0x67BC9149u), uint2(0xAD7C5EC1u, 0x822A7D6Du), v.c2) +
select(uint2(0xB492BF15u, 0xD37220E3u), uint2(0x7AA2C2BDu, 0xE16BC89Du), v.c3));
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,212 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct bool3x2 : System.IEquatable<bool3x2>
{
public bool3 c0;
public bool3 c1;
/// <summary>Constructs a bool3x2 matrix from two bool3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool3x2(bool3 c0, bool3 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a bool3x2 matrix from 6 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool3x2(bool m00, bool m01,
bool m10, bool m11,
bool m20, bool m21)
{
this.c0 = new bool3(m00, m10, m20);
this.c1 = new bool3(m01, m11, m21);
}
/// <summary>Constructs a bool3x2 matrix from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool3x2(bool v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Implicitly converts a single bool value to a bool3x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator bool3x2(bool v) { return new bool3x2(v); }
/// <summary>Returns the result of a componentwise equality operation on two bool3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (bool3x2 lhs, bool3x2 rhs) { return new bool3x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on a bool3x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (bool3x2 lhs, bool rhs) { return new bool3x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a bool value and a bool3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (bool lhs, bool3x2 rhs) { return new bool3x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two bool3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (bool3x2 lhs, bool3x2 rhs) { return new bool3x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on a bool3x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (bool3x2 lhs, bool rhs) { return new bool3x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (bool lhs, bool3x2 rhs) { return new bool3x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the result of a componentwise not operation on a bool3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator ! (bool3x2 val) { return new bool3x2 (!val.c0, !val.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on two bool3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator & (bool3x2 lhs, bool3x2 rhs) { return new bool3x2 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool3x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator & (bool3x2 lhs, bool rhs) { return new bool3x2 (lhs.c0 & rhs, lhs.c1 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator & (bool lhs, bool3x2 rhs) { return new bool3x2 (lhs & rhs.c0, lhs & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on two bool3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator | (bool3x2 lhs, bool3x2 rhs) { return new bool3x2 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool3x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator | (bool3x2 lhs, bool rhs) { return new bool3x2 (lhs.c0 | rhs, lhs.c1 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator | (bool lhs, bool3x2 rhs) { return new bool3x2 (lhs | rhs.c0, lhs | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator ^ (bool3x2 lhs, bool3x2 rhs) { return new bool3x2 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool3x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator ^ (bool3x2 lhs, bool rhs) { return new bool3x2 (lhs.c0 ^ rhs, lhs.c1 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator ^ (bool lhs, bool3x2 rhs) { return new bool3x2 (lhs ^ rhs.c0, lhs ^ rhs.c1); }
/// <summary>Returns the bool3 element at a specified index.</summary>
unsafe public ref bool3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (bool3x2* array = &this) { return ref ((bool3*)array)[index]; }
}
}
/// <summary>Returns true if the bool3x2 is equal to a given bool3x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(bool3x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the bool3x2 is equal to a given bool3x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((bool3x2)o); }
/// <summary>Returns a hash code for the bool3x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the bool3x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("bool3x2({0}, {1}, {2}, {3}, {4}, {5})", c0.x, c1.x, c0.y, c1.y, c0.z, c1.z);
}
}
public static partial class math
{
/// <summary>Returns a bool3x2 matrix constructed from two bool3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 bool3x2(bool3 c0, bool3 c1) { return new bool3x2(c0, c1); }
/// <summary>Returns a bool3x2 matrix constructed from from 6 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 bool3x2(bool m00, bool m01,
bool m10, bool m11,
bool m20, bool m21)
{
return new bool3x2(m00, m01,
m10, m11,
m20, m21);
}
/// <summary>Returns a bool3x2 matrix constructed from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 bool3x2(bool v) { return new bool3x2(v); }
/// <summary>Return the bool2x3 transpose of a bool3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 transpose(bool3x2 v)
{
return bool2x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z);
}
/// <summary>Returns a uint hash code of a bool3x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(bool3x2 v)
{
return csum(select(uint3(0x9C9F0823u, 0x5A9CA13Bu, 0xAFCDD5EFu), uint3(0xA88D187Du, 0xCF6EBA1Du, 0x9D88E5A1u), v.c0) +
select(uint3(0xEADF0775u, 0x747A9D7Bu, 0x4111F799u), uint3(0xB5F05AF1u, 0xFD80290Bu, 0x8B65ADB7u), v.c1));
}
/// <summary>
/// Returns a uint3 vector hash code of a bool3x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(bool3x2 v)
{
return (select(uint3(0xDFF4F563u, 0x7069770Du, 0xD1224537u), uint3(0xE99ED6F3u, 0x48125549u, 0xEEE2123Bu), v.c0) +
select(uint3(0xE3AD9FE5u, 0xCE1CF8BFu, 0x7BE39F3Bu), uint3(0xFAB9913Fu, 0xB4501269u, 0xE04B89FDu), v.c1));
}
}
}

View File

@@ -0,0 +1,219 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct bool3x3 : System.IEquatable<bool3x3>
{
public bool3 c0;
public bool3 c1;
public bool3 c2;
/// <summary>Constructs a bool3x3 matrix from three bool3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool3x3(bool3 c0, bool3 c1, bool3 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a bool3x3 matrix from 9 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool3x3(bool m00, bool m01, bool m02,
bool m10, bool m11, bool m12,
bool m20, bool m21, bool m22)
{
this.c0 = new bool3(m00, m10, m20);
this.c1 = new bool3(m01, m11, m21);
this.c2 = new bool3(m02, m12, m22);
}
/// <summary>Constructs a bool3x3 matrix from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool3x3(bool v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Implicitly converts a single bool value to a bool3x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator bool3x3(bool v) { return new bool3x3(v); }
/// <summary>Returns the result of a componentwise equality operation on two bool3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (bool3x3 lhs, bool3x3 rhs) { return new bool3x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on a bool3x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (bool3x3 lhs, bool rhs) { return new bool3x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a bool value and a bool3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (bool lhs, bool3x3 rhs) { return new bool3x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two bool3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (bool3x3 lhs, bool3x3 rhs) { return new bool3x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on a bool3x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (bool3x3 lhs, bool rhs) { return new bool3x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (bool lhs, bool3x3 rhs) { return new bool3x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the result of a componentwise not operation on a bool3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator ! (bool3x3 val) { return new bool3x3 (!val.c0, !val.c1, !val.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on two bool3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator & (bool3x3 lhs, bool3x3 rhs) { return new bool3x3 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool3x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator & (bool3x3 lhs, bool rhs) { return new bool3x3 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator & (bool lhs, bool3x3 rhs) { return new bool3x3 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on two bool3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator | (bool3x3 lhs, bool3x3 rhs) { return new bool3x3 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool3x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator | (bool3x3 lhs, bool rhs) { return new bool3x3 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator | (bool lhs, bool3x3 rhs) { return new bool3x3 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator ^ (bool3x3 lhs, bool3x3 rhs) { return new bool3x3 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool3x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator ^ (bool3x3 lhs, bool rhs) { return new bool3x3 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator ^ (bool lhs, bool3x3 rhs) { return new bool3x3 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2); }
/// <summary>Returns the bool3 element at a specified index.</summary>
unsafe public ref bool3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (bool3x3* array = &this) { return ref ((bool3*)array)[index]; }
}
}
/// <summary>Returns true if the bool3x3 is equal to a given bool3x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(bool3x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the bool3x3 is equal to a given bool3x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((bool3x3)o); }
/// <summary>Returns a hash code for the bool3x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the bool3x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
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);
}
}
public static partial class math
{
/// <summary>Returns a bool3x3 matrix constructed from three bool3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 bool3x3(bool3 c0, bool3 c1, bool3 c2) { return new bool3x3(c0, c1, c2); }
/// <summary>Returns a bool3x3 matrix constructed from from 9 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 bool3x3(bool m00, bool m01, bool m02,
bool m10, bool m11, bool m12,
bool m20, bool m21, bool m22)
{
return new bool3x3(m00, m01, m02,
m10, m11, m12,
m20, m21, m22);
}
/// <summary>Returns a bool3x3 matrix constructed from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 bool3x3(bool v) { return new bool3x3(v); }
/// <summary>Return the bool3x3 transpose of a bool3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 transpose(bool3x3 v)
{
return bool3x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z,
v.c2.x, v.c2.y, v.c2.z);
}
/// <summary>Returns a uint hash code of a bool3x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(bool3x3 v)
{
return csum(select(uint3(0xE7579997u, 0xEF7D56C7u, 0x66F38F0Bu), uint3(0x624256A3u, 0x5292ADE1u, 0xD2E590E5u), v.c0) +
select(uint3(0xF25BE857u, 0x9BC17CE7u, 0xC8B86851u), uint3(0x64095221u, 0xADF428FFu, 0xA3977109u), v.c1) +
select(uint3(0x745ED837u, 0x9CDC88F5u, 0xFA62D721u), uint3(0x7E4DB1CFu, 0x68EEE0F5u, 0xBC3B0A59u), v.c2));
}
/// <summary>
/// Returns a uint3 vector hash code of a bool3x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(bool3x3 v)
{
return (select(uint3(0x816EFB5Du, 0xA24E82B7u, 0x45A22087u), uint3(0xFC104C3Bu, 0x5FFF6B19u, 0x5E6CBF3Bu), v.c0) +
select(uint3(0xB546F2A5u, 0xBBCF63E7u, 0xC53F4755u), uint3(0x6985C229u, 0xE133B0B3u, 0xC3E0A3B9u), v.c1) +
select(uint3(0xFE31134Fu, 0x712A34D7u, 0x9D77A59Bu), uint3(0x4942CA39u, 0xB40EC62Du, 0x565ED63Fu), v.c2));
}
}
}

View File

@@ -0,0 +1,226 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct bool3x4 : System.IEquatable<bool3x4>
{
public bool3 c0;
public bool3 c1;
public bool3 c2;
public bool3 c3;
/// <summary>Constructs a bool3x4 matrix from four bool3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool3x4(bool3 c0, bool3 c1, bool3 c2, bool3 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a bool3x4 matrix from 12 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool3x4(bool m00, bool m01, bool m02, bool m03,
bool m10, bool m11, bool m12, bool m13,
bool m20, bool m21, bool m22, bool m23)
{
this.c0 = new bool3(m00, m10, m20);
this.c1 = new bool3(m01, m11, m21);
this.c2 = new bool3(m02, m12, m22);
this.c3 = new bool3(m03, m13, m23);
}
/// <summary>Constructs a bool3x4 matrix from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool3x4(bool v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Implicitly converts a single bool value to a bool3x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator bool3x4(bool v) { return new bool3x4(v); }
/// <summary>Returns the result of a componentwise equality operation on two bool3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (bool3x4 lhs, bool3x4 rhs) { return new bool3x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on a bool3x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (bool3x4 lhs, bool rhs) { return new bool3x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a bool value and a bool3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (bool lhs, bool3x4 rhs) { return new bool3x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two bool3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (bool3x4 lhs, bool3x4 rhs) { return new bool3x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on a bool3x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (bool3x4 lhs, bool rhs) { return new bool3x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (bool lhs, bool3x4 rhs) { return new bool3x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the result of a componentwise not operation on a bool3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator ! (bool3x4 val) { return new bool3x4 (!val.c0, !val.c1, !val.c2, !val.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on two bool3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator & (bool3x4 lhs, bool3x4 rhs) { return new bool3x4 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2, lhs.c3 & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool3x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator & (bool3x4 lhs, bool rhs) { return new bool3x4 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs, lhs.c3 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator & (bool lhs, bool3x4 rhs) { return new bool3x4 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2, lhs & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on two bool3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator | (bool3x4 lhs, bool3x4 rhs) { return new bool3x4 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2, lhs.c3 | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool3x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator | (bool3x4 lhs, bool rhs) { return new bool3x4 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs, lhs.c3 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator | (bool lhs, bool3x4 rhs) { return new bool3x4 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2, lhs | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator ^ (bool3x4 lhs, bool3x4 rhs) { return new bool3x4 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2, lhs.c3 ^ rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool3x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator ^ (bool3x4 lhs, bool rhs) { return new bool3x4 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs, lhs.c3 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator ^ (bool lhs, bool3x4 rhs) { return new bool3x4 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2, lhs ^ rhs.c3); }
/// <summary>Returns the bool3 element at a specified index.</summary>
unsafe public ref bool3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (bool3x4* array = &this) { return ref ((bool3*)array)[index]; }
}
}
/// <summary>Returns true if the bool3x4 is equal to a given bool3x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(bool3x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the bool3x4 is equal to a given bool3x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((bool3x4)o); }
/// <summary>Returns a hash code for the bool3x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the bool3x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("bool3x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y, c0.z, c1.z, c2.z, c3.z);
}
}
public static partial class math
{
/// <summary>Returns a bool3x4 matrix constructed from four bool3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 bool3x4(bool3 c0, bool3 c1, bool3 c2, bool3 c3) { return new bool3x4(c0, c1, c2, c3); }
/// <summary>Returns a bool3x4 matrix constructed from from 12 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 bool3x4(bool m00, bool m01, bool m02, bool m03,
bool m10, bool m11, bool m12, bool m13,
bool m20, bool m21, bool m22, bool m23)
{
return new bool3x4(m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23);
}
/// <summary>Returns a bool3x4 matrix constructed from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 bool3x4(bool v) { return new bool3x4(v); }
/// <summary>Return the bool4x3 transpose of a bool3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 transpose(bool3x4 v)
{
return bool4x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z,
v.c2.x, v.c2.y, v.c2.z,
v.c3.x, v.c3.y, v.c3.z);
}
/// <summary>Returns a uint hash code of a bool3x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(bool3x4 v)
{
return csum(select(uint3(0x83B58237u, 0x833E3E29u, 0xA9D919BFu), uint3(0xC3EC1D97u, 0xB8B208C7u, 0x5D3ED947u), v.c0) +
select(uint3(0x4473BBB1u, 0xCBA11D5Fu, 0x685835CFu), uint3(0xC3D32AE1u, 0xB966942Fu, 0xFE9856B3u), v.c1) +
select(uint3(0xFA3A3285u, 0xAD55999Du, 0xDCDD5341u), uint3(0x94DDD769u, 0xA1E92D39u, 0x4583C801u), v.c2) +
select(uint3(0x9536A0F5u, 0xAF816615u, 0x9AF8D62Du), uint3(0xE3600729u, 0x5F17300Du, 0x670D6809u), v.c3));
}
/// <summary>
/// Returns a uint3 vector hash code of a bool3x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(bool3x4 v)
{
return (select(uint3(0x7AF32C49u, 0xAE131389u, 0x5D1B165Bu), uint3(0x87096CD7u, 0x4C7F6DD1u, 0x4822A3E9u), v.c0) +
select(uint3(0xAAC3C25Du, 0xD21D0945u, 0x88FCAB2Du), uint3(0x614DA60Du, 0x5BA2C50Bu, 0x8C455ACBu), v.c1) +
select(uint3(0xCD266C89u, 0xF1852A33u, 0x77E35E77u), uint3(0x863E3729u, 0xE191B035u, 0x68586FAFu), v.c2) +
select(uint3(0xD4DFF6D3u, 0xCB634F4Du, 0x9B13B92Du), uint3(0x4ABF0813u, 0x86068063u, 0xD75513F9u), v.c3));
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,215 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct bool4x2 : System.IEquatable<bool4x2>
{
public bool4 c0;
public bool4 c1;
/// <summary>Constructs a bool4x2 matrix from two bool4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool4x2(bool4 c0, bool4 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a bool4x2 matrix from 8 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool4x2(bool m00, bool m01,
bool m10, bool m11,
bool m20, bool m21,
bool m30, bool m31)
{
this.c0 = new bool4(m00, m10, m20, m30);
this.c1 = new bool4(m01, m11, m21, m31);
}
/// <summary>Constructs a bool4x2 matrix from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool4x2(bool v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Implicitly converts a single bool value to a bool4x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator bool4x2(bool v) { return new bool4x2(v); }
/// <summary>Returns the result of a componentwise equality operation on two bool4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (bool4x2 lhs, bool4x2 rhs) { return new bool4x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on a bool4x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (bool4x2 lhs, bool rhs) { return new bool4x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a bool value and a bool4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (bool lhs, bool4x2 rhs) { return new bool4x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two bool4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (bool4x2 lhs, bool4x2 rhs) { return new bool4x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on a bool4x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (bool4x2 lhs, bool rhs) { return new bool4x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (bool lhs, bool4x2 rhs) { return new bool4x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the result of a componentwise not operation on a bool4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator ! (bool4x2 val) { return new bool4x2 (!val.c0, !val.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on two bool4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator & (bool4x2 lhs, bool4x2 rhs) { return new bool4x2 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool4x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator & (bool4x2 lhs, bool rhs) { return new bool4x2 (lhs.c0 & rhs, lhs.c1 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator & (bool lhs, bool4x2 rhs) { return new bool4x2 (lhs & rhs.c0, lhs & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on two bool4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator | (bool4x2 lhs, bool4x2 rhs) { return new bool4x2 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool4x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator | (bool4x2 lhs, bool rhs) { return new bool4x2 (lhs.c0 | rhs, lhs.c1 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator | (bool lhs, bool4x2 rhs) { return new bool4x2 (lhs | rhs.c0, lhs | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator ^ (bool4x2 lhs, bool4x2 rhs) { return new bool4x2 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool4x2 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator ^ (bool4x2 lhs, bool rhs) { return new bool4x2 (lhs.c0 ^ rhs, lhs.c1 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator ^ (bool lhs, bool4x2 rhs) { return new bool4x2 (lhs ^ rhs.c0, lhs ^ rhs.c1); }
/// <summary>Returns the bool4 element at a specified index.</summary>
unsafe public ref bool4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (bool4x2* array = &this) { return ref ((bool4*)array)[index]; }
}
}
/// <summary>Returns true if the bool4x2 is equal to a given bool4x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(bool4x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the bool4x2 is equal to a given bool4x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((bool4x2)o); }
/// <summary>Returns a hash code for the bool4x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the bool4x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("bool4x2({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x, c1.x, c0.y, c1.y, c0.z, c1.z, c0.w, c1.w);
}
}
public static partial class math
{
/// <summary>Returns a bool4x2 matrix constructed from two bool4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 bool4x2(bool4 c0, bool4 c1) { return new bool4x2(c0, c1); }
/// <summary>Returns a bool4x2 matrix constructed from from 8 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 bool4x2(bool m00, bool m01,
bool m10, bool m11,
bool m20, bool m21,
bool m30, bool m31)
{
return new bool4x2(m00, m01,
m10, m11,
m20, m21,
m30, m31);
}
/// <summary>Returns a bool4x2 matrix constructed from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 bool4x2(bool v) { return new bool4x2(v); }
/// <summary>Return the bool2x4 transpose of a bool4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 transpose(bool4x2 v)
{
return bool2x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w);
}
/// <summary>Returns a uint hash code of a bool4x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(bool4x2 v)
{
return csum(select(uint4(0xD19764C7u, 0xB5D0BF63u, 0xF9102C5Fu, 0x9881FB9Fu), uint4(0x56A1530Du, 0x804B722Du, 0x738E50E5u, 0x4FC93C25u), v.c0) +
select(uint4(0xCD0445A5u, 0xD2B90D9Bu, 0xD35C9B2Du, 0xA10D9E27u), uint4(0x568DAAA9u, 0x7530254Fu, 0x9F090439u, 0x5E9F85C9u), v.c1));
}
/// <summary>
/// Returns a uint4 vector hash code of a bool4x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(bool4x2 v)
{
return (select(uint4(0x8C4CA03Fu, 0xB8D969EDu, 0xAC5DB57Bu, 0xA91A02EDu), uint4(0xB3C49313u, 0xF43A9ABBu, 0x84E7E01Bu, 0x8E055BE5u), v.c0) +
select(uint4(0x6E624EB7u, 0x7383ED49u, 0xDD49C23Bu, 0xEBD0D005u), uint4(0x91475DF7u, 0x55E84827u, 0x90A285BBu, 0x5D19E1D5u), v.c1));
}
}
}

View File

@@ -0,0 +1,222 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct bool4x3 : System.IEquatable<bool4x3>
{
public bool4 c0;
public bool4 c1;
public bool4 c2;
/// <summary>Constructs a bool4x3 matrix from three bool4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool4x3(bool4 c0, bool4 c1, bool4 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a bool4x3 matrix from 12 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool4x3(bool m00, bool m01, bool m02,
bool m10, bool m11, bool m12,
bool m20, bool m21, bool m22,
bool m30, bool m31, bool m32)
{
this.c0 = new bool4(m00, m10, m20, m30);
this.c1 = new bool4(m01, m11, m21, m31);
this.c2 = new bool4(m02, m12, m22, m32);
}
/// <summary>Constructs a bool4x3 matrix from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool4x3(bool v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Implicitly converts a single bool value to a bool4x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator bool4x3(bool v) { return new bool4x3(v); }
/// <summary>Returns the result of a componentwise equality operation on two bool4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (bool4x3 lhs, bool4x3 rhs) { return new bool4x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on a bool4x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (bool4x3 lhs, bool rhs) { return new bool4x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a bool value and a bool4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (bool lhs, bool4x3 rhs) { return new bool4x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two bool4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (bool4x3 lhs, bool4x3 rhs) { return new bool4x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on a bool4x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (bool4x3 lhs, bool rhs) { return new bool4x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (bool lhs, bool4x3 rhs) { return new bool4x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the result of a componentwise not operation on a bool4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator ! (bool4x3 val) { return new bool4x3 (!val.c0, !val.c1, !val.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on two bool4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator & (bool4x3 lhs, bool4x3 rhs) { return new bool4x3 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool4x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator & (bool4x3 lhs, bool rhs) { return new bool4x3 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator & (bool lhs, bool4x3 rhs) { return new bool4x3 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on two bool4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator | (bool4x3 lhs, bool4x3 rhs) { return new bool4x3 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool4x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator | (bool4x3 lhs, bool rhs) { return new bool4x3 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator | (bool lhs, bool4x3 rhs) { return new bool4x3 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator ^ (bool4x3 lhs, bool4x3 rhs) { return new bool4x3 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool4x3 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator ^ (bool4x3 lhs, bool rhs) { return new bool4x3 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator ^ (bool lhs, bool4x3 rhs) { return new bool4x3 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2); }
/// <summary>Returns the bool4 element at a specified index.</summary>
unsafe public ref bool4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (bool4x3* array = &this) { return ref ((bool4*)array)[index]; }
}
}
/// <summary>Returns true if the bool4x3 is equal to a given bool4x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(bool4x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the bool4x3 is equal to a given bool4x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((bool4x3)o); }
/// <summary>Returns a hash code for the bool4x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the bool4x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("bool4x3({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", c0.x, c1.x, c2.x, c0.y, c1.y, c2.y, c0.z, c1.z, c2.z, c0.w, c1.w, c2.w);
}
}
public static partial class math
{
/// <summary>Returns a bool4x3 matrix constructed from three bool4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 bool4x3(bool4 c0, bool4 c1, bool4 c2) { return new bool4x3(c0, c1, c2); }
/// <summary>Returns a bool4x3 matrix constructed from from 12 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 bool4x3(bool m00, bool m01, bool m02,
bool m10, bool m11, bool m12,
bool m20, bool m21, bool m22,
bool m30, bool m31, bool m32)
{
return new bool4x3(m00, m01, m02,
m10, m11, m12,
m20, m21, m22,
m30, m31, m32);
}
/// <summary>Returns a bool4x3 matrix constructed from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 bool4x3(bool v) { return new bool4x3(v); }
/// <summary>Return the bool3x4 transpose of a bool4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 transpose(bool4x3 v)
{
return bool3x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w,
v.c2.x, v.c2.y, v.c2.z, v.c2.w);
}
/// <summary>Returns a uint hash code of a bool4x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(bool4x3 v)
{
return csum(select(uint4(0xEADF0775u, 0x747A9D7Bu, 0x4111F799u, 0xB5F05AF1u), uint4(0xFD80290Bu, 0x8B65ADB7u, 0xDFF4F563u, 0x7069770Du), v.c0) +
select(uint4(0xD1224537u, 0xE99ED6F3u, 0x48125549u, 0xEEE2123Bu), uint4(0xE3AD9FE5u, 0xCE1CF8BFu, 0x7BE39F3Bu, 0xFAB9913Fu), v.c1) +
select(uint4(0xB4501269u, 0xE04B89FDu, 0xDB3DE101u, 0x7B6D1B4Bu), uint4(0x58399E77u, 0x5EAC29C9u, 0xFC6014F9u, 0x6BF6693Fu), v.c2));
}
/// <summary>
/// Returns a uint4 vector hash code of a bool4x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(bool4x3 v)
{
return (select(uint4(0x9D1B1D9Bu, 0xF842F5C1u, 0xA47EC335u, 0xA477DF57u), uint4(0xC4B1493Fu, 0xBA0966D3u, 0xAFBEE253u, 0x5B419C01u), v.c0) +
select(uint4(0x515D90F5u, 0xEC9F68F3u, 0xF9EA92D5u, 0xC2FAFCB9u), uint4(0x616E9CA1u, 0xC5C5394Bu, 0xCAE78587u, 0x7A1541C9u), v.c1) +
select(uint4(0xF83BD927u, 0x6A243BCBu, 0x509B84C9u, 0x91D13847u), uint4(0x52F7230Fu, 0xCF286E83u, 0xE121E6ADu, 0xC9CA1249u), v.c2));
}
}
}

View File

@@ -0,0 +1,229 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct bool4x4 : System.IEquatable<bool4x4>
{
public bool4 c0;
public bool4 c1;
public bool4 c2;
public bool4 c3;
/// <summary>Constructs a bool4x4 matrix from four bool4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool4x4(bool4 c0, bool4 c1, bool4 c2, bool4 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a bool4x4 matrix from 16 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool4x4(bool m00, bool m01, bool m02, bool m03,
bool m10, bool m11, bool m12, bool m13,
bool m20, bool m21, bool m22, bool m23,
bool m30, bool m31, bool m32, bool m33)
{
this.c0 = new bool4(m00, m10, m20, m30);
this.c1 = new bool4(m01, m11, m21, m31);
this.c2 = new bool4(m02, m12, m22, m32);
this.c3 = new bool4(m03, m13, m23, m33);
}
/// <summary>Constructs a bool4x4 matrix from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool4x4(bool v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Implicitly converts a single bool value to a bool4x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator bool4x4(bool v) { return new bool4x4(v); }
/// <summary>Returns the result of a componentwise equality operation on two bool4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (bool4x4 lhs, bool4x4 rhs) { return new bool4x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on a bool4x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (bool4x4 lhs, bool rhs) { return new bool4x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a bool value and a bool4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (bool lhs, bool4x4 rhs) { return new bool4x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two bool4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (bool4x4 lhs, bool4x4 rhs) { return new bool4x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on a bool4x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (bool4x4 lhs, bool rhs) { return new bool4x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (bool lhs, bool4x4 rhs) { return new bool4x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the result of a componentwise not operation on a bool4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator ! (bool4x4 val) { return new bool4x4 (!val.c0, !val.c1, !val.c2, !val.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on two bool4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator & (bool4x4 lhs, bool4x4 rhs) { return new bool4x4 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2, lhs.c3 & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool4x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator & (bool4x4 lhs, bool rhs) { return new bool4x4 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs, lhs.c3 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator & (bool lhs, bool4x4 rhs) { return new bool4x4 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2, lhs & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on two bool4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator | (bool4x4 lhs, bool4x4 rhs) { return new bool4x4 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2, lhs.c3 | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool4x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator | (bool4x4 lhs, bool rhs) { return new bool4x4 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs, lhs.c3 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator | (bool lhs, bool4x4 rhs) { return new bool4x4 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2, lhs | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator ^ (bool4x4 lhs, bool4x4 rhs) { return new bool4x4 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2, lhs.c3 ^ rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool4x4 matrix and a bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator ^ (bool4x4 lhs, bool rhs) { return new bool4x4 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs, lhs.c3 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator ^ (bool lhs, bool4x4 rhs) { return new bool4x4 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2, lhs ^ rhs.c3); }
/// <summary>Returns the bool4 element at a specified index.</summary>
unsafe public ref bool4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (bool4x4* array = &this) { return ref ((bool4*)array)[index]; }
}
}
/// <summary>Returns true if the bool4x4 is equal to a given bool4x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(bool4x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the bool4x4 is equal to a given bool4x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((bool4x4)o); }
/// <summary>Returns a hash code for the bool4x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the bool4x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("bool4x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15})", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y, c0.z, c1.z, c2.z, c3.z, c0.w, c1.w, c2.w, c3.w);
}
}
public static partial class math
{
/// <summary>Returns a bool4x4 matrix constructed from four bool4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 bool4x4(bool4 c0, bool4 c1, bool4 c2, bool4 c3) { return new bool4x4(c0, c1, c2, c3); }
/// <summary>Returns a bool4x4 matrix constructed from from 16 bool values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 bool4x4(bool m00, bool m01, bool m02, bool m03,
bool m10, bool m11, bool m12, bool m13,
bool m20, bool m21, bool m22, bool m23,
bool m30, bool m31, bool m32, bool m33)
{
return new bool4x4(m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23,
m30, m31, m32, m33);
}
/// <summary>Returns a bool4x4 matrix constructed from a single bool value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 bool4x4(bool v) { return new bool4x4(v); }
/// <summary>Return the bool4x4 transpose of a bool4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 transpose(bool4x4 v)
{
return bool4x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w,
v.c2.x, v.c2.y, v.c2.z, v.c2.w,
v.c3.x, v.c3.y, v.c3.z, v.c3.w);
}
/// <summary>Returns a uint hash code of a bool4x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(bool4x4 v)
{
return csum(select(uint4(0xD19764C7u, 0xB5D0BF63u, 0xF9102C5Fu, 0x9881FB9Fu), uint4(0x56A1530Du, 0x804B722Du, 0x738E50E5u, 0x4FC93C25u), v.c0) +
select(uint4(0xCD0445A5u, 0xD2B90D9Bu, 0xD35C9B2Du, 0xA10D9E27u), uint4(0x568DAAA9u, 0x7530254Fu, 0x9F090439u, 0x5E9F85C9u), v.c1) +
select(uint4(0x8C4CA03Fu, 0xB8D969EDu, 0xAC5DB57Bu, 0xA91A02EDu), uint4(0xB3C49313u, 0xF43A9ABBu, 0x84E7E01Bu, 0x8E055BE5u), v.c2) +
select(uint4(0x6E624EB7u, 0x7383ED49u, 0xDD49C23Bu, 0xEBD0D005u), uint4(0x91475DF7u, 0x55E84827u, 0x90A285BBu, 0x5D19E1D5u), v.c3));
}
/// <summary>
/// Returns a uint4 vector hash code of a bool4x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(bool4x4 v)
{
return (select(uint4(0xFAAF07DDu, 0x625C45BDu, 0xC9F27FCBu, 0x6D2523B1u), uint4(0x6E2BF6A9u, 0xCC74B3B7u, 0x83B58237u, 0x833E3E29u), v.c0) +
select(uint4(0xA9D919BFu, 0xC3EC1D97u, 0xB8B208C7u, 0x5D3ED947u), uint4(0x4473BBB1u, 0xCBA11D5Fu, 0x685835CFu, 0xC3D32AE1u), v.c1) +
select(uint4(0xB966942Fu, 0xFE9856B3u, 0xFA3A3285u, 0xAD55999Du), uint4(0xDCDD5341u, 0x94DDD769u, 0xA1E92D39u, 0x4583C801u), v.c2) +
select(uint4(0x9536A0F5u, 0xAF816615u, 0x9AF8D62Du, 0xE3600729u), uint4(0x5F17300Du, 0x670D6809u, 0x7AF32C49u, 0xAE131389u), v.c3));
}
}
}

View File

@@ -0,0 +1,760 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
using System.Diagnostics;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[DebuggerTypeProxy(typeof(double2.DebuggerProxy))]
[System.Serializable]
public partial struct double2 : System.IEquatable<double2>, IFormattable
{
public double x;
public double y;
/// <summary>double2 zero value.</summary>
public static readonly double2 zero;
/// <summary>Constructs a double2 vector from two double values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2(double x, double y)
{
this.x = x;
this.y = y;
}
/// <summary>Constructs a double2 vector from a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2(double2 xy)
{
this.x = xy.x;
this.y = xy.y;
}
/// <summary>Constructs a double2 vector from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2(double v)
{
this.x = v;
this.y = v;
}
/// <summary>Constructs a double2 vector from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2(bool v)
{
this.x = v ? 1.0 : 0.0;
this.y = v ? 1.0 : 0.0;
}
/// <summary>Constructs a double2 vector from a bool2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2(bool2 v)
{
this.x = v.x ? 1.0 : 0.0;
this.y = v.y ? 1.0 : 0.0;
}
/// <summary>Constructs a double2 vector from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2(int v)
{
this.x = v;
this.y = v;
}
/// <summary>Constructs a double2 vector from a int2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2(int2 v)
{
this.x = v.x;
this.y = v.y;
}
/// <summary>Constructs a double2 vector from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2(uint v)
{
this.x = v;
this.y = v;
}
/// <summary>Constructs a double2 vector from a uint2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2(uint2 v)
{
this.x = v.x;
this.y = v.y;
}
/// <summary>Constructs a double2 vector from a single half value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2(half v)
{
this.x = v;
this.y = v;
}
/// <summary>Constructs a double2 vector from a half2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2(half2 v)
{
this.x = v.x;
this.y = v.y;
}
/// <summary>Constructs a double2 vector from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2(float v)
{
this.x = v;
this.y = v;
}
/// <summary>Constructs a double2 vector from a float2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2(float2 v)
{
this.x = v.x;
this.y = v.y;
}
/// <summary>Implicitly converts a single double value to a double2 vector by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2(double v) { return new double2(v); }
/// <summary>Explicitly converts a single bool value to a double2 vector by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double2(bool v) { return new double2(v); }
/// <summary>Explicitly converts a bool2 vector to a double2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double2(bool2 v) { return new double2(v); }
/// <summary>Implicitly converts a single int value to a double2 vector by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2(int v) { return new double2(v); }
/// <summary>Implicitly converts a int2 vector to a double2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2(int2 v) { return new double2(v); }
/// <summary>Implicitly converts a single uint value to a double2 vector by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2(uint v) { return new double2(v); }
/// <summary>Implicitly converts a uint2 vector to a double2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2(uint2 v) { return new double2(v); }
/// <summary>Implicitly converts a single half value to a double2 vector by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2(half v) { return new double2(v); }
/// <summary>Implicitly converts a half2 vector to a double2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2(half2 v) { return new double2(v); }
/// <summary>Implicitly converts a single float value to a double2 vector by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2(float v) { return new double2(v); }
/// <summary>Implicitly converts a float2 vector to a double2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2(float2 v) { return new double2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator * (double2 lhs, double2 rhs) { return new double2 (lhs.x * rhs.x, lhs.y * rhs.y); }
/// <summary>Returns the result of a componentwise multiplication operation on a double2 vector and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator * (double2 lhs, double rhs) { return new double2 (lhs.x * rhs, lhs.y * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a double value and a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator * (double lhs, double2 rhs) { return new double2 (lhs * rhs.x, lhs * rhs.y); }
/// <summary>Returns the result of a componentwise addition operation on two double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator + (double2 lhs, double2 rhs) { return new double2 (lhs.x + rhs.x, lhs.y + rhs.y); }
/// <summary>Returns the result of a componentwise addition operation on a double2 vector and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator + (double2 lhs, double rhs) { return new double2 (lhs.x + rhs, lhs.y + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a double value and a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator + (double lhs, double2 rhs) { return new double2 (lhs + rhs.x, lhs + rhs.y); }
/// <summary>Returns the result of a componentwise subtraction operation on two double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator - (double2 lhs, double2 rhs) { return new double2 (lhs.x - rhs.x, lhs.y - rhs.y); }
/// <summary>Returns the result of a componentwise subtraction operation on a double2 vector and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator - (double2 lhs, double rhs) { return new double2 (lhs.x - rhs, lhs.y - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a double value and a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator - (double lhs, double2 rhs) { return new double2 (lhs - rhs.x, lhs - rhs.y); }
/// <summary>Returns the result of a componentwise division operation on two double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator / (double2 lhs, double2 rhs) { return new double2 (lhs.x / rhs.x, lhs.y / rhs.y); }
/// <summary>Returns the result of a componentwise division operation on a double2 vector and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator / (double2 lhs, double rhs) { return new double2 (lhs.x / rhs, lhs.y / rhs); }
/// <summary>Returns the result of a componentwise division operation on a double value and a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator / (double lhs, double2 rhs) { return new double2 (lhs / rhs.x, lhs / rhs.y); }
/// <summary>Returns the result of a componentwise modulus operation on two double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator % (double2 lhs, double2 rhs) { return new double2 (lhs.x % rhs.x, lhs.y % rhs.y); }
/// <summary>Returns the result of a componentwise modulus operation on a double2 vector and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator % (double2 lhs, double rhs) { return new double2 (lhs.x % rhs, lhs.y % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a double value and a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator % (double lhs, double2 rhs) { return new double2 (lhs % rhs.x, lhs % rhs.y); }
/// <summary>Returns the result of a componentwise increment operation on a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator ++ (double2 val) { return new double2 (++val.x, ++val.y); }
/// <summary>Returns the result of a componentwise decrement operation on a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator -- (double2 val) { return new double2 (--val.x, --val.y); }
/// <summary>Returns the result of a componentwise less than operation on two double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator < (double2 lhs, double2 rhs) { return new bool2 (lhs.x < rhs.x, lhs.y < rhs.y); }
/// <summary>Returns the result of a componentwise less than operation on a double2 vector and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator < (double2 lhs, double rhs) { return new bool2 (lhs.x < rhs, lhs.y < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a double value and a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator < (double lhs, double2 rhs) { return new bool2 (lhs < rhs.x, lhs < rhs.y); }
/// <summary>Returns the result of a componentwise less or equal operation on two double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator <= (double2 lhs, double2 rhs) { return new bool2 (lhs.x <= rhs.x, lhs.y <= rhs.y); }
/// <summary>Returns the result of a componentwise less or equal operation on a double2 vector and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator <= (double2 lhs, double rhs) { return new bool2 (lhs.x <= rhs, lhs.y <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a double value and a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator <= (double lhs, double2 rhs) { return new bool2 (lhs <= rhs.x, lhs <= rhs.y); }
/// <summary>Returns the result of a componentwise greater than operation on two double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator > (double2 lhs, double2 rhs) { return new bool2 (lhs.x > rhs.x, lhs.y > rhs.y); }
/// <summary>Returns the result of a componentwise greater than operation on a double2 vector and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator > (double2 lhs, double rhs) { return new bool2 (lhs.x > rhs, lhs.y > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a double value and a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator > (double lhs, double2 rhs) { return new bool2 (lhs > rhs.x, lhs > rhs.y); }
/// <summary>Returns the result of a componentwise greater or equal operation on two double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator >= (double2 lhs, double2 rhs) { return new bool2 (lhs.x >= rhs.x, lhs.y >= rhs.y); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double2 vector and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator >= (double2 lhs, double rhs) { return new bool2 (lhs.x >= rhs, lhs.y >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double value and a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator >= (double lhs, double2 rhs) { return new bool2 (lhs >= rhs.x, lhs >= rhs.y); }
/// <summary>Returns the result of a componentwise unary minus operation on a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator - (double2 val) { return new double2 (-val.x, -val.y); }
/// <summary>Returns the result of a componentwise unary plus operation on a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 operator + (double2 val) { return new double2 (+val.x, +val.y); }
/// <summary>Returns the result of a componentwise equality operation on two double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (double2 lhs, double2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); }
/// <summary>Returns the result of a componentwise equality operation on a double2 vector and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (double2 lhs, double rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a double value and a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (double lhs, double2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); }
/// <summary>Returns the result of a componentwise not equal operation on two double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (double2 lhs, double2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); }
/// <summary>Returns the result of a componentwise not equal operation on a double2 vector and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (double2 lhs, double rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a double value and a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (double lhs, double2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); }
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 xxxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(x, x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 xxxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(x, x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 xxyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(x, x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 xxyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(x, x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 xyxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(x, y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 xyxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(x, y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 xyyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(x, y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 xyyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(x, y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 yxxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(y, x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 yxxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(y, x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 yxyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(y, x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 yxyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(y, x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 yyxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(y, y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 yyxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(y, y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 yyyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(y, y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double4 yyyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double4(y, y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double3 xxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double3(x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double3 xxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double3(x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double3 xyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double3(x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double3 xyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double3(x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double3 yxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double3(y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double3 yxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double3(y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double3 yyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double3(y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double3 yyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double3(y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double2 xx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double2(x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double2 xy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double2(x, y); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set { x = value.x; y = value.y; }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double2 yx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double2(y, x); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set { y = value.x; x = value.y; }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public double2 yy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new double2(y, y); }
}
/// <summary>Returns the double element at a specified index.</summary>
unsafe public double this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (double2* array = &this) { return ((double*)array)[index]; }
}
set
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (double* array = &x) { array[index] = value; }
}
}
/// <summary>Returns true if the double2 is equal to a given double2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(double2 rhs) { return x == rhs.x && y == rhs.y; }
/// <summary>Returns true if the double2 is equal to a given double2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((double2)o); }
/// <summary>Returns a hash code for the double2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the double2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("double2({0}, {1})", x, y);
}
/// <summary>Returns a string representation of the double2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("double2({0}, {1})", x.ToString(format, formatProvider), y.ToString(format, formatProvider));
}
internal sealed class DebuggerProxy
{
public double x;
public double y;
public DebuggerProxy(double2 v)
{
x = v.x;
y = v.y;
}
}
}
public static partial class math
{
/// <summary>Returns a double2 vector constructed from two double values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 double2(double x, double y) { return new double2(x, y); }
/// <summary>Returns a double2 vector constructed from a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 double2(double2 xy) { return new double2(xy); }
/// <summary>Returns a double2 vector constructed from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 double2(double v) { return new double2(v); }
/// <summary>Returns a double2 vector constructed from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 double2(bool v) { return new double2(v); }
/// <summary>Return a double2 vector constructed from a bool2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 double2(bool2 v) { return new double2(v); }
/// <summary>Returns a double2 vector constructed from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 double2(int v) { return new double2(v); }
/// <summary>Return a double2 vector constructed from a int2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 double2(int2 v) { return new double2(v); }
/// <summary>Returns a double2 vector constructed from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 double2(uint v) { return new double2(v); }
/// <summary>Return a double2 vector constructed from a uint2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 double2(uint2 v) { return new double2(v); }
/// <summary>Returns a double2 vector constructed from a single half value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 double2(half v) { return new double2(v); }
/// <summary>Return a double2 vector constructed from a half2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 double2(half2 v) { return new double2(v); }
/// <summary>Returns a double2 vector constructed from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 double2(float v) { return new double2(v); }
/// <summary>Return a double2 vector constructed from a float2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 double2(float2 v) { return new double2(v); }
/// <summary>Returns a uint hash code of a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(double2 v)
{
return csum(fold_to_uint(v) * uint2(0x9536A0F5u, 0xAF816615u)) + 0x9AF8D62Du;
}
/// <summary>
/// Returns a uint2 vector hash code of a double2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(double2 v)
{
return (fold_to_uint(v) * uint2(0xE3600729u, 0x5F17300Du)) + 0x670D6809u;
}
/// <summary>Returns the result of specified shuffling of the components from two double2 vectors into a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double shuffle(double2 a, double2 b, ShuffleComponent x)
{
return select_shuffle_component(a, b, x);
}
/// <summary>Returns the result of specified shuffling of the components from two double2 vectors into a double2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2 shuffle(double2 a, double2 b, ShuffleComponent x, ShuffleComponent y)
{
return double2(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y));
}
/// <summary>Returns the result of specified shuffling of the components from two double2 vectors into a double3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3 shuffle(double2 a, double2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z)
{
return double3(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y),
select_shuffle_component(a, b, z));
}
/// <summary>Returns the result of specified shuffling of the components from two double2 vectors into a double4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4 shuffle(double2 a, double2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z, ShuffleComponent w)
{
return double4(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y),
select_shuffle_component(a, b, z),
select_shuffle_component(a, b, w));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static double select_shuffle_component(double2 a, double2 b, ShuffleComponent component)
{
switch(component)
{
case ShuffleComponent.LeftX:
return a.x;
case ShuffleComponent.LeftY:
return a.y;
case ShuffleComponent.RightX:
return b.x;
case ShuffleComponent.RightY:
return b.y;
default:
throw new System.ArgumentException("Invalid shuffle component: " + component);
}
}
}
}

View File

@@ -0,0 +1,468 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct double2x2 : System.IEquatable<double2x2>, IFormattable
{
public double2 c0;
public double2 c1;
/// <summary>double2x2 identity transform.</summary>
public static readonly double2x2 identity = new double2x2(1.0, 0.0, 0.0, 1.0);
/// <summary>double2x2 zero value.</summary>
public static readonly double2x2 zero;
/// <summary>Constructs a double2x2 matrix from two double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x2(double2 c0, double2 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a double2x2 matrix from 4 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x2(double m00, double m01,
double m10, double m11)
{
this.c0 = new double2(m00, m10);
this.c1 = new double2(m01, m11);
}
/// <summary>Constructs a double2x2 matrix from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x2(double v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a double2x2 matrix from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x2(bool v)
{
this.c0 = math.select(new double2(0.0), new double2(1.0), v);
this.c1 = math.select(new double2(0.0), new double2(1.0), v);
}
/// <summary>Constructs a double2x2 matrix from a bool2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x2(bool2x2 v)
{
this.c0 = math.select(new double2(0.0), new double2(1.0), v.c0);
this.c1 = math.select(new double2(0.0), new double2(1.0), v.c1);
}
/// <summary>Constructs a double2x2 matrix from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x2(int v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a double2x2 matrix from a int2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x2(int2x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Constructs a double2x2 matrix from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x2(uint v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a double2x2 matrix from a uint2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x2(uint2x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Constructs a double2x2 matrix from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x2(float v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a double2x2 matrix from a float2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x2(float2x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Implicitly converts a single double value to a double2x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x2(double v) { return new double2x2(v); }
/// <summary>Explicitly converts a single bool value to a double2x2 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double2x2(bool v) { return new double2x2(v); }
/// <summary>Explicitly converts a bool2x2 matrix to a double2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double2x2(bool2x2 v) { return new double2x2(v); }
/// <summary>Implicitly converts a single int value to a double2x2 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x2(int v) { return new double2x2(v); }
/// <summary>Implicitly converts a int2x2 matrix to a double2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x2(int2x2 v) { return new double2x2(v); }
/// <summary>Implicitly converts a single uint value to a double2x2 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x2(uint v) { return new double2x2(v); }
/// <summary>Implicitly converts a uint2x2 matrix to a double2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x2(uint2x2 v) { return new double2x2(v); }
/// <summary>Implicitly converts a single float value to a double2x2 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x2(float v) { return new double2x2(v); }
/// <summary>Implicitly converts a float2x2 matrix to a double2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x2(float2x2 v) { return new double2x2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two double2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator * (double2x2 lhs, double2x2 rhs) { return new double2x2 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1); }
/// <summary>Returns the result of a componentwise multiplication operation on a double2x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator * (double2x2 lhs, double rhs) { return new double2x2 (lhs.c0 * rhs, lhs.c1 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a double value and a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator * (double lhs, double2x2 rhs) { return new double2x2 (lhs * rhs.c0, lhs * rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on two double2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator + (double2x2 lhs, double2x2 rhs) { return new double2x2 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on a double2x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator + (double2x2 lhs, double rhs) { return new double2x2 (lhs.c0 + rhs, lhs.c1 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a double value and a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator + (double lhs, double2x2 rhs) { return new double2x2 (lhs + rhs.c0, lhs + rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on two double2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator - (double2x2 lhs, double2x2 rhs) { return new double2x2 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on a double2x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator - (double2x2 lhs, double rhs) { return new double2x2 (lhs.c0 - rhs, lhs.c1 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a double value and a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator - (double lhs, double2x2 rhs) { return new double2x2 (lhs - rhs.c0, lhs - rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on two double2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator / (double2x2 lhs, double2x2 rhs) { return new double2x2 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on a double2x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator / (double2x2 lhs, double rhs) { return new double2x2 (lhs.c0 / rhs, lhs.c1 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a double value and a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator / (double lhs, double2x2 rhs) { return new double2x2 (lhs / rhs.c0, lhs / rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on two double2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator % (double2x2 lhs, double2x2 rhs) { return new double2x2 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on a double2x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator % (double2x2 lhs, double rhs) { return new double2x2 (lhs.c0 % rhs, lhs.c1 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a double value and a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator % (double lhs, double2x2 rhs) { return new double2x2 (lhs % rhs.c0, lhs % rhs.c1); }
/// <summary>Returns the result of a componentwise increment operation on a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator ++ (double2x2 val) { return new double2x2 (++val.c0, ++val.c1); }
/// <summary>Returns the result of a componentwise decrement operation on a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator -- (double2x2 val) { return new double2x2 (--val.c0, --val.c1); }
/// <summary>Returns the result of a componentwise less than operation on two double2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator < (double2x2 lhs, double2x2 rhs) { return new bool2x2 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1); }
/// <summary>Returns the result of a componentwise less than operation on a double2x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator < (double2x2 lhs, double rhs) { return new bool2x2 (lhs.c0 < rhs, lhs.c1 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a double value and a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator < (double lhs, double2x2 rhs) { return new bool2x2 (lhs < rhs.c0, lhs < rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on two double2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator <= (double2x2 lhs, double2x2 rhs) { return new bool2x2 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on a double2x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator <= (double2x2 lhs, double rhs) { return new bool2x2 (lhs.c0 <= rhs, lhs.c1 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a double value and a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator <= (double lhs, double2x2 rhs) { return new bool2x2 (lhs <= rhs.c0, lhs <= rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on two double2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator > (double2x2 lhs, double2x2 rhs) { return new bool2x2 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on a double2x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator > (double2x2 lhs, double rhs) { return new bool2x2 (lhs.c0 > rhs, lhs.c1 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a double value and a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator > (double lhs, double2x2 rhs) { return new bool2x2 (lhs > rhs.c0, lhs > rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on two double2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator >= (double2x2 lhs, double2x2 rhs) { return new bool2x2 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double2x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator >= (double2x2 lhs, double rhs) { return new bool2x2 (lhs.c0 >= rhs, lhs.c1 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double value and a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator >= (double lhs, double2x2 rhs) { return new bool2x2 (lhs >= rhs.c0, lhs >= rhs.c1); }
/// <summary>Returns the result of a componentwise unary minus operation on a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator - (double2x2 val) { return new double2x2 (-val.c0, -val.c1); }
/// <summary>Returns the result of a componentwise unary plus operation on a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 operator + (double2x2 val) { return new double2x2 (+val.c0, +val.c1); }
/// <summary>Returns the result of a componentwise equality operation on two double2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (double2x2 lhs, double2x2 rhs) { return new bool2x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on a double2x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (double2x2 lhs, double rhs) { return new bool2x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a double value and a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (double lhs, double2x2 rhs) { return new bool2x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two double2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (double2x2 lhs, double2x2 rhs) { return new bool2x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on a double2x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (double2x2 lhs, double rhs) { return new bool2x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a double value and a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (double lhs, double2x2 rhs) { return new bool2x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the double2 element at a specified index.</summary>
unsafe public ref double2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (double2x2* array = &this) { return ref ((double2*)array)[index]; }
}
}
/// <summary>Returns true if the double2x2 is equal to a given double2x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(double2x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the double2x2 is equal to a given double2x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((double2x2)o); }
/// <summary>Returns a hash code for the double2x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the double2x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("double2x2({0}, {1}, {2}, {3})", c0.x, c1.x, c0.y, c1.y);
}
/// <summary>Returns a string representation of the double2x2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("double2x2({0}, {1}, {2}, {3})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a double2x2 matrix constructed from two double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 double2x2(double2 c0, double2 c1) { return new double2x2(c0, c1); }
/// <summary>Returns a double2x2 matrix constructed from from 4 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 double2x2(double m00, double m01,
double m10, double m11)
{
return new double2x2(m00, m01,
m10, m11);
}
/// <summary>Returns a double2x2 matrix constructed from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 double2x2(double v) { return new double2x2(v); }
/// <summary>Returns a double2x2 matrix constructed from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 double2x2(bool v) { return new double2x2(v); }
/// <summary>Return a double2x2 matrix constructed from a bool2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 double2x2(bool2x2 v) { return new double2x2(v); }
/// <summary>Returns a double2x2 matrix constructed from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 double2x2(int v) { return new double2x2(v); }
/// <summary>Return a double2x2 matrix constructed from a int2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 double2x2(int2x2 v) { return new double2x2(v); }
/// <summary>Returns a double2x2 matrix constructed from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 double2x2(uint v) { return new double2x2(v); }
/// <summary>Return a double2x2 matrix constructed from a uint2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 double2x2(uint2x2 v) { return new double2x2(v); }
/// <summary>Returns a double2x2 matrix constructed from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 double2x2(float v) { return new double2x2(v); }
/// <summary>Return a double2x2 matrix constructed from a float2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 double2x2(float2x2 v) { return new double2x2(v); }
/// <summary>Return the double2x2 transpose of a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 transpose(double2x2 v)
{
return double2x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y);
}
/// <summary>Returns the double2x2 full inverse of a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x2 inverse(double2x2 m)
{
double a = m.c0.x;
double b = m.c1.x;
double c = m.c0.y;
double d = m.c1.y;
double det = a * d - b * c;
return double2x2(d, -b, -c, a) * (1.0 / det);
}
/// <summary>Returns the determinant of a double2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double determinant(double2x2 m)
{
double a = m.c0.x;
double b = m.c1.x;
double c = m.c0.y;
double d = m.c1.y;
return a * d - b * c;
}
/// <summary>Returns a uint hash code of a double2x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(double2x2 v)
{
return csum(fold_to_uint(v.c0) * uint2(0xFD80290Bu, 0x8B65ADB7u) +
fold_to_uint(v.c1) * uint2(0xDFF4F563u, 0x7069770Du)) + 0xD1224537u;
}
/// <summary>
/// Returns a uint2 vector hash code of a double2x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(double2x2 v)
{
return (fold_to_uint(v.c0) * uint2(0xE99ED6F3u, 0x48125549u) +
fold_to_uint(v.c1) * uint2(0xEEE2123Bu, 0xE3AD9FE5u)) + 0xCE1CF8BFu;
}
}
}

View File

@@ -0,0 +1,454 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct double2x3 : System.IEquatable<double2x3>, IFormattable
{
public double2 c0;
public double2 c1;
public double2 c2;
/// <summary>double2x3 zero value.</summary>
public static readonly double2x3 zero;
/// <summary>Constructs a double2x3 matrix from three double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x3(double2 c0, double2 c1, double2 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a double2x3 matrix from 6 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x3(double m00, double m01, double m02,
double m10, double m11, double m12)
{
this.c0 = new double2(m00, m10);
this.c1 = new double2(m01, m11);
this.c2 = new double2(m02, m12);
}
/// <summary>Constructs a double2x3 matrix from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x3(double v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a double2x3 matrix from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x3(bool v)
{
this.c0 = math.select(new double2(0.0), new double2(1.0), v);
this.c1 = math.select(new double2(0.0), new double2(1.0), v);
this.c2 = math.select(new double2(0.0), new double2(1.0), v);
}
/// <summary>Constructs a double2x3 matrix from a bool2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x3(bool2x3 v)
{
this.c0 = math.select(new double2(0.0), new double2(1.0), v.c0);
this.c1 = math.select(new double2(0.0), new double2(1.0), v.c1);
this.c2 = math.select(new double2(0.0), new double2(1.0), v.c2);
}
/// <summary>Constructs a double2x3 matrix from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x3(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a double2x3 matrix from a int2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x3(int2x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Constructs a double2x3 matrix from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x3(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a double2x3 matrix from a uint2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x3(uint2x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Constructs a double2x3 matrix from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x3(float v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a double2x3 matrix from a float2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x3(float2x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Implicitly converts a single double value to a double2x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x3(double v) { return new double2x3(v); }
/// <summary>Explicitly converts a single bool value to a double2x3 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double2x3(bool v) { return new double2x3(v); }
/// <summary>Explicitly converts a bool2x3 matrix to a double2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double2x3(bool2x3 v) { return new double2x3(v); }
/// <summary>Implicitly converts a single int value to a double2x3 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x3(int v) { return new double2x3(v); }
/// <summary>Implicitly converts a int2x3 matrix to a double2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x3(int2x3 v) { return new double2x3(v); }
/// <summary>Implicitly converts a single uint value to a double2x3 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x3(uint v) { return new double2x3(v); }
/// <summary>Implicitly converts a uint2x3 matrix to a double2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x3(uint2x3 v) { return new double2x3(v); }
/// <summary>Implicitly converts a single float value to a double2x3 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x3(float v) { return new double2x3(v); }
/// <summary>Implicitly converts a float2x3 matrix to a double2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x3(float2x3 v) { return new double2x3(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two double2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator * (double2x3 lhs, double2x3 rhs) { return new double2x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); }
/// <summary>Returns the result of a componentwise multiplication operation on a double2x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator * (double2x3 lhs, double rhs) { return new double2x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a double value and a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator * (double lhs, double2x3 rhs) { return new double2x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on two double2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator + (double2x3 lhs, double2x3 rhs) { return new double2x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on a double2x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator + (double2x3 lhs, double rhs) { return new double2x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a double value and a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator + (double lhs, double2x3 rhs) { return new double2x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on two double2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator - (double2x3 lhs, double2x3 rhs) { return new double2x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on a double2x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator - (double2x3 lhs, double rhs) { return new double2x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a double value and a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator - (double lhs, double2x3 rhs) { return new double2x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on two double2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator / (double2x3 lhs, double2x3 rhs) { return new double2x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on a double2x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator / (double2x3 lhs, double rhs) { return new double2x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a double value and a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator / (double lhs, double2x3 rhs) { return new double2x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on two double2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator % (double2x3 lhs, double2x3 rhs) { return new double2x3 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on a double2x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator % (double2x3 lhs, double rhs) { return new double2x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a double value and a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator % (double lhs, double2x3 rhs) { return new double2x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); }
/// <summary>Returns the result of a componentwise increment operation on a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator ++ (double2x3 val) { return new double2x3 (++val.c0, ++val.c1, ++val.c2); }
/// <summary>Returns the result of a componentwise decrement operation on a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator -- (double2x3 val) { return new double2x3 (--val.c0, --val.c1, --val.c2); }
/// <summary>Returns the result of a componentwise less than operation on two double2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator < (double2x3 lhs, double2x3 rhs) { return new bool2x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); }
/// <summary>Returns the result of a componentwise less than operation on a double2x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator < (double2x3 lhs, double rhs) { return new bool2x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a double value and a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator < (double lhs, double2x3 rhs) { return new bool2x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on two double2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator <= (double2x3 lhs, double2x3 rhs) { return new bool2x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on a double2x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator <= (double2x3 lhs, double rhs) { return new bool2x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a double value and a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator <= (double lhs, double2x3 rhs) { return new bool2x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on two double2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator > (double2x3 lhs, double2x3 rhs) { return new bool2x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on a double2x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator > (double2x3 lhs, double rhs) { return new bool2x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a double value and a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator > (double lhs, double2x3 rhs) { return new bool2x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on two double2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator >= (double2x3 lhs, double2x3 rhs) { return new bool2x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double2x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator >= (double2x3 lhs, double rhs) { return new bool2x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double value and a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator >= (double lhs, double2x3 rhs) { return new bool2x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); }
/// <summary>Returns the result of a componentwise unary minus operation on a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator - (double2x3 val) { return new double2x3 (-val.c0, -val.c1, -val.c2); }
/// <summary>Returns the result of a componentwise unary plus operation on a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 operator + (double2x3 val) { return new double2x3 (+val.c0, +val.c1, +val.c2); }
/// <summary>Returns the result of a componentwise equality operation on two double2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (double2x3 lhs, double2x3 rhs) { return new bool2x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on a double2x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (double2x3 lhs, double rhs) { return new bool2x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a double value and a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (double lhs, double2x3 rhs) { return new bool2x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two double2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (double2x3 lhs, double2x3 rhs) { return new bool2x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on a double2x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (double2x3 lhs, double rhs) { return new bool2x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a double value and a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (double lhs, double2x3 rhs) { return new bool2x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the double2 element at a specified index.</summary>
unsafe public ref double2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (double2x3* array = &this) { return ref ((double2*)array)[index]; }
}
}
/// <summary>Returns true if the double2x3 is equal to a given double2x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(double2x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the double2x3 is equal to a given double2x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((double2x3)o); }
/// <summary>Returns a hash code for the double2x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the double2x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("double2x3({0}, {1}, {2}, {3}, {4}, {5})", c0.x, c1.x, c2.x, c0.y, c1.y, c2.y);
}
/// <summary>Returns a string representation of the double2x3 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("double2x3({0}, {1}, {2}, {3}, {4}, {5})", 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));
}
}
public static partial class math
{
/// <summary>Returns a double2x3 matrix constructed from three double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 double2x3(double2 c0, double2 c1, double2 c2) { return new double2x3(c0, c1, c2); }
/// <summary>Returns a double2x3 matrix constructed from from 6 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 double2x3(double m00, double m01, double m02,
double m10, double m11, double m12)
{
return new double2x3(m00, m01, m02,
m10, m11, m12);
}
/// <summary>Returns a double2x3 matrix constructed from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 double2x3(double v) { return new double2x3(v); }
/// <summary>Returns a double2x3 matrix constructed from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 double2x3(bool v) { return new double2x3(v); }
/// <summary>Return a double2x3 matrix constructed from a bool2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 double2x3(bool2x3 v) { return new double2x3(v); }
/// <summary>Returns a double2x3 matrix constructed from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 double2x3(int v) { return new double2x3(v); }
/// <summary>Return a double2x3 matrix constructed from a int2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 double2x3(int2x3 v) { return new double2x3(v); }
/// <summary>Returns a double2x3 matrix constructed from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 double2x3(uint v) { return new double2x3(v); }
/// <summary>Return a double2x3 matrix constructed from a uint2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 double2x3(uint2x3 v) { return new double2x3(v); }
/// <summary>Returns a double2x3 matrix constructed from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 double2x3(float v) { return new double2x3(v); }
/// <summary>Return a double2x3 matrix constructed from a float2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 double2x3(float2x3 v) { return new double2x3(v); }
/// <summary>Return the double3x2 transpose of a double2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 transpose(double2x3 v)
{
return double3x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y,
v.c2.x, v.c2.y);
}
/// <summary>Returns a uint hash code of a double2x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(double2x3 v)
{
return csum(fold_to_uint(v.c0) * uint2(0xF25BE857u, 0x9BC17CE7u) +
fold_to_uint(v.c1) * uint2(0xC8B86851u, 0x64095221u) +
fold_to_uint(v.c2) * uint2(0xADF428FFu, 0xA3977109u)) + 0x745ED837u;
}
/// <summary>
/// Returns a uint2 vector hash code of a double2x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(double2x3 v)
{
return (fold_to_uint(v.c0) * uint2(0x9CDC88F5u, 0xFA62D721u) +
fold_to_uint(v.c1) * uint2(0x7E4DB1CFu, 0x68EEE0F5u) +
fold_to_uint(v.c2) * uint2(0xBC3B0A59u, 0x816EFB5Du)) + 0xA24E82B7u;
}
}
}

View File

@@ -0,0 +1,469 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct double2x4 : System.IEquatable<double2x4>, IFormattable
{
public double2 c0;
public double2 c1;
public double2 c2;
public double2 c3;
/// <summary>double2x4 zero value.</summary>
public static readonly double2x4 zero;
/// <summary>Constructs a double2x4 matrix from four double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x4(double2 c0, double2 c1, double2 c2, double2 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a double2x4 matrix from 8 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x4(double m00, double m01, double m02, double m03,
double m10, double m11, double m12, double m13)
{
this.c0 = new double2(m00, m10);
this.c1 = new double2(m01, m11);
this.c2 = new double2(m02, m12);
this.c3 = new double2(m03, m13);
}
/// <summary>Constructs a double2x4 matrix from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x4(double v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a double2x4 matrix from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x4(bool v)
{
this.c0 = math.select(new double2(0.0), new double2(1.0), v);
this.c1 = math.select(new double2(0.0), new double2(1.0), v);
this.c2 = math.select(new double2(0.0), new double2(1.0), v);
this.c3 = math.select(new double2(0.0), new double2(1.0), v);
}
/// <summary>Constructs a double2x4 matrix from a bool2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x4(bool2x4 v)
{
this.c0 = math.select(new double2(0.0), new double2(1.0), v.c0);
this.c1 = math.select(new double2(0.0), new double2(1.0), v.c1);
this.c2 = math.select(new double2(0.0), new double2(1.0), v.c2);
this.c3 = math.select(new double2(0.0), new double2(1.0), v.c3);
}
/// <summary>Constructs a double2x4 matrix from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x4(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a double2x4 matrix from a int2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x4(int2x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Constructs a double2x4 matrix from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x4(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a double2x4 matrix from a uint2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x4(uint2x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Constructs a double2x4 matrix from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x4(float v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a double2x4 matrix from a float2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2x4(float2x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Implicitly converts a single double value to a double2x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x4(double v) { return new double2x4(v); }
/// <summary>Explicitly converts a single bool value to a double2x4 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double2x4(bool v) { return new double2x4(v); }
/// <summary>Explicitly converts a bool2x4 matrix to a double2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double2x4(bool2x4 v) { return new double2x4(v); }
/// <summary>Implicitly converts a single int value to a double2x4 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x4(int v) { return new double2x4(v); }
/// <summary>Implicitly converts a int2x4 matrix to a double2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x4(int2x4 v) { return new double2x4(v); }
/// <summary>Implicitly converts a single uint value to a double2x4 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x4(uint v) { return new double2x4(v); }
/// <summary>Implicitly converts a uint2x4 matrix to a double2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x4(uint2x4 v) { return new double2x4(v); }
/// <summary>Implicitly converts a single float value to a double2x4 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x4(float v) { return new double2x4(v); }
/// <summary>Implicitly converts a float2x4 matrix to a double2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double2x4(float2x4 v) { return new double2x4(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two double2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator * (double2x4 lhs, double2x4 rhs) { return new double2x4 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2, lhs.c3 * rhs.c3); }
/// <summary>Returns the result of a componentwise multiplication operation on a double2x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator * (double2x4 lhs, double rhs) { return new double2x4 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs, lhs.c3 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a double value and a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator * (double lhs, double2x4 rhs) { return new double2x4 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2, lhs * rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on two double2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator + (double2x4 lhs, double2x4 rhs) { return new double2x4 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2, lhs.c3 + rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on a double2x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator + (double2x4 lhs, double rhs) { return new double2x4 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs, lhs.c3 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a double value and a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator + (double lhs, double2x4 rhs) { return new double2x4 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2, lhs + rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on two double2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator - (double2x4 lhs, double2x4 rhs) { return new double2x4 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2, lhs.c3 - rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on a double2x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator - (double2x4 lhs, double rhs) { return new double2x4 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs, lhs.c3 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a double value and a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator - (double lhs, double2x4 rhs) { return new double2x4 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2, lhs - rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on two double2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator / (double2x4 lhs, double2x4 rhs) { return new double2x4 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2, lhs.c3 / rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on a double2x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator / (double2x4 lhs, double rhs) { return new double2x4 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs, lhs.c3 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a double value and a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator / (double lhs, double2x4 rhs) { return new double2x4 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2, lhs / rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on two double2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator % (double2x4 lhs, double2x4 rhs) { return new double2x4 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2, lhs.c3 % rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on a double2x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator % (double2x4 lhs, double rhs) { return new double2x4 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs, lhs.c3 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a double value and a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator % (double lhs, double2x4 rhs) { return new double2x4 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2, lhs % rhs.c3); }
/// <summary>Returns the result of a componentwise increment operation on a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator ++ (double2x4 val) { return new double2x4 (++val.c0, ++val.c1, ++val.c2, ++val.c3); }
/// <summary>Returns the result of a componentwise decrement operation on a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator -- (double2x4 val) { return new double2x4 (--val.c0, --val.c1, --val.c2, --val.c3); }
/// <summary>Returns the result of a componentwise less than operation on two double2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator < (double2x4 lhs, double2x4 rhs) { return new bool2x4 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2, lhs.c3 < rhs.c3); }
/// <summary>Returns the result of a componentwise less than operation on a double2x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator < (double2x4 lhs, double rhs) { return new bool2x4 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs, lhs.c3 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a double value and a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator < (double lhs, double2x4 rhs) { return new bool2x4 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2, lhs < rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on two double2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator <= (double2x4 lhs, double2x4 rhs) { return new bool2x4 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2, lhs.c3 <= rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on a double2x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator <= (double2x4 lhs, double rhs) { return new bool2x4 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs, lhs.c3 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a double value and a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator <= (double lhs, double2x4 rhs) { return new bool2x4 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2, lhs <= rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on two double2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator > (double2x4 lhs, double2x4 rhs) { return new bool2x4 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2, lhs.c3 > rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on a double2x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator > (double2x4 lhs, double rhs) { return new bool2x4 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs, lhs.c3 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a double value and a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator > (double lhs, double2x4 rhs) { return new bool2x4 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2, lhs > rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on two double2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator >= (double2x4 lhs, double2x4 rhs) { return new bool2x4 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2, lhs.c3 >= rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double2x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator >= (double2x4 lhs, double rhs) { return new bool2x4 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs, lhs.c3 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double value and a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator >= (double lhs, double2x4 rhs) { return new bool2x4 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2, lhs >= rhs.c3); }
/// <summary>Returns the result of a componentwise unary minus operation on a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator - (double2x4 val) { return new double2x4 (-val.c0, -val.c1, -val.c2, -val.c3); }
/// <summary>Returns the result of a componentwise unary plus operation on a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 operator + (double2x4 val) { return new double2x4 (+val.c0, +val.c1, +val.c2, +val.c3); }
/// <summary>Returns the result of a componentwise equality operation on two double2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (double2x4 lhs, double2x4 rhs) { return new bool2x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on a double2x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (double2x4 lhs, double rhs) { return new bool2x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a double value and a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (double lhs, double2x4 rhs) { return new bool2x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two double2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (double2x4 lhs, double2x4 rhs) { return new bool2x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on a double2x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (double2x4 lhs, double rhs) { return new bool2x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a double value and a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (double lhs, double2x4 rhs) { return new bool2x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the double2 element at a specified index.</summary>
unsafe public ref double2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (double2x4* array = &this) { return ref ((double2*)array)[index]; }
}
}
/// <summary>Returns true if the double2x4 is equal to a given double2x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(double2x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the double2x4 is equal to a given double2x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((double2x4)o); }
/// <summary>Returns a hash code for the double2x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the double2x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("double2x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y);
}
/// <summary>Returns a string representation of the double2x4 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("double2x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c3.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider), c3.y.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a double2x4 matrix constructed from four double2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 double2x4(double2 c0, double2 c1, double2 c2, double2 c3) { return new double2x4(c0, c1, c2, c3); }
/// <summary>Returns a double2x4 matrix constructed from from 8 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 double2x4(double m00, double m01, double m02, double m03,
double m10, double m11, double m12, double m13)
{
return new double2x4(m00, m01, m02, m03,
m10, m11, m12, m13);
}
/// <summary>Returns a double2x4 matrix constructed from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 double2x4(double v) { return new double2x4(v); }
/// <summary>Returns a double2x4 matrix constructed from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 double2x4(bool v) { return new double2x4(v); }
/// <summary>Return a double2x4 matrix constructed from a bool2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 double2x4(bool2x4 v) { return new double2x4(v); }
/// <summary>Returns a double2x4 matrix constructed from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 double2x4(int v) { return new double2x4(v); }
/// <summary>Return a double2x4 matrix constructed from a int2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 double2x4(int2x4 v) { return new double2x4(v); }
/// <summary>Returns a double2x4 matrix constructed from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 double2x4(uint v) { return new double2x4(v); }
/// <summary>Return a double2x4 matrix constructed from a uint2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 double2x4(uint2x4 v) { return new double2x4(v); }
/// <summary>Returns a double2x4 matrix constructed from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 double2x4(float v) { return new double2x4(v); }
/// <summary>Return a double2x4 matrix constructed from a float2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 double2x4(float2x4 v) { return new double2x4(v); }
/// <summary>Return the double4x2 transpose of a double2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 transpose(double2x4 v)
{
return double4x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y,
v.c2.x, v.c2.y,
v.c3.x, v.c3.y);
}
/// <summary>Returns a uint hash code of a double2x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(double2x4 v)
{
return csum(fold_to_uint(v.c0) * uint2(0x91475DF7u, 0x55E84827u) +
fold_to_uint(v.c1) * uint2(0x90A285BBu, 0x5D19E1D5u) +
fold_to_uint(v.c2) * uint2(0xFAAF07DDu, 0x625C45BDu) +
fold_to_uint(v.c3) * uint2(0xC9F27FCBu, 0x6D2523B1u)) + 0x6E2BF6A9u;
}
/// <summary>
/// Returns a uint2 vector hash code of a double2x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(double2x4 v)
{
return (fold_to_uint(v.c0) * uint2(0xCC74B3B7u, 0x83B58237u) +
fold_to_uint(v.c1) * uint2(0x833E3E29u, 0xA9D919BFu) +
fold_to_uint(v.c2) * uint2(0xC3EC1D97u, 0xB8B208C7u) +
fold_to_uint(v.c3) * uint2(0x5D3ED947u, 0x4473BBB1u)) + 0xCBA11D5Fu;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,442 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct double3x2 : System.IEquatable<double3x2>, IFormattable
{
public double3 c0;
public double3 c1;
/// <summary>double3x2 zero value.</summary>
public static readonly double3x2 zero;
/// <summary>Constructs a double3x2 matrix from two double3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x2(double3 c0, double3 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a double3x2 matrix from 6 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x2(double m00, double m01,
double m10, double m11,
double m20, double m21)
{
this.c0 = new double3(m00, m10, m20);
this.c1 = new double3(m01, m11, m21);
}
/// <summary>Constructs a double3x2 matrix from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x2(double v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a double3x2 matrix from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x2(bool v)
{
this.c0 = math.select(new double3(0.0), new double3(1.0), v);
this.c1 = math.select(new double3(0.0), new double3(1.0), v);
}
/// <summary>Constructs a double3x2 matrix from a bool3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x2(bool3x2 v)
{
this.c0 = math.select(new double3(0.0), new double3(1.0), v.c0);
this.c1 = math.select(new double3(0.0), new double3(1.0), v.c1);
}
/// <summary>Constructs a double3x2 matrix from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x2(int v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a double3x2 matrix from a int3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x2(int3x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Constructs a double3x2 matrix from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x2(uint v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a double3x2 matrix from a uint3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x2(uint3x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Constructs a double3x2 matrix from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x2(float v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a double3x2 matrix from a float3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x2(float3x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Implicitly converts a single double value to a double3x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x2(double v) { return new double3x2(v); }
/// <summary>Explicitly converts a single bool value to a double3x2 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double3x2(bool v) { return new double3x2(v); }
/// <summary>Explicitly converts a bool3x2 matrix to a double3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double3x2(bool3x2 v) { return new double3x2(v); }
/// <summary>Implicitly converts a single int value to a double3x2 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x2(int v) { return new double3x2(v); }
/// <summary>Implicitly converts a int3x2 matrix to a double3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x2(int3x2 v) { return new double3x2(v); }
/// <summary>Implicitly converts a single uint value to a double3x2 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x2(uint v) { return new double3x2(v); }
/// <summary>Implicitly converts a uint3x2 matrix to a double3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x2(uint3x2 v) { return new double3x2(v); }
/// <summary>Implicitly converts a single float value to a double3x2 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x2(float v) { return new double3x2(v); }
/// <summary>Implicitly converts a float3x2 matrix to a double3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x2(float3x2 v) { return new double3x2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two double3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator * (double3x2 lhs, double3x2 rhs) { return new double3x2 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1); }
/// <summary>Returns the result of a componentwise multiplication operation on a double3x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator * (double3x2 lhs, double rhs) { return new double3x2 (lhs.c0 * rhs, lhs.c1 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a double value and a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator * (double lhs, double3x2 rhs) { return new double3x2 (lhs * rhs.c0, lhs * rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on two double3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator + (double3x2 lhs, double3x2 rhs) { return new double3x2 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on a double3x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator + (double3x2 lhs, double rhs) { return new double3x2 (lhs.c0 + rhs, lhs.c1 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a double value and a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator + (double lhs, double3x2 rhs) { return new double3x2 (lhs + rhs.c0, lhs + rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on two double3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator - (double3x2 lhs, double3x2 rhs) { return new double3x2 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on a double3x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator - (double3x2 lhs, double rhs) { return new double3x2 (lhs.c0 - rhs, lhs.c1 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a double value and a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator - (double lhs, double3x2 rhs) { return new double3x2 (lhs - rhs.c0, lhs - rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on two double3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator / (double3x2 lhs, double3x2 rhs) { return new double3x2 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on a double3x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator / (double3x2 lhs, double rhs) { return new double3x2 (lhs.c0 / rhs, lhs.c1 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a double value and a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator / (double lhs, double3x2 rhs) { return new double3x2 (lhs / rhs.c0, lhs / rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on two double3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator % (double3x2 lhs, double3x2 rhs) { return new double3x2 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on a double3x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator % (double3x2 lhs, double rhs) { return new double3x2 (lhs.c0 % rhs, lhs.c1 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a double value and a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator % (double lhs, double3x2 rhs) { return new double3x2 (lhs % rhs.c0, lhs % rhs.c1); }
/// <summary>Returns the result of a componentwise increment operation on a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator ++ (double3x2 val) { return new double3x2 (++val.c0, ++val.c1); }
/// <summary>Returns the result of a componentwise decrement operation on a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator -- (double3x2 val) { return new double3x2 (--val.c0, --val.c1); }
/// <summary>Returns the result of a componentwise less than operation on two double3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator < (double3x2 lhs, double3x2 rhs) { return new bool3x2 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1); }
/// <summary>Returns the result of a componentwise less than operation on a double3x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator < (double3x2 lhs, double rhs) { return new bool3x2 (lhs.c0 < rhs, lhs.c1 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a double value and a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator < (double lhs, double3x2 rhs) { return new bool3x2 (lhs < rhs.c0, lhs < rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on two double3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator <= (double3x2 lhs, double3x2 rhs) { return new bool3x2 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on a double3x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator <= (double3x2 lhs, double rhs) { return new bool3x2 (lhs.c0 <= rhs, lhs.c1 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a double value and a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator <= (double lhs, double3x2 rhs) { return new bool3x2 (lhs <= rhs.c0, lhs <= rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on two double3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator > (double3x2 lhs, double3x2 rhs) { return new bool3x2 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on a double3x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator > (double3x2 lhs, double rhs) { return new bool3x2 (lhs.c0 > rhs, lhs.c1 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a double value and a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator > (double lhs, double3x2 rhs) { return new bool3x2 (lhs > rhs.c0, lhs > rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on two double3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator >= (double3x2 lhs, double3x2 rhs) { return new bool3x2 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double3x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator >= (double3x2 lhs, double rhs) { return new bool3x2 (lhs.c0 >= rhs, lhs.c1 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double value and a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator >= (double lhs, double3x2 rhs) { return new bool3x2 (lhs >= rhs.c0, lhs >= rhs.c1); }
/// <summary>Returns the result of a componentwise unary minus operation on a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator - (double3x2 val) { return new double3x2 (-val.c0, -val.c1); }
/// <summary>Returns the result of a componentwise unary plus operation on a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 operator + (double3x2 val) { return new double3x2 (+val.c0, +val.c1); }
/// <summary>Returns the result of a componentwise equality operation on two double3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (double3x2 lhs, double3x2 rhs) { return new bool3x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on a double3x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (double3x2 lhs, double rhs) { return new bool3x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a double value and a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (double lhs, double3x2 rhs) { return new bool3x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two double3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (double3x2 lhs, double3x2 rhs) { return new bool3x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on a double3x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (double3x2 lhs, double rhs) { return new bool3x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a double value and a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (double lhs, double3x2 rhs) { return new bool3x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the double3 element at a specified index.</summary>
unsafe public ref double3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (double3x2* array = &this) { return ref ((double3*)array)[index]; }
}
}
/// <summary>Returns true if the double3x2 is equal to a given double3x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(double3x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the double3x2 is equal to a given double3x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((double3x2)o); }
/// <summary>Returns a hash code for the double3x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the double3x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("double3x2({0}, {1}, {2}, {3}, {4}, {5})", c0.x, c1.x, c0.y, c1.y, c0.z, c1.z);
}
/// <summary>Returns a string representation of the double3x2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("double3x2({0}, {1}, {2}, {3}, {4}, {5})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a double3x2 matrix constructed from two double3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 double3x2(double3 c0, double3 c1) { return new double3x2(c0, c1); }
/// <summary>Returns a double3x2 matrix constructed from from 6 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 double3x2(double m00, double m01,
double m10, double m11,
double m20, double m21)
{
return new double3x2(m00, m01,
m10, m11,
m20, m21);
}
/// <summary>Returns a double3x2 matrix constructed from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 double3x2(double v) { return new double3x2(v); }
/// <summary>Returns a double3x2 matrix constructed from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 double3x2(bool v) { return new double3x2(v); }
/// <summary>Return a double3x2 matrix constructed from a bool3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 double3x2(bool3x2 v) { return new double3x2(v); }
/// <summary>Returns a double3x2 matrix constructed from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 double3x2(int v) { return new double3x2(v); }
/// <summary>Return a double3x2 matrix constructed from a int3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 double3x2(int3x2 v) { return new double3x2(v); }
/// <summary>Returns a double3x2 matrix constructed from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 double3x2(uint v) { return new double3x2(v); }
/// <summary>Return a double3x2 matrix constructed from a uint3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 double3x2(uint3x2 v) { return new double3x2(v); }
/// <summary>Returns a double3x2 matrix constructed from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 double3x2(float v) { return new double3x2(v); }
/// <summary>Return a double3x2 matrix constructed from a float3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x2 double3x2(float3x2 v) { return new double3x2(v); }
/// <summary>Return the double2x3 transpose of a double3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x3 transpose(double3x2 v)
{
return double2x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z);
}
/// <summary>Returns a uint hash code of a double3x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(double3x2 v)
{
return csum(fold_to_uint(v.c0) * uint3(0xEE390C97u, 0x9C8A2F05u, 0x4DDC6509u) +
fold_to_uint(v.c1) * uint3(0x7CF083CBu, 0x5C4D6CEDu, 0xF9137117u)) + 0xE857DCE1u;
}
/// <summary>
/// Returns a uint3 vector hash code of a double3x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(double3x2 v)
{
return (fold_to_uint(v.c0) * uint3(0xF62213C5u, 0x9CDAA959u, 0xAA269ABFu) +
fold_to_uint(v.c1) * uint3(0xD54BA36Fu, 0xFD0847B9u, 0x8189A683u)) + 0xB139D651u;
}
}
}

View File

@@ -0,0 +1,494 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct double3x3 : System.IEquatable<double3x3>, IFormattable
{
public double3 c0;
public double3 c1;
public double3 c2;
/// <summary>double3x3 identity transform.</summary>
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);
/// <summary>double3x3 zero value.</summary>
public static readonly double3x3 zero;
/// <summary>Constructs a double3x3 matrix from three double3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x3(double3 c0, double3 c1, double3 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a double3x3 matrix from 9 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x3(double m00, double m01, double m02,
double m10, double m11, double m12,
double m20, double m21, double m22)
{
this.c0 = new double3(m00, m10, m20);
this.c1 = new double3(m01, m11, m21);
this.c2 = new double3(m02, m12, m22);
}
/// <summary>Constructs a double3x3 matrix from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x3(double v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a double3x3 matrix from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x3(bool v)
{
this.c0 = math.select(new double3(0.0), new double3(1.0), v);
this.c1 = math.select(new double3(0.0), new double3(1.0), v);
this.c2 = math.select(new double3(0.0), new double3(1.0), v);
}
/// <summary>Constructs a double3x3 matrix from a bool3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x3(bool3x3 v)
{
this.c0 = math.select(new double3(0.0), new double3(1.0), v.c0);
this.c1 = math.select(new double3(0.0), new double3(1.0), v.c1);
this.c2 = math.select(new double3(0.0), new double3(1.0), v.c2);
}
/// <summary>Constructs a double3x3 matrix from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x3(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a double3x3 matrix from a int3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x3(int3x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Constructs a double3x3 matrix from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x3(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a double3x3 matrix from a uint3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x3(uint3x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Constructs a double3x3 matrix from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x3(float v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a double3x3 matrix from a float3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x3(float3x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Implicitly converts a single double value to a double3x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x3(double v) { return new double3x3(v); }
/// <summary>Explicitly converts a single bool value to a double3x3 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double3x3(bool v) { return new double3x3(v); }
/// <summary>Explicitly converts a bool3x3 matrix to a double3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double3x3(bool3x3 v) { return new double3x3(v); }
/// <summary>Implicitly converts a single int value to a double3x3 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x3(int v) { return new double3x3(v); }
/// <summary>Implicitly converts a int3x3 matrix to a double3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x3(int3x3 v) { return new double3x3(v); }
/// <summary>Implicitly converts a single uint value to a double3x3 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x3(uint v) { return new double3x3(v); }
/// <summary>Implicitly converts a uint3x3 matrix to a double3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x3(uint3x3 v) { return new double3x3(v); }
/// <summary>Implicitly converts a single float value to a double3x3 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x3(float v) { return new double3x3(v); }
/// <summary>Implicitly converts a float3x3 matrix to a double3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x3(float3x3 v) { return new double3x3(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two double3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator * (double3x3 lhs, double3x3 rhs) { return new double3x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); }
/// <summary>Returns the result of a componentwise multiplication operation on a double3x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator * (double3x3 lhs, double rhs) { return new double3x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a double value and a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator * (double lhs, double3x3 rhs) { return new double3x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on two double3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator + (double3x3 lhs, double3x3 rhs) { return new double3x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on a double3x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator + (double3x3 lhs, double rhs) { return new double3x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a double value and a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator + (double lhs, double3x3 rhs) { return new double3x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on two double3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator - (double3x3 lhs, double3x3 rhs) { return new double3x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on a double3x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator - (double3x3 lhs, double rhs) { return new double3x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a double value and a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator - (double lhs, double3x3 rhs) { return new double3x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on two double3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator / (double3x3 lhs, double3x3 rhs) { return new double3x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on a double3x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator / (double3x3 lhs, double rhs) { return new double3x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a double value and a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator / (double lhs, double3x3 rhs) { return new double3x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on two double3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator % (double3x3 lhs, double3x3 rhs) { return new double3x3 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on a double3x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator % (double3x3 lhs, double rhs) { return new double3x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a double value and a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator % (double lhs, double3x3 rhs) { return new double3x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); }
/// <summary>Returns the result of a componentwise increment operation on a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator ++ (double3x3 val) { return new double3x3 (++val.c0, ++val.c1, ++val.c2); }
/// <summary>Returns the result of a componentwise decrement operation on a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator -- (double3x3 val) { return new double3x3 (--val.c0, --val.c1, --val.c2); }
/// <summary>Returns the result of a componentwise less than operation on two double3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator < (double3x3 lhs, double3x3 rhs) { return new bool3x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); }
/// <summary>Returns the result of a componentwise less than operation on a double3x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator < (double3x3 lhs, double rhs) { return new bool3x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a double value and a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator < (double lhs, double3x3 rhs) { return new bool3x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on two double3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator <= (double3x3 lhs, double3x3 rhs) { return new bool3x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on a double3x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator <= (double3x3 lhs, double rhs) { return new bool3x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a double value and a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator <= (double lhs, double3x3 rhs) { return new bool3x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on two double3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator > (double3x3 lhs, double3x3 rhs) { return new bool3x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on a double3x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator > (double3x3 lhs, double rhs) { return new bool3x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a double value and a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator > (double lhs, double3x3 rhs) { return new bool3x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on two double3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator >= (double3x3 lhs, double3x3 rhs) { return new bool3x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double3x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator >= (double3x3 lhs, double rhs) { return new bool3x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double value and a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator >= (double lhs, double3x3 rhs) { return new bool3x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); }
/// <summary>Returns the result of a componentwise unary minus operation on a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator - (double3x3 val) { return new double3x3 (-val.c0, -val.c1, -val.c2); }
/// <summary>Returns the result of a componentwise unary plus operation on a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 operator + (double3x3 val) { return new double3x3 (+val.c0, +val.c1, +val.c2); }
/// <summary>Returns the result of a componentwise equality operation on two double3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (double3x3 lhs, double3x3 rhs) { return new bool3x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on a double3x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (double3x3 lhs, double rhs) { return new bool3x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a double value and a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (double lhs, double3x3 rhs) { return new bool3x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two double3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (double3x3 lhs, double3x3 rhs) { return new bool3x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on a double3x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (double3x3 lhs, double rhs) { return new bool3x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a double value and a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (double lhs, double3x3 rhs) { return new bool3x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the double3 element at a specified index.</summary>
unsafe public ref double3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (double3x3* array = &this) { return ref ((double3*)array)[index]; }
}
}
/// <summary>Returns true if the double3x3 is equal to a given double3x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(double3x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the double3x3 is equal to a given double3x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((double3x3)o); }
/// <summary>Returns a hash code for the double3x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the double3x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
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);
}
/// <summary>Returns a string representation of the double3x3 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
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));
}
}
public static partial class math
{
/// <summary>Returns a double3x3 matrix constructed from three double3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 double3x3(double3 c0, double3 c1, double3 c2) { return new double3x3(c0, c1, c2); }
/// <summary>Returns a double3x3 matrix constructed from from 9 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 double3x3(double m00, double m01, double m02,
double m10, double m11, double m12,
double m20, double m21, double m22)
{
return new double3x3(m00, m01, m02,
m10, m11, m12,
m20, m21, m22);
}
/// <summary>Returns a double3x3 matrix constructed from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 double3x3(double v) { return new double3x3(v); }
/// <summary>Returns a double3x3 matrix constructed from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 double3x3(bool v) { return new double3x3(v); }
/// <summary>Return a double3x3 matrix constructed from a bool3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 double3x3(bool3x3 v) { return new double3x3(v); }
/// <summary>Returns a double3x3 matrix constructed from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 double3x3(int v) { return new double3x3(v); }
/// <summary>Return a double3x3 matrix constructed from a int3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 double3x3(int3x3 v) { return new double3x3(v); }
/// <summary>Returns a double3x3 matrix constructed from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 double3x3(uint v) { return new double3x3(v); }
/// <summary>Return a double3x3 matrix constructed from a uint3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 double3x3(uint3x3 v) { return new double3x3(v); }
/// <summary>Returns a double3x3 matrix constructed from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 double3x3(float v) { return new double3x3(v); }
/// <summary>Return a double3x3 matrix constructed from a float3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 double3x3(float3x3 v) { return new double3x3(v); }
/// <summary>Return the double3x3 transpose of a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x3 transpose(double3x3 v)
{
return double3x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z,
v.c2.x, v.c2.y, v.c2.z);
}
/// <summary>Returns the double3x3 full inverse of a double3x3 matrix.</summary>
public static double3x3 inverse(double3x3 m)
{
double3 c0 = m.c0;
double3 c1 = m.c1;
double3 c2 = m.c2;
double3 t0 = double3(c1.x, c2.x, c0.x);
double3 t1 = double3(c1.y, c2.y, c0.y);
double3 t2 = double3(c1.z, c2.z, c0.z);
double3 m0 = t1 * t2.yzx - t1.yzx * t2;
double3 m1 = t0.yzx * t2 - t0 * t2.yzx;
double3 m2 = t0 * t1.yzx - t0.yzx * t1;
double rcpDet = 1.0 / csum(t0.zxy * m0);
return double3x3(m0, m1, m2) * rcpDet;
}
/// <summary>Returns the determinant of a double3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double determinant(double3x3 m)
{
double3 c0 = m.c0;
double3 c1 = m.c1;
double3 c2 = m.c2;
double m00 = c1.y * c2.z - c1.z * c2.y;
double m01 = c0.y * c2.z - c0.z * c2.y;
double m02 = c0.y * c1.z - c0.z * c1.y;
return c0.x * m00 - c1.x * m01 + c2.x * m02;
}
/// <summary>Returns a uint hash code of a double3x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(double3x3 v)
{
return csum(fold_to_uint(v.c0) * uint3(0xAC5DB57Bu, 0xA91A02EDu, 0xB3C49313u) +
fold_to_uint(v.c1) * uint3(0xF43A9ABBu, 0x84E7E01Bu, 0x8E055BE5u) +
fold_to_uint(v.c2) * uint3(0x6E624EB7u, 0x7383ED49u, 0xDD49C23Bu)) + 0xEBD0D005u;
}
/// <summary>
/// Returns a uint3 vector hash code of a double3x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(double3x3 v)
{
return (fold_to_uint(v.c0) * uint3(0x91475DF7u, 0x55E84827u, 0x90A285BBu) +
fold_to_uint(v.c1) * uint3(0x5D19E1D5u, 0xFAAF07DDu, 0x625C45BDu) +
fold_to_uint(v.c2) * uint3(0xC9F27FCBu, 0x6D2523B1u, 0x6E2BF6A9u)) + 0xCC74B3B7u;
}
}
}

View File

@@ -0,0 +1,489 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct double3x4 : System.IEquatable<double3x4>, IFormattable
{
public double3 c0;
public double3 c1;
public double3 c2;
public double3 c3;
/// <summary>double3x4 zero value.</summary>
public static readonly double3x4 zero;
/// <summary>Constructs a double3x4 matrix from four double3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x4(double3 c0, double3 c1, double3 c2, double3 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a double3x4 matrix from 12 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x4(double m00, double m01, double m02, double m03,
double m10, double m11, double m12, double m13,
double m20, double m21, double m22, double m23)
{
this.c0 = new double3(m00, m10, m20);
this.c1 = new double3(m01, m11, m21);
this.c2 = new double3(m02, m12, m22);
this.c3 = new double3(m03, m13, m23);
}
/// <summary>Constructs a double3x4 matrix from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x4(double v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a double3x4 matrix from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x4(bool v)
{
this.c0 = math.select(new double3(0.0), new double3(1.0), v);
this.c1 = math.select(new double3(0.0), new double3(1.0), v);
this.c2 = math.select(new double3(0.0), new double3(1.0), v);
this.c3 = math.select(new double3(0.0), new double3(1.0), v);
}
/// <summary>Constructs a double3x4 matrix from a bool3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x4(bool3x4 v)
{
this.c0 = math.select(new double3(0.0), new double3(1.0), v.c0);
this.c1 = math.select(new double3(0.0), new double3(1.0), v.c1);
this.c2 = math.select(new double3(0.0), new double3(1.0), v.c2);
this.c3 = math.select(new double3(0.0), new double3(1.0), v.c3);
}
/// <summary>Constructs a double3x4 matrix from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x4(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a double3x4 matrix from a int3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x4(int3x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Constructs a double3x4 matrix from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x4(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a double3x4 matrix from a uint3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x4(uint3x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Constructs a double3x4 matrix from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x4(float v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a double3x4 matrix from a float3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3x4(float3x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Implicitly converts a single double value to a double3x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x4(double v) { return new double3x4(v); }
/// <summary>Explicitly converts a single bool value to a double3x4 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double3x4(bool v) { return new double3x4(v); }
/// <summary>Explicitly converts a bool3x4 matrix to a double3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double3x4(bool3x4 v) { return new double3x4(v); }
/// <summary>Implicitly converts a single int value to a double3x4 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x4(int v) { return new double3x4(v); }
/// <summary>Implicitly converts a int3x4 matrix to a double3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x4(int3x4 v) { return new double3x4(v); }
/// <summary>Implicitly converts a single uint value to a double3x4 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x4(uint v) { return new double3x4(v); }
/// <summary>Implicitly converts a uint3x4 matrix to a double3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x4(uint3x4 v) { return new double3x4(v); }
/// <summary>Implicitly converts a single float value to a double3x4 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x4(float v) { return new double3x4(v); }
/// <summary>Implicitly converts a float3x4 matrix to a double3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double3x4(float3x4 v) { return new double3x4(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two double3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator * (double3x4 lhs, double3x4 rhs) { return new double3x4 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2, lhs.c3 * rhs.c3); }
/// <summary>Returns the result of a componentwise multiplication operation on a double3x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator * (double3x4 lhs, double rhs) { return new double3x4 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs, lhs.c3 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a double value and a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator * (double lhs, double3x4 rhs) { return new double3x4 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2, lhs * rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on two double3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator + (double3x4 lhs, double3x4 rhs) { return new double3x4 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2, lhs.c3 + rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on a double3x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator + (double3x4 lhs, double rhs) { return new double3x4 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs, lhs.c3 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a double value and a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator + (double lhs, double3x4 rhs) { return new double3x4 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2, lhs + rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on two double3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator - (double3x4 lhs, double3x4 rhs) { return new double3x4 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2, lhs.c3 - rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on a double3x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator - (double3x4 lhs, double rhs) { return new double3x4 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs, lhs.c3 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a double value and a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator - (double lhs, double3x4 rhs) { return new double3x4 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2, lhs - rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on two double3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator / (double3x4 lhs, double3x4 rhs) { return new double3x4 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2, lhs.c3 / rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on a double3x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator / (double3x4 lhs, double rhs) { return new double3x4 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs, lhs.c3 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a double value and a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator / (double lhs, double3x4 rhs) { return new double3x4 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2, lhs / rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on two double3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator % (double3x4 lhs, double3x4 rhs) { return new double3x4 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2, lhs.c3 % rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on a double3x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator % (double3x4 lhs, double rhs) { return new double3x4 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs, lhs.c3 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a double value and a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator % (double lhs, double3x4 rhs) { return new double3x4 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2, lhs % rhs.c3); }
/// <summary>Returns the result of a componentwise increment operation on a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator ++ (double3x4 val) { return new double3x4 (++val.c0, ++val.c1, ++val.c2, ++val.c3); }
/// <summary>Returns the result of a componentwise decrement operation on a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator -- (double3x4 val) { return new double3x4 (--val.c0, --val.c1, --val.c2, --val.c3); }
/// <summary>Returns the result of a componentwise less than operation on two double3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator < (double3x4 lhs, double3x4 rhs) { return new bool3x4 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2, lhs.c3 < rhs.c3); }
/// <summary>Returns the result of a componentwise less than operation on a double3x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator < (double3x4 lhs, double rhs) { return new bool3x4 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs, lhs.c3 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a double value and a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator < (double lhs, double3x4 rhs) { return new bool3x4 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2, lhs < rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on two double3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator <= (double3x4 lhs, double3x4 rhs) { return new bool3x4 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2, lhs.c3 <= rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on a double3x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator <= (double3x4 lhs, double rhs) { return new bool3x4 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs, lhs.c3 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a double value and a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator <= (double lhs, double3x4 rhs) { return new bool3x4 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2, lhs <= rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on two double3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator > (double3x4 lhs, double3x4 rhs) { return new bool3x4 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2, lhs.c3 > rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on a double3x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator > (double3x4 lhs, double rhs) { return new bool3x4 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs, lhs.c3 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a double value and a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator > (double lhs, double3x4 rhs) { return new bool3x4 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2, lhs > rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on two double3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator >= (double3x4 lhs, double3x4 rhs) { return new bool3x4 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2, lhs.c3 >= rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double3x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator >= (double3x4 lhs, double rhs) { return new bool3x4 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs, lhs.c3 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double value and a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator >= (double lhs, double3x4 rhs) { return new bool3x4 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2, lhs >= rhs.c3); }
/// <summary>Returns the result of a componentwise unary minus operation on a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator - (double3x4 val) { return new double3x4 (-val.c0, -val.c1, -val.c2, -val.c3); }
/// <summary>Returns the result of a componentwise unary plus operation on a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 operator + (double3x4 val) { return new double3x4 (+val.c0, +val.c1, +val.c2, +val.c3); }
/// <summary>Returns the result of a componentwise equality operation on two double3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (double3x4 lhs, double3x4 rhs) { return new bool3x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on a double3x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (double3x4 lhs, double rhs) { return new bool3x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a double value and a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (double lhs, double3x4 rhs) { return new bool3x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two double3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (double3x4 lhs, double3x4 rhs) { return new bool3x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on a double3x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (double3x4 lhs, double rhs) { return new bool3x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a double value and a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (double lhs, double3x4 rhs) { return new bool3x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the double3 element at a specified index.</summary>
unsafe public ref double3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (double3x4* array = &this) { return ref ((double3*)array)[index]; }
}
}
/// <summary>Returns true if the double3x4 is equal to a given double3x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(double3x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the double3x4 is equal to a given double3x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((double3x4)o); }
/// <summary>Returns a hash code for the double3x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the double3x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("double3x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y, c0.z, c1.z, c2.z, c3.z);
}
/// <summary>Returns a string representation of the double3x4 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("double3x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c3.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider), c3.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider), c2.z.ToString(format, formatProvider), c3.z.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a double3x4 matrix constructed from four double3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 double3x4(double3 c0, double3 c1, double3 c2, double3 c3) { return new double3x4(c0, c1, c2, c3); }
/// <summary>Returns a double3x4 matrix constructed from from 12 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 double3x4(double m00, double m01, double m02, double m03,
double m10, double m11, double m12, double m13,
double m20, double m21, double m22, double m23)
{
return new double3x4(m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23);
}
/// <summary>Returns a double3x4 matrix constructed from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 double3x4(double v) { return new double3x4(v); }
/// <summary>Returns a double3x4 matrix constructed from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 double3x4(bool v) { return new double3x4(v); }
/// <summary>Return a double3x4 matrix constructed from a bool3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 double3x4(bool3x4 v) { return new double3x4(v); }
/// <summary>Returns a double3x4 matrix constructed from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 double3x4(int v) { return new double3x4(v); }
/// <summary>Return a double3x4 matrix constructed from a int3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 double3x4(int3x4 v) { return new double3x4(v); }
/// <summary>Returns a double3x4 matrix constructed from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 double3x4(uint v) { return new double3x4(v); }
/// <summary>Return a double3x4 matrix constructed from a uint3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 double3x4(uint3x4 v) { return new double3x4(v); }
/// <summary>Returns a double3x4 matrix constructed from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 double3x4(float v) { return new double3x4(v); }
/// <summary>Return a double3x4 matrix constructed from a float3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 double3x4(float3x4 v) { return new double3x4(v); }
/// <summary>Return the double4x3 transpose of a double3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 transpose(double3x4 v)
{
return double4x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z,
v.c2.x, v.c2.y, v.c2.z,
v.c3.x, v.c3.y, v.c3.z);
}
// Fast matrix inverse for rigid transforms (Orthonormal basis and translation)
public static double3x4 fastinverse(double3x4 m)
{
double3 c0 = m.c0;
double3 c1 = m.c1;
double3 c2 = m.c2;
double3 pos = m.c3;
double3 r0 = double3(c0.x, c1.x, c2.x);
double3 r1 = double3(c0.y, c1.y, c2.y);
double3 r2 = double3(c0.z, c1.z, c2.z);
pos = -(r0 * pos.x + r1 * pos.y + r2 * pos.z);
return double3x4(r0, r1, r2, pos);
}
/// <summary>Returns a uint hash code of a double3x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(double3x4 v)
{
return csum(fold_to_uint(v.c0) * uint3(0xEE390C97u, 0x9C8A2F05u, 0x4DDC6509u) +
fold_to_uint(v.c1) * uint3(0x7CF083CBu, 0x5C4D6CEDu, 0xF9137117u) +
fold_to_uint(v.c2) * uint3(0xE857DCE1u, 0xF62213C5u, 0x9CDAA959u) +
fold_to_uint(v.c3) * uint3(0xAA269ABFu, 0xD54BA36Fu, 0xFD0847B9u)) + 0x8189A683u;
}
/// <summary>
/// Returns a uint3 vector hash code of a double3x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(double3x4 v)
{
return (fold_to_uint(v.c0) * uint3(0xB139D651u, 0xE7579997u, 0xEF7D56C7u) +
fold_to_uint(v.c1) * uint3(0x66F38F0Bu, 0x624256A3u, 0x5292ADE1u) +
fold_to_uint(v.c2) * uint3(0xD2E590E5u, 0xF25BE857u, 0x9BC17CE7u) +
fold_to_uint(v.c3) * uint3(0xC8B86851u, 0x64095221u, 0xADF428FFu)) + 0xA3977109u;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,445 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct double4x2 : System.IEquatable<double4x2>, IFormattable
{
public double4 c0;
public double4 c1;
/// <summary>double4x2 zero value.</summary>
public static readonly double4x2 zero;
/// <summary>Constructs a double4x2 matrix from two double4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x2(double4 c0, double4 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a double4x2 matrix from 8 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x2(double m00, double m01,
double m10, double m11,
double m20, double m21,
double m30, double m31)
{
this.c0 = new double4(m00, m10, m20, m30);
this.c1 = new double4(m01, m11, m21, m31);
}
/// <summary>Constructs a double4x2 matrix from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x2(double v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a double4x2 matrix from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x2(bool v)
{
this.c0 = math.select(new double4(0.0), new double4(1.0), v);
this.c1 = math.select(new double4(0.0), new double4(1.0), v);
}
/// <summary>Constructs a double4x2 matrix from a bool4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x2(bool4x2 v)
{
this.c0 = math.select(new double4(0.0), new double4(1.0), v.c0);
this.c1 = math.select(new double4(0.0), new double4(1.0), v.c1);
}
/// <summary>Constructs a double4x2 matrix from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x2(int v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a double4x2 matrix from a int4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x2(int4x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Constructs a double4x2 matrix from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x2(uint v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a double4x2 matrix from a uint4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x2(uint4x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Constructs a double4x2 matrix from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x2(float v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a double4x2 matrix from a float4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x2(float4x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Implicitly converts a single double value to a double4x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x2(double v) { return new double4x2(v); }
/// <summary>Explicitly converts a single bool value to a double4x2 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double4x2(bool v) { return new double4x2(v); }
/// <summary>Explicitly converts a bool4x2 matrix to a double4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double4x2(bool4x2 v) { return new double4x2(v); }
/// <summary>Implicitly converts a single int value to a double4x2 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x2(int v) { return new double4x2(v); }
/// <summary>Implicitly converts a int4x2 matrix to a double4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x2(int4x2 v) { return new double4x2(v); }
/// <summary>Implicitly converts a single uint value to a double4x2 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x2(uint v) { return new double4x2(v); }
/// <summary>Implicitly converts a uint4x2 matrix to a double4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x2(uint4x2 v) { return new double4x2(v); }
/// <summary>Implicitly converts a single float value to a double4x2 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x2(float v) { return new double4x2(v); }
/// <summary>Implicitly converts a float4x2 matrix to a double4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x2(float4x2 v) { return new double4x2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two double4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator * (double4x2 lhs, double4x2 rhs) { return new double4x2 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1); }
/// <summary>Returns the result of a componentwise multiplication operation on a double4x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator * (double4x2 lhs, double rhs) { return new double4x2 (lhs.c0 * rhs, lhs.c1 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a double value and a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator * (double lhs, double4x2 rhs) { return new double4x2 (lhs * rhs.c0, lhs * rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on two double4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator + (double4x2 lhs, double4x2 rhs) { return new double4x2 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on a double4x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator + (double4x2 lhs, double rhs) { return new double4x2 (lhs.c0 + rhs, lhs.c1 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a double value and a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator + (double lhs, double4x2 rhs) { return new double4x2 (lhs + rhs.c0, lhs + rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on two double4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator - (double4x2 lhs, double4x2 rhs) { return new double4x2 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on a double4x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator - (double4x2 lhs, double rhs) { return new double4x2 (lhs.c0 - rhs, lhs.c1 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a double value and a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator - (double lhs, double4x2 rhs) { return new double4x2 (lhs - rhs.c0, lhs - rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on two double4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator / (double4x2 lhs, double4x2 rhs) { return new double4x2 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on a double4x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator / (double4x2 lhs, double rhs) { return new double4x2 (lhs.c0 / rhs, lhs.c1 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a double value and a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator / (double lhs, double4x2 rhs) { return new double4x2 (lhs / rhs.c0, lhs / rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on two double4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator % (double4x2 lhs, double4x2 rhs) { return new double4x2 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on a double4x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator % (double4x2 lhs, double rhs) { return new double4x2 (lhs.c0 % rhs, lhs.c1 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a double value and a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator % (double lhs, double4x2 rhs) { return new double4x2 (lhs % rhs.c0, lhs % rhs.c1); }
/// <summary>Returns the result of a componentwise increment operation on a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator ++ (double4x2 val) { return new double4x2 (++val.c0, ++val.c1); }
/// <summary>Returns the result of a componentwise decrement operation on a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator -- (double4x2 val) { return new double4x2 (--val.c0, --val.c1); }
/// <summary>Returns the result of a componentwise less than operation on two double4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator < (double4x2 lhs, double4x2 rhs) { return new bool4x2 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1); }
/// <summary>Returns the result of a componentwise less than operation on a double4x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator < (double4x2 lhs, double rhs) { return new bool4x2 (lhs.c0 < rhs, lhs.c1 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a double value and a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator < (double lhs, double4x2 rhs) { return new bool4x2 (lhs < rhs.c0, lhs < rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on two double4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator <= (double4x2 lhs, double4x2 rhs) { return new bool4x2 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on a double4x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator <= (double4x2 lhs, double rhs) { return new bool4x2 (lhs.c0 <= rhs, lhs.c1 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a double value and a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator <= (double lhs, double4x2 rhs) { return new bool4x2 (lhs <= rhs.c0, lhs <= rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on two double4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator > (double4x2 lhs, double4x2 rhs) { return new bool4x2 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on a double4x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator > (double4x2 lhs, double rhs) { return new bool4x2 (lhs.c0 > rhs, lhs.c1 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a double value and a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator > (double lhs, double4x2 rhs) { return new bool4x2 (lhs > rhs.c0, lhs > rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on two double4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator >= (double4x2 lhs, double4x2 rhs) { return new bool4x2 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double4x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator >= (double4x2 lhs, double rhs) { return new bool4x2 (lhs.c0 >= rhs, lhs.c1 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double value and a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator >= (double lhs, double4x2 rhs) { return new bool4x2 (lhs >= rhs.c0, lhs >= rhs.c1); }
/// <summary>Returns the result of a componentwise unary minus operation on a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator - (double4x2 val) { return new double4x2 (-val.c0, -val.c1); }
/// <summary>Returns the result of a componentwise unary plus operation on a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 operator + (double4x2 val) { return new double4x2 (+val.c0, +val.c1); }
/// <summary>Returns the result of a componentwise equality operation on two double4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (double4x2 lhs, double4x2 rhs) { return new bool4x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on a double4x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (double4x2 lhs, double rhs) { return new bool4x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a double value and a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (double lhs, double4x2 rhs) { return new bool4x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two double4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (double4x2 lhs, double4x2 rhs) { return new bool4x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on a double4x2 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (double4x2 lhs, double rhs) { return new bool4x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a double value and a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (double lhs, double4x2 rhs) { return new bool4x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the double4 element at a specified index.</summary>
unsafe public ref double4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (double4x2* array = &this) { return ref ((double4*)array)[index]; }
}
}
/// <summary>Returns true if the double4x2 is equal to a given double4x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(double4x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the double4x2 is equal to a given double4x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((double4x2)o); }
/// <summary>Returns a hash code for the double4x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the double4x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("double4x2({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x, c1.x, c0.y, c1.y, c0.z, c1.z, c0.w, c1.w);
}
/// <summary>Returns a string representation of the double4x2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("double4x2({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider), c0.w.ToString(format, formatProvider), c1.w.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a double4x2 matrix constructed from two double4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 double4x2(double4 c0, double4 c1) { return new double4x2(c0, c1); }
/// <summary>Returns a double4x2 matrix constructed from from 8 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 double4x2(double m00, double m01,
double m10, double m11,
double m20, double m21,
double m30, double m31)
{
return new double4x2(m00, m01,
m10, m11,
m20, m21,
m30, m31);
}
/// <summary>Returns a double4x2 matrix constructed from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 double4x2(double v) { return new double4x2(v); }
/// <summary>Returns a double4x2 matrix constructed from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 double4x2(bool v) { return new double4x2(v); }
/// <summary>Return a double4x2 matrix constructed from a bool4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 double4x2(bool4x2 v) { return new double4x2(v); }
/// <summary>Returns a double4x2 matrix constructed from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 double4x2(int v) { return new double4x2(v); }
/// <summary>Return a double4x2 matrix constructed from a int4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 double4x2(int4x2 v) { return new double4x2(v); }
/// <summary>Returns a double4x2 matrix constructed from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 double4x2(uint v) { return new double4x2(v); }
/// <summary>Return a double4x2 matrix constructed from a uint4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 double4x2(uint4x2 v) { return new double4x2(v); }
/// <summary>Returns a double4x2 matrix constructed from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 double4x2(float v) { return new double4x2(v); }
/// <summary>Return a double4x2 matrix constructed from a float4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x2 double4x2(float4x2 v) { return new double4x2(v); }
/// <summary>Return the double2x4 transpose of a double4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double2x4 transpose(double4x2 v)
{
return double2x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w);
}
/// <summary>Returns a uint hash code of a double4x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(double4x2 v)
{
return csum(fold_to_uint(v.c0) * uint4(0x5AB3E8CDu, 0x676E8407u, 0xB36DE767u, 0x6FCA387Du) +
fold_to_uint(v.c1) * uint4(0xAF0F3103u, 0xE4A056C7u, 0x841D8225u, 0xC9393C7Du)) + 0xD42EAFA3u;
}
/// <summary>
/// Returns a uint4 vector hash code of a double4x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(double4x2 v)
{
return (fold_to_uint(v.c0) * uint4(0xD9AFD06Du, 0x97A65421u, 0x7809205Fu, 0x9C9F0823u) +
fold_to_uint(v.c1) * uint4(0x5A9CA13Bu, 0xAFCDD5EFu, 0xA88D187Du, 0xCF6EBA1Du)) + 0x9D88E5A1u;
}
}
}

View File

@@ -0,0 +1,460 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct double4x3 : System.IEquatable<double4x3>, IFormattable
{
public double4 c0;
public double4 c1;
public double4 c2;
/// <summary>double4x3 zero value.</summary>
public static readonly double4x3 zero;
/// <summary>Constructs a double4x3 matrix from three double4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x3(double4 c0, double4 c1, double4 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a double4x3 matrix from 12 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x3(double m00, double m01, double m02,
double m10, double m11, double m12,
double m20, double m21, double m22,
double m30, double m31, double m32)
{
this.c0 = new double4(m00, m10, m20, m30);
this.c1 = new double4(m01, m11, m21, m31);
this.c2 = new double4(m02, m12, m22, m32);
}
/// <summary>Constructs a double4x3 matrix from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x3(double v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a double4x3 matrix from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x3(bool v)
{
this.c0 = math.select(new double4(0.0), new double4(1.0), v);
this.c1 = math.select(new double4(0.0), new double4(1.0), v);
this.c2 = math.select(new double4(0.0), new double4(1.0), v);
}
/// <summary>Constructs a double4x3 matrix from a bool4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x3(bool4x3 v)
{
this.c0 = math.select(new double4(0.0), new double4(1.0), v.c0);
this.c1 = math.select(new double4(0.0), new double4(1.0), v.c1);
this.c2 = math.select(new double4(0.0), new double4(1.0), v.c2);
}
/// <summary>Constructs a double4x3 matrix from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x3(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a double4x3 matrix from a int4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x3(int4x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Constructs a double4x3 matrix from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x3(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a double4x3 matrix from a uint4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x3(uint4x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Constructs a double4x3 matrix from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x3(float v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a double4x3 matrix from a float4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x3(float4x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Implicitly converts a single double value to a double4x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x3(double v) { return new double4x3(v); }
/// <summary>Explicitly converts a single bool value to a double4x3 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double4x3(bool v) { return new double4x3(v); }
/// <summary>Explicitly converts a bool4x3 matrix to a double4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double4x3(bool4x3 v) { return new double4x3(v); }
/// <summary>Implicitly converts a single int value to a double4x3 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x3(int v) { return new double4x3(v); }
/// <summary>Implicitly converts a int4x3 matrix to a double4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x3(int4x3 v) { return new double4x3(v); }
/// <summary>Implicitly converts a single uint value to a double4x3 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x3(uint v) { return new double4x3(v); }
/// <summary>Implicitly converts a uint4x3 matrix to a double4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x3(uint4x3 v) { return new double4x3(v); }
/// <summary>Implicitly converts a single float value to a double4x3 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x3(float v) { return new double4x3(v); }
/// <summary>Implicitly converts a float4x3 matrix to a double4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x3(float4x3 v) { return new double4x3(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two double4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator * (double4x3 lhs, double4x3 rhs) { return new double4x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); }
/// <summary>Returns the result of a componentwise multiplication operation on a double4x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator * (double4x3 lhs, double rhs) { return new double4x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a double value and a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator * (double lhs, double4x3 rhs) { return new double4x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on two double4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator + (double4x3 lhs, double4x3 rhs) { return new double4x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on a double4x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator + (double4x3 lhs, double rhs) { return new double4x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a double value and a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator + (double lhs, double4x3 rhs) { return new double4x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on two double4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator - (double4x3 lhs, double4x3 rhs) { return new double4x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on a double4x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator - (double4x3 lhs, double rhs) { return new double4x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a double value and a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator - (double lhs, double4x3 rhs) { return new double4x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on two double4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator / (double4x3 lhs, double4x3 rhs) { return new double4x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on a double4x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator / (double4x3 lhs, double rhs) { return new double4x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a double value and a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator / (double lhs, double4x3 rhs) { return new double4x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on two double4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator % (double4x3 lhs, double4x3 rhs) { return new double4x3 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on a double4x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator % (double4x3 lhs, double rhs) { return new double4x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a double value and a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator % (double lhs, double4x3 rhs) { return new double4x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); }
/// <summary>Returns the result of a componentwise increment operation on a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator ++ (double4x3 val) { return new double4x3 (++val.c0, ++val.c1, ++val.c2); }
/// <summary>Returns the result of a componentwise decrement operation on a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator -- (double4x3 val) { return new double4x3 (--val.c0, --val.c1, --val.c2); }
/// <summary>Returns the result of a componentwise less than operation on two double4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator < (double4x3 lhs, double4x3 rhs) { return new bool4x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); }
/// <summary>Returns the result of a componentwise less than operation on a double4x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator < (double4x3 lhs, double rhs) { return new bool4x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a double value and a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator < (double lhs, double4x3 rhs) { return new bool4x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on two double4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator <= (double4x3 lhs, double4x3 rhs) { return new bool4x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on a double4x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator <= (double4x3 lhs, double rhs) { return new bool4x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a double value and a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator <= (double lhs, double4x3 rhs) { return new bool4x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on two double4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator > (double4x3 lhs, double4x3 rhs) { return new bool4x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on a double4x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator > (double4x3 lhs, double rhs) { return new bool4x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a double value and a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator > (double lhs, double4x3 rhs) { return new bool4x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on two double4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator >= (double4x3 lhs, double4x3 rhs) { return new bool4x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double4x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator >= (double4x3 lhs, double rhs) { return new bool4x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double value and a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator >= (double lhs, double4x3 rhs) { return new bool4x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); }
/// <summary>Returns the result of a componentwise unary minus operation on a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator - (double4x3 val) { return new double4x3 (-val.c0, -val.c1, -val.c2); }
/// <summary>Returns the result of a componentwise unary plus operation on a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 operator + (double4x3 val) { return new double4x3 (+val.c0, +val.c1, +val.c2); }
/// <summary>Returns the result of a componentwise equality operation on two double4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (double4x3 lhs, double4x3 rhs) { return new bool4x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on a double4x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (double4x3 lhs, double rhs) { return new bool4x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a double value and a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (double lhs, double4x3 rhs) { return new bool4x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two double4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (double4x3 lhs, double4x3 rhs) { return new bool4x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on a double4x3 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (double4x3 lhs, double rhs) { return new bool4x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a double value and a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (double lhs, double4x3 rhs) { return new bool4x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the double4 element at a specified index.</summary>
unsafe public ref double4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (double4x3* array = &this) { return ref ((double4*)array)[index]; }
}
}
/// <summary>Returns true if the double4x3 is equal to a given double4x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(double4x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the double4x3 is equal to a given double4x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((double4x3)o); }
/// <summary>Returns a hash code for the double4x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the double4x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("double4x3({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", c0.x, c1.x, c2.x, c0.y, c1.y, c2.y, c0.z, c1.z, c2.z, c0.w, c1.w, c2.w);
}
/// <summary>Returns a string representation of the double4x3 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("double4x3({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", 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), c0.w.ToString(format, formatProvider), c1.w.ToString(format, formatProvider), c2.w.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a double4x3 matrix constructed from three double4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 double4x3(double4 c0, double4 c1, double4 c2) { return new double4x3(c0, c1, c2); }
/// <summary>Returns a double4x3 matrix constructed from from 12 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 double4x3(double m00, double m01, double m02,
double m10, double m11, double m12,
double m20, double m21, double m22,
double m30, double m31, double m32)
{
return new double4x3(m00, m01, m02,
m10, m11, m12,
m20, m21, m22,
m30, m31, m32);
}
/// <summary>Returns a double4x3 matrix constructed from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 double4x3(double v) { return new double4x3(v); }
/// <summary>Returns a double4x3 matrix constructed from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 double4x3(bool v) { return new double4x3(v); }
/// <summary>Return a double4x3 matrix constructed from a bool4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 double4x3(bool4x3 v) { return new double4x3(v); }
/// <summary>Returns a double4x3 matrix constructed from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 double4x3(int v) { return new double4x3(v); }
/// <summary>Return a double4x3 matrix constructed from a int4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 double4x3(int4x3 v) { return new double4x3(v); }
/// <summary>Returns a double4x3 matrix constructed from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 double4x3(uint v) { return new double4x3(v); }
/// <summary>Return a double4x3 matrix constructed from a uint4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 double4x3(uint4x3 v) { return new double4x3(v); }
/// <summary>Returns a double4x3 matrix constructed from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 double4x3(float v) { return new double4x3(v); }
/// <summary>Return a double4x3 matrix constructed from a float4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x3 double4x3(float4x3 v) { return new double4x3(v); }
/// <summary>Return the double3x4 transpose of a double4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3x4 transpose(double4x3 v)
{
return double3x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w,
v.c2.x, v.c2.y, v.c2.z, v.c2.w);
}
/// <summary>Returns a uint hash code of a double4x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(double4x3 v)
{
return csum(fold_to_uint(v.c0) * uint4(0x7AA07CD3u, 0xAF642BA9u, 0xA8F2213Bu, 0x9F3FDC37u) +
fold_to_uint(v.c1) * uint4(0xAC60D0C3u, 0x9263662Fu, 0xE69626FFu, 0xBD010EEBu) +
fold_to_uint(v.c2) * uint4(0x9CEDE1D1u, 0x43BE0B51u, 0xAF836EE1u, 0xB130C137u)) + 0x54834775u;
}
/// <summary>
/// Returns a uint4 vector hash code of a double4x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(double4x3 v)
{
return (fold_to_uint(v.c0) * uint4(0x7C022221u, 0xA2D00EDFu, 0xA8977779u, 0x9F1C739Bu) +
fold_to_uint(v.c1) * uint4(0x4B1BD187u, 0x9DF50593u, 0xF18EEB85u, 0x9E19BFC3u) +
fold_to_uint(v.c2) * uint4(0x8196B06Fu, 0xD24EFA19u, 0x7D8048BBu, 0x713BD06Fu)) + 0x753AD6ADu;
}
}
}

View File

@@ -0,0 +1,596 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct double4x4 : System.IEquatable<double4x4>, IFormattable
{
public double4 c0;
public double4 c1;
public double4 c2;
public double4 c3;
/// <summary>double4x4 identity transform.</summary>
public static readonly double4x4 identity = new double4x4(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
/// <summary>double4x4 zero value.</summary>
public static readonly double4x4 zero;
/// <summary>Constructs a double4x4 matrix from four double4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x4(double4 c0, double4 c1, double4 c2, double4 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a double4x4 matrix from 16 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x4(double m00, double m01, double m02, double m03,
double m10, double m11, double m12, double m13,
double m20, double m21, double m22, double m23,
double m30, double m31, double m32, double m33)
{
this.c0 = new double4(m00, m10, m20, m30);
this.c1 = new double4(m01, m11, m21, m31);
this.c2 = new double4(m02, m12, m22, m32);
this.c3 = new double4(m03, m13, m23, m33);
}
/// <summary>Constructs a double4x4 matrix from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x4(double v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a double4x4 matrix from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x4(bool v)
{
this.c0 = math.select(new double4(0.0), new double4(1.0), v);
this.c1 = math.select(new double4(0.0), new double4(1.0), v);
this.c2 = math.select(new double4(0.0), new double4(1.0), v);
this.c3 = math.select(new double4(0.0), new double4(1.0), v);
}
/// <summary>Constructs a double4x4 matrix from a bool4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x4(bool4x4 v)
{
this.c0 = math.select(new double4(0.0), new double4(1.0), v.c0);
this.c1 = math.select(new double4(0.0), new double4(1.0), v.c1);
this.c2 = math.select(new double4(0.0), new double4(1.0), v.c2);
this.c3 = math.select(new double4(0.0), new double4(1.0), v.c3);
}
/// <summary>Constructs a double4x4 matrix from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x4(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a double4x4 matrix from a int4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x4(int4x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Constructs a double4x4 matrix from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x4(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a double4x4 matrix from a uint4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x4(uint4x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Constructs a double4x4 matrix from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x4(float v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a double4x4 matrix from a float4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4x4(float4x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Implicitly converts a single double value to a double4x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x4(double v) { return new double4x4(v); }
/// <summary>Explicitly converts a single bool value to a double4x4 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double4x4(bool v) { return new double4x4(v); }
/// <summary>Explicitly converts a bool4x4 matrix to a double4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator double4x4(bool4x4 v) { return new double4x4(v); }
/// <summary>Implicitly converts a single int value to a double4x4 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x4(int v) { return new double4x4(v); }
/// <summary>Implicitly converts a int4x4 matrix to a double4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x4(int4x4 v) { return new double4x4(v); }
/// <summary>Implicitly converts a single uint value to a double4x4 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x4(uint v) { return new double4x4(v); }
/// <summary>Implicitly converts a uint4x4 matrix to a double4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x4(uint4x4 v) { return new double4x4(v); }
/// <summary>Implicitly converts a single float value to a double4x4 matrix by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x4(float v) { return new double4x4(v); }
/// <summary>Implicitly converts a float4x4 matrix to a double4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double4x4(float4x4 v) { return new double4x4(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two double4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator * (double4x4 lhs, double4x4 rhs) { return new double4x4 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2, lhs.c3 * rhs.c3); }
/// <summary>Returns the result of a componentwise multiplication operation on a double4x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator * (double4x4 lhs, double rhs) { return new double4x4 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs, lhs.c3 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a double value and a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator * (double lhs, double4x4 rhs) { return new double4x4 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2, lhs * rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on two double4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator + (double4x4 lhs, double4x4 rhs) { return new double4x4 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2, lhs.c3 + rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on a double4x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator + (double4x4 lhs, double rhs) { return new double4x4 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs, lhs.c3 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a double value and a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator + (double lhs, double4x4 rhs) { return new double4x4 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2, lhs + rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on two double4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator - (double4x4 lhs, double4x4 rhs) { return new double4x4 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2, lhs.c3 - rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on a double4x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator - (double4x4 lhs, double rhs) { return new double4x4 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs, lhs.c3 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a double value and a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator - (double lhs, double4x4 rhs) { return new double4x4 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2, lhs - rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on two double4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator / (double4x4 lhs, double4x4 rhs) { return new double4x4 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2, lhs.c3 / rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on a double4x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator / (double4x4 lhs, double rhs) { return new double4x4 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs, lhs.c3 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a double value and a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator / (double lhs, double4x4 rhs) { return new double4x4 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2, lhs / rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on two double4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator % (double4x4 lhs, double4x4 rhs) { return new double4x4 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2, lhs.c3 % rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on a double4x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator % (double4x4 lhs, double rhs) { return new double4x4 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs, lhs.c3 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a double value and a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator % (double lhs, double4x4 rhs) { return new double4x4 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2, lhs % rhs.c3); }
/// <summary>Returns the result of a componentwise increment operation on a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator ++ (double4x4 val) { return new double4x4 (++val.c0, ++val.c1, ++val.c2, ++val.c3); }
/// <summary>Returns the result of a componentwise decrement operation on a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator -- (double4x4 val) { return new double4x4 (--val.c0, --val.c1, --val.c2, --val.c3); }
/// <summary>Returns the result of a componentwise less than operation on two double4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator < (double4x4 lhs, double4x4 rhs) { return new bool4x4 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2, lhs.c3 < rhs.c3); }
/// <summary>Returns the result of a componentwise less than operation on a double4x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator < (double4x4 lhs, double rhs) { return new bool4x4 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs, lhs.c3 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a double value and a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator < (double lhs, double4x4 rhs) { return new bool4x4 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2, lhs < rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on two double4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator <= (double4x4 lhs, double4x4 rhs) { return new bool4x4 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2, lhs.c3 <= rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on a double4x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator <= (double4x4 lhs, double rhs) { return new bool4x4 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs, lhs.c3 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a double value and a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator <= (double lhs, double4x4 rhs) { return new bool4x4 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2, lhs <= rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on two double4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator > (double4x4 lhs, double4x4 rhs) { return new bool4x4 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2, lhs.c3 > rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on a double4x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator > (double4x4 lhs, double rhs) { return new bool4x4 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs, lhs.c3 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a double value and a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator > (double lhs, double4x4 rhs) { return new bool4x4 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2, lhs > rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on two double4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator >= (double4x4 lhs, double4x4 rhs) { return new bool4x4 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2, lhs.c3 >= rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double4x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator >= (double4x4 lhs, double rhs) { return new bool4x4 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs, lhs.c3 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a double value and a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator >= (double lhs, double4x4 rhs) { return new bool4x4 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2, lhs >= rhs.c3); }
/// <summary>Returns the result of a componentwise unary minus operation on a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator - (double4x4 val) { return new double4x4 (-val.c0, -val.c1, -val.c2, -val.c3); }
/// <summary>Returns the result of a componentwise unary plus operation on a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 operator + (double4x4 val) { return new double4x4 (+val.c0, +val.c1, +val.c2, +val.c3); }
/// <summary>Returns the result of a componentwise equality operation on two double4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (double4x4 lhs, double4x4 rhs) { return new bool4x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on a double4x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (double4x4 lhs, double rhs) { return new bool4x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a double value and a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (double lhs, double4x4 rhs) { return new bool4x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two double4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (double4x4 lhs, double4x4 rhs) { return new bool4x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on a double4x4 matrix and a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (double4x4 lhs, double rhs) { return new bool4x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a double value and a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (double lhs, double4x4 rhs) { return new bool4x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the double4 element at a specified index.</summary>
unsafe public ref double4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (double4x4* array = &this) { return ref ((double4*)array)[index]; }
}
}
/// <summary>Returns true if the double4x4 is equal to a given double4x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(double4x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the double4x4 is equal to a given double4x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((double4x4)o); }
/// <summary>Returns a hash code for the double4x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the double4x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("double4x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15})", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y, c0.z, c1.z, c2.z, c3.z, c0.w, c1.w, c2.w, c3.w);
}
/// <summary>Returns a string representation of the double4x4 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("double4x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c3.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider), c3.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider), c2.z.ToString(format, formatProvider), c3.z.ToString(format, formatProvider), c0.w.ToString(format, formatProvider), c1.w.ToString(format, formatProvider), c2.w.ToString(format, formatProvider), c3.w.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a double4x4 matrix constructed from four double4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 double4x4(double4 c0, double4 c1, double4 c2, double4 c3) { return new double4x4(c0, c1, c2, c3); }
/// <summary>Returns a double4x4 matrix constructed from from 16 double values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 double4x4(double m00, double m01, double m02, double m03,
double m10, double m11, double m12, double m13,
double m20, double m21, double m22, double m23,
double m30, double m31, double m32, double m33)
{
return new double4x4(m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23,
m30, m31, m32, m33);
}
/// <summary>Returns a double4x4 matrix constructed from a single double value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 double4x4(double v) { return new double4x4(v); }
/// <summary>Returns a double4x4 matrix constructed from a single bool value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 double4x4(bool v) { return new double4x4(v); }
/// <summary>Return a double4x4 matrix constructed from a bool4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 double4x4(bool4x4 v) { return new double4x4(v); }
/// <summary>Returns a double4x4 matrix constructed from a single int value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 double4x4(int v) { return new double4x4(v); }
/// <summary>Return a double4x4 matrix constructed from a int4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 double4x4(int4x4 v) { return new double4x4(v); }
/// <summary>Returns a double4x4 matrix constructed from a single uint value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 double4x4(uint v) { return new double4x4(v); }
/// <summary>Return a double4x4 matrix constructed from a uint4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 double4x4(uint4x4 v) { return new double4x4(v); }
/// <summary>Returns a double4x4 matrix constructed from a single float value by converting it to double and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 double4x4(float v) { return new double4x4(v); }
/// <summary>Return a double4x4 matrix constructed from a float4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 double4x4(float4x4 v) { return new double4x4(v); }
/// <summary>Return the result of rotating a double3 vector by a double4x4 matrix</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3 rotate(double4x4 a, double3 b)
{
return (a.c0 * b.x + a.c1 * b.y + a.c2 * b.z).xyz;
}
/// <summary>Return the result of transforming a double3 point by a double4x4 matrix</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double3 transform(double4x4 a, double3 b)
{
return (a.c0 * b.x + a.c1 * b.y + a.c2 * b.z + a.c3).xyz;
}
/// <summary>Return the double4x4 transpose of a double4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double4x4 transpose(double4x4 v)
{
return double4x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w,
v.c2.x, v.c2.y, v.c2.z, v.c2.w,
v.c3.x, v.c3.y, v.c3.z, v.c3.w);
}
/// <summary>Returns the double4x4 full inverse of a double4x4 matrix.</summary>
public static double4x4 inverse(double4x4 m)
{
double4 c0 = m.c0;
double4 c1 = m.c1;
double4 c2 = m.c2;
double4 c3 = m.c3;
double4 r0y_r1y_r0x_r1x = movelh(c1, c0);
double4 r0z_r1z_r0w_r1w = movelh(c2, c3);
double4 r2y_r3y_r2x_r3x = movehl(c0, c1);
double4 r2z_r3z_r2w_r3w = movehl(c3, c2);
double4 r1y_r2y_r1x_r2x = shuffle(c1, c0, ShuffleComponent.LeftY, ShuffleComponent.LeftZ, ShuffleComponent.RightY, ShuffleComponent.RightZ);
double4 r1z_r2z_r1w_r2w = shuffle(c2, c3, ShuffleComponent.LeftY, ShuffleComponent.LeftZ, ShuffleComponent.RightY, ShuffleComponent.RightZ);
double4 r3y_r0y_r3x_r0x = shuffle(c1, c0, ShuffleComponent.LeftW, ShuffleComponent.LeftX, ShuffleComponent.RightW, ShuffleComponent.RightX);
double4 r3z_r0z_r3w_r0w = shuffle(c2, c3, ShuffleComponent.LeftW, ShuffleComponent.LeftX, ShuffleComponent.RightW, ShuffleComponent.RightX);
double4 r0_wzyx = shuffle(r0z_r1z_r0w_r1w, r0y_r1y_r0x_r1x, ShuffleComponent.LeftZ, ShuffleComponent.LeftX, ShuffleComponent.RightX, ShuffleComponent.RightZ);
double4 r1_wzyx = shuffle(r0z_r1z_r0w_r1w, r0y_r1y_r0x_r1x, ShuffleComponent.LeftW, ShuffleComponent.LeftY, ShuffleComponent.RightY, ShuffleComponent.RightW);
double4 r2_wzyx = shuffle(r2z_r3z_r2w_r3w, r2y_r3y_r2x_r3x, ShuffleComponent.LeftZ, ShuffleComponent.LeftX, ShuffleComponent.RightX, ShuffleComponent.RightZ);
double4 r3_wzyx = shuffle(r2z_r3z_r2w_r3w, r2y_r3y_r2x_r3x, ShuffleComponent.LeftW, ShuffleComponent.LeftY, ShuffleComponent.RightY, ShuffleComponent.RightW);
double4 r0_xyzw = shuffle(r0y_r1y_r0x_r1x, r0z_r1z_r0w_r1w, ShuffleComponent.LeftZ, ShuffleComponent.LeftX, ShuffleComponent.RightX, ShuffleComponent.RightZ);
// Calculate remaining inner term pairs. inner terms have zw=-xy, so we only have to calculate xy and can pack two pairs per vector.
double4 inner12_23 = r1y_r2y_r1x_r2x * r2z_r3z_r2w_r3w - r1z_r2z_r1w_r2w * r2y_r3y_r2x_r3x;
double4 inner02_13 = r0y_r1y_r0x_r1x * r2z_r3z_r2w_r3w - r0z_r1z_r0w_r1w * r2y_r3y_r2x_r3x;
double4 inner30_01 = r3z_r0z_r3w_r0w * r0y_r1y_r0x_r1x - r3y_r0y_r3x_r0x * r0z_r1z_r0w_r1w;
// Expand inner terms back to 4 components. zw signs still need to be flipped
double4 inner12 = shuffle(inner12_23, inner12_23, ShuffleComponent.LeftX, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.RightX);
double4 inner23 = shuffle(inner12_23, inner12_23, ShuffleComponent.LeftY, ShuffleComponent.LeftW, ShuffleComponent.RightW, ShuffleComponent.RightY);
double4 inner02 = shuffle(inner02_13, inner02_13, ShuffleComponent.LeftX, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.RightX);
double4 inner13 = shuffle(inner02_13, inner02_13, ShuffleComponent.LeftY, ShuffleComponent.LeftW, ShuffleComponent.RightW, ShuffleComponent.RightY);
// Calculate minors
double4 minors0 = r3_wzyx * inner12 - r2_wzyx * inner13 + r1_wzyx * inner23;
double4 denom = r0_xyzw * minors0;
// Horizontal sum of denominator. Free sign flip of z and w compensates for missing flip in inner terms.
denom = denom + shuffle(denom, denom, ShuffleComponent.LeftY, ShuffleComponent.LeftX, ShuffleComponent.RightW, ShuffleComponent.RightZ); // x+y x+y z+w z+w
denom = denom - shuffle(denom, denom, ShuffleComponent.LeftZ, ShuffleComponent.LeftZ, ShuffleComponent.RightX, ShuffleComponent.RightX); // x+y-z-w x+y-z-w z+w-x-y z+w-x-y
double4 rcp_denom_ppnn = double4(1.0) / denom;
double4x4 res;
res.c0 = minors0 * rcp_denom_ppnn;
double4 inner30 = shuffle(inner30_01, inner30_01, ShuffleComponent.LeftX, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.RightX);
double4 inner01 = shuffle(inner30_01, inner30_01, ShuffleComponent.LeftY, ShuffleComponent.LeftW, ShuffleComponent.RightW, ShuffleComponent.RightY);
double4 minors1 = r2_wzyx * inner30 - r0_wzyx * inner23 - r3_wzyx * inner02;
res.c1 = minors1 * rcp_denom_ppnn;
double4 minors2 = r0_wzyx * inner13 - r1_wzyx * inner30 - r3_wzyx * inner01;
res.c2 = minors2 * rcp_denom_ppnn;
double4 minors3 = r1_wzyx * inner02 - r0_wzyx * inner12 + r2_wzyx * inner01;
res.c3 = minors3 * rcp_denom_ppnn;
return res;
}
// Fast matrix inverse for rigid transforms (Orthonormal basis and translation)
public static double4x4 fastinverse(double4x4 m)
{
double4 c0 = m.c0;
double4 c1 = m.c1;
double4 c2 = m.c2;
double4 pos = m.c3;
double4 zero = double4(0);
double4 t0 = unpacklo(c0, c2);
double4 t1 = unpacklo(c1, zero);
double4 t2 = unpackhi(c0, c2);
double4 t3 = unpackhi(c1, zero);
double4 r0 = unpacklo(t0, t1);
double4 r1 = unpackhi(t0, t1);
double4 r2 = unpacklo(t2, t3);
pos = -(r0 * pos.x + r1 * pos.y + r2 * pos.z);
pos.w = 1.0f;
return double4x4(r0, r1, r2, pos);
}
/// <summary>Returns the determinant of a double4x4 matrix.</summary>
public static double determinant(double4x4 m)
{
double4 c0 = m.c0;
double4 c1 = m.c1;
double4 c2 = m.c2;
double4 c3 = m.c3;
double m00 = c1.y * (c2.z * c3.w - c2.w * c3.z) - c2.y * (c1.z * c3.w - c1.w * c3.z) + c3.y * (c1.z * c2.w - c1.w * c2.z);
double m01 = c0.y * (c2.z * c3.w - c2.w * c3.z) - c2.y * (c0.z * c3.w - c0.w * c3.z) + c3.y * (c0.z * c2.w - c0.w * c2.z);
double m02 = c0.y * (c1.z * c3.w - c1.w * c3.z) - c1.y * (c0.z * c3.w - c0.w * c3.z) + c3.y * (c0.z * c1.w - c0.w * c1.z);
double m03 = c0.y * (c1.z * c2.w - c1.w * c2.z) - c1.y * (c0.z * c2.w - c0.w * c2.z) + c2.y * (c0.z * c1.w - c0.w * c1.z);
return c0.x * m00 - c1.x * m01 + c2.x * m02 - c3.x * m03;
}
/// <summary>Returns a uint hash code of a double4x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(double4x4 v)
{
return csum(fold_to_uint(v.c0) * uint4(0x4DDC6509u, 0x7CF083CBu, 0x5C4D6CEDu, 0xF9137117u) +
fold_to_uint(v.c1) * uint4(0xE857DCE1u, 0xF62213C5u, 0x9CDAA959u, 0xAA269ABFu) +
fold_to_uint(v.c2) * uint4(0xD54BA36Fu, 0xFD0847B9u, 0x8189A683u, 0xB139D651u) +
fold_to_uint(v.c3) * uint4(0xE7579997u, 0xEF7D56C7u, 0x66F38F0Bu, 0x624256A3u)) + 0x5292ADE1u;
}
/// <summary>
/// Returns a uint4 vector hash code of a double4x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(double4x4 v)
{
return (fold_to_uint(v.c0) * uint4(0xD2E590E5u, 0xF25BE857u, 0x9BC17CE7u, 0xC8B86851u) +
fold_to_uint(v.c1) * uint4(0x64095221u, 0xADF428FFu, 0xA3977109u, 0x745ED837u) +
fold_to_uint(v.c2) * uint4(0x9CDC88F5u, 0xFA62D721u, 0x7E4DB1CFu, 0x68EEE0F5u) +
fold_to_uint(v.c3) * uint4(0xBC3B0A59u, 0x816EFB5Du, 0xA24E82B7u, 0x45A22087u)) + 0xFC104C3Bu;
}
}
}

View File

@@ -0,0 +1,760 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
using System.Diagnostics;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[DebuggerTypeProxy(typeof(float2.DebuggerProxy))]
[System.Serializable]
public partial struct float2 : System.IEquatable<float2>, IFormattable
{
public float x;
public float y;
/// <summary>float2 zero value.</summary>
public static readonly float2 zero;
/// <summary>Constructs a float2 vector from two float values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2(float x, float y)
{
this.x = x;
this.y = y;
}
/// <summary>Constructs a float2 vector from a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2(float2 xy)
{
this.x = xy.x;
this.y = xy.y;
}
/// <summary>Constructs a float2 vector from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2(float v)
{
this.x = v;
this.y = v;
}
/// <summary>Constructs a float2 vector from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2(bool v)
{
this.x = v ? 1.0f : 0.0f;
this.y = v ? 1.0f : 0.0f;
}
/// <summary>Constructs a float2 vector from a bool2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2(bool2 v)
{
this.x = v.x ? 1.0f : 0.0f;
this.y = v.y ? 1.0f : 0.0f;
}
/// <summary>Constructs a float2 vector from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2(int v)
{
this.x = v;
this.y = v;
}
/// <summary>Constructs a float2 vector from a int2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2(int2 v)
{
this.x = v.x;
this.y = v.y;
}
/// <summary>Constructs a float2 vector from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2(uint v)
{
this.x = v;
this.y = v;
}
/// <summary>Constructs a float2 vector from a uint2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2(uint2 v)
{
this.x = v.x;
this.y = v.y;
}
/// <summary>Constructs a float2 vector from a single half value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2(half v)
{
this.x = v;
this.y = v;
}
/// <summary>Constructs a float2 vector from a half2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2(half2 v)
{
this.x = v.x;
this.y = v.y;
}
/// <summary>Constructs a float2 vector from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2(double v)
{
this.x = (float)v;
this.y = (float)v;
}
/// <summary>Constructs a float2 vector from a double2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2(double2 v)
{
this.x = (float)v.x;
this.y = (float)v.y;
}
/// <summary>Implicitly converts a single float value to a float2 vector by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2(float v) { return new float2(v); }
/// <summary>Explicitly converts a single bool value to a float2 vector by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2(bool v) { return new float2(v); }
/// <summary>Explicitly converts a bool2 vector to a float2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2(bool2 v) { return new float2(v); }
/// <summary>Implicitly converts a single int value to a float2 vector by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2(int v) { return new float2(v); }
/// <summary>Implicitly converts a int2 vector to a float2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2(int2 v) { return new float2(v); }
/// <summary>Implicitly converts a single uint value to a float2 vector by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2(uint v) { return new float2(v); }
/// <summary>Implicitly converts a uint2 vector to a float2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2(uint2 v) { return new float2(v); }
/// <summary>Implicitly converts a single half value to a float2 vector by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2(half v) { return new float2(v); }
/// <summary>Implicitly converts a half2 vector to a float2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2(half2 v) { return new float2(v); }
/// <summary>Explicitly converts a single double value to a float2 vector by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2(double v) { return new float2(v); }
/// <summary>Explicitly converts a double2 vector to a float2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2(double2 v) { return new float2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator * (float2 lhs, float2 rhs) { return new float2 (lhs.x * rhs.x, lhs.y * rhs.y); }
/// <summary>Returns the result of a componentwise multiplication operation on a float2 vector and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator * (float2 lhs, float rhs) { return new float2 (lhs.x * rhs, lhs.y * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a float value and a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator * (float lhs, float2 rhs) { return new float2 (lhs * rhs.x, lhs * rhs.y); }
/// <summary>Returns the result of a componentwise addition operation on two float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator + (float2 lhs, float2 rhs) { return new float2 (lhs.x + rhs.x, lhs.y + rhs.y); }
/// <summary>Returns the result of a componentwise addition operation on a float2 vector and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator + (float2 lhs, float rhs) { return new float2 (lhs.x + rhs, lhs.y + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a float value and a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator + (float lhs, float2 rhs) { return new float2 (lhs + rhs.x, lhs + rhs.y); }
/// <summary>Returns the result of a componentwise subtraction operation on two float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator - (float2 lhs, float2 rhs) { return new float2 (lhs.x - rhs.x, lhs.y - rhs.y); }
/// <summary>Returns the result of a componentwise subtraction operation on a float2 vector and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator - (float2 lhs, float rhs) { return new float2 (lhs.x - rhs, lhs.y - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a float value and a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator - (float lhs, float2 rhs) { return new float2 (lhs - rhs.x, lhs - rhs.y); }
/// <summary>Returns the result of a componentwise division operation on two float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator / (float2 lhs, float2 rhs) { return new float2 (lhs.x / rhs.x, lhs.y / rhs.y); }
/// <summary>Returns the result of a componentwise division operation on a float2 vector and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator / (float2 lhs, float rhs) { return new float2 (lhs.x / rhs, lhs.y / rhs); }
/// <summary>Returns the result of a componentwise division operation on a float value and a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator / (float lhs, float2 rhs) { return new float2 (lhs / rhs.x, lhs / rhs.y); }
/// <summary>Returns the result of a componentwise modulus operation on two float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator % (float2 lhs, float2 rhs) { return new float2 (lhs.x % rhs.x, lhs.y % rhs.y); }
/// <summary>Returns the result of a componentwise modulus operation on a float2 vector and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator % (float2 lhs, float rhs) { return new float2 (lhs.x % rhs, lhs.y % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a float value and a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator % (float lhs, float2 rhs) { return new float2 (lhs % rhs.x, lhs % rhs.y); }
/// <summary>Returns the result of a componentwise increment operation on a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator ++ (float2 val) { return new float2 (++val.x, ++val.y); }
/// <summary>Returns the result of a componentwise decrement operation on a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator -- (float2 val) { return new float2 (--val.x, --val.y); }
/// <summary>Returns the result of a componentwise less than operation on two float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator < (float2 lhs, float2 rhs) { return new bool2 (lhs.x < rhs.x, lhs.y < rhs.y); }
/// <summary>Returns the result of a componentwise less than operation on a float2 vector and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator < (float2 lhs, float rhs) { return new bool2 (lhs.x < rhs, lhs.y < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a float value and a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator < (float lhs, float2 rhs) { return new bool2 (lhs < rhs.x, lhs < rhs.y); }
/// <summary>Returns the result of a componentwise less or equal operation on two float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator <= (float2 lhs, float2 rhs) { return new bool2 (lhs.x <= rhs.x, lhs.y <= rhs.y); }
/// <summary>Returns the result of a componentwise less or equal operation on a float2 vector and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator <= (float2 lhs, float rhs) { return new bool2 (lhs.x <= rhs, lhs.y <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a float value and a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator <= (float lhs, float2 rhs) { return new bool2 (lhs <= rhs.x, lhs <= rhs.y); }
/// <summary>Returns the result of a componentwise greater than operation on two float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator > (float2 lhs, float2 rhs) { return new bool2 (lhs.x > rhs.x, lhs.y > rhs.y); }
/// <summary>Returns the result of a componentwise greater than operation on a float2 vector and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator > (float2 lhs, float rhs) { return new bool2 (lhs.x > rhs, lhs.y > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a float value and a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator > (float lhs, float2 rhs) { return new bool2 (lhs > rhs.x, lhs > rhs.y); }
/// <summary>Returns the result of a componentwise greater or equal operation on two float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator >= (float2 lhs, float2 rhs) { return new bool2 (lhs.x >= rhs.x, lhs.y >= rhs.y); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float2 vector and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator >= (float2 lhs, float rhs) { return new bool2 (lhs.x >= rhs, lhs.y >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float value and a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator >= (float lhs, float2 rhs) { return new bool2 (lhs >= rhs.x, lhs >= rhs.y); }
/// <summary>Returns the result of a componentwise unary minus operation on a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator - (float2 val) { return new float2 (-val.x, -val.y); }
/// <summary>Returns the result of a componentwise unary plus operation on a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 operator + (float2 val) { return new float2 (+val.x, +val.y); }
/// <summary>Returns the result of a componentwise equality operation on two float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (float2 lhs, float2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); }
/// <summary>Returns the result of a componentwise equality operation on a float2 vector and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (float2 lhs, float rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a float value and a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (float lhs, float2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); }
/// <summary>Returns the result of a componentwise not equal operation on two float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (float2 lhs, float2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); }
/// <summary>Returns the result of a componentwise not equal operation on a float2 vector and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (float2 lhs, float rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a float value and a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (float lhs, float2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); }
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 xxxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(x, x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 xxxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(x, x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 xxyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(x, x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 xxyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(x, x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 xyxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(x, y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 xyxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(x, y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 xyyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(x, y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 xyyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(x, y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 yxxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(y, x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 yxxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(y, x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 yxyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(y, x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 yxyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(y, x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 yyxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(y, y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 yyxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(y, y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 yyyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(y, y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float4 yyyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float4(y, y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float3 xxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float3(x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float3 xxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float3(x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float3 xyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float3(x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float3 xyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float3(x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float3 yxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float3(y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float3 yxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float3(y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float3 yyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float3(y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float3 yyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float3(y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float2 xx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float2(x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float2 xy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float2(x, y); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set { x = value.x; y = value.y; }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float2 yx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float2(y, x); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set { y = value.x; x = value.y; }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public float2 yy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new float2(y, y); }
}
/// <summary>Returns the float element at a specified index.</summary>
unsafe public float this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (float2* array = &this) { return ((float*)array)[index]; }
}
set
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (float* array = &x) { array[index] = value; }
}
}
/// <summary>Returns true if the float2 is equal to a given float2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(float2 rhs) { return x == rhs.x && y == rhs.y; }
/// <summary>Returns true if the float2 is equal to a given float2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((float2)o); }
/// <summary>Returns a hash code for the float2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the float2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("float2({0}f, {1}f)", x, y);
}
/// <summary>Returns a string representation of the float2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("float2({0}f, {1}f)", x.ToString(format, formatProvider), y.ToString(format, formatProvider));
}
internal sealed class DebuggerProxy
{
public float x;
public float y;
public DebuggerProxy(float2 v)
{
x = v.x;
y = v.y;
}
}
}
public static partial class math
{
/// <summary>Returns a float2 vector constructed from two float values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 float2(float x, float y) { return new float2(x, y); }
/// <summary>Returns a float2 vector constructed from a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 float2(float2 xy) { return new float2(xy); }
/// <summary>Returns a float2 vector constructed from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 float2(float v) { return new float2(v); }
/// <summary>Returns a float2 vector constructed from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 float2(bool v) { return new float2(v); }
/// <summary>Return a float2 vector constructed from a bool2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 float2(bool2 v) { return new float2(v); }
/// <summary>Returns a float2 vector constructed from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 float2(int v) { return new float2(v); }
/// <summary>Return a float2 vector constructed from a int2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 float2(int2 v) { return new float2(v); }
/// <summary>Returns a float2 vector constructed from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 float2(uint v) { return new float2(v); }
/// <summary>Return a float2 vector constructed from a uint2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 float2(uint2 v) { return new float2(v); }
/// <summary>Returns a float2 vector constructed from a single half value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 float2(half v) { return new float2(v); }
/// <summary>Return a float2 vector constructed from a half2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 float2(half2 v) { return new float2(v); }
/// <summary>Returns a float2 vector constructed from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 float2(double v) { return new float2(v); }
/// <summary>Return a float2 vector constructed from a double2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 float2(double2 v) { return new float2(v); }
/// <summary>Returns a uint hash code of a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(float2 v)
{
return csum(asuint(v) * uint2(0xFA3A3285u, 0xAD55999Du)) + 0xDCDD5341u;
}
/// <summary>
/// Returns a uint2 vector hash code of a float2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(float2 v)
{
return (asuint(v) * uint2(0x94DDD769u, 0xA1E92D39u)) + 0x4583C801u;
}
/// <summary>Returns the result of specified shuffling of the components from two float2 vectors into a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float shuffle(float2 a, float2 b, ShuffleComponent x)
{
return select_shuffle_component(a, b, x);
}
/// <summary>Returns the result of specified shuffling of the components from two float2 vectors into a float2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 shuffle(float2 a, float2 b, ShuffleComponent x, ShuffleComponent y)
{
return float2(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y));
}
/// <summary>Returns the result of specified shuffling of the components from two float2 vectors into a float3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3 shuffle(float2 a, float2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z)
{
return float3(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y),
select_shuffle_component(a, b, z));
}
/// <summary>Returns the result of specified shuffling of the components from two float2 vectors into a float4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4 shuffle(float2 a, float2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z, ShuffleComponent w)
{
return float4(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y),
select_shuffle_component(a, b, z),
select_shuffle_component(a, b, w));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static float select_shuffle_component(float2 a, float2 b, ShuffleComponent component)
{
switch(component)
{
case ShuffleComponent.LeftX:
return a.x;
case ShuffleComponent.LeftY:
return a.y;
case ShuffleComponent.RightX:
return b.x;
case ShuffleComponent.RightY:
return b.y;
default:
throw new System.ArgumentException("Invalid shuffle component: " + component);
}
}
}
}

View File

@@ -0,0 +1,468 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct float2x2 : System.IEquatable<float2x2>, IFormattable
{
public float2 c0;
public float2 c1;
/// <summary>float2x2 identity transform.</summary>
public static readonly float2x2 identity = new float2x2(1.0f, 0.0f, 0.0f, 1.0f);
/// <summary>float2x2 zero value.</summary>
public static readonly float2x2 zero;
/// <summary>Constructs a float2x2 matrix from two float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x2(float2 c0, float2 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a float2x2 matrix from 4 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x2(float m00, float m01,
float m10, float m11)
{
this.c0 = new float2(m00, m10);
this.c1 = new float2(m01, m11);
}
/// <summary>Constructs a float2x2 matrix from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x2(float v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a float2x2 matrix from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x2(bool v)
{
this.c0 = math.select(new float2(0.0f), new float2(1.0f), v);
this.c1 = math.select(new float2(0.0f), new float2(1.0f), v);
}
/// <summary>Constructs a float2x2 matrix from a bool2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x2(bool2x2 v)
{
this.c0 = math.select(new float2(0.0f), new float2(1.0f), v.c0);
this.c1 = math.select(new float2(0.0f), new float2(1.0f), v.c1);
}
/// <summary>Constructs a float2x2 matrix from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x2(int v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a float2x2 matrix from a int2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x2(int2x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Constructs a float2x2 matrix from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x2(uint v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a float2x2 matrix from a uint2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x2(uint2x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Constructs a float2x2 matrix from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x2(double v)
{
this.c0 = (float2)v;
this.c1 = (float2)v;
}
/// <summary>Constructs a float2x2 matrix from a double2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x2(double2x2 v)
{
this.c0 = (float2)v.c0;
this.c1 = (float2)v.c1;
}
/// <summary>Implicitly converts a single float value to a float2x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x2(float v) { return new float2x2(v); }
/// <summary>Explicitly converts a single bool value to a float2x2 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2x2(bool v) { return new float2x2(v); }
/// <summary>Explicitly converts a bool2x2 matrix to a float2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2x2(bool2x2 v) { return new float2x2(v); }
/// <summary>Implicitly converts a single int value to a float2x2 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x2(int v) { return new float2x2(v); }
/// <summary>Implicitly converts a int2x2 matrix to a float2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x2(int2x2 v) { return new float2x2(v); }
/// <summary>Implicitly converts a single uint value to a float2x2 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x2(uint v) { return new float2x2(v); }
/// <summary>Implicitly converts a uint2x2 matrix to a float2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x2(uint2x2 v) { return new float2x2(v); }
/// <summary>Explicitly converts a single double value to a float2x2 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2x2(double v) { return new float2x2(v); }
/// <summary>Explicitly converts a double2x2 matrix to a float2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2x2(double2x2 v) { return new float2x2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two float2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator * (float2x2 lhs, float2x2 rhs) { return new float2x2 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1); }
/// <summary>Returns the result of a componentwise multiplication operation on a float2x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator * (float2x2 lhs, float rhs) { return new float2x2 (lhs.c0 * rhs, lhs.c1 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a float value and a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator * (float lhs, float2x2 rhs) { return new float2x2 (lhs * rhs.c0, lhs * rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on two float2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator + (float2x2 lhs, float2x2 rhs) { return new float2x2 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on a float2x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator + (float2x2 lhs, float rhs) { return new float2x2 (lhs.c0 + rhs, lhs.c1 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a float value and a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator + (float lhs, float2x2 rhs) { return new float2x2 (lhs + rhs.c0, lhs + rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on two float2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator - (float2x2 lhs, float2x2 rhs) { return new float2x2 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on a float2x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator - (float2x2 lhs, float rhs) { return new float2x2 (lhs.c0 - rhs, lhs.c1 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a float value and a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator - (float lhs, float2x2 rhs) { return new float2x2 (lhs - rhs.c0, lhs - rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on two float2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator / (float2x2 lhs, float2x2 rhs) { return new float2x2 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on a float2x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator / (float2x2 lhs, float rhs) { return new float2x2 (lhs.c0 / rhs, lhs.c1 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a float value and a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator / (float lhs, float2x2 rhs) { return new float2x2 (lhs / rhs.c0, lhs / rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on two float2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator % (float2x2 lhs, float2x2 rhs) { return new float2x2 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on a float2x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator % (float2x2 lhs, float rhs) { return new float2x2 (lhs.c0 % rhs, lhs.c1 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a float value and a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator % (float lhs, float2x2 rhs) { return new float2x2 (lhs % rhs.c0, lhs % rhs.c1); }
/// <summary>Returns the result of a componentwise increment operation on a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator ++ (float2x2 val) { return new float2x2 (++val.c0, ++val.c1); }
/// <summary>Returns the result of a componentwise decrement operation on a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator -- (float2x2 val) { return new float2x2 (--val.c0, --val.c1); }
/// <summary>Returns the result of a componentwise less than operation on two float2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator < (float2x2 lhs, float2x2 rhs) { return new bool2x2 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1); }
/// <summary>Returns the result of a componentwise less than operation on a float2x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator < (float2x2 lhs, float rhs) { return new bool2x2 (lhs.c0 < rhs, lhs.c1 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a float value and a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator < (float lhs, float2x2 rhs) { return new bool2x2 (lhs < rhs.c0, lhs < rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on two float2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator <= (float2x2 lhs, float2x2 rhs) { return new bool2x2 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on a float2x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator <= (float2x2 lhs, float rhs) { return new bool2x2 (lhs.c0 <= rhs, lhs.c1 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a float value and a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator <= (float lhs, float2x2 rhs) { return new bool2x2 (lhs <= rhs.c0, lhs <= rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on two float2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator > (float2x2 lhs, float2x2 rhs) { return new bool2x2 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on a float2x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator > (float2x2 lhs, float rhs) { return new bool2x2 (lhs.c0 > rhs, lhs.c1 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a float value and a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator > (float lhs, float2x2 rhs) { return new bool2x2 (lhs > rhs.c0, lhs > rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on two float2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator >= (float2x2 lhs, float2x2 rhs) { return new bool2x2 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float2x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator >= (float2x2 lhs, float rhs) { return new bool2x2 (lhs.c0 >= rhs, lhs.c1 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float value and a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator >= (float lhs, float2x2 rhs) { return new bool2x2 (lhs >= rhs.c0, lhs >= rhs.c1); }
/// <summary>Returns the result of a componentwise unary minus operation on a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator - (float2x2 val) { return new float2x2 (-val.c0, -val.c1); }
/// <summary>Returns the result of a componentwise unary plus operation on a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 operator + (float2x2 val) { return new float2x2 (+val.c0, +val.c1); }
/// <summary>Returns the result of a componentwise equality operation on two float2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (float2x2 lhs, float2x2 rhs) { return new bool2x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on a float2x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (float2x2 lhs, float rhs) { return new bool2x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a float value and a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (float lhs, float2x2 rhs) { return new bool2x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two float2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (float2x2 lhs, float2x2 rhs) { return new bool2x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on a float2x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (float2x2 lhs, float rhs) { return new bool2x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a float value and a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (float lhs, float2x2 rhs) { return new bool2x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the float2 element at a specified index.</summary>
unsafe public ref float2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (float2x2* array = &this) { return ref ((float2*)array)[index]; }
}
}
/// <summary>Returns true if the float2x2 is equal to a given float2x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(float2x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the float2x2 is equal to a given float2x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((float2x2)o); }
/// <summary>Returns a hash code for the float2x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the float2x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("float2x2({0}f, {1}f, {2}f, {3}f)", c0.x, c1.x, c0.y, c1.y);
}
/// <summary>Returns a string representation of the float2x2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
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));
}
}
public static partial class math
{
/// <summary>Returns a float2x2 matrix constructed from two float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 float2x2(float2 c0, float2 c1) { return new float2x2(c0, c1); }
/// <summary>Returns a float2x2 matrix constructed from from 4 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 float2x2(float m00, float m01,
float m10, float m11)
{
return new float2x2(m00, m01,
m10, m11);
}
/// <summary>Returns a float2x2 matrix constructed from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 float2x2(float v) { return new float2x2(v); }
/// <summary>Returns a float2x2 matrix constructed from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 float2x2(bool v) { return new float2x2(v); }
/// <summary>Return a float2x2 matrix constructed from a bool2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 float2x2(bool2x2 v) { return new float2x2(v); }
/// <summary>Returns a float2x2 matrix constructed from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 float2x2(int v) { return new float2x2(v); }
/// <summary>Return a float2x2 matrix constructed from a int2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 float2x2(int2x2 v) { return new float2x2(v); }
/// <summary>Returns a float2x2 matrix constructed from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 float2x2(uint v) { return new float2x2(v); }
/// <summary>Return a float2x2 matrix constructed from a uint2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 float2x2(uint2x2 v) { return new float2x2(v); }
/// <summary>Returns a float2x2 matrix constructed from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 float2x2(double v) { return new float2x2(v); }
/// <summary>Return a float2x2 matrix constructed from a double2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 float2x2(double2x2 v) { return new float2x2(v); }
/// <summary>Return the float2x2 transpose of a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 transpose(float2x2 v)
{
return float2x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y);
}
/// <summary>Returns the float2x2 full inverse of a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 inverse(float2x2 m)
{
float a = m.c0.x;
float b = m.c1.x;
float c = m.c0.y;
float d = m.c1.y;
float det = a * d - b * c;
return float2x2(d, -b, -c, a) * (1.0f / det);
}
/// <summary>Returns the determinant of a float2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float determinant(float2x2 m)
{
float a = m.c0.x;
float b = m.c1.x;
float c = m.c0.y;
float d = m.c1.y;
return a * d - b * c;
}
/// <summary>Returns a uint hash code of a float2x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(float2x2 v)
{
return csum(asuint(v.c0) * uint2(0x9C9F0823u, 0x5A9CA13Bu) +
asuint(v.c1) * uint2(0xAFCDD5EFu, 0xA88D187Du)) + 0xCF6EBA1Du;
}
/// <summary>
/// Returns a uint2 vector hash code of a float2x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(float2x2 v)
{
return (asuint(v.c0) * uint2(0x9D88E5A1u, 0xEADF0775u) +
asuint(v.c1) * uint2(0x747A9D7Bu, 0x4111F799u)) + 0xB5F05AF1u;
}
}
}

View File

@@ -0,0 +1,454 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct float2x3 : System.IEquatable<float2x3>, IFormattable
{
public float2 c0;
public float2 c1;
public float2 c2;
/// <summary>float2x3 zero value.</summary>
public static readonly float2x3 zero;
/// <summary>Constructs a float2x3 matrix from three float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x3(float2 c0, float2 c1, float2 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a float2x3 matrix from 6 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x3(float m00, float m01, float m02,
float m10, float m11, float m12)
{
this.c0 = new float2(m00, m10);
this.c1 = new float2(m01, m11);
this.c2 = new float2(m02, m12);
}
/// <summary>Constructs a float2x3 matrix from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x3(float v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a float2x3 matrix from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x3(bool v)
{
this.c0 = math.select(new float2(0.0f), new float2(1.0f), v);
this.c1 = math.select(new float2(0.0f), new float2(1.0f), v);
this.c2 = math.select(new float2(0.0f), new float2(1.0f), v);
}
/// <summary>Constructs a float2x3 matrix from a bool2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x3(bool2x3 v)
{
this.c0 = math.select(new float2(0.0f), new float2(1.0f), v.c0);
this.c1 = math.select(new float2(0.0f), new float2(1.0f), v.c1);
this.c2 = math.select(new float2(0.0f), new float2(1.0f), v.c2);
}
/// <summary>Constructs a float2x3 matrix from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x3(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a float2x3 matrix from a int2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x3(int2x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Constructs a float2x3 matrix from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x3(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a float2x3 matrix from a uint2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x3(uint2x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Constructs a float2x3 matrix from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x3(double v)
{
this.c0 = (float2)v;
this.c1 = (float2)v;
this.c2 = (float2)v;
}
/// <summary>Constructs a float2x3 matrix from a double2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x3(double2x3 v)
{
this.c0 = (float2)v.c0;
this.c1 = (float2)v.c1;
this.c2 = (float2)v.c2;
}
/// <summary>Implicitly converts a single float value to a float2x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x3(float v) { return new float2x3(v); }
/// <summary>Explicitly converts a single bool value to a float2x3 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2x3(bool v) { return new float2x3(v); }
/// <summary>Explicitly converts a bool2x3 matrix to a float2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2x3(bool2x3 v) { return new float2x3(v); }
/// <summary>Implicitly converts a single int value to a float2x3 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x3(int v) { return new float2x3(v); }
/// <summary>Implicitly converts a int2x3 matrix to a float2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x3(int2x3 v) { return new float2x3(v); }
/// <summary>Implicitly converts a single uint value to a float2x3 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x3(uint v) { return new float2x3(v); }
/// <summary>Implicitly converts a uint2x3 matrix to a float2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x3(uint2x3 v) { return new float2x3(v); }
/// <summary>Explicitly converts a single double value to a float2x3 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2x3(double v) { return new float2x3(v); }
/// <summary>Explicitly converts a double2x3 matrix to a float2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2x3(double2x3 v) { return new float2x3(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two float2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator * (float2x3 lhs, float2x3 rhs) { return new float2x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); }
/// <summary>Returns the result of a componentwise multiplication operation on a float2x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator * (float2x3 lhs, float rhs) { return new float2x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a float value and a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator * (float lhs, float2x3 rhs) { return new float2x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on two float2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator + (float2x3 lhs, float2x3 rhs) { return new float2x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on a float2x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator + (float2x3 lhs, float rhs) { return new float2x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a float value and a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator + (float lhs, float2x3 rhs) { return new float2x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on two float2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator - (float2x3 lhs, float2x3 rhs) { return new float2x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on a float2x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator - (float2x3 lhs, float rhs) { return new float2x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a float value and a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator - (float lhs, float2x3 rhs) { return new float2x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on two float2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator / (float2x3 lhs, float2x3 rhs) { return new float2x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on a float2x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator / (float2x3 lhs, float rhs) { return new float2x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a float value and a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator / (float lhs, float2x3 rhs) { return new float2x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on two float2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator % (float2x3 lhs, float2x3 rhs) { return new float2x3 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on a float2x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator % (float2x3 lhs, float rhs) { return new float2x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a float value and a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator % (float lhs, float2x3 rhs) { return new float2x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); }
/// <summary>Returns the result of a componentwise increment operation on a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator ++ (float2x3 val) { return new float2x3 (++val.c0, ++val.c1, ++val.c2); }
/// <summary>Returns the result of a componentwise decrement operation on a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator -- (float2x3 val) { return new float2x3 (--val.c0, --val.c1, --val.c2); }
/// <summary>Returns the result of a componentwise less than operation on two float2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator < (float2x3 lhs, float2x3 rhs) { return new bool2x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); }
/// <summary>Returns the result of a componentwise less than operation on a float2x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator < (float2x3 lhs, float rhs) { return new bool2x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a float value and a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator < (float lhs, float2x3 rhs) { return new bool2x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on two float2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator <= (float2x3 lhs, float2x3 rhs) { return new bool2x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on a float2x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator <= (float2x3 lhs, float rhs) { return new bool2x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a float value and a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator <= (float lhs, float2x3 rhs) { return new bool2x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on two float2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator > (float2x3 lhs, float2x3 rhs) { return new bool2x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on a float2x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator > (float2x3 lhs, float rhs) { return new bool2x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a float value and a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator > (float lhs, float2x3 rhs) { return new bool2x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on two float2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator >= (float2x3 lhs, float2x3 rhs) { return new bool2x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float2x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator >= (float2x3 lhs, float rhs) { return new bool2x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float value and a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator >= (float lhs, float2x3 rhs) { return new bool2x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); }
/// <summary>Returns the result of a componentwise unary minus operation on a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator - (float2x3 val) { return new float2x3 (-val.c0, -val.c1, -val.c2); }
/// <summary>Returns the result of a componentwise unary plus operation on a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 operator + (float2x3 val) { return new float2x3 (+val.c0, +val.c1, +val.c2); }
/// <summary>Returns the result of a componentwise equality operation on two float2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (float2x3 lhs, float2x3 rhs) { return new bool2x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on a float2x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (float2x3 lhs, float rhs) { return new bool2x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a float value and a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (float lhs, float2x3 rhs) { return new bool2x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two float2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (float2x3 lhs, float2x3 rhs) { return new bool2x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on a float2x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (float2x3 lhs, float rhs) { return new bool2x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a float value and a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (float lhs, float2x3 rhs) { return new bool2x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the float2 element at a specified index.</summary>
unsafe public ref float2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (float2x3* array = &this) { return ref ((float2*)array)[index]; }
}
}
/// <summary>Returns true if the float2x3 is equal to a given float2x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(float2x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the float2x3 is equal to a given float2x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((float2x3)o); }
/// <summary>Returns a hash code for the float2x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the float2x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("float2x3({0}f, {1}f, {2}f, {3}f, {4}f, {5}f)", c0.x, c1.x, c2.x, c0.y, c1.y, c2.y);
}
/// <summary>Returns a string representation of the float2x3 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("float2x3({0}f, {1}f, {2}f, {3}f, {4}f, {5}f)", 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));
}
}
public static partial class math
{
/// <summary>Returns a float2x3 matrix constructed from three float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 float2x3(float2 c0, float2 c1, float2 c2) { return new float2x3(c0, c1, c2); }
/// <summary>Returns a float2x3 matrix constructed from from 6 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 float2x3(float m00, float m01, float m02,
float m10, float m11, float m12)
{
return new float2x3(m00, m01, m02,
m10, m11, m12);
}
/// <summary>Returns a float2x3 matrix constructed from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 float2x3(float v) { return new float2x3(v); }
/// <summary>Returns a float2x3 matrix constructed from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 float2x3(bool v) { return new float2x3(v); }
/// <summary>Return a float2x3 matrix constructed from a bool2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 float2x3(bool2x3 v) { return new float2x3(v); }
/// <summary>Returns a float2x3 matrix constructed from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 float2x3(int v) { return new float2x3(v); }
/// <summary>Return a float2x3 matrix constructed from a int2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 float2x3(int2x3 v) { return new float2x3(v); }
/// <summary>Returns a float2x3 matrix constructed from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 float2x3(uint v) { return new float2x3(v); }
/// <summary>Return a float2x3 matrix constructed from a uint2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 float2x3(uint2x3 v) { return new float2x3(v); }
/// <summary>Returns a float2x3 matrix constructed from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 float2x3(double v) { return new float2x3(v); }
/// <summary>Return a float2x3 matrix constructed from a double2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 float2x3(double2x3 v) { return new float2x3(v); }
/// <summary>Return the float3x2 transpose of a float2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 transpose(float2x3 v)
{
return float3x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y,
v.c2.x, v.c2.y);
}
/// <summary>Returns a uint hash code of a float2x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(float2x3 v)
{
return csum(asuint(v.c0) * uint2(0xE857DCE1u, 0xF62213C5u) +
asuint(v.c1) * uint2(0x9CDAA959u, 0xAA269ABFu) +
asuint(v.c2) * uint2(0xD54BA36Fu, 0xFD0847B9u)) + 0x8189A683u;
}
/// <summary>
/// Returns a uint2 vector hash code of a float2x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(float2x3 v)
{
return (asuint(v.c0) * uint2(0xB139D651u, 0xE7579997u) +
asuint(v.c1) * uint2(0xEF7D56C7u, 0x66F38F0Bu) +
asuint(v.c2) * uint2(0x624256A3u, 0x5292ADE1u)) + 0xD2E590E5u;
}
}
}

View File

@@ -0,0 +1,469 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct float2x4 : System.IEquatable<float2x4>, IFormattable
{
public float2 c0;
public float2 c1;
public float2 c2;
public float2 c3;
/// <summary>float2x4 zero value.</summary>
public static readonly float2x4 zero;
/// <summary>Constructs a float2x4 matrix from four float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x4(float2 c0, float2 c1, float2 c2, float2 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a float2x4 matrix from 8 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x4(float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13)
{
this.c0 = new float2(m00, m10);
this.c1 = new float2(m01, m11);
this.c2 = new float2(m02, m12);
this.c3 = new float2(m03, m13);
}
/// <summary>Constructs a float2x4 matrix from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x4(float v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a float2x4 matrix from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x4(bool v)
{
this.c0 = math.select(new float2(0.0f), new float2(1.0f), v);
this.c1 = math.select(new float2(0.0f), new float2(1.0f), v);
this.c2 = math.select(new float2(0.0f), new float2(1.0f), v);
this.c3 = math.select(new float2(0.0f), new float2(1.0f), v);
}
/// <summary>Constructs a float2x4 matrix from a bool2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x4(bool2x4 v)
{
this.c0 = math.select(new float2(0.0f), new float2(1.0f), v.c0);
this.c1 = math.select(new float2(0.0f), new float2(1.0f), v.c1);
this.c2 = math.select(new float2(0.0f), new float2(1.0f), v.c2);
this.c3 = math.select(new float2(0.0f), new float2(1.0f), v.c3);
}
/// <summary>Constructs a float2x4 matrix from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x4(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a float2x4 matrix from a int2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x4(int2x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Constructs a float2x4 matrix from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x4(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a float2x4 matrix from a uint2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x4(uint2x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Constructs a float2x4 matrix from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x4(double v)
{
this.c0 = (float2)v;
this.c1 = (float2)v;
this.c2 = (float2)v;
this.c3 = (float2)v;
}
/// <summary>Constructs a float2x4 matrix from a double2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2x4(double2x4 v)
{
this.c0 = (float2)v.c0;
this.c1 = (float2)v.c1;
this.c2 = (float2)v.c2;
this.c3 = (float2)v.c3;
}
/// <summary>Implicitly converts a single float value to a float2x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x4(float v) { return new float2x4(v); }
/// <summary>Explicitly converts a single bool value to a float2x4 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2x4(bool v) { return new float2x4(v); }
/// <summary>Explicitly converts a bool2x4 matrix to a float2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2x4(bool2x4 v) { return new float2x4(v); }
/// <summary>Implicitly converts a single int value to a float2x4 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x4(int v) { return new float2x4(v); }
/// <summary>Implicitly converts a int2x4 matrix to a float2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x4(int2x4 v) { return new float2x4(v); }
/// <summary>Implicitly converts a single uint value to a float2x4 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x4(uint v) { return new float2x4(v); }
/// <summary>Implicitly converts a uint2x4 matrix to a float2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float2x4(uint2x4 v) { return new float2x4(v); }
/// <summary>Explicitly converts a single double value to a float2x4 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2x4(double v) { return new float2x4(v); }
/// <summary>Explicitly converts a double2x4 matrix to a float2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float2x4(double2x4 v) { return new float2x4(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two float2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator * (float2x4 lhs, float2x4 rhs) { return new float2x4 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2, lhs.c3 * rhs.c3); }
/// <summary>Returns the result of a componentwise multiplication operation on a float2x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator * (float2x4 lhs, float rhs) { return new float2x4 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs, lhs.c3 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a float value and a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator * (float lhs, float2x4 rhs) { return new float2x4 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2, lhs * rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on two float2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator + (float2x4 lhs, float2x4 rhs) { return new float2x4 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2, lhs.c3 + rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on a float2x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator + (float2x4 lhs, float rhs) { return new float2x4 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs, lhs.c3 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a float value and a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator + (float lhs, float2x4 rhs) { return new float2x4 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2, lhs + rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on two float2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator - (float2x4 lhs, float2x4 rhs) { return new float2x4 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2, lhs.c3 - rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on a float2x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator - (float2x4 lhs, float rhs) { return new float2x4 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs, lhs.c3 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a float value and a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator - (float lhs, float2x4 rhs) { return new float2x4 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2, lhs - rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on two float2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator / (float2x4 lhs, float2x4 rhs) { return new float2x4 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2, lhs.c3 / rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on a float2x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator / (float2x4 lhs, float rhs) { return new float2x4 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs, lhs.c3 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a float value and a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator / (float lhs, float2x4 rhs) { return new float2x4 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2, lhs / rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on two float2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator % (float2x4 lhs, float2x4 rhs) { return new float2x4 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2, lhs.c3 % rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on a float2x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator % (float2x4 lhs, float rhs) { return new float2x4 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs, lhs.c3 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a float value and a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator % (float lhs, float2x4 rhs) { return new float2x4 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2, lhs % rhs.c3); }
/// <summary>Returns the result of a componentwise increment operation on a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator ++ (float2x4 val) { return new float2x4 (++val.c0, ++val.c1, ++val.c2, ++val.c3); }
/// <summary>Returns the result of a componentwise decrement operation on a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator -- (float2x4 val) { return new float2x4 (--val.c0, --val.c1, --val.c2, --val.c3); }
/// <summary>Returns the result of a componentwise less than operation on two float2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator < (float2x4 lhs, float2x4 rhs) { return new bool2x4 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2, lhs.c3 < rhs.c3); }
/// <summary>Returns the result of a componentwise less than operation on a float2x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator < (float2x4 lhs, float rhs) { return new bool2x4 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs, lhs.c3 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a float value and a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator < (float lhs, float2x4 rhs) { return new bool2x4 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2, lhs < rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on two float2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator <= (float2x4 lhs, float2x4 rhs) { return new bool2x4 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2, lhs.c3 <= rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on a float2x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator <= (float2x4 lhs, float rhs) { return new bool2x4 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs, lhs.c3 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a float value and a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator <= (float lhs, float2x4 rhs) { return new bool2x4 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2, lhs <= rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on two float2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator > (float2x4 lhs, float2x4 rhs) { return new bool2x4 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2, lhs.c3 > rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on a float2x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator > (float2x4 lhs, float rhs) { return new bool2x4 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs, lhs.c3 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a float value and a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator > (float lhs, float2x4 rhs) { return new bool2x4 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2, lhs > rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on two float2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator >= (float2x4 lhs, float2x4 rhs) { return new bool2x4 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2, lhs.c3 >= rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float2x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator >= (float2x4 lhs, float rhs) { return new bool2x4 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs, lhs.c3 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float value and a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator >= (float lhs, float2x4 rhs) { return new bool2x4 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2, lhs >= rhs.c3); }
/// <summary>Returns the result of a componentwise unary minus operation on a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator - (float2x4 val) { return new float2x4 (-val.c0, -val.c1, -val.c2, -val.c3); }
/// <summary>Returns the result of a componentwise unary plus operation on a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 operator + (float2x4 val) { return new float2x4 (+val.c0, +val.c1, +val.c2, +val.c3); }
/// <summary>Returns the result of a componentwise equality operation on two float2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (float2x4 lhs, float2x4 rhs) { return new bool2x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on a float2x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (float2x4 lhs, float rhs) { return new bool2x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a float value and a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (float lhs, float2x4 rhs) { return new bool2x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two float2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (float2x4 lhs, float2x4 rhs) { return new bool2x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on a float2x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (float2x4 lhs, float rhs) { return new bool2x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a float value and a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (float lhs, float2x4 rhs) { return new bool2x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the float2 element at a specified index.</summary>
unsafe public ref float2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (float2x4* array = &this) { return ref ((float2*)array)[index]; }
}
}
/// <summary>Returns true if the float2x4 is equal to a given float2x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(float2x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the float2x4 is equal to a given float2x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((float2x4)o); }
/// <summary>Returns a hash code for the float2x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the float2x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("float2x4({0}f, {1}f, {2}f, {3}f, {4}f, {5}f, {6}f, {7}f)", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y);
}
/// <summary>Returns a string representation of the float2x4 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("float2x4({0}f, {1}f, {2}f, {3}f, {4}f, {5}f, {6}f, {7}f)", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c3.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider), c3.y.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a float2x4 matrix constructed from four float2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 float2x4(float2 c0, float2 c1, float2 c2, float2 c3) { return new float2x4(c0, c1, c2, c3); }
/// <summary>Returns a float2x4 matrix constructed from from 8 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 float2x4(float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13)
{
return new float2x4(m00, m01, m02, m03,
m10, m11, m12, m13);
}
/// <summary>Returns a float2x4 matrix constructed from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 float2x4(float v) { return new float2x4(v); }
/// <summary>Returns a float2x4 matrix constructed from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 float2x4(bool v) { return new float2x4(v); }
/// <summary>Return a float2x4 matrix constructed from a bool2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 float2x4(bool2x4 v) { return new float2x4(v); }
/// <summary>Returns a float2x4 matrix constructed from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 float2x4(int v) { return new float2x4(v); }
/// <summary>Return a float2x4 matrix constructed from a int2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 float2x4(int2x4 v) { return new float2x4(v); }
/// <summary>Returns a float2x4 matrix constructed from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 float2x4(uint v) { return new float2x4(v); }
/// <summary>Return a float2x4 matrix constructed from a uint2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 float2x4(uint2x4 v) { return new float2x4(v); }
/// <summary>Returns a float2x4 matrix constructed from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 float2x4(double v) { return new float2x4(v); }
/// <summary>Return a float2x4 matrix constructed from a double2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 float2x4(double2x4 v) { return new float2x4(v); }
/// <summary>Return the float4x2 transpose of a float2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 transpose(float2x4 v)
{
return float4x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y,
v.c2.x, v.c2.y,
v.c3.x, v.c3.y);
}
/// <summary>Returns a uint hash code of a float2x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(float2x4 v)
{
return csum(asuint(v.c0) * uint2(0xD35C9B2Du, 0xA10D9E27u) +
asuint(v.c1) * uint2(0x568DAAA9u, 0x7530254Fu) +
asuint(v.c2) * uint2(0x9F090439u, 0x5E9F85C9u) +
asuint(v.c3) * uint2(0x8C4CA03Fu, 0xB8D969EDu)) + 0xAC5DB57Bu;
}
/// <summary>
/// Returns a uint2 vector hash code of a float2x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(float2x4 v)
{
return (asuint(v.c0) * uint2(0xA91A02EDu, 0xB3C49313u) +
asuint(v.c1) * uint2(0xF43A9ABBu, 0x84E7E01Bu) +
asuint(v.c2) * uint2(0x8E055BE5u, 0x6E624EB7u) +
asuint(v.c3) * uint2(0x7383ED49u, 0xDD49C23Bu)) + 0xEBD0D005u;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,442 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct float3x2 : System.IEquatable<float3x2>, IFormattable
{
public float3 c0;
public float3 c1;
/// <summary>float3x2 zero value.</summary>
public static readonly float3x2 zero;
/// <summary>Constructs a float3x2 matrix from two float3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x2(float3 c0, float3 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a float3x2 matrix from 6 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x2(float m00, float m01,
float m10, float m11,
float m20, float m21)
{
this.c0 = new float3(m00, m10, m20);
this.c1 = new float3(m01, m11, m21);
}
/// <summary>Constructs a float3x2 matrix from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x2(float v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a float3x2 matrix from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x2(bool v)
{
this.c0 = math.select(new float3(0.0f), new float3(1.0f), v);
this.c1 = math.select(new float3(0.0f), new float3(1.0f), v);
}
/// <summary>Constructs a float3x2 matrix from a bool3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x2(bool3x2 v)
{
this.c0 = math.select(new float3(0.0f), new float3(1.0f), v.c0);
this.c1 = math.select(new float3(0.0f), new float3(1.0f), v.c1);
}
/// <summary>Constructs a float3x2 matrix from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x2(int v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a float3x2 matrix from a int3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x2(int3x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Constructs a float3x2 matrix from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x2(uint v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a float3x2 matrix from a uint3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x2(uint3x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Constructs a float3x2 matrix from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x2(double v)
{
this.c0 = (float3)v;
this.c1 = (float3)v;
}
/// <summary>Constructs a float3x2 matrix from a double3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x2(double3x2 v)
{
this.c0 = (float3)v.c0;
this.c1 = (float3)v.c1;
}
/// <summary>Implicitly converts a single float value to a float3x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x2(float v) { return new float3x2(v); }
/// <summary>Explicitly converts a single bool value to a float3x2 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float3x2(bool v) { return new float3x2(v); }
/// <summary>Explicitly converts a bool3x2 matrix to a float3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float3x2(bool3x2 v) { return new float3x2(v); }
/// <summary>Implicitly converts a single int value to a float3x2 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x2(int v) { return new float3x2(v); }
/// <summary>Implicitly converts a int3x2 matrix to a float3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x2(int3x2 v) { return new float3x2(v); }
/// <summary>Implicitly converts a single uint value to a float3x2 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x2(uint v) { return new float3x2(v); }
/// <summary>Implicitly converts a uint3x2 matrix to a float3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x2(uint3x2 v) { return new float3x2(v); }
/// <summary>Explicitly converts a single double value to a float3x2 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float3x2(double v) { return new float3x2(v); }
/// <summary>Explicitly converts a double3x2 matrix to a float3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float3x2(double3x2 v) { return new float3x2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two float3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator * (float3x2 lhs, float3x2 rhs) { return new float3x2 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1); }
/// <summary>Returns the result of a componentwise multiplication operation on a float3x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator * (float3x2 lhs, float rhs) { return new float3x2 (lhs.c0 * rhs, lhs.c1 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a float value and a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator * (float lhs, float3x2 rhs) { return new float3x2 (lhs * rhs.c0, lhs * rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on two float3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator + (float3x2 lhs, float3x2 rhs) { return new float3x2 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on a float3x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator + (float3x2 lhs, float rhs) { return new float3x2 (lhs.c0 + rhs, lhs.c1 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a float value and a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator + (float lhs, float3x2 rhs) { return new float3x2 (lhs + rhs.c0, lhs + rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on two float3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator - (float3x2 lhs, float3x2 rhs) { return new float3x2 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on a float3x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator - (float3x2 lhs, float rhs) { return new float3x2 (lhs.c0 - rhs, lhs.c1 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a float value and a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator - (float lhs, float3x2 rhs) { return new float3x2 (lhs - rhs.c0, lhs - rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on two float3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator / (float3x2 lhs, float3x2 rhs) { return new float3x2 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on a float3x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator / (float3x2 lhs, float rhs) { return new float3x2 (lhs.c0 / rhs, lhs.c1 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a float value and a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator / (float lhs, float3x2 rhs) { return new float3x2 (lhs / rhs.c0, lhs / rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on two float3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator % (float3x2 lhs, float3x2 rhs) { return new float3x2 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on a float3x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator % (float3x2 lhs, float rhs) { return new float3x2 (lhs.c0 % rhs, lhs.c1 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a float value and a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator % (float lhs, float3x2 rhs) { return new float3x2 (lhs % rhs.c0, lhs % rhs.c1); }
/// <summary>Returns the result of a componentwise increment operation on a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator ++ (float3x2 val) { return new float3x2 (++val.c0, ++val.c1); }
/// <summary>Returns the result of a componentwise decrement operation on a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator -- (float3x2 val) { return new float3x2 (--val.c0, --val.c1); }
/// <summary>Returns the result of a componentwise less than operation on two float3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator < (float3x2 lhs, float3x2 rhs) { return new bool3x2 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1); }
/// <summary>Returns the result of a componentwise less than operation on a float3x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator < (float3x2 lhs, float rhs) { return new bool3x2 (lhs.c0 < rhs, lhs.c1 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a float value and a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator < (float lhs, float3x2 rhs) { return new bool3x2 (lhs < rhs.c0, lhs < rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on two float3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator <= (float3x2 lhs, float3x2 rhs) { return new bool3x2 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on a float3x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator <= (float3x2 lhs, float rhs) { return new bool3x2 (lhs.c0 <= rhs, lhs.c1 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a float value and a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator <= (float lhs, float3x2 rhs) { return new bool3x2 (lhs <= rhs.c0, lhs <= rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on two float3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator > (float3x2 lhs, float3x2 rhs) { return new bool3x2 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on a float3x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator > (float3x2 lhs, float rhs) { return new bool3x2 (lhs.c0 > rhs, lhs.c1 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a float value and a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator > (float lhs, float3x2 rhs) { return new bool3x2 (lhs > rhs.c0, lhs > rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on two float3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator >= (float3x2 lhs, float3x2 rhs) { return new bool3x2 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float3x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator >= (float3x2 lhs, float rhs) { return new bool3x2 (lhs.c0 >= rhs, lhs.c1 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float value and a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator >= (float lhs, float3x2 rhs) { return new bool3x2 (lhs >= rhs.c0, lhs >= rhs.c1); }
/// <summary>Returns the result of a componentwise unary minus operation on a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator - (float3x2 val) { return new float3x2 (-val.c0, -val.c1); }
/// <summary>Returns the result of a componentwise unary plus operation on a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 operator + (float3x2 val) { return new float3x2 (+val.c0, +val.c1); }
/// <summary>Returns the result of a componentwise equality operation on two float3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (float3x2 lhs, float3x2 rhs) { return new bool3x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on a float3x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (float3x2 lhs, float rhs) { return new bool3x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a float value and a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (float lhs, float3x2 rhs) { return new bool3x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two float3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (float3x2 lhs, float3x2 rhs) { return new bool3x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on a float3x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (float3x2 lhs, float rhs) { return new bool3x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a float value and a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (float lhs, float3x2 rhs) { return new bool3x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the float3 element at a specified index.</summary>
unsafe public ref float3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (float3x2* array = &this) { return ref ((float3*)array)[index]; }
}
}
/// <summary>Returns true if the float3x2 is equal to a given float3x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(float3x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the float3x2 is equal to a given float3x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((float3x2)o); }
/// <summary>Returns a hash code for the float3x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the float3x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("float3x2({0}f, {1}f, {2}f, {3}f, {4}f, {5}f)", c0.x, c1.x, c0.y, c1.y, c0.z, c1.z);
}
/// <summary>Returns a string representation of the float3x2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("float3x2({0}f, {1}f, {2}f, {3}f, {4}f, {5}f)", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a float3x2 matrix constructed from two float3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 float3x2(float3 c0, float3 c1) { return new float3x2(c0, c1); }
/// <summary>Returns a float3x2 matrix constructed from from 6 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 float3x2(float m00, float m01,
float m10, float m11,
float m20, float m21)
{
return new float3x2(m00, m01,
m10, m11,
m20, m21);
}
/// <summary>Returns a float3x2 matrix constructed from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 float3x2(float v) { return new float3x2(v); }
/// <summary>Returns a float3x2 matrix constructed from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 float3x2(bool v) { return new float3x2(v); }
/// <summary>Return a float3x2 matrix constructed from a bool3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 float3x2(bool3x2 v) { return new float3x2(v); }
/// <summary>Returns a float3x2 matrix constructed from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 float3x2(int v) { return new float3x2(v); }
/// <summary>Return a float3x2 matrix constructed from a int3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 float3x2(int3x2 v) { return new float3x2(v); }
/// <summary>Returns a float3x2 matrix constructed from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 float3x2(uint v) { return new float3x2(v); }
/// <summary>Return a float3x2 matrix constructed from a uint3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 float3x2(uint3x2 v) { return new float3x2(v); }
/// <summary>Returns a float3x2 matrix constructed from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 float3x2(double v) { return new float3x2(v); }
/// <summary>Return a float3x2 matrix constructed from a double3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x2 float3x2(double3x2 v) { return new float3x2(v); }
/// <summary>Return the float2x3 transpose of a float3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x3 transpose(float3x2 v)
{
return float2x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z);
}
/// <summary>Returns a uint hash code of a float3x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(float3x2 v)
{
return csum(asuint(v.c0) * uint3(0xE121E6ADu, 0xC9CA1249u, 0x69B60C81u) +
asuint(v.c1) * uint3(0xE0EB6C25u, 0xF648BEABu, 0x6BDB2B07u)) + 0xEF63C699u;
}
/// <summary>
/// Returns a uint3 vector hash code of a float3x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(float3x2 v)
{
return (asuint(v.c0) * uint3(0x9001903Fu, 0xA895B9CDu, 0x9D23B201u) +
asuint(v.c1) * uint3(0x4B01D3E1u, 0x7461CA0Du, 0x79725379u)) + 0xD6258E5Bu;
}
}
}

View File

@@ -0,0 +1,494 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct float3x3 : System.IEquatable<float3x3>, IFormattable
{
public float3 c0;
public float3 c1;
public float3 c2;
/// <summary>float3x3 identity transform.</summary>
public static readonly float3x3 identity = new float3x3(1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f);
/// <summary>float3x3 zero value.</summary>
public static readonly float3x3 zero;
/// <summary>Constructs a float3x3 matrix from three float3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x3(float3 c0, float3 c1, float3 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a float3x3 matrix from 9 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x3(float m00, float m01, float m02,
float m10, float m11, float m12,
float m20, float m21, float m22)
{
this.c0 = new float3(m00, m10, m20);
this.c1 = new float3(m01, m11, m21);
this.c2 = new float3(m02, m12, m22);
}
/// <summary>Constructs a float3x3 matrix from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x3(float v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a float3x3 matrix from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x3(bool v)
{
this.c0 = math.select(new float3(0.0f), new float3(1.0f), v);
this.c1 = math.select(new float3(0.0f), new float3(1.0f), v);
this.c2 = math.select(new float3(0.0f), new float3(1.0f), v);
}
/// <summary>Constructs a float3x3 matrix from a bool3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x3(bool3x3 v)
{
this.c0 = math.select(new float3(0.0f), new float3(1.0f), v.c0);
this.c1 = math.select(new float3(0.0f), new float3(1.0f), v.c1);
this.c2 = math.select(new float3(0.0f), new float3(1.0f), v.c2);
}
/// <summary>Constructs a float3x3 matrix from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x3(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a float3x3 matrix from a int3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x3(int3x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Constructs a float3x3 matrix from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x3(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a float3x3 matrix from a uint3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x3(uint3x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Constructs a float3x3 matrix from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x3(double v)
{
this.c0 = (float3)v;
this.c1 = (float3)v;
this.c2 = (float3)v;
}
/// <summary>Constructs a float3x3 matrix from a double3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x3(double3x3 v)
{
this.c0 = (float3)v.c0;
this.c1 = (float3)v.c1;
this.c2 = (float3)v.c2;
}
/// <summary>Implicitly converts a single float value to a float3x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x3(float v) { return new float3x3(v); }
/// <summary>Explicitly converts a single bool value to a float3x3 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float3x3(bool v) { return new float3x3(v); }
/// <summary>Explicitly converts a bool3x3 matrix to a float3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float3x3(bool3x3 v) { return new float3x3(v); }
/// <summary>Implicitly converts a single int value to a float3x3 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x3(int v) { return new float3x3(v); }
/// <summary>Implicitly converts a int3x3 matrix to a float3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x3(int3x3 v) { return new float3x3(v); }
/// <summary>Implicitly converts a single uint value to a float3x3 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x3(uint v) { return new float3x3(v); }
/// <summary>Implicitly converts a uint3x3 matrix to a float3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x3(uint3x3 v) { return new float3x3(v); }
/// <summary>Explicitly converts a single double value to a float3x3 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float3x3(double v) { return new float3x3(v); }
/// <summary>Explicitly converts a double3x3 matrix to a float3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float3x3(double3x3 v) { return new float3x3(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two float3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator * (float3x3 lhs, float3x3 rhs) { return new float3x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); }
/// <summary>Returns the result of a componentwise multiplication operation on a float3x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator * (float3x3 lhs, float rhs) { return new float3x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a float value and a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator * (float lhs, float3x3 rhs) { return new float3x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on two float3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator + (float3x3 lhs, float3x3 rhs) { return new float3x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on a float3x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator + (float3x3 lhs, float rhs) { return new float3x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a float value and a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator + (float lhs, float3x3 rhs) { return new float3x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on two float3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator - (float3x3 lhs, float3x3 rhs) { return new float3x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on a float3x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator - (float3x3 lhs, float rhs) { return new float3x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a float value and a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator - (float lhs, float3x3 rhs) { return new float3x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on two float3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator / (float3x3 lhs, float3x3 rhs) { return new float3x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on a float3x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator / (float3x3 lhs, float rhs) { return new float3x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a float value and a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator / (float lhs, float3x3 rhs) { return new float3x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on two float3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator % (float3x3 lhs, float3x3 rhs) { return new float3x3 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on a float3x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator % (float3x3 lhs, float rhs) { return new float3x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a float value and a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator % (float lhs, float3x3 rhs) { return new float3x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); }
/// <summary>Returns the result of a componentwise increment operation on a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator ++ (float3x3 val) { return new float3x3 (++val.c0, ++val.c1, ++val.c2); }
/// <summary>Returns the result of a componentwise decrement operation on a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator -- (float3x3 val) { return new float3x3 (--val.c0, --val.c1, --val.c2); }
/// <summary>Returns the result of a componentwise less than operation on two float3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator < (float3x3 lhs, float3x3 rhs) { return new bool3x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); }
/// <summary>Returns the result of a componentwise less than operation on a float3x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator < (float3x3 lhs, float rhs) { return new bool3x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a float value and a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator < (float lhs, float3x3 rhs) { return new bool3x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on two float3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator <= (float3x3 lhs, float3x3 rhs) { return new bool3x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on a float3x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator <= (float3x3 lhs, float rhs) { return new bool3x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a float value and a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator <= (float lhs, float3x3 rhs) { return new bool3x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on two float3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator > (float3x3 lhs, float3x3 rhs) { return new bool3x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on a float3x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator > (float3x3 lhs, float rhs) { return new bool3x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a float value and a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator > (float lhs, float3x3 rhs) { return new bool3x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on two float3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator >= (float3x3 lhs, float3x3 rhs) { return new bool3x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float3x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator >= (float3x3 lhs, float rhs) { return new bool3x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float value and a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator >= (float lhs, float3x3 rhs) { return new bool3x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); }
/// <summary>Returns the result of a componentwise unary minus operation on a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator - (float3x3 val) { return new float3x3 (-val.c0, -val.c1, -val.c2); }
/// <summary>Returns the result of a componentwise unary plus operation on a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 operator + (float3x3 val) { return new float3x3 (+val.c0, +val.c1, +val.c2); }
/// <summary>Returns the result of a componentwise equality operation on two float3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (float3x3 lhs, float3x3 rhs) { return new bool3x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on a float3x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (float3x3 lhs, float rhs) { return new bool3x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a float value and a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (float lhs, float3x3 rhs) { return new bool3x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two float3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (float3x3 lhs, float3x3 rhs) { return new bool3x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on a float3x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (float3x3 lhs, float rhs) { return new bool3x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a float value and a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (float lhs, float3x3 rhs) { return new bool3x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the float3 element at a specified index.</summary>
unsafe public ref float3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (float3x3* array = &this) { return ref ((float3*)array)[index]; }
}
}
/// <summary>Returns true if the float3x3 is equal to a given float3x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(float3x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the float3x3 is equal to a given float3x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((float3x3)o); }
/// <summary>Returns a hash code for the float3x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the float3x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("float3x3({0}f, {1}f, {2}f, {3}f, {4}f, {5}f, {6}f, {7}f, {8}f)", c0.x, c1.x, c2.x, c0.y, c1.y, c2.y, c0.z, c1.z, c2.z);
}
/// <summary>Returns a string representation of the float3x3 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("float3x3({0}f, {1}f, {2}f, {3}f, {4}f, {5}f, {6}f, {7}f, {8}f)", 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));
}
}
public static partial class math
{
/// <summary>Returns a float3x3 matrix constructed from three float3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 float3x3(float3 c0, float3 c1, float3 c2) { return new float3x3(c0, c1, c2); }
/// <summary>Returns a float3x3 matrix constructed from from 9 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 float3x3(float m00, float m01, float m02,
float m10, float m11, float m12,
float m20, float m21, float m22)
{
return new float3x3(m00, m01, m02,
m10, m11, m12,
m20, m21, m22);
}
/// <summary>Returns a float3x3 matrix constructed from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 float3x3(float v) { return new float3x3(v); }
/// <summary>Returns a float3x3 matrix constructed from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 float3x3(bool v) { return new float3x3(v); }
/// <summary>Return a float3x3 matrix constructed from a bool3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 float3x3(bool3x3 v) { return new float3x3(v); }
/// <summary>Returns a float3x3 matrix constructed from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 float3x3(int v) { return new float3x3(v); }
/// <summary>Return a float3x3 matrix constructed from a int3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 float3x3(int3x3 v) { return new float3x3(v); }
/// <summary>Returns a float3x3 matrix constructed from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 float3x3(uint v) { return new float3x3(v); }
/// <summary>Return a float3x3 matrix constructed from a uint3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 float3x3(uint3x3 v) { return new float3x3(v); }
/// <summary>Returns a float3x3 matrix constructed from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 float3x3(double v) { return new float3x3(v); }
/// <summary>Return a float3x3 matrix constructed from a double3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 float3x3(double3x3 v) { return new float3x3(v); }
/// <summary>Return the float3x3 transpose of a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 transpose(float3x3 v)
{
return float3x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z,
v.c2.x, v.c2.y, v.c2.z);
}
/// <summary>Returns the float3x3 full inverse of a float3x3 matrix.</summary>
public static float3x3 inverse(float3x3 m)
{
float3 c0 = m.c0;
float3 c1 = m.c1;
float3 c2 = m.c2;
float3 t0 = float3(c1.x, c2.x, c0.x);
float3 t1 = float3(c1.y, c2.y, c0.y);
float3 t2 = float3(c1.z, c2.z, c0.z);
float3 m0 = t1 * t2.yzx - t1.yzx * t2;
float3 m1 = t0.yzx * t2 - t0 * t2.yzx;
float3 m2 = t0 * t1.yzx - t0.yzx * t1;
float rcpDet = 1.0f / csum(t0.zxy * m0);
return float3x3(m0, m1, m2) * rcpDet;
}
/// <summary>Returns the determinant of a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float determinant(float3x3 m)
{
float3 c0 = m.c0;
float3 c1 = m.c1;
float3 c2 = m.c2;
float m00 = c1.y * c2.z - c1.z * c2.y;
float m01 = c0.y * c2.z - c0.z * c2.y;
float m02 = c0.y * c1.z - c0.z * c1.y;
return c0.x * m00 - c1.x * m01 + c2.x * m02;
}
/// <summary>Returns a uint hash code of a float3x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(float3x3 v)
{
return csum(asuint(v.c0) * uint3(0x713BD06Fu, 0x753AD6ADu, 0xD19764C7u) +
asuint(v.c1) * uint3(0xB5D0BF63u, 0xF9102C5Fu, 0x9881FB9Fu) +
asuint(v.c2) * uint3(0x56A1530Du, 0x804B722Du, 0x738E50E5u)) + 0x4FC93C25u;
}
/// <summary>
/// Returns a uint3 vector hash code of a float3x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(float3x3 v)
{
return (asuint(v.c0) * uint3(0xCD0445A5u, 0xD2B90D9Bu, 0xD35C9B2Du) +
asuint(v.c1) * uint3(0xA10D9E27u, 0x568DAAA9u, 0x7530254Fu) +
asuint(v.c2) * uint3(0x9F090439u, 0x5E9F85C9u, 0x8C4CA03Fu)) + 0xB8D969EDu;
}
}
}

View File

@@ -0,0 +1,489 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct float3x4 : System.IEquatable<float3x4>, IFormattable
{
public float3 c0;
public float3 c1;
public float3 c2;
public float3 c3;
/// <summary>float3x4 zero value.</summary>
public static readonly float3x4 zero;
/// <summary>Constructs a float3x4 matrix from four float3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x4(float3 c0, float3 c1, float3 c2, float3 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a float3x4 matrix from 12 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x4(float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13,
float m20, float m21, float m22, float m23)
{
this.c0 = new float3(m00, m10, m20);
this.c1 = new float3(m01, m11, m21);
this.c2 = new float3(m02, m12, m22);
this.c3 = new float3(m03, m13, m23);
}
/// <summary>Constructs a float3x4 matrix from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x4(float v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a float3x4 matrix from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x4(bool v)
{
this.c0 = math.select(new float3(0.0f), new float3(1.0f), v);
this.c1 = math.select(new float3(0.0f), new float3(1.0f), v);
this.c2 = math.select(new float3(0.0f), new float3(1.0f), v);
this.c3 = math.select(new float3(0.0f), new float3(1.0f), v);
}
/// <summary>Constructs a float3x4 matrix from a bool3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x4(bool3x4 v)
{
this.c0 = math.select(new float3(0.0f), new float3(1.0f), v.c0);
this.c1 = math.select(new float3(0.0f), new float3(1.0f), v.c1);
this.c2 = math.select(new float3(0.0f), new float3(1.0f), v.c2);
this.c3 = math.select(new float3(0.0f), new float3(1.0f), v.c3);
}
/// <summary>Constructs a float3x4 matrix from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x4(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a float3x4 matrix from a int3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x4(int3x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Constructs a float3x4 matrix from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x4(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a float3x4 matrix from a uint3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x4(uint3x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Constructs a float3x4 matrix from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x4(double v)
{
this.c0 = (float3)v;
this.c1 = (float3)v;
this.c2 = (float3)v;
this.c3 = (float3)v;
}
/// <summary>Constructs a float3x4 matrix from a double3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3x4(double3x4 v)
{
this.c0 = (float3)v.c0;
this.c1 = (float3)v.c1;
this.c2 = (float3)v.c2;
this.c3 = (float3)v.c3;
}
/// <summary>Implicitly converts a single float value to a float3x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x4(float v) { return new float3x4(v); }
/// <summary>Explicitly converts a single bool value to a float3x4 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float3x4(bool v) { return new float3x4(v); }
/// <summary>Explicitly converts a bool3x4 matrix to a float3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float3x4(bool3x4 v) { return new float3x4(v); }
/// <summary>Implicitly converts a single int value to a float3x4 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x4(int v) { return new float3x4(v); }
/// <summary>Implicitly converts a int3x4 matrix to a float3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x4(int3x4 v) { return new float3x4(v); }
/// <summary>Implicitly converts a single uint value to a float3x4 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x4(uint v) { return new float3x4(v); }
/// <summary>Implicitly converts a uint3x4 matrix to a float3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float3x4(uint3x4 v) { return new float3x4(v); }
/// <summary>Explicitly converts a single double value to a float3x4 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float3x4(double v) { return new float3x4(v); }
/// <summary>Explicitly converts a double3x4 matrix to a float3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float3x4(double3x4 v) { return new float3x4(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two float3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator * (float3x4 lhs, float3x4 rhs) { return new float3x4 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2, lhs.c3 * rhs.c3); }
/// <summary>Returns the result of a componentwise multiplication operation on a float3x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator * (float3x4 lhs, float rhs) { return new float3x4 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs, lhs.c3 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a float value and a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator * (float lhs, float3x4 rhs) { return new float3x4 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2, lhs * rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on two float3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator + (float3x4 lhs, float3x4 rhs) { return new float3x4 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2, lhs.c3 + rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on a float3x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator + (float3x4 lhs, float rhs) { return new float3x4 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs, lhs.c3 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a float value and a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator + (float lhs, float3x4 rhs) { return new float3x4 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2, lhs + rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on two float3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator - (float3x4 lhs, float3x4 rhs) { return new float3x4 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2, lhs.c3 - rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on a float3x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator - (float3x4 lhs, float rhs) { return new float3x4 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs, lhs.c3 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a float value and a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator - (float lhs, float3x4 rhs) { return new float3x4 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2, lhs - rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on two float3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator / (float3x4 lhs, float3x4 rhs) { return new float3x4 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2, lhs.c3 / rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on a float3x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator / (float3x4 lhs, float rhs) { return new float3x4 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs, lhs.c3 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a float value and a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator / (float lhs, float3x4 rhs) { return new float3x4 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2, lhs / rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on two float3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator % (float3x4 lhs, float3x4 rhs) { return new float3x4 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2, lhs.c3 % rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on a float3x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator % (float3x4 lhs, float rhs) { return new float3x4 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs, lhs.c3 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a float value and a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator % (float lhs, float3x4 rhs) { return new float3x4 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2, lhs % rhs.c3); }
/// <summary>Returns the result of a componentwise increment operation on a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator ++ (float3x4 val) { return new float3x4 (++val.c0, ++val.c1, ++val.c2, ++val.c3); }
/// <summary>Returns the result of a componentwise decrement operation on a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator -- (float3x4 val) { return new float3x4 (--val.c0, --val.c1, --val.c2, --val.c3); }
/// <summary>Returns the result of a componentwise less than operation on two float3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator < (float3x4 lhs, float3x4 rhs) { return new bool3x4 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2, lhs.c3 < rhs.c3); }
/// <summary>Returns the result of a componentwise less than operation on a float3x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator < (float3x4 lhs, float rhs) { return new bool3x4 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs, lhs.c3 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a float value and a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator < (float lhs, float3x4 rhs) { return new bool3x4 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2, lhs < rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on two float3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator <= (float3x4 lhs, float3x4 rhs) { return new bool3x4 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2, lhs.c3 <= rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on a float3x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator <= (float3x4 lhs, float rhs) { return new bool3x4 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs, lhs.c3 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a float value and a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator <= (float lhs, float3x4 rhs) { return new bool3x4 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2, lhs <= rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on two float3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator > (float3x4 lhs, float3x4 rhs) { return new bool3x4 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2, lhs.c3 > rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on a float3x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator > (float3x4 lhs, float rhs) { return new bool3x4 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs, lhs.c3 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a float value and a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator > (float lhs, float3x4 rhs) { return new bool3x4 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2, lhs > rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on two float3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator >= (float3x4 lhs, float3x4 rhs) { return new bool3x4 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2, lhs.c3 >= rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float3x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator >= (float3x4 lhs, float rhs) { return new bool3x4 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs, lhs.c3 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float value and a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator >= (float lhs, float3x4 rhs) { return new bool3x4 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2, lhs >= rhs.c3); }
/// <summary>Returns the result of a componentwise unary minus operation on a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator - (float3x4 val) { return new float3x4 (-val.c0, -val.c1, -val.c2, -val.c3); }
/// <summary>Returns the result of a componentwise unary plus operation on a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 operator + (float3x4 val) { return new float3x4 (+val.c0, +val.c1, +val.c2, +val.c3); }
/// <summary>Returns the result of a componentwise equality operation on two float3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (float3x4 lhs, float3x4 rhs) { return new bool3x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on a float3x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (float3x4 lhs, float rhs) { return new bool3x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a float value and a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (float lhs, float3x4 rhs) { return new bool3x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two float3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (float3x4 lhs, float3x4 rhs) { return new bool3x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on a float3x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (float3x4 lhs, float rhs) { return new bool3x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a float value and a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (float lhs, float3x4 rhs) { return new bool3x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the float3 element at a specified index.</summary>
unsafe public ref float3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (float3x4* array = &this) { return ref ((float3*)array)[index]; }
}
}
/// <summary>Returns true if the float3x4 is equal to a given float3x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(float3x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the float3x4 is equal to a given float3x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((float3x4)o); }
/// <summary>Returns a hash code for the float3x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the float3x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("float3x4({0}f, {1}f, {2}f, {3}f, {4}f, {5}f, {6}f, {7}f, {8}f, {9}f, {10}f, {11}f)", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y, c0.z, c1.z, c2.z, c3.z);
}
/// <summary>Returns a string representation of the float3x4 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("float3x4({0}f, {1}f, {2}f, {3}f, {4}f, {5}f, {6}f, {7}f, {8}f, {9}f, {10}f, {11}f)", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c3.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider), c3.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider), c2.z.ToString(format, formatProvider), c3.z.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a float3x4 matrix constructed from four float3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 float3x4(float3 c0, float3 c1, float3 c2, float3 c3) { return new float3x4(c0, c1, c2, c3); }
/// <summary>Returns a float3x4 matrix constructed from from 12 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 float3x4(float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13,
float m20, float m21, float m22, float m23)
{
return new float3x4(m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23);
}
/// <summary>Returns a float3x4 matrix constructed from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 float3x4(float v) { return new float3x4(v); }
/// <summary>Returns a float3x4 matrix constructed from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 float3x4(bool v) { return new float3x4(v); }
/// <summary>Return a float3x4 matrix constructed from a bool3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 float3x4(bool3x4 v) { return new float3x4(v); }
/// <summary>Returns a float3x4 matrix constructed from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 float3x4(int v) { return new float3x4(v); }
/// <summary>Return a float3x4 matrix constructed from a int3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 float3x4(int3x4 v) { return new float3x4(v); }
/// <summary>Returns a float3x4 matrix constructed from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 float3x4(uint v) { return new float3x4(v); }
/// <summary>Return a float3x4 matrix constructed from a uint3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 float3x4(uint3x4 v) { return new float3x4(v); }
/// <summary>Returns a float3x4 matrix constructed from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 float3x4(double v) { return new float3x4(v); }
/// <summary>Return a float3x4 matrix constructed from a double3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 float3x4(double3x4 v) { return new float3x4(v); }
/// <summary>Return the float4x3 transpose of a float3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 transpose(float3x4 v)
{
return float4x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z,
v.c2.x, v.c2.y, v.c2.z,
v.c3.x, v.c3.y, v.c3.z);
}
// Fast matrix inverse for rigid transforms (Orthonormal basis and translation)
public static float3x4 fastinverse(float3x4 m)
{
float3 c0 = m.c0;
float3 c1 = m.c1;
float3 c2 = m.c2;
float3 pos = m.c3;
float3 r0 = float3(c0.x, c1.x, c2.x);
float3 r1 = float3(c0.y, c1.y, c2.y);
float3 r2 = float3(c0.z, c1.z, c2.z);
pos = -(r0 * pos.x + r1 * pos.y + r2 * pos.z);
return float3x4(r0, r1, r2, pos);
}
/// <summary>Returns a uint hash code of a float3x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(float3x4 v)
{
return csum(asuint(v.c0) * uint3(0xF9EA92D5u, 0xC2FAFCB9u, 0x616E9CA1u) +
asuint(v.c1) * uint3(0xC5C5394Bu, 0xCAE78587u, 0x7A1541C9u) +
asuint(v.c2) * uint3(0xF83BD927u, 0x6A243BCBu, 0x509B84C9u) +
asuint(v.c3) * uint3(0x91D13847u, 0x52F7230Fu, 0xCF286E83u)) + 0xE121E6ADu;
}
/// <summary>
/// Returns a uint3 vector hash code of a float3x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(float3x4 v)
{
return (asuint(v.c0) * uint3(0xC9CA1249u, 0x69B60C81u, 0xE0EB6C25u) +
asuint(v.c1) * uint3(0xF648BEABu, 0x6BDB2B07u, 0xEF63C699u) +
asuint(v.c2) * uint3(0x9001903Fu, 0xA895B9CDu, 0x9D23B201u) +
asuint(v.c3) * uint3(0x4B01D3E1u, 0x7461CA0Du, 0x79725379u)) + 0xD6258E5Bu;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,445 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct float4x2 : System.IEquatable<float4x2>, IFormattable
{
public float4 c0;
public float4 c1;
/// <summary>float4x2 zero value.</summary>
public static readonly float4x2 zero;
/// <summary>Constructs a float4x2 matrix from two float4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x2(float4 c0, float4 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a float4x2 matrix from 8 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x2(float m00, float m01,
float m10, float m11,
float m20, float m21,
float m30, float m31)
{
this.c0 = new float4(m00, m10, m20, m30);
this.c1 = new float4(m01, m11, m21, m31);
}
/// <summary>Constructs a float4x2 matrix from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x2(float v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a float4x2 matrix from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x2(bool v)
{
this.c0 = math.select(new float4(0.0f), new float4(1.0f), v);
this.c1 = math.select(new float4(0.0f), new float4(1.0f), v);
}
/// <summary>Constructs a float4x2 matrix from a bool4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x2(bool4x2 v)
{
this.c0 = math.select(new float4(0.0f), new float4(1.0f), v.c0);
this.c1 = math.select(new float4(0.0f), new float4(1.0f), v.c1);
}
/// <summary>Constructs a float4x2 matrix from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x2(int v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a float4x2 matrix from a int4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x2(int4x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Constructs a float4x2 matrix from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x2(uint v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a float4x2 matrix from a uint4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x2(uint4x2 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
}
/// <summary>Constructs a float4x2 matrix from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x2(double v)
{
this.c0 = (float4)v;
this.c1 = (float4)v;
}
/// <summary>Constructs a float4x2 matrix from a double4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x2(double4x2 v)
{
this.c0 = (float4)v.c0;
this.c1 = (float4)v.c1;
}
/// <summary>Implicitly converts a single float value to a float4x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x2(float v) { return new float4x2(v); }
/// <summary>Explicitly converts a single bool value to a float4x2 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float4x2(bool v) { return new float4x2(v); }
/// <summary>Explicitly converts a bool4x2 matrix to a float4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float4x2(bool4x2 v) { return new float4x2(v); }
/// <summary>Implicitly converts a single int value to a float4x2 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x2(int v) { return new float4x2(v); }
/// <summary>Implicitly converts a int4x2 matrix to a float4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x2(int4x2 v) { return new float4x2(v); }
/// <summary>Implicitly converts a single uint value to a float4x2 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x2(uint v) { return new float4x2(v); }
/// <summary>Implicitly converts a uint4x2 matrix to a float4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x2(uint4x2 v) { return new float4x2(v); }
/// <summary>Explicitly converts a single double value to a float4x2 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float4x2(double v) { return new float4x2(v); }
/// <summary>Explicitly converts a double4x2 matrix to a float4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float4x2(double4x2 v) { return new float4x2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two float4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator * (float4x2 lhs, float4x2 rhs) { return new float4x2 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1); }
/// <summary>Returns the result of a componentwise multiplication operation on a float4x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator * (float4x2 lhs, float rhs) { return new float4x2 (lhs.c0 * rhs, lhs.c1 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a float value and a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator * (float lhs, float4x2 rhs) { return new float4x2 (lhs * rhs.c0, lhs * rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on two float4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator + (float4x2 lhs, float4x2 rhs) { return new float4x2 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on a float4x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator + (float4x2 lhs, float rhs) { return new float4x2 (lhs.c0 + rhs, lhs.c1 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a float value and a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator + (float lhs, float4x2 rhs) { return new float4x2 (lhs + rhs.c0, lhs + rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on two float4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator - (float4x2 lhs, float4x2 rhs) { return new float4x2 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on a float4x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator - (float4x2 lhs, float rhs) { return new float4x2 (lhs.c0 - rhs, lhs.c1 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a float value and a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator - (float lhs, float4x2 rhs) { return new float4x2 (lhs - rhs.c0, lhs - rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on two float4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator / (float4x2 lhs, float4x2 rhs) { return new float4x2 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on a float4x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator / (float4x2 lhs, float rhs) { return new float4x2 (lhs.c0 / rhs, lhs.c1 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a float value and a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator / (float lhs, float4x2 rhs) { return new float4x2 (lhs / rhs.c0, lhs / rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on two float4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator % (float4x2 lhs, float4x2 rhs) { return new float4x2 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on a float4x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator % (float4x2 lhs, float rhs) { return new float4x2 (lhs.c0 % rhs, lhs.c1 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a float value and a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator % (float lhs, float4x2 rhs) { return new float4x2 (lhs % rhs.c0, lhs % rhs.c1); }
/// <summary>Returns the result of a componentwise increment operation on a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator ++ (float4x2 val) { return new float4x2 (++val.c0, ++val.c1); }
/// <summary>Returns the result of a componentwise decrement operation on a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator -- (float4x2 val) { return new float4x2 (--val.c0, --val.c1); }
/// <summary>Returns the result of a componentwise less than operation on two float4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator < (float4x2 lhs, float4x2 rhs) { return new bool4x2 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1); }
/// <summary>Returns the result of a componentwise less than operation on a float4x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator < (float4x2 lhs, float rhs) { return new bool4x2 (lhs.c0 < rhs, lhs.c1 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a float value and a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator < (float lhs, float4x2 rhs) { return new bool4x2 (lhs < rhs.c0, lhs < rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on two float4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator <= (float4x2 lhs, float4x2 rhs) { return new bool4x2 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on a float4x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator <= (float4x2 lhs, float rhs) { return new bool4x2 (lhs.c0 <= rhs, lhs.c1 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a float value and a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator <= (float lhs, float4x2 rhs) { return new bool4x2 (lhs <= rhs.c0, lhs <= rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on two float4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator > (float4x2 lhs, float4x2 rhs) { return new bool4x2 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on a float4x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator > (float4x2 lhs, float rhs) { return new bool4x2 (lhs.c0 > rhs, lhs.c1 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a float value and a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator > (float lhs, float4x2 rhs) { return new bool4x2 (lhs > rhs.c0, lhs > rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on two float4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator >= (float4x2 lhs, float4x2 rhs) { return new bool4x2 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float4x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator >= (float4x2 lhs, float rhs) { return new bool4x2 (lhs.c0 >= rhs, lhs.c1 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float value and a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator >= (float lhs, float4x2 rhs) { return new bool4x2 (lhs >= rhs.c0, lhs >= rhs.c1); }
/// <summary>Returns the result of a componentwise unary minus operation on a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator - (float4x2 val) { return new float4x2 (-val.c0, -val.c1); }
/// <summary>Returns the result of a componentwise unary plus operation on a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 operator + (float4x2 val) { return new float4x2 (+val.c0, +val.c1); }
/// <summary>Returns the result of a componentwise equality operation on two float4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (float4x2 lhs, float4x2 rhs) { return new bool4x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on a float4x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (float4x2 lhs, float rhs) { return new bool4x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a float value and a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (float lhs, float4x2 rhs) { return new bool4x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two float4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (float4x2 lhs, float4x2 rhs) { return new bool4x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on a float4x2 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (float4x2 lhs, float rhs) { return new bool4x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a float value and a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (float lhs, float4x2 rhs) { return new bool4x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the float4 element at a specified index.</summary>
unsafe public ref float4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (float4x2* array = &this) { return ref ((float4*)array)[index]; }
}
}
/// <summary>Returns true if the float4x2 is equal to a given float4x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(float4x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the float4x2 is equal to a given float4x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((float4x2)o); }
/// <summary>Returns a hash code for the float4x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the float4x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("float4x2({0}f, {1}f, {2}f, {3}f, {4}f, {5}f, {6}f, {7}f)", c0.x, c1.x, c0.y, c1.y, c0.z, c1.z, c0.w, c1.w);
}
/// <summary>Returns a string representation of the float4x2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("float4x2({0}f, {1}f, {2}f, {3}f, {4}f, {5}f, {6}f, {7}f)", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider), c0.w.ToString(format, formatProvider), c1.w.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a float4x2 matrix constructed from two float4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 float4x2(float4 c0, float4 c1) { return new float4x2(c0, c1); }
/// <summary>Returns a float4x2 matrix constructed from from 8 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 float4x2(float m00, float m01,
float m10, float m11,
float m20, float m21,
float m30, float m31)
{
return new float4x2(m00, m01,
m10, m11,
m20, m21,
m30, m31);
}
/// <summary>Returns a float4x2 matrix constructed from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 float4x2(float v) { return new float4x2(v); }
/// <summary>Returns a float4x2 matrix constructed from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 float4x2(bool v) { return new float4x2(v); }
/// <summary>Return a float4x2 matrix constructed from a bool4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 float4x2(bool4x2 v) { return new float4x2(v); }
/// <summary>Returns a float4x2 matrix constructed from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 float4x2(int v) { return new float4x2(v); }
/// <summary>Return a float4x2 matrix constructed from a int4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 float4x2(int4x2 v) { return new float4x2(v); }
/// <summary>Returns a float4x2 matrix constructed from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 float4x2(uint v) { return new float4x2(v); }
/// <summary>Return a float4x2 matrix constructed from a uint4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 float4x2(uint4x2 v) { return new float4x2(v); }
/// <summary>Returns a float4x2 matrix constructed from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 float4x2(double v) { return new float4x2(v); }
/// <summary>Return a float4x2 matrix constructed from a double4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x2 float4x2(double4x2 v) { return new float4x2(v); }
/// <summary>Return the float2x4 transpose of a float4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x4 transpose(float4x2 v)
{
return float2x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w);
}
/// <summary>Returns a uint hash code of a float4x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(float4x2 v)
{
return csum(asuint(v.c0) * uint4(0xAAC3C25Du, 0xD21D0945u, 0x88FCAB2Du, 0x614DA60Du) +
asuint(v.c1) * uint4(0x5BA2C50Bu, 0x8C455ACBu, 0xCD266C89u, 0xF1852A33u)) + 0x77E35E77u;
}
/// <summary>
/// Returns a uint4 vector hash code of a float4x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(float4x2 v)
{
return (asuint(v.c0) * uint4(0x863E3729u, 0xE191B035u, 0x68586FAFu, 0xD4DFF6D3u) +
asuint(v.c1) * uint4(0xCB634F4Du, 0x9B13B92Du, 0x4ABF0813u, 0x86068063u)) + 0xD75513F9u;
}
}
}

View File

@@ -0,0 +1,460 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct float4x3 : System.IEquatable<float4x3>, IFormattable
{
public float4 c0;
public float4 c1;
public float4 c2;
/// <summary>float4x3 zero value.</summary>
public static readonly float4x3 zero;
/// <summary>Constructs a float4x3 matrix from three float4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x3(float4 c0, float4 c1, float4 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a float4x3 matrix from 12 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x3(float m00, float m01, float m02,
float m10, float m11, float m12,
float m20, float m21, float m22,
float m30, float m31, float m32)
{
this.c0 = new float4(m00, m10, m20, m30);
this.c1 = new float4(m01, m11, m21, m31);
this.c2 = new float4(m02, m12, m22, m32);
}
/// <summary>Constructs a float4x3 matrix from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x3(float v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a float4x3 matrix from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x3(bool v)
{
this.c0 = math.select(new float4(0.0f), new float4(1.0f), v);
this.c1 = math.select(new float4(0.0f), new float4(1.0f), v);
this.c2 = math.select(new float4(0.0f), new float4(1.0f), v);
}
/// <summary>Constructs a float4x3 matrix from a bool4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x3(bool4x3 v)
{
this.c0 = math.select(new float4(0.0f), new float4(1.0f), v.c0);
this.c1 = math.select(new float4(0.0f), new float4(1.0f), v.c1);
this.c2 = math.select(new float4(0.0f), new float4(1.0f), v.c2);
}
/// <summary>Constructs a float4x3 matrix from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x3(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a float4x3 matrix from a int4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x3(int4x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Constructs a float4x3 matrix from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x3(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a float4x3 matrix from a uint4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x3(uint4x3 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
}
/// <summary>Constructs a float4x3 matrix from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x3(double v)
{
this.c0 = (float4)v;
this.c1 = (float4)v;
this.c2 = (float4)v;
}
/// <summary>Constructs a float4x3 matrix from a double4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x3(double4x3 v)
{
this.c0 = (float4)v.c0;
this.c1 = (float4)v.c1;
this.c2 = (float4)v.c2;
}
/// <summary>Implicitly converts a single float value to a float4x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x3(float v) { return new float4x3(v); }
/// <summary>Explicitly converts a single bool value to a float4x3 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float4x3(bool v) { return new float4x3(v); }
/// <summary>Explicitly converts a bool4x3 matrix to a float4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float4x3(bool4x3 v) { return new float4x3(v); }
/// <summary>Implicitly converts a single int value to a float4x3 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x3(int v) { return new float4x3(v); }
/// <summary>Implicitly converts a int4x3 matrix to a float4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x3(int4x3 v) { return new float4x3(v); }
/// <summary>Implicitly converts a single uint value to a float4x3 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x3(uint v) { return new float4x3(v); }
/// <summary>Implicitly converts a uint4x3 matrix to a float4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x3(uint4x3 v) { return new float4x3(v); }
/// <summary>Explicitly converts a single double value to a float4x3 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float4x3(double v) { return new float4x3(v); }
/// <summary>Explicitly converts a double4x3 matrix to a float4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float4x3(double4x3 v) { return new float4x3(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two float4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator * (float4x3 lhs, float4x3 rhs) { return new float4x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); }
/// <summary>Returns the result of a componentwise multiplication operation on a float4x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator * (float4x3 lhs, float rhs) { return new float4x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a float value and a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator * (float lhs, float4x3 rhs) { return new float4x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on two float4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator + (float4x3 lhs, float4x3 rhs) { return new float4x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on a float4x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator + (float4x3 lhs, float rhs) { return new float4x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a float value and a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator + (float lhs, float4x3 rhs) { return new float4x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on two float4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator - (float4x3 lhs, float4x3 rhs) { return new float4x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on a float4x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator - (float4x3 lhs, float rhs) { return new float4x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a float value and a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator - (float lhs, float4x3 rhs) { return new float4x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on two float4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator / (float4x3 lhs, float4x3 rhs) { return new float4x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on a float4x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator / (float4x3 lhs, float rhs) { return new float4x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a float value and a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator / (float lhs, float4x3 rhs) { return new float4x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on two float4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator % (float4x3 lhs, float4x3 rhs) { return new float4x3 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on a float4x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator % (float4x3 lhs, float rhs) { return new float4x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a float value and a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator % (float lhs, float4x3 rhs) { return new float4x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); }
/// <summary>Returns the result of a componentwise increment operation on a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator ++ (float4x3 val) { return new float4x3 (++val.c0, ++val.c1, ++val.c2); }
/// <summary>Returns the result of a componentwise decrement operation on a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator -- (float4x3 val) { return new float4x3 (--val.c0, --val.c1, --val.c2); }
/// <summary>Returns the result of a componentwise less than operation on two float4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator < (float4x3 lhs, float4x3 rhs) { return new bool4x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); }
/// <summary>Returns the result of a componentwise less than operation on a float4x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator < (float4x3 lhs, float rhs) { return new bool4x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a float value and a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator < (float lhs, float4x3 rhs) { return new bool4x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on two float4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator <= (float4x3 lhs, float4x3 rhs) { return new bool4x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on a float4x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator <= (float4x3 lhs, float rhs) { return new bool4x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a float value and a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator <= (float lhs, float4x3 rhs) { return new bool4x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on two float4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator > (float4x3 lhs, float4x3 rhs) { return new bool4x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on a float4x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator > (float4x3 lhs, float rhs) { return new bool4x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a float value and a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator > (float lhs, float4x3 rhs) { return new bool4x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on two float4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator >= (float4x3 lhs, float4x3 rhs) { return new bool4x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float4x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator >= (float4x3 lhs, float rhs) { return new bool4x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float value and a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator >= (float lhs, float4x3 rhs) { return new bool4x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); }
/// <summary>Returns the result of a componentwise unary minus operation on a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator - (float4x3 val) { return new float4x3 (-val.c0, -val.c1, -val.c2); }
/// <summary>Returns the result of a componentwise unary plus operation on a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 operator + (float4x3 val) { return new float4x3 (+val.c0, +val.c1, +val.c2); }
/// <summary>Returns the result of a componentwise equality operation on two float4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (float4x3 lhs, float4x3 rhs) { return new bool4x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on a float4x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (float4x3 lhs, float rhs) { return new bool4x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a float value and a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (float lhs, float4x3 rhs) { return new bool4x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two float4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (float4x3 lhs, float4x3 rhs) { return new bool4x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on a float4x3 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (float4x3 lhs, float rhs) { return new bool4x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a float value and a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (float lhs, float4x3 rhs) { return new bool4x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the float4 element at a specified index.</summary>
unsafe public ref float4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (float4x3* array = &this) { return ref ((float4*)array)[index]; }
}
}
/// <summary>Returns true if the float4x3 is equal to a given float4x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(float4x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the float4x3 is equal to a given float4x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((float4x3)o); }
/// <summary>Returns a hash code for the float4x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the float4x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("float4x3({0}f, {1}f, {2}f, {3}f, {4}f, {5}f, {6}f, {7}f, {8}f, {9}f, {10}f, {11}f)", c0.x, c1.x, c2.x, c0.y, c1.y, c2.y, c0.z, c1.z, c2.z, c0.w, c1.w, c2.w);
}
/// <summary>Returns a string representation of the float4x3 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("float4x3({0}f, {1}f, {2}f, {3}f, {4}f, {5}f, {6}f, {7}f, {8}f, {9}f, {10}f, {11}f)", 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), c0.w.ToString(format, formatProvider), c1.w.ToString(format, formatProvider), c2.w.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a float4x3 matrix constructed from three float4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 float4x3(float4 c0, float4 c1, float4 c2) { return new float4x3(c0, c1, c2); }
/// <summary>Returns a float4x3 matrix constructed from from 12 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 float4x3(float m00, float m01, float m02,
float m10, float m11, float m12,
float m20, float m21, float m22,
float m30, float m31, float m32)
{
return new float4x3(m00, m01, m02,
m10, m11, m12,
m20, m21, m22,
m30, m31, m32);
}
/// <summary>Returns a float4x3 matrix constructed from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 float4x3(float v) { return new float4x3(v); }
/// <summary>Returns a float4x3 matrix constructed from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 float4x3(bool v) { return new float4x3(v); }
/// <summary>Return a float4x3 matrix constructed from a bool4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 float4x3(bool4x3 v) { return new float4x3(v); }
/// <summary>Returns a float4x3 matrix constructed from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 float4x3(int v) { return new float4x3(v); }
/// <summary>Return a float4x3 matrix constructed from a int4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 float4x3(int4x3 v) { return new float4x3(v); }
/// <summary>Returns a float4x3 matrix constructed from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 float4x3(uint v) { return new float4x3(v); }
/// <summary>Return a float4x3 matrix constructed from a uint4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 float4x3(uint4x3 v) { return new float4x3(v); }
/// <summary>Returns a float4x3 matrix constructed from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 float4x3(double v) { return new float4x3(v); }
/// <summary>Return a float4x3 matrix constructed from a double4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x3 float4x3(double4x3 v) { return new float4x3(v); }
/// <summary>Return the float3x4 transpose of a float4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x4 transpose(float4x3 v)
{
return float3x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w,
v.c2.x, v.c2.y, v.c2.z, v.c2.w);
}
/// <summary>Returns a uint hash code of a float4x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(float4x3 v)
{
return csum(asuint(v.c0) * uint4(0xC53F4755u, 0x6985C229u, 0xE133B0B3u, 0xC3E0A3B9u) +
asuint(v.c1) * uint4(0xFE31134Fu, 0x712A34D7u, 0x9D77A59Bu, 0x4942CA39u) +
asuint(v.c2) * uint4(0xB40EC62Du, 0x565ED63Fu, 0x93C30C2Bu, 0xDCAF0351u)) + 0x6E050B01u;
}
/// <summary>
/// Returns a uint4 vector hash code of a float4x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(float4x3 v)
{
return (asuint(v.c0) * uint4(0x750FDBF5u, 0x7F3DD499u, 0x52EAAEBBu, 0x4599C793u) +
asuint(v.c1) * uint4(0x83B5E729u, 0xC267163Fu, 0x67BC9149u, 0xAD7C5EC1u) +
asuint(v.c2) * uint4(0x822A7D6Du, 0xB492BF15u, 0xD37220E3u, 0x7AA2C2BDu)) + 0xE16BC89Du;
}
}
}

View File

@@ -0,0 +1,596 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct float4x4 : System.IEquatable<float4x4>, IFormattable
{
public float4 c0;
public float4 c1;
public float4 c2;
public float4 c3;
/// <summary>float4x4 identity transform.</summary>
public static readonly float4x4 identity = new float4x4(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f);
/// <summary>float4x4 zero value.</summary>
public static readonly float4x4 zero;
/// <summary>Constructs a float4x4 matrix from four float4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x4(float4 c0, float4 c1, float4 c2, float4 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a float4x4 matrix from 16 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x4(float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13,
float m20, float m21, float m22, float m23,
float m30, float m31, float m32, float m33)
{
this.c0 = new float4(m00, m10, m20, m30);
this.c1 = new float4(m01, m11, m21, m31);
this.c2 = new float4(m02, m12, m22, m32);
this.c3 = new float4(m03, m13, m23, m33);
}
/// <summary>Constructs a float4x4 matrix from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x4(float v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a float4x4 matrix from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x4(bool v)
{
this.c0 = math.select(new float4(0.0f), new float4(1.0f), v);
this.c1 = math.select(new float4(0.0f), new float4(1.0f), v);
this.c2 = math.select(new float4(0.0f), new float4(1.0f), v);
this.c3 = math.select(new float4(0.0f), new float4(1.0f), v);
}
/// <summary>Constructs a float4x4 matrix from a bool4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x4(bool4x4 v)
{
this.c0 = math.select(new float4(0.0f), new float4(1.0f), v.c0);
this.c1 = math.select(new float4(0.0f), new float4(1.0f), v.c1);
this.c2 = math.select(new float4(0.0f), new float4(1.0f), v.c2);
this.c3 = math.select(new float4(0.0f), new float4(1.0f), v.c3);
}
/// <summary>Constructs a float4x4 matrix from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x4(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a float4x4 matrix from a int4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x4(int4x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Constructs a float4x4 matrix from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x4(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a float4x4 matrix from a uint4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x4(uint4x4 v)
{
this.c0 = v.c0;
this.c1 = v.c1;
this.c2 = v.c2;
this.c3 = v.c3;
}
/// <summary>Constructs a float4x4 matrix from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x4(double v)
{
this.c0 = (float4)v;
this.c1 = (float4)v;
this.c2 = (float4)v;
this.c3 = (float4)v;
}
/// <summary>Constructs a float4x4 matrix from a double4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4x4(double4x4 v)
{
this.c0 = (float4)v.c0;
this.c1 = (float4)v.c1;
this.c2 = (float4)v.c2;
this.c3 = (float4)v.c3;
}
/// <summary>Implicitly converts a single float value to a float4x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x4(float v) { return new float4x4(v); }
/// <summary>Explicitly converts a single bool value to a float4x4 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float4x4(bool v) { return new float4x4(v); }
/// <summary>Explicitly converts a bool4x4 matrix to a float4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float4x4(bool4x4 v) { return new float4x4(v); }
/// <summary>Implicitly converts a single int value to a float4x4 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x4(int v) { return new float4x4(v); }
/// <summary>Implicitly converts a int4x4 matrix to a float4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x4(int4x4 v) { return new float4x4(v); }
/// <summary>Implicitly converts a single uint value to a float4x4 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x4(uint v) { return new float4x4(v); }
/// <summary>Implicitly converts a uint4x4 matrix to a float4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float4x4(uint4x4 v) { return new float4x4(v); }
/// <summary>Explicitly converts a single double value to a float4x4 matrix by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float4x4(double v) { return new float4x4(v); }
/// <summary>Explicitly converts a double4x4 matrix to a float4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator float4x4(double4x4 v) { return new float4x4(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two float4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator * (float4x4 lhs, float4x4 rhs) { return new float4x4 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2, lhs.c3 * rhs.c3); }
/// <summary>Returns the result of a componentwise multiplication operation on a float4x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator * (float4x4 lhs, float rhs) { return new float4x4 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs, lhs.c3 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a float value and a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator * (float lhs, float4x4 rhs) { return new float4x4 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2, lhs * rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on two float4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator + (float4x4 lhs, float4x4 rhs) { return new float4x4 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2, lhs.c3 + rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on a float4x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator + (float4x4 lhs, float rhs) { return new float4x4 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs, lhs.c3 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a float value and a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator + (float lhs, float4x4 rhs) { return new float4x4 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2, lhs + rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on two float4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator - (float4x4 lhs, float4x4 rhs) { return new float4x4 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2, lhs.c3 - rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on a float4x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator - (float4x4 lhs, float rhs) { return new float4x4 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs, lhs.c3 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a float value and a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator - (float lhs, float4x4 rhs) { return new float4x4 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2, lhs - rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on two float4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator / (float4x4 lhs, float4x4 rhs) { return new float4x4 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2, lhs.c3 / rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on a float4x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator / (float4x4 lhs, float rhs) { return new float4x4 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs, lhs.c3 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a float value and a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator / (float lhs, float4x4 rhs) { return new float4x4 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2, lhs / rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on two float4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator % (float4x4 lhs, float4x4 rhs) { return new float4x4 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2, lhs.c3 % rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on a float4x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator % (float4x4 lhs, float rhs) { return new float4x4 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs, lhs.c3 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a float value and a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator % (float lhs, float4x4 rhs) { return new float4x4 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2, lhs % rhs.c3); }
/// <summary>Returns the result of a componentwise increment operation on a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator ++ (float4x4 val) { return new float4x4 (++val.c0, ++val.c1, ++val.c2, ++val.c3); }
/// <summary>Returns the result of a componentwise decrement operation on a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator -- (float4x4 val) { return new float4x4 (--val.c0, --val.c1, --val.c2, --val.c3); }
/// <summary>Returns the result of a componentwise less than operation on two float4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator < (float4x4 lhs, float4x4 rhs) { return new bool4x4 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2, lhs.c3 < rhs.c3); }
/// <summary>Returns the result of a componentwise less than operation on a float4x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator < (float4x4 lhs, float rhs) { return new bool4x4 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs, lhs.c3 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a float value and a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator < (float lhs, float4x4 rhs) { return new bool4x4 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2, lhs < rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on two float4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator <= (float4x4 lhs, float4x4 rhs) { return new bool4x4 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2, lhs.c3 <= rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on a float4x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator <= (float4x4 lhs, float rhs) { return new bool4x4 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs, lhs.c3 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a float value and a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator <= (float lhs, float4x4 rhs) { return new bool4x4 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2, lhs <= rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on two float4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator > (float4x4 lhs, float4x4 rhs) { return new bool4x4 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2, lhs.c3 > rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on a float4x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator > (float4x4 lhs, float rhs) { return new bool4x4 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs, lhs.c3 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a float value and a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator > (float lhs, float4x4 rhs) { return new bool4x4 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2, lhs > rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on two float4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator >= (float4x4 lhs, float4x4 rhs) { return new bool4x4 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2, lhs.c3 >= rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float4x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator >= (float4x4 lhs, float rhs) { return new bool4x4 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs, lhs.c3 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a float value and a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator >= (float lhs, float4x4 rhs) { return new bool4x4 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2, lhs >= rhs.c3); }
/// <summary>Returns the result of a componentwise unary minus operation on a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator - (float4x4 val) { return new float4x4 (-val.c0, -val.c1, -val.c2, -val.c3); }
/// <summary>Returns the result of a componentwise unary plus operation on a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 operator + (float4x4 val) { return new float4x4 (+val.c0, +val.c1, +val.c2, +val.c3); }
/// <summary>Returns the result of a componentwise equality operation on two float4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (float4x4 lhs, float4x4 rhs) { return new bool4x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on a float4x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (float4x4 lhs, float rhs) { return new bool4x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a float value and a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (float lhs, float4x4 rhs) { return new bool4x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two float4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (float4x4 lhs, float4x4 rhs) { return new bool4x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on a float4x4 matrix and a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (float4x4 lhs, float rhs) { return new bool4x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a float value and a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (float lhs, float4x4 rhs) { return new bool4x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the float4 element at a specified index.</summary>
unsafe public ref float4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (float4x4* array = &this) { return ref ((float4*)array)[index]; }
}
}
/// <summary>Returns true if the float4x4 is equal to a given float4x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(float4x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the float4x4 is equal to a given float4x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((float4x4)o); }
/// <summary>Returns a hash code for the float4x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the float4x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("float4x4({0}f, {1}f, {2}f, {3}f, {4}f, {5}f, {6}f, {7}f, {8}f, {9}f, {10}f, {11}f, {12}f, {13}f, {14}f, {15}f)", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y, c0.z, c1.z, c2.z, c3.z, c0.w, c1.w, c2.w, c3.w);
}
/// <summary>Returns a string representation of the float4x4 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("float4x4({0}f, {1}f, {2}f, {3}f, {4}f, {5}f, {6}f, {7}f, {8}f, {9}f, {10}f, {11}f, {12}f, {13}f, {14}f, {15}f)", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c3.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider), c3.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider), c2.z.ToString(format, formatProvider), c3.z.ToString(format, formatProvider), c0.w.ToString(format, formatProvider), c1.w.ToString(format, formatProvider), c2.w.ToString(format, formatProvider), c3.w.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a float4x4 matrix constructed from four float4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 float4x4(float4 c0, float4 c1, float4 c2, float4 c3) { return new float4x4(c0, c1, c2, c3); }
/// <summary>Returns a float4x4 matrix constructed from from 16 float values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 float4x4(float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13,
float m20, float m21, float m22, float m23,
float m30, float m31, float m32, float m33)
{
return new float4x4(m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23,
m30, m31, m32, m33);
}
/// <summary>Returns a float4x4 matrix constructed from a single float value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 float4x4(float v) { return new float4x4(v); }
/// <summary>Returns a float4x4 matrix constructed from a single bool value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 float4x4(bool v) { return new float4x4(v); }
/// <summary>Return a float4x4 matrix constructed from a bool4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 float4x4(bool4x4 v) { return new float4x4(v); }
/// <summary>Returns a float4x4 matrix constructed from a single int value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 float4x4(int v) { return new float4x4(v); }
/// <summary>Return a float4x4 matrix constructed from a int4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 float4x4(int4x4 v) { return new float4x4(v); }
/// <summary>Returns a float4x4 matrix constructed from a single uint value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 float4x4(uint v) { return new float4x4(v); }
/// <summary>Return a float4x4 matrix constructed from a uint4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 float4x4(uint4x4 v) { return new float4x4(v); }
/// <summary>Returns a float4x4 matrix constructed from a single double value by converting it to float and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 float4x4(double v) { return new float4x4(v); }
/// <summary>Return a float4x4 matrix constructed from a double4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 float4x4(double4x4 v) { return new float4x4(v); }
/// <summary>Return the result of rotating a float3 vector by a float4x4 matrix</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3 rotate(float4x4 a, float3 b)
{
return (a.c0 * b.x + a.c1 * b.y + a.c2 * b.z).xyz;
}
/// <summary>Return the result of transforming a float3 point by a float4x4 matrix</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3 transform(float4x4 a, float3 b)
{
return (a.c0 * b.x + a.c1 * b.y + a.c2 * b.z + a.c3).xyz;
}
/// <summary>Return the float4x4 transpose of a float4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 transpose(float4x4 v)
{
return float4x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w,
v.c2.x, v.c2.y, v.c2.z, v.c2.w,
v.c3.x, v.c3.y, v.c3.z, v.c3.w);
}
/// <summary>Returns the float4x4 full inverse of a float4x4 matrix.</summary>
public static float4x4 inverse(float4x4 m)
{
float4 c0 = m.c0;
float4 c1 = m.c1;
float4 c2 = m.c2;
float4 c3 = m.c3;
float4 r0y_r1y_r0x_r1x = movelh(c1, c0);
float4 r0z_r1z_r0w_r1w = movelh(c2, c3);
float4 r2y_r3y_r2x_r3x = movehl(c0, c1);
float4 r2z_r3z_r2w_r3w = movehl(c3, c2);
float4 r1y_r2y_r1x_r2x = shuffle(c1, c0, ShuffleComponent.LeftY, ShuffleComponent.LeftZ, ShuffleComponent.RightY, ShuffleComponent.RightZ);
float4 r1z_r2z_r1w_r2w = shuffle(c2, c3, ShuffleComponent.LeftY, ShuffleComponent.LeftZ, ShuffleComponent.RightY, ShuffleComponent.RightZ);
float4 r3y_r0y_r3x_r0x = shuffle(c1, c0, ShuffleComponent.LeftW, ShuffleComponent.LeftX, ShuffleComponent.RightW, ShuffleComponent.RightX);
float4 r3z_r0z_r3w_r0w = shuffle(c2, c3, ShuffleComponent.LeftW, ShuffleComponent.LeftX, ShuffleComponent.RightW, ShuffleComponent.RightX);
float4 r0_wzyx = shuffle(r0z_r1z_r0w_r1w, r0y_r1y_r0x_r1x, ShuffleComponent.LeftZ, ShuffleComponent.LeftX, ShuffleComponent.RightX, ShuffleComponent.RightZ);
float4 r1_wzyx = shuffle(r0z_r1z_r0w_r1w, r0y_r1y_r0x_r1x, ShuffleComponent.LeftW, ShuffleComponent.LeftY, ShuffleComponent.RightY, ShuffleComponent.RightW);
float4 r2_wzyx = shuffle(r2z_r3z_r2w_r3w, r2y_r3y_r2x_r3x, ShuffleComponent.LeftZ, ShuffleComponent.LeftX, ShuffleComponent.RightX, ShuffleComponent.RightZ);
float4 r3_wzyx = shuffle(r2z_r3z_r2w_r3w, r2y_r3y_r2x_r3x, ShuffleComponent.LeftW, ShuffleComponent.LeftY, ShuffleComponent.RightY, ShuffleComponent.RightW);
float4 r0_xyzw = shuffle(r0y_r1y_r0x_r1x, r0z_r1z_r0w_r1w, ShuffleComponent.LeftZ, ShuffleComponent.LeftX, ShuffleComponent.RightX, ShuffleComponent.RightZ);
// Calculate remaining inner term pairs. inner terms have zw=-xy, so we only have to calculate xy and can pack two pairs per vector.
float4 inner12_23 = r1y_r2y_r1x_r2x * r2z_r3z_r2w_r3w - r1z_r2z_r1w_r2w * r2y_r3y_r2x_r3x;
float4 inner02_13 = r0y_r1y_r0x_r1x * r2z_r3z_r2w_r3w - r0z_r1z_r0w_r1w * r2y_r3y_r2x_r3x;
float4 inner30_01 = r3z_r0z_r3w_r0w * r0y_r1y_r0x_r1x - r3y_r0y_r3x_r0x * r0z_r1z_r0w_r1w;
// Expand inner terms back to 4 components. zw signs still need to be flipped
float4 inner12 = shuffle(inner12_23, inner12_23, ShuffleComponent.LeftX, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.RightX);
float4 inner23 = shuffle(inner12_23, inner12_23, ShuffleComponent.LeftY, ShuffleComponent.LeftW, ShuffleComponent.RightW, ShuffleComponent.RightY);
float4 inner02 = shuffle(inner02_13, inner02_13, ShuffleComponent.LeftX, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.RightX);
float4 inner13 = shuffle(inner02_13, inner02_13, ShuffleComponent.LeftY, ShuffleComponent.LeftW, ShuffleComponent.RightW, ShuffleComponent.RightY);
// Calculate minors
float4 minors0 = r3_wzyx * inner12 - r2_wzyx * inner13 + r1_wzyx * inner23;
float4 denom = r0_xyzw * minors0;
// Horizontal sum of denominator. Free sign flip of z and w compensates for missing flip in inner terms.
denom = denom + shuffle(denom, denom, ShuffleComponent.LeftY, ShuffleComponent.LeftX, ShuffleComponent.RightW, ShuffleComponent.RightZ); // x+y x+y z+w z+w
denom = denom - shuffle(denom, denom, ShuffleComponent.LeftZ, ShuffleComponent.LeftZ, ShuffleComponent.RightX, ShuffleComponent.RightX); // x+y-z-w x+y-z-w z+w-x-y z+w-x-y
float4 rcp_denom_ppnn = float4(1.0f) / denom;
float4x4 res;
res.c0 = minors0 * rcp_denom_ppnn;
float4 inner30 = shuffle(inner30_01, inner30_01, ShuffleComponent.LeftX, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.RightX);
float4 inner01 = shuffle(inner30_01, inner30_01, ShuffleComponent.LeftY, ShuffleComponent.LeftW, ShuffleComponent.RightW, ShuffleComponent.RightY);
float4 minors1 = r2_wzyx * inner30 - r0_wzyx * inner23 - r3_wzyx * inner02;
res.c1 = minors1 * rcp_denom_ppnn;
float4 minors2 = r0_wzyx * inner13 - r1_wzyx * inner30 - r3_wzyx * inner01;
res.c2 = minors2 * rcp_denom_ppnn;
float4 minors3 = r1_wzyx * inner02 - r0_wzyx * inner12 + r2_wzyx * inner01;
res.c3 = minors3 * rcp_denom_ppnn;
return res;
}
// Fast matrix inverse for rigid transforms (Orthonormal basis and translation)
public static float4x4 fastinverse(float4x4 m)
{
float4 c0 = m.c0;
float4 c1 = m.c1;
float4 c2 = m.c2;
float4 pos = m.c3;
float4 zero = float4(0);
float4 t0 = unpacklo(c0, c2);
float4 t1 = unpacklo(c1, zero);
float4 t2 = unpackhi(c0, c2);
float4 t3 = unpackhi(c1, zero);
float4 r0 = unpacklo(t0, t1);
float4 r1 = unpackhi(t0, t1);
float4 r2 = unpacklo(t2, t3);
pos = -(r0 * pos.x + r1 * pos.y + r2 * pos.z);
pos.w = 1.0f;
return float4x4(r0, r1, r2, pos);
}
/// <summary>Returns the determinant of a float4x4 matrix.</summary>
public static float determinant(float4x4 m)
{
float4 c0 = m.c0;
float4 c1 = m.c1;
float4 c2 = m.c2;
float4 c3 = m.c3;
float m00 = c1.y * (c2.z * c3.w - c2.w * c3.z) - c2.y * (c1.z * c3.w - c1.w * c3.z) + c3.y * (c1.z * c2.w - c1.w * c2.z);
float m01 = c0.y * (c2.z * c3.w - c2.w * c3.z) - c2.y * (c0.z * c3.w - c0.w * c3.z) + c3.y * (c0.z * c2.w - c0.w * c2.z);
float m02 = c0.y * (c1.z * c3.w - c1.w * c3.z) - c1.y * (c0.z * c3.w - c0.w * c3.z) + c3.y * (c0.z * c1.w - c0.w * c1.z);
float m03 = c0.y * (c1.z * c2.w - c1.w * c2.z) - c1.y * (c0.z * c2.w - c0.w * c2.z) + c2.y * (c0.z * c1.w - c0.w * c1.z);
return c0.x * m00 - c1.x * m01 + c2.x * m02 - c3.x * m03;
}
/// <summary>Returns a uint hash code of a float4x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(float4x4 v)
{
return csum(asuint(v.c0) * uint4(0xC4B1493Fu, 0xBA0966D3u, 0xAFBEE253u, 0x5B419C01u) +
asuint(v.c1) * uint4(0x515D90F5u, 0xEC9F68F3u, 0xF9EA92D5u, 0xC2FAFCB9u) +
asuint(v.c2) * uint4(0x616E9CA1u, 0xC5C5394Bu, 0xCAE78587u, 0x7A1541C9u) +
asuint(v.c3) * uint4(0xF83BD927u, 0x6A243BCBu, 0x509B84C9u, 0x91D13847u)) + 0x52F7230Fu;
}
/// <summary>
/// Returns a uint4 vector hash code of a float4x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(float4x4 v)
{
return (asuint(v.c0) * uint4(0xCF286E83u, 0xE121E6ADu, 0xC9CA1249u, 0x69B60C81u) +
asuint(v.c1) * uint4(0xE0EB6C25u, 0xF648BEABu, 0x6BDB2B07u, 0xEF63C699u) +
asuint(v.c2) * uint4(0x9001903Fu, 0xA895B9CDu, 0x9D23B201u, 0x4B01D3E1u) +
asuint(v.c3) * uint4(0x7461CA0Du, 0x79725379u, 0xD6258E5Bu, 0xEE390C97u)) + 0x9C8A2F05u;
}
}
}

View File

@@ -0,0 +1,114 @@
using System;
using System.Runtime.CompilerServices;
namespace Unity.Mathematics
{
[Serializable]
public struct half : System.IEquatable<half>, IFormattable
{
public ushort value;
/// <summary>half zero value.</summary>
public static readonly half zero = new half();
public static float MaxValue { get { return 65504.0f; } }
public static float MinValue { get { return -65504.0f; } }
public static half MaxValueAsHalf => new half(MaxValue);
public static half MinValueAsHalf => new half(MinValue);
/// <summary>Constructs a half value from a half value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half(half x)
{
value = x.value;
}
/// <summary>Constructs a half value from a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half(float v)
{
value = (ushort)math.f32tof16(v);
}
/// <summary>Constructs a half value from a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half(double v)
{
value = (ushort)math.f32tof16((float)v);
}
/// <summary>Explicitly converts a float value to a half value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half(float v) { return new half(v); }
/// <summary>Explicitly converts a double value to a half value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half(double v) { return new half(v); }
/// <summary>Implicitly converts a half value to a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator float(half d) { return math.f16tof32(d.value); }
/// <summary>Implicitly converts a half value to a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator double(half d) { return math.f16tof32(d.value); }
/// <summary>Returns whether two half values are equal.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(half lhs, half rhs) { return lhs.value == rhs.value; }
/// <summary>Returns whether two half values are different.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(half lhs, half rhs) { return lhs.value != rhs.value; }
/// <summary>Returns true if the half is equal to a given half, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(half rhs) { return value == rhs.value; }
/// <summary>Returns true if the half is equal to a given half, false otherwise.</summary>
public override bool Equals(object o) { return Equals((half)o); }
/// <summary>Returns a hash code for the half.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)value; }
/// <summary>Returns a string representation of the half.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return math.f16tof32(value).ToString();
}
/// <summary>Returns a string representation of the half using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return math.f16tof32(value).ToString(format, formatProvider);
}
}
public static partial class math
{
/// <summary>Returns a half value constructed from a half values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half half(half x) { return new half(x); }
/// <summary>Returns a half value constructed from a float value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half half(float v) { return new half(v); }
/// <summary>Returns a half value constructed from a double value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half half(double v) { return new half(v); }
/// <summary>Returns a uint hash code of a half value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(half v)
{
return v.value * 0x745ED837u + 0x816EFB5Du;
}
}
}

View File

@@ -0,0 +1,472 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
using System.Diagnostics;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[DebuggerTypeProxy(typeof(half2.DebuggerProxy))]
[System.Serializable]
public partial struct half2 : System.IEquatable<half2>, IFormattable
{
public half x;
public half y;
/// <summary>half2 zero value.</summary>
public static readonly half2 zero;
/// <summary>Constructs a half2 vector from two half values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half2(half x, half y)
{
this.x = x;
this.y = y;
}
/// <summary>Constructs a half2 vector from a half2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half2(half2 xy)
{
this.x = xy.x;
this.y = xy.y;
}
/// <summary>Constructs a half2 vector from a single half value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half2(half v)
{
this.x = v;
this.y = v;
}
/// <summary>Constructs a half2 vector from a single float value by converting it to half and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half2(float v)
{
this.x = (half)v;
this.y = (half)v;
}
/// <summary>Constructs a half2 vector from a float2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half2(float2 v)
{
this.x = (half)v.x;
this.y = (half)v.y;
}
/// <summary>Constructs a half2 vector from a single double value by converting it to half and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half2(double v)
{
this.x = (half)v;
this.y = (half)v;
}
/// <summary>Constructs a half2 vector from a double2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public half2(double2 v)
{
this.x = (half)v.x;
this.y = (half)v.y;
}
/// <summary>Implicitly converts a single half value to a half2 vector by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator half2(half v) { return new half2(v); }
/// <summary>Explicitly converts a single float value to a half2 vector by converting it to half and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half2(float v) { return new half2(v); }
/// <summary>Explicitly converts a float2 vector to a half2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half2(float2 v) { return new half2(v); }
/// <summary>Explicitly converts a single double value to a half2 vector by converting it to half and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half2(double v) { return new half2(v); }
/// <summary>Explicitly converts a double2 vector to a half2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator half2(double2 v) { return new half2(v); }
/// <summary>Returns the result of a componentwise equality operation on two half2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (half2 lhs, half2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); }
/// <summary>Returns the result of a componentwise equality operation on a half2 vector and a half value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (half2 lhs, half rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a half value and a half2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (half lhs, half2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); }
/// <summary>Returns the result of a componentwise not equal operation on two half2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (half2 lhs, half2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); }
/// <summary>Returns the result of a componentwise not equal operation on a half2 vector and a half value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (half2 lhs, half rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a half value and a half2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (half lhs, half2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); }
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 xxxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(x, x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 xxxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(x, x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 xxyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(x, x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 xxyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(x, x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 xyxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(x, y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 xyxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(x, y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 xyyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(x, y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 xyyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(x, y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 yxxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(y, x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 yxxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(y, x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 yxyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(y, x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 yxyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(y, x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 yyxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(y, y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 yyxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(y, y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 yyyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(y, y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half4 yyyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half4(y, y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half3 xxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half3(x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half3 xxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half3(x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half3 xyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half3(x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half3 xyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half3(x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half3 yxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half3(y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half3 yxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half3(y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half3 yyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half3(y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half3 yyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half3(y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half2 xx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half2(x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half2 xy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half2(x, y); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set { x = value.x; y = value.y; }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half2 yx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half2(y, x); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set { y = value.x; x = value.y; }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public half2 yy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new half2(y, y); }
}
/// <summary>Returns the half element at a specified index.</summary>
unsafe public half this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (half2* array = &this) { return ((half*)array)[index]; }
}
set
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (half* array = &x) { array[index] = value; }
}
}
/// <summary>Returns true if the half2 is equal to a given half2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(half2 rhs) { return x == rhs.x && y == rhs.y; }
/// <summary>Returns true if the half2 is equal to a given half2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((half2)o); }
/// <summary>Returns a hash code for the half2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the half2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("half2({0}, {1})", x, y);
}
/// <summary>Returns a string representation of the half2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("half2({0}, {1})", x.ToString(format, formatProvider), y.ToString(format, formatProvider));
}
internal sealed class DebuggerProxy
{
public half x;
public half y;
public DebuggerProxy(half2 v)
{
x = v.x;
y = v.y;
}
}
}
public static partial class math
{
/// <summary>Returns a half2 vector constructed from two half values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half2 half2(half x, half y) { return new half2(x, y); }
/// <summary>Returns a half2 vector constructed from a half2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half2 half2(half2 xy) { return new half2(xy); }
/// <summary>Returns a half2 vector constructed from a single half value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half2 half2(half v) { return new half2(v); }
/// <summary>Returns a half2 vector constructed from a single float value by converting it to half and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half2 half2(float v) { return new half2(v); }
/// <summary>Return a half2 vector constructed from a float2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half2 half2(float2 v) { return new half2(v); }
/// <summary>Returns a half2 vector constructed from a single double value by converting it to half and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half2 half2(double v) { return new half2(v); }
/// <summary>Return a half2 vector constructed from a double2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static half2 half2(double2 v) { return new half2(v); }
/// <summary>Returns a uint hash code of a half2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(half2 v)
{
return csum(uint2(v.x.value, v.y.value) * uint2(0x6E624EB7u, 0x7383ED49u)) + 0xDD49C23Bu;
}
/// <summary>
/// Returns a uint2 vector hash code of a half2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(half2 v)
{
return (uint2(v.x.value, v.y.value) * uint2(0xEBD0D005u, 0x91475DF7u)) + 0x55E84827u;
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,780 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
using System.Diagnostics;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[DebuggerTypeProxy(typeof(int2.DebuggerProxy))]
[System.Serializable]
public partial struct int2 : System.IEquatable<int2>, IFormattable
{
public int x;
public int y;
/// <summary>int2 zero value.</summary>
public static readonly int2 zero;
/// <summary>Constructs a int2 vector from two int values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2(int x, int y)
{
this.x = x;
this.y = y;
}
/// <summary>Constructs a int2 vector from an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2(int2 xy)
{
this.x = xy.x;
this.y = xy.y;
}
/// <summary>Constructs a int2 vector from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2(int v)
{
this.x = v;
this.y = v;
}
/// <summary>Constructs a int2 vector from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2(bool v)
{
this.x = v ? 1 : 0;
this.y = v ? 1 : 0;
}
/// <summary>Constructs a int2 vector from a bool2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2(bool2 v)
{
this.x = v.x ? 1 : 0;
this.y = v.y ? 1 : 0;
}
/// <summary>Constructs a int2 vector from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2(uint v)
{
this.x = (int)v;
this.y = (int)v;
}
/// <summary>Constructs a int2 vector from a uint2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2(uint2 v)
{
this.x = (int)v.x;
this.y = (int)v.y;
}
/// <summary>Constructs a int2 vector from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2(float v)
{
this.x = (int)v;
this.y = (int)v;
}
/// <summary>Constructs a int2 vector from a float2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2(float2 v)
{
this.x = (int)v.x;
this.y = (int)v.y;
}
/// <summary>Constructs a int2 vector from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2(double v)
{
this.x = (int)v;
this.y = (int)v;
}
/// <summary>Constructs a int2 vector from a double2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2(double2 v)
{
this.x = (int)v.x;
this.y = (int)v.y;
}
/// <summary>Implicitly converts a single int value to a int2 vector by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator int2(int v) { return new int2(v); }
/// <summary>Explicitly converts a single bool value to a int2 vector by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2(bool v) { return new int2(v); }
/// <summary>Explicitly converts a bool2 vector to a int2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2(bool2 v) { return new int2(v); }
/// <summary>Explicitly converts a single uint value to a int2 vector by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2(uint v) { return new int2(v); }
/// <summary>Explicitly converts a uint2 vector to a int2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2(uint2 v) { return new int2(v); }
/// <summary>Explicitly converts a single float value to a int2 vector by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2(float v) { return new int2(v); }
/// <summary>Explicitly converts a float2 vector to a int2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2(float2 v) { return new int2(v); }
/// <summary>Explicitly converts a single double value to a int2 vector by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2(double v) { return new int2(v); }
/// <summary>Explicitly converts a double2 vector to a int2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2(double2 v) { return new int2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator * (int2 lhs, int2 rhs) { return new int2 (lhs.x * rhs.x, lhs.y * rhs.y); }
/// <summary>Returns the result of a componentwise multiplication operation on an int2 vector and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator * (int2 lhs, int rhs) { return new int2 (lhs.x * rhs, lhs.y * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on an int value and an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator * (int lhs, int2 rhs) { return new int2 (lhs * rhs.x, lhs * rhs.y); }
/// <summary>Returns the result of a componentwise addition operation on two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator + (int2 lhs, int2 rhs) { return new int2 (lhs.x + rhs.x, lhs.y + rhs.y); }
/// <summary>Returns the result of a componentwise addition operation on an int2 vector and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator + (int2 lhs, int rhs) { return new int2 (lhs.x + rhs, lhs.y + rhs); }
/// <summary>Returns the result of a componentwise addition operation on an int value and an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator + (int lhs, int2 rhs) { return new int2 (lhs + rhs.x, lhs + rhs.y); }
/// <summary>Returns the result of a componentwise subtraction operation on two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator - (int2 lhs, int2 rhs) { return new int2 (lhs.x - rhs.x, lhs.y - rhs.y); }
/// <summary>Returns the result of a componentwise subtraction operation on an int2 vector and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator - (int2 lhs, int rhs) { return new int2 (lhs.x - rhs, lhs.y - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on an int value and an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator - (int lhs, int2 rhs) { return new int2 (lhs - rhs.x, lhs - rhs.y); }
/// <summary>Returns the result of a componentwise division operation on two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator / (int2 lhs, int2 rhs) { return new int2 (lhs.x / rhs.x, lhs.y / rhs.y); }
/// <summary>Returns the result of a componentwise division operation on an int2 vector and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator / (int2 lhs, int rhs) { return new int2 (lhs.x / rhs, lhs.y / rhs); }
/// <summary>Returns the result of a componentwise division operation on an int value and an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator / (int lhs, int2 rhs) { return new int2 (lhs / rhs.x, lhs / rhs.y); }
/// <summary>Returns the result of a componentwise modulus operation on two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator % (int2 lhs, int2 rhs) { return new int2 (lhs.x % rhs.x, lhs.y % rhs.y); }
/// <summary>Returns the result of a componentwise modulus operation on an int2 vector and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator % (int2 lhs, int rhs) { return new int2 (lhs.x % rhs, lhs.y % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on an int value and an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator % (int lhs, int2 rhs) { return new int2 (lhs % rhs.x, lhs % rhs.y); }
/// <summary>Returns the result of a componentwise increment operation on an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator ++ (int2 val) { return new int2 (++val.x, ++val.y); }
/// <summary>Returns the result of a componentwise decrement operation on an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator -- (int2 val) { return new int2 (--val.x, --val.y); }
/// <summary>Returns the result of a componentwise less than operation on two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator < (int2 lhs, int2 rhs) { return new bool2 (lhs.x < rhs.x, lhs.y < rhs.y); }
/// <summary>Returns the result of a componentwise less than operation on an int2 vector and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator < (int2 lhs, int rhs) { return new bool2 (lhs.x < rhs, lhs.y < rhs); }
/// <summary>Returns the result of a componentwise less than operation on an int value and an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator < (int lhs, int2 rhs) { return new bool2 (lhs < rhs.x, lhs < rhs.y); }
/// <summary>Returns the result of a componentwise less or equal operation on two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator <= (int2 lhs, int2 rhs) { return new bool2 (lhs.x <= rhs.x, lhs.y <= rhs.y); }
/// <summary>Returns the result of a componentwise less or equal operation on an int2 vector and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator <= (int2 lhs, int rhs) { return new bool2 (lhs.x <= rhs, lhs.y <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on an int value and an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator <= (int lhs, int2 rhs) { return new bool2 (lhs <= rhs.x, lhs <= rhs.y); }
/// <summary>Returns the result of a componentwise greater than operation on two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator > (int2 lhs, int2 rhs) { return new bool2 (lhs.x > rhs.x, lhs.y > rhs.y); }
/// <summary>Returns the result of a componentwise greater than operation on an int2 vector and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator > (int2 lhs, int rhs) { return new bool2 (lhs.x > rhs, lhs.y > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on an int value and an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator > (int lhs, int2 rhs) { return new bool2 (lhs > rhs.x, lhs > rhs.y); }
/// <summary>Returns the result of a componentwise greater or equal operation on two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator >= (int2 lhs, int2 rhs) { return new bool2 (lhs.x >= rhs.x, lhs.y >= rhs.y); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int2 vector and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator >= (int2 lhs, int rhs) { return new bool2 (lhs.x >= rhs, lhs.y >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int value and an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator >= (int lhs, int2 rhs) { return new bool2 (lhs >= rhs.x, lhs >= rhs.y); }
/// <summary>Returns the result of a componentwise unary minus operation on an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator - (int2 val) { return new int2 (-val.x, -val.y); }
/// <summary>Returns the result of a componentwise unary plus operation on an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator + (int2 val) { return new int2 (+val.x, +val.y); }
/// <summary>Returns the result of a componentwise left shift operation on an int2 vector by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator << (int2 x, int n) { return new int2 (x.x << n, x.y << n); }
/// <summary>Returns the result of a componentwise right shift operation on an int2 vector by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator >> (int2 x, int n) { return new int2 (x.x >> n, x.y >> n); }
/// <summary>Returns the result of a componentwise equality operation on two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (int2 lhs, int2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); }
/// <summary>Returns the result of a componentwise equality operation on an int2 vector and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (int2 lhs, int rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); }
/// <summary>Returns the result of a componentwise equality operation on an int value and an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (int lhs, int2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); }
/// <summary>Returns the result of a componentwise not equal operation on two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (int2 lhs, int2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); }
/// <summary>Returns the result of a componentwise not equal operation on an int2 vector and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (int2 lhs, int rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on an int value and an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (int lhs, int2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); }
/// <summary>Returns the result of a componentwise bitwise not operation on an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator ~ (int2 val) { return new int2 (~val.x, ~val.y); }
/// <summary>Returns the result of a componentwise bitwise and operation on two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator & (int2 lhs, int2 rhs) { return new int2 (lhs.x & rhs.x, lhs.y & rhs.y); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int2 vector and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator & (int2 lhs, int rhs) { return new int2 (lhs.x & rhs, lhs.y & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int value and an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator & (int lhs, int2 rhs) { return new int2 (lhs & rhs.x, lhs & rhs.y); }
/// <summary>Returns the result of a componentwise bitwise or operation on two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator | (int2 lhs, int2 rhs) { return new int2 (lhs.x | rhs.x, lhs.y | rhs.y); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int2 vector and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator | (int2 lhs, int rhs) { return new int2 (lhs.x | rhs, lhs.y | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int value and an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator | (int lhs, int2 rhs) { return new int2 (lhs | rhs.x, lhs | rhs.y); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator ^ (int2 lhs, int2 rhs) { return new int2 (lhs.x ^ rhs.x, lhs.y ^ rhs.y); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int2 vector and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator ^ (int2 lhs, int rhs) { return new int2 (lhs.x ^ rhs, lhs.y ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int value and an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 operator ^ (int lhs, int2 rhs) { return new int2 (lhs ^ rhs.x, lhs ^ rhs.y); }
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 xxxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(x, x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 xxxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(x, x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 xxyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(x, x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 xxyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(x, x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 xyxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(x, y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 xyxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(x, y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 xyyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(x, y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 xyyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(x, y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 yxxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(y, x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 yxxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(y, x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 yxyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(y, x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 yxyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(y, x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 yyxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(y, y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 yyxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(y, y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 yyyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(y, y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int4 yyyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int4(y, y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int3 xxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int3(x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int3 xxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int3(x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int3 xyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int3(x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int3 xyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int3(x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int3 yxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int3(y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int3 yxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int3(y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int3 yyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int3(y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int3 yyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int3(y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int2 xx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int2(x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int2 xy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int2(x, y); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set { x = value.x; y = value.y; }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int2 yx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int2(y, x); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set { y = value.x; x = value.y; }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public int2 yy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new int2(y, y); }
}
/// <summary>Returns the int element at a specified index.</summary>
unsafe public int this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (int2* array = &this) { return ((int*)array)[index]; }
}
set
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (int* array = &x) { array[index] = value; }
}
}
/// <summary>Returns true if the int2 is equal to a given int2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(int2 rhs) { return x == rhs.x && y == rhs.y; }
/// <summary>Returns true if the int2 is equal to a given int2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((int2)o); }
/// <summary>Returns a hash code for the int2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the int2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("int2({0}, {1})", x, y);
}
/// <summary>Returns a string representation of the int2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("int2({0}, {1})", x.ToString(format, formatProvider), y.ToString(format, formatProvider));
}
internal sealed class DebuggerProxy
{
public int x;
public int y;
public DebuggerProxy(int2 v)
{
x = v.x;
y = v.y;
}
}
}
public static partial class math
{
/// <summary>Returns a int2 vector constructed from two int values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 int2(int x, int y) { return new int2(x, y); }
/// <summary>Returns a int2 vector constructed from an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 int2(int2 xy) { return new int2(xy); }
/// <summary>Returns a int2 vector constructed from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 int2(int v) { return new int2(v); }
/// <summary>Returns a int2 vector constructed from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 int2(bool v) { return new int2(v); }
/// <summary>Return a int2 vector constructed from a bool2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 int2(bool2 v) { return new int2(v); }
/// <summary>Returns a int2 vector constructed from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 int2(uint v) { return new int2(v); }
/// <summary>Return a int2 vector constructed from a uint2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 int2(uint2 v) { return new int2(v); }
/// <summary>Returns a int2 vector constructed from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 int2(float v) { return new int2(v); }
/// <summary>Return a int2 vector constructed from a float2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 int2(float2 v) { return new int2(v); }
/// <summary>Returns a int2 vector constructed from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 int2(double v) { return new int2(v); }
/// <summary>Return a int2 vector constructed from a double2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 int2(double2 v) { return new int2(v); }
/// <summary>Returns a uint hash code of a int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(int2 v)
{
return csum(asuint(v) * uint2(0x83B58237u, 0x833E3E29u)) + 0xA9D919BFu;
}
/// <summary>
/// Returns a uint2 vector hash code of a int2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(int2 v)
{
return (asuint(v) * uint2(0xC3EC1D97u, 0xB8B208C7u)) + 0x5D3ED947u;
}
/// <summary>Returns the result of specified shuffling of the components from two int2 vectors into an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int shuffle(int2 a, int2 b, ShuffleComponent x)
{
return select_shuffle_component(a, b, x);
}
/// <summary>Returns the result of specified shuffling of the components from two int2 vectors into an int2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2 shuffle(int2 a, int2 b, ShuffleComponent x, ShuffleComponent y)
{
return int2(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y));
}
/// <summary>Returns the result of specified shuffling of the components from two int2 vectors into an int3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3 shuffle(int2 a, int2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z)
{
return int3(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y),
select_shuffle_component(a, b, z));
}
/// <summary>Returns the result of specified shuffling of the components from two int2 vectors into an int4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4 shuffle(int2 a, int2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z, ShuffleComponent w)
{
return int4(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y),
select_shuffle_component(a, b, z),
select_shuffle_component(a, b, w));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static int select_shuffle_component(int2 a, int2 b, ShuffleComponent component)
{
switch(component)
{
case ShuffleComponent.LeftX:
return a.x;
case ShuffleComponent.LeftY:
return a.y;
case ShuffleComponent.RightX:
return b.x;
case ShuffleComponent.RightY:
return b.y;
default:
throw new System.ArgumentException("Invalid shuffle component: " + component);
}
}
}
}

View File

@@ -0,0 +1,506 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct int2x2 : System.IEquatable<int2x2>, IFormattable
{
public int2 c0;
public int2 c1;
/// <summary>int2x2 identity transform.</summary>
public static readonly int2x2 identity = new int2x2(1, 0, 0, 1);
/// <summary>int2x2 zero value.</summary>
public static readonly int2x2 zero;
/// <summary>Constructs a int2x2 matrix from two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x2(int2 c0, int2 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a int2x2 matrix from 4 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x2(int m00, int m01,
int m10, int m11)
{
this.c0 = new int2(m00, m10);
this.c1 = new int2(m01, m11);
}
/// <summary>Constructs a int2x2 matrix from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x2(int v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a int2x2 matrix from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x2(bool v)
{
this.c0 = math.select(new int2(0), new int2(1), v);
this.c1 = math.select(new int2(0), new int2(1), v);
}
/// <summary>Constructs a int2x2 matrix from a bool2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x2(bool2x2 v)
{
this.c0 = math.select(new int2(0), new int2(1), v.c0);
this.c1 = math.select(new int2(0), new int2(1), v.c1);
}
/// <summary>Constructs a int2x2 matrix from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x2(uint v)
{
this.c0 = (int2)v;
this.c1 = (int2)v;
}
/// <summary>Constructs a int2x2 matrix from a uint2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x2(uint2x2 v)
{
this.c0 = (int2)v.c0;
this.c1 = (int2)v.c1;
}
/// <summary>Constructs a int2x2 matrix from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x2(float v)
{
this.c0 = (int2)v;
this.c1 = (int2)v;
}
/// <summary>Constructs a int2x2 matrix from a float2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x2(float2x2 v)
{
this.c0 = (int2)v.c0;
this.c1 = (int2)v.c1;
}
/// <summary>Constructs a int2x2 matrix from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x2(double v)
{
this.c0 = (int2)v;
this.c1 = (int2)v;
}
/// <summary>Constructs a int2x2 matrix from a double2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x2(double2x2 v)
{
this.c0 = (int2)v.c0;
this.c1 = (int2)v.c1;
}
/// <summary>Implicitly converts a single int value to a int2x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator int2x2(int v) { return new int2x2(v); }
/// <summary>Explicitly converts a single bool value to a int2x2 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x2(bool v) { return new int2x2(v); }
/// <summary>Explicitly converts a bool2x2 matrix to a int2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x2(bool2x2 v) { return new int2x2(v); }
/// <summary>Explicitly converts a single uint value to a int2x2 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x2(uint v) { return new int2x2(v); }
/// <summary>Explicitly converts a uint2x2 matrix to a int2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x2(uint2x2 v) { return new int2x2(v); }
/// <summary>Explicitly converts a single float value to a int2x2 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x2(float v) { return new int2x2(v); }
/// <summary>Explicitly converts a float2x2 matrix to a int2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x2(float2x2 v) { return new int2x2(v); }
/// <summary>Explicitly converts a single double value to a int2x2 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x2(double v) { return new int2x2(v); }
/// <summary>Explicitly converts a double2x2 matrix to a int2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x2(double2x2 v) { return new int2x2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two int2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator * (int2x2 lhs, int2x2 rhs) { return new int2x2 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1); }
/// <summary>Returns the result of a componentwise multiplication operation on an int2x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator * (int2x2 lhs, int rhs) { return new int2x2 (lhs.c0 * rhs, lhs.c1 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on an int value and an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator * (int lhs, int2x2 rhs) { return new int2x2 (lhs * rhs.c0, lhs * rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on two int2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator + (int2x2 lhs, int2x2 rhs) { return new int2x2 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on an int2x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator + (int2x2 lhs, int rhs) { return new int2x2 (lhs.c0 + rhs, lhs.c1 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on an int value and an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator + (int lhs, int2x2 rhs) { return new int2x2 (lhs + rhs.c0, lhs + rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on two int2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator - (int2x2 lhs, int2x2 rhs) { return new int2x2 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on an int2x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator - (int2x2 lhs, int rhs) { return new int2x2 (lhs.c0 - rhs, lhs.c1 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on an int value and an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator - (int lhs, int2x2 rhs) { return new int2x2 (lhs - rhs.c0, lhs - rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on two int2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator / (int2x2 lhs, int2x2 rhs) { return new int2x2 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on an int2x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator / (int2x2 lhs, int rhs) { return new int2x2 (lhs.c0 / rhs, lhs.c1 / rhs); }
/// <summary>Returns the result of a componentwise division operation on an int value and an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator / (int lhs, int2x2 rhs) { return new int2x2 (lhs / rhs.c0, lhs / rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on two int2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator % (int2x2 lhs, int2x2 rhs) { return new int2x2 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on an int2x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator % (int2x2 lhs, int rhs) { return new int2x2 (lhs.c0 % rhs, lhs.c1 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on an int value and an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator % (int lhs, int2x2 rhs) { return new int2x2 (lhs % rhs.c0, lhs % rhs.c1); }
/// <summary>Returns the result of a componentwise increment operation on an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator ++ (int2x2 val) { return new int2x2 (++val.c0, ++val.c1); }
/// <summary>Returns the result of a componentwise decrement operation on an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator -- (int2x2 val) { return new int2x2 (--val.c0, --val.c1); }
/// <summary>Returns the result of a componentwise less than operation on two int2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator < (int2x2 lhs, int2x2 rhs) { return new bool2x2 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1); }
/// <summary>Returns the result of a componentwise less than operation on an int2x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator < (int2x2 lhs, int rhs) { return new bool2x2 (lhs.c0 < rhs, lhs.c1 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on an int value and an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator < (int lhs, int2x2 rhs) { return new bool2x2 (lhs < rhs.c0, lhs < rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on two int2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator <= (int2x2 lhs, int2x2 rhs) { return new bool2x2 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on an int2x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator <= (int2x2 lhs, int rhs) { return new bool2x2 (lhs.c0 <= rhs, lhs.c1 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on an int value and an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator <= (int lhs, int2x2 rhs) { return new bool2x2 (lhs <= rhs.c0, lhs <= rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on two int2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator > (int2x2 lhs, int2x2 rhs) { return new bool2x2 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on an int2x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator > (int2x2 lhs, int rhs) { return new bool2x2 (lhs.c0 > rhs, lhs.c1 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on an int value and an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator > (int lhs, int2x2 rhs) { return new bool2x2 (lhs > rhs.c0, lhs > rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on two int2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator >= (int2x2 lhs, int2x2 rhs) { return new bool2x2 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int2x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator >= (int2x2 lhs, int rhs) { return new bool2x2 (lhs.c0 >= rhs, lhs.c1 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int value and an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator >= (int lhs, int2x2 rhs) { return new bool2x2 (lhs >= rhs.c0, lhs >= rhs.c1); }
/// <summary>Returns the result of a componentwise unary minus operation on an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator - (int2x2 val) { return new int2x2 (-val.c0, -val.c1); }
/// <summary>Returns the result of a componentwise unary plus operation on an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator + (int2x2 val) { return new int2x2 (+val.c0, +val.c1); }
/// <summary>Returns the result of a componentwise left shift operation on an int2x2 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator << (int2x2 x, int n) { return new int2x2 (x.c0 << n, x.c1 << n); }
/// <summary>Returns the result of a componentwise right shift operation on an int2x2 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator >> (int2x2 x, int n) { return new int2x2 (x.c0 >> n, x.c1 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two int2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (int2x2 lhs, int2x2 rhs) { return new bool2x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on an int2x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (int2x2 lhs, int rhs) { return new bool2x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on an int value and an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (int lhs, int2x2 rhs) { return new bool2x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two int2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (int2x2 lhs, int2x2 rhs) { return new bool2x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on an int2x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (int2x2 lhs, int rhs) { return new bool2x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on an int value and an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (int lhs, int2x2 rhs) { return new bool2x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise not operation on an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator ~ (int2x2 val) { return new int2x2 (~val.c0, ~val.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on two int2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator & (int2x2 lhs, int2x2 rhs) { return new int2x2 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int2x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator & (int2x2 lhs, int rhs) { return new int2x2 (lhs.c0 & rhs, lhs.c1 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int value and an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator & (int lhs, int2x2 rhs) { return new int2x2 (lhs & rhs.c0, lhs & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on two int2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator | (int2x2 lhs, int2x2 rhs) { return new int2x2 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int2x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator | (int2x2 lhs, int rhs) { return new int2x2 (lhs.c0 | rhs, lhs.c1 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int value and an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator | (int lhs, int2x2 rhs) { return new int2x2 (lhs | rhs.c0, lhs | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two int2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator ^ (int2x2 lhs, int2x2 rhs) { return new int2x2 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int2x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator ^ (int2x2 lhs, int rhs) { return new int2x2 (lhs.c0 ^ rhs, lhs.c1 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int value and an int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 operator ^ (int lhs, int2x2 rhs) { return new int2x2 (lhs ^ rhs.c0, lhs ^ rhs.c1); }
/// <summary>Returns the int2 element at a specified index.</summary>
unsafe public ref int2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (int2x2* array = &this) { return ref ((int2*)array)[index]; }
}
}
/// <summary>Returns true if the int2x2 is equal to a given int2x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(int2x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the int2x2 is equal to a given int2x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((int2x2)o); }
/// <summary>Returns a hash code for the int2x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the int2x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("int2x2({0}, {1}, {2}, {3})", c0.x, c1.x, c0.y, c1.y);
}
/// <summary>Returns a string representation of the int2x2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("int2x2({0}, {1}, {2}, {3})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a int2x2 matrix constructed from two int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 int2x2(int2 c0, int2 c1) { return new int2x2(c0, c1); }
/// <summary>Returns a int2x2 matrix constructed from from 4 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 int2x2(int m00, int m01,
int m10, int m11)
{
return new int2x2(m00, m01,
m10, m11);
}
/// <summary>Returns a int2x2 matrix constructed from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 int2x2(int v) { return new int2x2(v); }
/// <summary>Returns a int2x2 matrix constructed from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 int2x2(bool v) { return new int2x2(v); }
/// <summary>Return a int2x2 matrix constructed from a bool2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 int2x2(bool2x2 v) { return new int2x2(v); }
/// <summary>Returns a int2x2 matrix constructed from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 int2x2(uint v) { return new int2x2(v); }
/// <summary>Return a int2x2 matrix constructed from a uint2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 int2x2(uint2x2 v) { return new int2x2(v); }
/// <summary>Returns a int2x2 matrix constructed from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 int2x2(float v) { return new int2x2(v); }
/// <summary>Return a int2x2 matrix constructed from a float2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 int2x2(float2x2 v) { return new int2x2(v); }
/// <summary>Returns a int2x2 matrix constructed from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 int2x2(double v) { return new int2x2(v); }
/// <summary>Return a int2x2 matrix constructed from a double2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 int2x2(double2x2 v) { return new int2x2(v); }
/// <summary>Return the int2x2 transpose of a int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x2 transpose(int2x2 v)
{
return int2x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y);
}
/// <summary>Returns the determinant of a int2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int determinant(int2x2 m)
{
int a = m.c0.x;
int b = m.c1.x;
int c = m.c0.y;
int d = m.c1.y;
return a * d - b * c;
}
/// <summary>Returns a uint hash code of a int2x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(int2x2 v)
{
return csum(asuint(v.c0) * uint2(0xE191B035u, 0x68586FAFu) +
asuint(v.c1) * uint2(0xD4DFF6D3u, 0xCB634F4Du)) + 0x9B13B92Du;
}
/// <summary>
/// Returns a uint2 vector hash code of a int2x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(int2x2 v)
{
return (asuint(v.c0) * uint2(0x4ABF0813u, 0x86068063u) +
asuint(v.c1) * uint2(0xD75513F9u, 0x5AB3E8CDu)) + 0x676E8407u;
}
}
}

View File

@@ -0,0 +1,506 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct int2x3 : System.IEquatable<int2x3>, IFormattable
{
public int2 c0;
public int2 c1;
public int2 c2;
/// <summary>int2x3 zero value.</summary>
public static readonly int2x3 zero;
/// <summary>Constructs a int2x3 matrix from three int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x3(int2 c0, int2 c1, int2 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a int2x3 matrix from 6 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x3(int m00, int m01, int m02,
int m10, int m11, int m12)
{
this.c0 = new int2(m00, m10);
this.c1 = new int2(m01, m11);
this.c2 = new int2(m02, m12);
}
/// <summary>Constructs a int2x3 matrix from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x3(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a int2x3 matrix from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x3(bool v)
{
this.c0 = math.select(new int2(0), new int2(1), v);
this.c1 = math.select(new int2(0), new int2(1), v);
this.c2 = math.select(new int2(0), new int2(1), v);
}
/// <summary>Constructs a int2x3 matrix from a bool2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x3(bool2x3 v)
{
this.c0 = math.select(new int2(0), new int2(1), v.c0);
this.c1 = math.select(new int2(0), new int2(1), v.c1);
this.c2 = math.select(new int2(0), new int2(1), v.c2);
}
/// <summary>Constructs a int2x3 matrix from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x3(uint v)
{
this.c0 = (int2)v;
this.c1 = (int2)v;
this.c2 = (int2)v;
}
/// <summary>Constructs a int2x3 matrix from a uint2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x3(uint2x3 v)
{
this.c0 = (int2)v.c0;
this.c1 = (int2)v.c1;
this.c2 = (int2)v.c2;
}
/// <summary>Constructs a int2x3 matrix from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x3(float v)
{
this.c0 = (int2)v;
this.c1 = (int2)v;
this.c2 = (int2)v;
}
/// <summary>Constructs a int2x3 matrix from a float2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x3(float2x3 v)
{
this.c0 = (int2)v.c0;
this.c1 = (int2)v.c1;
this.c2 = (int2)v.c2;
}
/// <summary>Constructs a int2x3 matrix from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x3(double v)
{
this.c0 = (int2)v;
this.c1 = (int2)v;
this.c2 = (int2)v;
}
/// <summary>Constructs a int2x3 matrix from a double2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x3(double2x3 v)
{
this.c0 = (int2)v.c0;
this.c1 = (int2)v.c1;
this.c2 = (int2)v.c2;
}
/// <summary>Implicitly converts a single int value to a int2x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator int2x3(int v) { return new int2x3(v); }
/// <summary>Explicitly converts a single bool value to a int2x3 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x3(bool v) { return new int2x3(v); }
/// <summary>Explicitly converts a bool2x3 matrix to a int2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x3(bool2x3 v) { return new int2x3(v); }
/// <summary>Explicitly converts a single uint value to a int2x3 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x3(uint v) { return new int2x3(v); }
/// <summary>Explicitly converts a uint2x3 matrix to a int2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x3(uint2x3 v) { return new int2x3(v); }
/// <summary>Explicitly converts a single float value to a int2x3 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x3(float v) { return new int2x3(v); }
/// <summary>Explicitly converts a float2x3 matrix to a int2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x3(float2x3 v) { return new int2x3(v); }
/// <summary>Explicitly converts a single double value to a int2x3 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x3(double v) { return new int2x3(v); }
/// <summary>Explicitly converts a double2x3 matrix to a int2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x3(double2x3 v) { return new int2x3(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two int2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator * (int2x3 lhs, int2x3 rhs) { return new int2x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); }
/// <summary>Returns the result of a componentwise multiplication operation on an int2x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator * (int2x3 lhs, int rhs) { return new int2x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on an int value and an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator * (int lhs, int2x3 rhs) { return new int2x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on two int2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator + (int2x3 lhs, int2x3 rhs) { return new int2x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on an int2x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator + (int2x3 lhs, int rhs) { return new int2x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on an int value and an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator + (int lhs, int2x3 rhs) { return new int2x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on two int2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator - (int2x3 lhs, int2x3 rhs) { return new int2x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on an int2x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator - (int2x3 lhs, int rhs) { return new int2x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on an int value and an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator - (int lhs, int2x3 rhs) { return new int2x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on two int2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator / (int2x3 lhs, int2x3 rhs) { return new int2x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on an int2x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator / (int2x3 lhs, int rhs) { return new int2x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); }
/// <summary>Returns the result of a componentwise division operation on an int value and an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator / (int lhs, int2x3 rhs) { return new int2x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on two int2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator % (int2x3 lhs, int2x3 rhs) { return new int2x3 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on an int2x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator % (int2x3 lhs, int rhs) { return new int2x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on an int value and an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator % (int lhs, int2x3 rhs) { return new int2x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); }
/// <summary>Returns the result of a componentwise increment operation on an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator ++ (int2x3 val) { return new int2x3 (++val.c0, ++val.c1, ++val.c2); }
/// <summary>Returns the result of a componentwise decrement operation on an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator -- (int2x3 val) { return new int2x3 (--val.c0, --val.c1, --val.c2); }
/// <summary>Returns the result of a componentwise less than operation on two int2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator < (int2x3 lhs, int2x3 rhs) { return new bool2x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); }
/// <summary>Returns the result of a componentwise less than operation on an int2x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator < (int2x3 lhs, int rhs) { return new bool2x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on an int value and an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator < (int lhs, int2x3 rhs) { return new bool2x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on two int2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator <= (int2x3 lhs, int2x3 rhs) { return new bool2x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on an int2x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator <= (int2x3 lhs, int rhs) { return new bool2x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on an int value and an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator <= (int lhs, int2x3 rhs) { return new bool2x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on two int2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator > (int2x3 lhs, int2x3 rhs) { return new bool2x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on an int2x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator > (int2x3 lhs, int rhs) { return new bool2x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on an int value and an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator > (int lhs, int2x3 rhs) { return new bool2x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on two int2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator >= (int2x3 lhs, int2x3 rhs) { return new bool2x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int2x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator >= (int2x3 lhs, int rhs) { return new bool2x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int value and an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator >= (int lhs, int2x3 rhs) { return new bool2x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); }
/// <summary>Returns the result of a componentwise unary minus operation on an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator - (int2x3 val) { return new int2x3 (-val.c0, -val.c1, -val.c2); }
/// <summary>Returns the result of a componentwise unary plus operation on an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator + (int2x3 val) { return new int2x3 (+val.c0, +val.c1, +val.c2); }
/// <summary>Returns the result of a componentwise left shift operation on an int2x3 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator << (int2x3 x, int n) { return new int2x3 (x.c0 << n, x.c1 << n, x.c2 << n); }
/// <summary>Returns the result of a componentwise right shift operation on an int2x3 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator >> (int2x3 x, int n) { return new int2x3 (x.c0 >> n, x.c1 >> n, x.c2 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two int2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (int2x3 lhs, int2x3 rhs) { return new bool2x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on an int2x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (int2x3 lhs, int rhs) { return new bool2x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on an int value and an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (int lhs, int2x3 rhs) { return new bool2x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two int2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (int2x3 lhs, int2x3 rhs) { return new bool2x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on an int2x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (int2x3 lhs, int rhs) { return new bool2x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on an int value and an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (int lhs, int2x3 rhs) { return new bool2x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise not operation on an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator ~ (int2x3 val) { return new int2x3 (~val.c0, ~val.c1, ~val.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on two int2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator & (int2x3 lhs, int2x3 rhs) { return new int2x3 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int2x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator & (int2x3 lhs, int rhs) { return new int2x3 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int value and an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator & (int lhs, int2x3 rhs) { return new int2x3 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on two int2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator | (int2x3 lhs, int2x3 rhs) { return new int2x3 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int2x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator | (int2x3 lhs, int rhs) { return new int2x3 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int value and an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator | (int lhs, int2x3 rhs) { return new int2x3 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two int2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator ^ (int2x3 lhs, int2x3 rhs) { return new int2x3 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int2x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator ^ (int2x3 lhs, int rhs) { return new int2x3 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int value and an int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 operator ^ (int lhs, int2x3 rhs) { return new int2x3 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2); }
/// <summary>Returns the int2 element at a specified index.</summary>
unsafe public ref int2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (int2x3* array = &this) { return ref ((int2*)array)[index]; }
}
}
/// <summary>Returns true if the int2x3 is equal to a given int2x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(int2x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the int2x3 is equal to a given int2x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((int2x3)o); }
/// <summary>Returns a hash code for the int2x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the int2x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("int2x3({0}, {1}, {2}, {3}, {4}, {5})", c0.x, c1.x, c2.x, c0.y, c1.y, c2.y);
}
/// <summary>Returns a string representation of the int2x3 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("int2x3({0}, {1}, {2}, {3}, {4}, {5})", 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));
}
}
public static partial class math
{
/// <summary>Returns a int2x3 matrix constructed from three int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 int2x3(int2 c0, int2 c1, int2 c2) { return new int2x3(c0, c1, c2); }
/// <summary>Returns a int2x3 matrix constructed from from 6 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 int2x3(int m00, int m01, int m02,
int m10, int m11, int m12)
{
return new int2x3(m00, m01, m02,
m10, m11, m12);
}
/// <summary>Returns a int2x3 matrix constructed from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 int2x3(int v) { return new int2x3(v); }
/// <summary>Returns a int2x3 matrix constructed from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 int2x3(bool v) { return new int2x3(v); }
/// <summary>Return a int2x3 matrix constructed from a bool2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 int2x3(bool2x3 v) { return new int2x3(v); }
/// <summary>Returns a int2x3 matrix constructed from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 int2x3(uint v) { return new int2x3(v); }
/// <summary>Return a int2x3 matrix constructed from a uint2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 int2x3(uint2x3 v) { return new int2x3(v); }
/// <summary>Returns a int2x3 matrix constructed from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 int2x3(float v) { return new int2x3(v); }
/// <summary>Return a int2x3 matrix constructed from a float2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 int2x3(float2x3 v) { return new int2x3(v); }
/// <summary>Returns a int2x3 matrix constructed from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 int2x3(double v) { return new int2x3(v); }
/// <summary>Return a int2x3 matrix constructed from a double2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 int2x3(double2x3 v) { return new int2x3(v); }
/// <summary>Return the int3x2 transpose of a int2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 transpose(int2x3 v)
{
return int3x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y,
v.c2.x, v.c2.y);
}
/// <summary>Returns a uint hash code of a int2x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(int2x3 v)
{
return csum(asuint(v.c0) * uint2(0xCAE78587u, 0x7A1541C9u) +
asuint(v.c1) * uint2(0xF83BD927u, 0x6A243BCBu) +
asuint(v.c2) * uint2(0x509B84C9u, 0x91D13847u)) + 0x52F7230Fu;
}
/// <summary>
/// Returns a uint2 vector hash code of a int2x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(int2x3 v)
{
return (asuint(v.c0) * uint2(0xCF286E83u, 0xE121E6ADu) +
asuint(v.c1) * uint2(0xC9CA1249u, 0x69B60C81u) +
asuint(v.c2) * uint2(0xE0EB6C25u, 0xF648BEABu)) + 0x6BDB2B07u;
}
}
}

View File

@@ -0,0 +1,521 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct int2x4 : System.IEquatable<int2x4>, IFormattable
{
public int2 c0;
public int2 c1;
public int2 c2;
public int2 c3;
/// <summary>int2x4 zero value.</summary>
public static readonly int2x4 zero;
/// <summary>Constructs a int2x4 matrix from four int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x4(int2 c0, int2 c1, int2 c2, int2 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a int2x4 matrix from 8 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x4(int m00, int m01, int m02, int m03,
int m10, int m11, int m12, int m13)
{
this.c0 = new int2(m00, m10);
this.c1 = new int2(m01, m11);
this.c2 = new int2(m02, m12);
this.c3 = new int2(m03, m13);
}
/// <summary>Constructs a int2x4 matrix from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x4(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a int2x4 matrix from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x4(bool v)
{
this.c0 = math.select(new int2(0), new int2(1), v);
this.c1 = math.select(new int2(0), new int2(1), v);
this.c2 = math.select(new int2(0), new int2(1), v);
this.c3 = math.select(new int2(0), new int2(1), v);
}
/// <summary>Constructs a int2x4 matrix from a bool2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x4(bool2x4 v)
{
this.c0 = math.select(new int2(0), new int2(1), v.c0);
this.c1 = math.select(new int2(0), new int2(1), v.c1);
this.c2 = math.select(new int2(0), new int2(1), v.c2);
this.c3 = math.select(new int2(0), new int2(1), v.c3);
}
/// <summary>Constructs a int2x4 matrix from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x4(uint v)
{
this.c0 = (int2)v;
this.c1 = (int2)v;
this.c2 = (int2)v;
this.c3 = (int2)v;
}
/// <summary>Constructs a int2x4 matrix from a uint2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x4(uint2x4 v)
{
this.c0 = (int2)v.c0;
this.c1 = (int2)v.c1;
this.c2 = (int2)v.c2;
this.c3 = (int2)v.c3;
}
/// <summary>Constructs a int2x4 matrix from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x4(float v)
{
this.c0 = (int2)v;
this.c1 = (int2)v;
this.c2 = (int2)v;
this.c3 = (int2)v;
}
/// <summary>Constructs a int2x4 matrix from a float2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x4(float2x4 v)
{
this.c0 = (int2)v.c0;
this.c1 = (int2)v.c1;
this.c2 = (int2)v.c2;
this.c3 = (int2)v.c3;
}
/// <summary>Constructs a int2x4 matrix from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x4(double v)
{
this.c0 = (int2)v;
this.c1 = (int2)v;
this.c2 = (int2)v;
this.c3 = (int2)v;
}
/// <summary>Constructs a int2x4 matrix from a double2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2x4(double2x4 v)
{
this.c0 = (int2)v.c0;
this.c1 = (int2)v.c1;
this.c2 = (int2)v.c2;
this.c3 = (int2)v.c3;
}
/// <summary>Implicitly converts a single int value to a int2x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator int2x4(int v) { return new int2x4(v); }
/// <summary>Explicitly converts a single bool value to a int2x4 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x4(bool v) { return new int2x4(v); }
/// <summary>Explicitly converts a bool2x4 matrix to a int2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x4(bool2x4 v) { return new int2x4(v); }
/// <summary>Explicitly converts a single uint value to a int2x4 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x4(uint v) { return new int2x4(v); }
/// <summary>Explicitly converts a uint2x4 matrix to a int2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x4(uint2x4 v) { return new int2x4(v); }
/// <summary>Explicitly converts a single float value to a int2x4 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x4(float v) { return new int2x4(v); }
/// <summary>Explicitly converts a float2x4 matrix to a int2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x4(float2x4 v) { return new int2x4(v); }
/// <summary>Explicitly converts a single double value to a int2x4 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x4(double v) { return new int2x4(v); }
/// <summary>Explicitly converts a double2x4 matrix to a int2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int2x4(double2x4 v) { return new int2x4(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two int2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator * (int2x4 lhs, int2x4 rhs) { return new int2x4 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2, lhs.c3 * rhs.c3); }
/// <summary>Returns the result of a componentwise multiplication operation on an int2x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator * (int2x4 lhs, int rhs) { return new int2x4 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs, lhs.c3 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on an int value and an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator * (int lhs, int2x4 rhs) { return new int2x4 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2, lhs * rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on two int2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator + (int2x4 lhs, int2x4 rhs) { return new int2x4 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2, lhs.c3 + rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on an int2x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator + (int2x4 lhs, int rhs) { return new int2x4 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs, lhs.c3 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on an int value and an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator + (int lhs, int2x4 rhs) { return new int2x4 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2, lhs + rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on two int2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator - (int2x4 lhs, int2x4 rhs) { return new int2x4 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2, lhs.c3 - rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on an int2x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator - (int2x4 lhs, int rhs) { return new int2x4 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs, lhs.c3 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on an int value and an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator - (int lhs, int2x4 rhs) { return new int2x4 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2, lhs - rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on two int2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator / (int2x4 lhs, int2x4 rhs) { return new int2x4 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2, lhs.c3 / rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on an int2x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator / (int2x4 lhs, int rhs) { return new int2x4 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs, lhs.c3 / rhs); }
/// <summary>Returns the result of a componentwise division operation on an int value and an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator / (int lhs, int2x4 rhs) { return new int2x4 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2, lhs / rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on two int2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator % (int2x4 lhs, int2x4 rhs) { return new int2x4 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2, lhs.c3 % rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on an int2x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator % (int2x4 lhs, int rhs) { return new int2x4 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs, lhs.c3 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on an int value and an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator % (int lhs, int2x4 rhs) { return new int2x4 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2, lhs % rhs.c3); }
/// <summary>Returns the result of a componentwise increment operation on an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator ++ (int2x4 val) { return new int2x4 (++val.c0, ++val.c1, ++val.c2, ++val.c3); }
/// <summary>Returns the result of a componentwise decrement operation on an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator -- (int2x4 val) { return new int2x4 (--val.c0, --val.c1, --val.c2, --val.c3); }
/// <summary>Returns the result of a componentwise less than operation on two int2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator < (int2x4 lhs, int2x4 rhs) { return new bool2x4 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2, lhs.c3 < rhs.c3); }
/// <summary>Returns the result of a componentwise less than operation on an int2x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator < (int2x4 lhs, int rhs) { return new bool2x4 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs, lhs.c3 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on an int value and an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator < (int lhs, int2x4 rhs) { return new bool2x4 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2, lhs < rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on two int2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator <= (int2x4 lhs, int2x4 rhs) { return new bool2x4 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2, lhs.c3 <= rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on an int2x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator <= (int2x4 lhs, int rhs) { return new bool2x4 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs, lhs.c3 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on an int value and an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator <= (int lhs, int2x4 rhs) { return new bool2x4 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2, lhs <= rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on two int2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator > (int2x4 lhs, int2x4 rhs) { return new bool2x4 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2, lhs.c3 > rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on an int2x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator > (int2x4 lhs, int rhs) { return new bool2x4 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs, lhs.c3 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on an int value and an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator > (int lhs, int2x4 rhs) { return new bool2x4 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2, lhs > rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on two int2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator >= (int2x4 lhs, int2x4 rhs) { return new bool2x4 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2, lhs.c3 >= rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int2x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator >= (int2x4 lhs, int rhs) { return new bool2x4 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs, lhs.c3 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int value and an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator >= (int lhs, int2x4 rhs) { return new bool2x4 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2, lhs >= rhs.c3); }
/// <summary>Returns the result of a componentwise unary minus operation on an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator - (int2x4 val) { return new int2x4 (-val.c0, -val.c1, -val.c2, -val.c3); }
/// <summary>Returns the result of a componentwise unary plus operation on an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator + (int2x4 val) { return new int2x4 (+val.c0, +val.c1, +val.c2, +val.c3); }
/// <summary>Returns the result of a componentwise left shift operation on an int2x4 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator << (int2x4 x, int n) { return new int2x4 (x.c0 << n, x.c1 << n, x.c2 << n, x.c3 << n); }
/// <summary>Returns the result of a componentwise right shift operation on an int2x4 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator >> (int2x4 x, int n) { return new int2x4 (x.c0 >> n, x.c1 >> n, x.c2 >> n, x.c3 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two int2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (int2x4 lhs, int2x4 rhs) { return new bool2x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on an int2x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (int2x4 lhs, int rhs) { return new bool2x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on an int value and an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (int lhs, int2x4 rhs) { return new bool2x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two int2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (int2x4 lhs, int2x4 rhs) { return new bool2x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on an int2x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (int2x4 lhs, int rhs) { return new bool2x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on an int value and an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (int lhs, int2x4 rhs) { return new bool2x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise not operation on an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator ~ (int2x4 val) { return new int2x4 (~val.c0, ~val.c1, ~val.c2, ~val.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on two int2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator & (int2x4 lhs, int2x4 rhs) { return new int2x4 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2, lhs.c3 & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int2x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator & (int2x4 lhs, int rhs) { return new int2x4 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs, lhs.c3 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int value and an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator & (int lhs, int2x4 rhs) { return new int2x4 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2, lhs & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on two int2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator | (int2x4 lhs, int2x4 rhs) { return new int2x4 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2, lhs.c3 | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int2x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator | (int2x4 lhs, int rhs) { return new int2x4 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs, lhs.c3 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int value and an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator | (int lhs, int2x4 rhs) { return new int2x4 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2, lhs | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two int2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator ^ (int2x4 lhs, int2x4 rhs) { return new int2x4 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2, lhs.c3 ^ rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int2x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator ^ (int2x4 lhs, int rhs) { return new int2x4 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs, lhs.c3 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int value and an int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 operator ^ (int lhs, int2x4 rhs) { return new int2x4 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2, lhs ^ rhs.c3); }
/// <summary>Returns the int2 element at a specified index.</summary>
unsafe public ref int2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (int2x4* array = &this) { return ref ((int2*)array)[index]; }
}
}
/// <summary>Returns true if the int2x4 is equal to a given int2x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(int2x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the int2x4 is equal to a given int2x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((int2x4)o); }
/// <summary>Returns a hash code for the int2x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the int2x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("int2x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y);
}
/// <summary>Returns a string representation of the int2x4 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("int2x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c3.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider), c3.y.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a int2x4 matrix constructed from four int2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 int2x4(int2 c0, int2 c1, int2 c2, int2 c3) { return new int2x4(c0, c1, c2, c3); }
/// <summary>Returns a int2x4 matrix constructed from from 8 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 int2x4(int m00, int m01, int m02, int m03,
int m10, int m11, int m12, int m13)
{
return new int2x4(m00, m01, m02, m03,
m10, m11, m12, m13);
}
/// <summary>Returns a int2x4 matrix constructed from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 int2x4(int v) { return new int2x4(v); }
/// <summary>Returns a int2x4 matrix constructed from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 int2x4(bool v) { return new int2x4(v); }
/// <summary>Return a int2x4 matrix constructed from a bool2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 int2x4(bool2x4 v) { return new int2x4(v); }
/// <summary>Returns a int2x4 matrix constructed from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 int2x4(uint v) { return new int2x4(v); }
/// <summary>Return a int2x4 matrix constructed from a uint2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 int2x4(uint2x4 v) { return new int2x4(v); }
/// <summary>Returns a int2x4 matrix constructed from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 int2x4(float v) { return new int2x4(v); }
/// <summary>Return a int2x4 matrix constructed from a float2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 int2x4(float2x4 v) { return new int2x4(v); }
/// <summary>Returns a int2x4 matrix constructed from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 int2x4(double v) { return new int2x4(v); }
/// <summary>Return a int2x4 matrix constructed from a double2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 int2x4(double2x4 v) { return new int2x4(v); }
/// <summary>Return the int4x2 transpose of a int2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 transpose(int2x4 v)
{
return int4x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y,
v.c2.x, v.c2.y,
v.c3.x, v.c3.y);
}
/// <summary>Returns a uint hash code of a int2x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(int2x4 v)
{
return csum(asuint(v.c0) * uint2(0x7AA07CD3u, 0xAF642BA9u) +
asuint(v.c1) * uint2(0xA8F2213Bu, 0x9F3FDC37u) +
asuint(v.c2) * uint2(0xAC60D0C3u, 0x9263662Fu) +
asuint(v.c3) * uint2(0xE69626FFu, 0xBD010EEBu)) + 0x9CEDE1D1u;
}
/// <summary>
/// Returns a uint2 vector hash code of a int2x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(int2x4 v)
{
return (asuint(v.c0) * uint2(0x43BE0B51u, 0xAF836EE1u) +
asuint(v.c1) * uint2(0xB130C137u, 0x54834775u) +
asuint(v.c2) * uint2(0x7C022221u, 0xA2D00EDFu) +
asuint(v.c3) * uint2(0xA8977779u, 0x9F1C739Bu)) + 0x4B1BD187u;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,494 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct int3x2 : System.IEquatable<int3x2>, IFormattable
{
public int3 c0;
public int3 c1;
/// <summary>int3x2 zero value.</summary>
public static readonly int3x2 zero;
/// <summary>Constructs a int3x2 matrix from two int3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x2(int3 c0, int3 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a int3x2 matrix from 6 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x2(int m00, int m01,
int m10, int m11,
int m20, int m21)
{
this.c0 = new int3(m00, m10, m20);
this.c1 = new int3(m01, m11, m21);
}
/// <summary>Constructs a int3x2 matrix from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x2(int v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a int3x2 matrix from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x2(bool v)
{
this.c0 = math.select(new int3(0), new int3(1), v);
this.c1 = math.select(new int3(0), new int3(1), v);
}
/// <summary>Constructs a int3x2 matrix from a bool3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x2(bool3x2 v)
{
this.c0 = math.select(new int3(0), new int3(1), v.c0);
this.c1 = math.select(new int3(0), new int3(1), v.c1);
}
/// <summary>Constructs a int3x2 matrix from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x2(uint v)
{
this.c0 = (int3)v;
this.c1 = (int3)v;
}
/// <summary>Constructs a int3x2 matrix from a uint3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x2(uint3x2 v)
{
this.c0 = (int3)v.c0;
this.c1 = (int3)v.c1;
}
/// <summary>Constructs a int3x2 matrix from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x2(float v)
{
this.c0 = (int3)v;
this.c1 = (int3)v;
}
/// <summary>Constructs a int3x2 matrix from a float3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x2(float3x2 v)
{
this.c0 = (int3)v.c0;
this.c1 = (int3)v.c1;
}
/// <summary>Constructs a int3x2 matrix from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x2(double v)
{
this.c0 = (int3)v;
this.c1 = (int3)v;
}
/// <summary>Constructs a int3x2 matrix from a double3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x2(double3x2 v)
{
this.c0 = (int3)v.c0;
this.c1 = (int3)v.c1;
}
/// <summary>Implicitly converts a single int value to a int3x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator int3x2(int v) { return new int3x2(v); }
/// <summary>Explicitly converts a single bool value to a int3x2 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x2(bool v) { return new int3x2(v); }
/// <summary>Explicitly converts a bool3x2 matrix to a int3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x2(bool3x2 v) { return new int3x2(v); }
/// <summary>Explicitly converts a single uint value to a int3x2 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x2(uint v) { return new int3x2(v); }
/// <summary>Explicitly converts a uint3x2 matrix to a int3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x2(uint3x2 v) { return new int3x2(v); }
/// <summary>Explicitly converts a single float value to a int3x2 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x2(float v) { return new int3x2(v); }
/// <summary>Explicitly converts a float3x2 matrix to a int3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x2(float3x2 v) { return new int3x2(v); }
/// <summary>Explicitly converts a single double value to a int3x2 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x2(double v) { return new int3x2(v); }
/// <summary>Explicitly converts a double3x2 matrix to a int3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x2(double3x2 v) { return new int3x2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two int3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator * (int3x2 lhs, int3x2 rhs) { return new int3x2 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1); }
/// <summary>Returns the result of a componentwise multiplication operation on an int3x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator * (int3x2 lhs, int rhs) { return new int3x2 (lhs.c0 * rhs, lhs.c1 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on an int value and an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator * (int lhs, int3x2 rhs) { return new int3x2 (lhs * rhs.c0, lhs * rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on two int3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator + (int3x2 lhs, int3x2 rhs) { return new int3x2 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on an int3x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator + (int3x2 lhs, int rhs) { return new int3x2 (lhs.c0 + rhs, lhs.c1 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on an int value and an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator + (int lhs, int3x2 rhs) { return new int3x2 (lhs + rhs.c0, lhs + rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on two int3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator - (int3x2 lhs, int3x2 rhs) { return new int3x2 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on an int3x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator - (int3x2 lhs, int rhs) { return new int3x2 (lhs.c0 - rhs, lhs.c1 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on an int value and an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator - (int lhs, int3x2 rhs) { return new int3x2 (lhs - rhs.c0, lhs - rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on two int3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator / (int3x2 lhs, int3x2 rhs) { return new int3x2 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on an int3x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator / (int3x2 lhs, int rhs) { return new int3x2 (lhs.c0 / rhs, lhs.c1 / rhs); }
/// <summary>Returns the result of a componentwise division operation on an int value and an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator / (int lhs, int3x2 rhs) { return new int3x2 (lhs / rhs.c0, lhs / rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on two int3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator % (int3x2 lhs, int3x2 rhs) { return new int3x2 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on an int3x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator % (int3x2 lhs, int rhs) { return new int3x2 (lhs.c0 % rhs, lhs.c1 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on an int value and an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator % (int lhs, int3x2 rhs) { return new int3x2 (lhs % rhs.c0, lhs % rhs.c1); }
/// <summary>Returns the result of a componentwise increment operation on an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator ++ (int3x2 val) { return new int3x2 (++val.c0, ++val.c1); }
/// <summary>Returns the result of a componentwise decrement operation on an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator -- (int3x2 val) { return new int3x2 (--val.c0, --val.c1); }
/// <summary>Returns the result of a componentwise less than operation on two int3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator < (int3x2 lhs, int3x2 rhs) { return new bool3x2 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1); }
/// <summary>Returns the result of a componentwise less than operation on an int3x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator < (int3x2 lhs, int rhs) { return new bool3x2 (lhs.c0 < rhs, lhs.c1 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on an int value and an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator < (int lhs, int3x2 rhs) { return new bool3x2 (lhs < rhs.c0, lhs < rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on two int3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator <= (int3x2 lhs, int3x2 rhs) { return new bool3x2 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on an int3x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator <= (int3x2 lhs, int rhs) { return new bool3x2 (lhs.c0 <= rhs, lhs.c1 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on an int value and an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator <= (int lhs, int3x2 rhs) { return new bool3x2 (lhs <= rhs.c0, lhs <= rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on two int3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator > (int3x2 lhs, int3x2 rhs) { return new bool3x2 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on an int3x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator > (int3x2 lhs, int rhs) { return new bool3x2 (lhs.c0 > rhs, lhs.c1 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on an int value and an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator > (int lhs, int3x2 rhs) { return new bool3x2 (lhs > rhs.c0, lhs > rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on two int3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator >= (int3x2 lhs, int3x2 rhs) { return new bool3x2 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int3x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator >= (int3x2 lhs, int rhs) { return new bool3x2 (lhs.c0 >= rhs, lhs.c1 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int value and an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator >= (int lhs, int3x2 rhs) { return new bool3x2 (lhs >= rhs.c0, lhs >= rhs.c1); }
/// <summary>Returns the result of a componentwise unary minus operation on an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator - (int3x2 val) { return new int3x2 (-val.c0, -val.c1); }
/// <summary>Returns the result of a componentwise unary plus operation on an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator + (int3x2 val) { return new int3x2 (+val.c0, +val.c1); }
/// <summary>Returns the result of a componentwise left shift operation on an int3x2 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator << (int3x2 x, int n) { return new int3x2 (x.c0 << n, x.c1 << n); }
/// <summary>Returns the result of a componentwise right shift operation on an int3x2 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator >> (int3x2 x, int n) { return new int3x2 (x.c0 >> n, x.c1 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two int3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (int3x2 lhs, int3x2 rhs) { return new bool3x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on an int3x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (int3x2 lhs, int rhs) { return new bool3x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on an int value and an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (int lhs, int3x2 rhs) { return new bool3x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two int3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (int3x2 lhs, int3x2 rhs) { return new bool3x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on an int3x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (int3x2 lhs, int rhs) { return new bool3x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on an int value and an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (int lhs, int3x2 rhs) { return new bool3x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise not operation on an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator ~ (int3x2 val) { return new int3x2 (~val.c0, ~val.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on two int3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator & (int3x2 lhs, int3x2 rhs) { return new int3x2 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int3x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator & (int3x2 lhs, int rhs) { return new int3x2 (lhs.c0 & rhs, lhs.c1 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int value and an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator & (int lhs, int3x2 rhs) { return new int3x2 (lhs & rhs.c0, lhs & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on two int3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator | (int3x2 lhs, int3x2 rhs) { return new int3x2 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int3x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator | (int3x2 lhs, int rhs) { return new int3x2 (lhs.c0 | rhs, lhs.c1 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int value and an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator | (int lhs, int3x2 rhs) { return new int3x2 (lhs | rhs.c0, lhs | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two int3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator ^ (int3x2 lhs, int3x2 rhs) { return new int3x2 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int3x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator ^ (int3x2 lhs, int rhs) { return new int3x2 (lhs.c0 ^ rhs, lhs.c1 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int value and an int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 operator ^ (int lhs, int3x2 rhs) { return new int3x2 (lhs ^ rhs.c0, lhs ^ rhs.c1); }
/// <summary>Returns the int3 element at a specified index.</summary>
unsafe public ref int3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (int3x2* array = &this) { return ref ((int3*)array)[index]; }
}
}
/// <summary>Returns true if the int3x2 is equal to a given int3x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(int3x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the int3x2 is equal to a given int3x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((int3x2)o); }
/// <summary>Returns a hash code for the int3x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the int3x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("int3x2({0}, {1}, {2}, {3}, {4}, {5})", c0.x, c1.x, c0.y, c1.y, c0.z, c1.z);
}
/// <summary>Returns a string representation of the int3x2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("int3x2({0}, {1}, {2}, {3}, {4}, {5})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a int3x2 matrix constructed from two int3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 int3x2(int3 c0, int3 c1) { return new int3x2(c0, c1); }
/// <summary>Returns a int3x2 matrix constructed from from 6 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 int3x2(int m00, int m01,
int m10, int m11,
int m20, int m21)
{
return new int3x2(m00, m01,
m10, m11,
m20, m21);
}
/// <summary>Returns a int3x2 matrix constructed from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 int3x2(int v) { return new int3x2(v); }
/// <summary>Returns a int3x2 matrix constructed from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 int3x2(bool v) { return new int3x2(v); }
/// <summary>Return a int3x2 matrix constructed from a bool3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 int3x2(bool3x2 v) { return new int3x2(v); }
/// <summary>Returns a int3x2 matrix constructed from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 int3x2(uint v) { return new int3x2(v); }
/// <summary>Return a int3x2 matrix constructed from a uint3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 int3x2(uint3x2 v) { return new int3x2(v); }
/// <summary>Returns a int3x2 matrix constructed from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 int3x2(float v) { return new int3x2(v); }
/// <summary>Return a int3x2 matrix constructed from a float3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 int3x2(float3x2 v) { return new int3x2(v); }
/// <summary>Returns a int3x2 matrix constructed from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 int3x2(double v) { return new int3x2(v); }
/// <summary>Return a int3x2 matrix constructed from a double3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x2 int3x2(double3x2 v) { return new int3x2(v); }
/// <summary>Return the int2x3 transpose of a int3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x3 transpose(int3x2 v)
{
return int2x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z);
}
/// <summary>Returns a uint hash code of a int3x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(int3x2 v)
{
return csum(asuint(v.c0) * uint3(0xDB3DE101u, 0x7B6D1B4Bu, 0x58399E77u) +
asuint(v.c1) * uint3(0x5EAC29C9u, 0xFC6014F9u, 0x6BF6693Fu)) + 0x9D1B1D9Bu;
}
/// <summary>
/// Returns a uint3 vector hash code of a int3x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(int3x2 v)
{
return (asuint(v.c0) * uint3(0xF842F5C1u, 0xA47EC335u, 0xA477DF57u) +
asuint(v.c1) * uint3(0xC4B1493Fu, 0xBA0966D3u, 0xAFBEE253u)) + 0x5B419C01u;
}
}
}

View File

@@ -0,0 +1,527 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct int3x3 : System.IEquatable<int3x3>, IFormattable
{
public int3 c0;
public int3 c1;
public int3 c2;
/// <summary>int3x3 identity transform.</summary>
public static readonly int3x3 identity = new int3x3(1, 0, 0, 0, 1, 0, 0, 0, 1);
/// <summary>int3x3 zero value.</summary>
public static readonly int3x3 zero;
/// <summary>Constructs a int3x3 matrix from three int3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x3(int3 c0, int3 c1, int3 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a int3x3 matrix from 9 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x3(int m00, int m01, int m02,
int m10, int m11, int m12,
int m20, int m21, int m22)
{
this.c0 = new int3(m00, m10, m20);
this.c1 = new int3(m01, m11, m21);
this.c2 = new int3(m02, m12, m22);
}
/// <summary>Constructs a int3x3 matrix from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x3(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a int3x3 matrix from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x3(bool v)
{
this.c0 = math.select(new int3(0), new int3(1), v);
this.c1 = math.select(new int3(0), new int3(1), v);
this.c2 = math.select(new int3(0), new int3(1), v);
}
/// <summary>Constructs a int3x3 matrix from a bool3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x3(bool3x3 v)
{
this.c0 = math.select(new int3(0), new int3(1), v.c0);
this.c1 = math.select(new int3(0), new int3(1), v.c1);
this.c2 = math.select(new int3(0), new int3(1), v.c2);
}
/// <summary>Constructs a int3x3 matrix from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x3(uint v)
{
this.c0 = (int3)v;
this.c1 = (int3)v;
this.c2 = (int3)v;
}
/// <summary>Constructs a int3x3 matrix from a uint3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x3(uint3x3 v)
{
this.c0 = (int3)v.c0;
this.c1 = (int3)v.c1;
this.c2 = (int3)v.c2;
}
/// <summary>Constructs a int3x3 matrix from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x3(float v)
{
this.c0 = (int3)v;
this.c1 = (int3)v;
this.c2 = (int3)v;
}
/// <summary>Constructs a int3x3 matrix from a float3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x3(float3x3 v)
{
this.c0 = (int3)v.c0;
this.c1 = (int3)v.c1;
this.c2 = (int3)v.c2;
}
/// <summary>Constructs a int3x3 matrix from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x3(double v)
{
this.c0 = (int3)v;
this.c1 = (int3)v;
this.c2 = (int3)v;
}
/// <summary>Constructs a int3x3 matrix from a double3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x3(double3x3 v)
{
this.c0 = (int3)v.c0;
this.c1 = (int3)v.c1;
this.c2 = (int3)v.c2;
}
/// <summary>Implicitly converts a single int value to a int3x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator int3x3(int v) { return new int3x3(v); }
/// <summary>Explicitly converts a single bool value to a int3x3 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x3(bool v) { return new int3x3(v); }
/// <summary>Explicitly converts a bool3x3 matrix to a int3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x3(bool3x3 v) { return new int3x3(v); }
/// <summary>Explicitly converts a single uint value to a int3x3 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x3(uint v) { return new int3x3(v); }
/// <summary>Explicitly converts a uint3x3 matrix to a int3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x3(uint3x3 v) { return new int3x3(v); }
/// <summary>Explicitly converts a single float value to a int3x3 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x3(float v) { return new int3x3(v); }
/// <summary>Explicitly converts a float3x3 matrix to a int3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x3(float3x3 v) { return new int3x3(v); }
/// <summary>Explicitly converts a single double value to a int3x3 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x3(double v) { return new int3x3(v); }
/// <summary>Explicitly converts a double3x3 matrix to a int3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x3(double3x3 v) { return new int3x3(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two int3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator * (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); }
/// <summary>Returns the result of a componentwise multiplication operation on an int3x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator * (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on an int value and an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator * (int lhs, int3x3 rhs) { return new int3x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on two int3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator + (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on an int3x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator + (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on an int value and an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator + (int lhs, int3x3 rhs) { return new int3x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on two int3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator - (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on an int3x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator - (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on an int value and an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator - (int lhs, int3x3 rhs) { return new int3x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on two int3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator / (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on an int3x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator / (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); }
/// <summary>Returns the result of a componentwise division operation on an int value and an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator / (int lhs, int3x3 rhs) { return new int3x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on two int3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator % (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on an int3x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator % (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on an int value and an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator % (int lhs, int3x3 rhs) { return new int3x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); }
/// <summary>Returns the result of a componentwise increment operation on an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator ++ (int3x3 val) { return new int3x3 (++val.c0, ++val.c1, ++val.c2); }
/// <summary>Returns the result of a componentwise decrement operation on an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator -- (int3x3 val) { return new int3x3 (--val.c0, --val.c1, --val.c2); }
/// <summary>Returns the result of a componentwise less than operation on two int3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator < (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); }
/// <summary>Returns the result of a componentwise less than operation on an int3x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator < (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on an int value and an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator < (int lhs, int3x3 rhs) { return new bool3x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on two int3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator <= (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on an int3x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator <= (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on an int value and an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator <= (int lhs, int3x3 rhs) { return new bool3x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on two int3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator > (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on an int3x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator > (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on an int value and an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator > (int lhs, int3x3 rhs) { return new bool3x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on two int3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator >= (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int3x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator >= (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int value and an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator >= (int lhs, int3x3 rhs) { return new bool3x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); }
/// <summary>Returns the result of a componentwise unary minus operation on an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator - (int3x3 val) { return new int3x3 (-val.c0, -val.c1, -val.c2); }
/// <summary>Returns the result of a componentwise unary plus operation on an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator + (int3x3 val) { return new int3x3 (+val.c0, +val.c1, +val.c2); }
/// <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>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator << (int3x3 x, int n) { return new int3x3 (x.c0 << n, x.c1 << n, x.c2 << n); }
/// <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>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator >> (int3x3 x, int n) { return new int3x3 (x.c0 >> n, x.c1 >> n, x.c2 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two int3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on an int3x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on an int value and an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (int lhs, int3x3 rhs) { return new bool3x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two int3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (int3x3 lhs, int3x3 rhs) { return new bool3x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on an int3x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (int3x3 lhs, int rhs) { return new bool3x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on an int value and an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (int lhs, int3x3 rhs) { return new bool3x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise not operation on an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator ~ (int3x3 val) { return new int3x3 (~val.c0, ~val.c1, ~val.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on two int3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator & (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int3x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator & (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int value and an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator & (int lhs, int3x3 rhs) { return new int3x3 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on two int3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator | (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int3x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator | (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int value and an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator | (int lhs, int3x3 rhs) { return new int3x3 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two int3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator ^ (int3x3 lhs, int3x3 rhs) { return new int3x3 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int3x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator ^ (int3x3 lhs, int rhs) { return new int3x3 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int value and an int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 operator ^ (int lhs, int3x3 rhs) { return new int3x3 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2); }
/// <summary>Returns the int3 element at a specified index.</summary>
unsafe public ref int3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (int3x3* array = &this) { return ref ((int3*)array)[index]; }
}
}
/// <summary>Returns true if the int3x3 is equal to a given int3x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(int3x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the int3x3 is equal to a given int3x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((int3x3)o); }
/// <summary>Returns a hash code for the int3x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the int3x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
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);
}
/// <summary>Returns a string representation of the int3x3 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
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));
}
}
public static partial class math
{
/// <summary>Returns a int3x3 matrix constructed from three int3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 int3x3(int3 c0, int3 c1, int3 c2) { return new int3x3(c0, c1, c2); }
/// <summary>Returns a int3x3 matrix constructed from from 9 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 int3x3(int m00, int m01, int m02,
int m10, int m11, int m12,
int m20, int m21, int m22)
{
return new int3x3(m00, m01, m02,
m10, m11, m12,
m20, m21, m22);
}
/// <summary>Returns a int3x3 matrix constructed from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 int3x3(int v) { return new int3x3(v); }
/// <summary>Returns a int3x3 matrix constructed from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 int3x3(bool v) { return new int3x3(v); }
/// <summary>Return a int3x3 matrix constructed from a bool3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 int3x3(bool3x3 v) { return new int3x3(v); }
/// <summary>Returns a int3x3 matrix constructed from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 int3x3(uint v) { return new int3x3(v); }
/// <summary>Return a int3x3 matrix constructed from a uint3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 int3x3(uint3x3 v) { return new int3x3(v); }
/// <summary>Returns a int3x3 matrix constructed from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 int3x3(float v) { return new int3x3(v); }
/// <summary>Return a int3x3 matrix constructed from a float3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 int3x3(float3x3 v) { return new int3x3(v); }
/// <summary>Returns a int3x3 matrix constructed from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 int3x3(double v) { return new int3x3(v); }
/// <summary>Return a int3x3 matrix constructed from a double3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 int3x3(double3x3 v) { return new int3x3(v); }
/// <summary>Return the int3x3 transpose of a int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x3 transpose(int3x3 v)
{
return int3x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z,
v.c2.x, v.c2.y, v.c2.z);
}
/// <summary>Returns the determinant of a int3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int determinant(int3x3 m)
{
int3 c0 = m.c0;
int3 c1 = m.c1;
int3 c2 = m.c2;
int m00 = c1.y * c2.z - c1.z * c2.y;
int m01 = c0.y * c2.z - c0.z * c2.y;
int m02 = c0.y * c1.z - c0.z * c1.y;
return c0.x * m00 - c1.x * m01 + c2.x * m02;
}
/// <summary>Returns a uint hash code of a int3x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(int3x3 v)
{
return csum(asuint(v.c0) * uint3(0x93C30C2Bu, 0xDCAF0351u, 0x6E050B01u) +
asuint(v.c1) * uint3(0x750FDBF5u, 0x7F3DD499u, 0x52EAAEBBu) +
asuint(v.c2) * uint3(0x4599C793u, 0x83B5E729u, 0xC267163Fu)) + 0x67BC9149u;
}
/// <summary>
/// Returns a uint3 vector hash code of a int3x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(int3x3 v)
{
return (asuint(v.c0) * uint3(0xAD7C5EC1u, 0x822A7D6Du, 0xB492BF15u) +
asuint(v.c1) * uint3(0xD37220E3u, 0x7AA2C2BDu, 0xE16BC89Du) +
asuint(v.c2) * uint3(0x7AA07CD3u, 0xAF642BA9u, 0xA8F2213Bu)) + 0x9F3FDC37u;
}
}
}

View File

@@ -0,0 +1,524 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct int3x4 : System.IEquatable<int3x4>, IFormattable
{
public int3 c0;
public int3 c1;
public int3 c2;
public int3 c3;
/// <summary>int3x4 zero value.</summary>
public static readonly int3x4 zero;
/// <summary>Constructs a int3x4 matrix from four int3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x4(int3 c0, int3 c1, int3 c2, int3 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a int3x4 matrix from 12 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x4(int m00, int m01, int m02, int m03,
int m10, int m11, int m12, int m13,
int m20, int m21, int m22, int m23)
{
this.c0 = new int3(m00, m10, m20);
this.c1 = new int3(m01, m11, m21);
this.c2 = new int3(m02, m12, m22);
this.c3 = new int3(m03, m13, m23);
}
/// <summary>Constructs a int3x4 matrix from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x4(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a int3x4 matrix from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x4(bool v)
{
this.c0 = math.select(new int3(0), new int3(1), v);
this.c1 = math.select(new int3(0), new int3(1), v);
this.c2 = math.select(new int3(0), new int3(1), v);
this.c3 = math.select(new int3(0), new int3(1), v);
}
/// <summary>Constructs a int3x4 matrix from a bool3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x4(bool3x4 v)
{
this.c0 = math.select(new int3(0), new int3(1), v.c0);
this.c1 = math.select(new int3(0), new int3(1), v.c1);
this.c2 = math.select(new int3(0), new int3(1), v.c2);
this.c3 = math.select(new int3(0), new int3(1), v.c3);
}
/// <summary>Constructs a int3x4 matrix from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x4(uint v)
{
this.c0 = (int3)v;
this.c1 = (int3)v;
this.c2 = (int3)v;
this.c3 = (int3)v;
}
/// <summary>Constructs a int3x4 matrix from a uint3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x4(uint3x4 v)
{
this.c0 = (int3)v.c0;
this.c1 = (int3)v.c1;
this.c2 = (int3)v.c2;
this.c3 = (int3)v.c3;
}
/// <summary>Constructs a int3x4 matrix from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x4(float v)
{
this.c0 = (int3)v;
this.c1 = (int3)v;
this.c2 = (int3)v;
this.c3 = (int3)v;
}
/// <summary>Constructs a int3x4 matrix from a float3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x4(float3x4 v)
{
this.c0 = (int3)v.c0;
this.c1 = (int3)v.c1;
this.c2 = (int3)v.c2;
this.c3 = (int3)v.c3;
}
/// <summary>Constructs a int3x4 matrix from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x4(double v)
{
this.c0 = (int3)v;
this.c1 = (int3)v;
this.c2 = (int3)v;
this.c3 = (int3)v;
}
/// <summary>Constructs a int3x4 matrix from a double3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3x4(double3x4 v)
{
this.c0 = (int3)v.c0;
this.c1 = (int3)v.c1;
this.c2 = (int3)v.c2;
this.c3 = (int3)v.c3;
}
/// <summary>Implicitly converts a single int value to a int3x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator int3x4(int v) { return new int3x4(v); }
/// <summary>Explicitly converts a single bool value to a int3x4 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x4(bool v) { return new int3x4(v); }
/// <summary>Explicitly converts a bool3x4 matrix to a int3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x4(bool3x4 v) { return new int3x4(v); }
/// <summary>Explicitly converts a single uint value to a int3x4 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x4(uint v) { return new int3x4(v); }
/// <summary>Explicitly converts a uint3x4 matrix to a int3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x4(uint3x4 v) { return new int3x4(v); }
/// <summary>Explicitly converts a single float value to a int3x4 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x4(float v) { return new int3x4(v); }
/// <summary>Explicitly converts a float3x4 matrix to a int3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x4(float3x4 v) { return new int3x4(v); }
/// <summary>Explicitly converts a single double value to a int3x4 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x4(double v) { return new int3x4(v); }
/// <summary>Explicitly converts a double3x4 matrix to a int3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int3x4(double3x4 v) { return new int3x4(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two int3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator * (int3x4 lhs, int3x4 rhs) { return new int3x4 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2, lhs.c3 * rhs.c3); }
/// <summary>Returns the result of a componentwise multiplication operation on an int3x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator * (int3x4 lhs, int rhs) { return new int3x4 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs, lhs.c3 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on an int value and an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator * (int lhs, int3x4 rhs) { return new int3x4 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2, lhs * rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on two int3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator + (int3x4 lhs, int3x4 rhs) { return new int3x4 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2, lhs.c3 + rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on an int3x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator + (int3x4 lhs, int rhs) { return new int3x4 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs, lhs.c3 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on an int value and an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator + (int lhs, int3x4 rhs) { return new int3x4 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2, lhs + rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on two int3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator - (int3x4 lhs, int3x4 rhs) { return new int3x4 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2, lhs.c3 - rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on an int3x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator - (int3x4 lhs, int rhs) { return new int3x4 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs, lhs.c3 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on an int value and an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator - (int lhs, int3x4 rhs) { return new int3x4 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2, lhs - rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on two int3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator / (int3x4 lhs, int3x4 rhs) { return new int3x4 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2, lhs.c3 / rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on an int3x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator / (int3x4 lhs, int rhs) { return new int3x4 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs, lhs.c3 / rhs); }
/// <summary>Returns the result of a componentwise division operation on an int value and an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator / (int lhs, int3x4 rhs) { return new int3x4 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2, lhs / rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on two int3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator % (int3x4 lhs, int3x4 rhs) { return new int3x4 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2, lhs.c3 % rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on an int3x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator % (int3x4 lhs, int rhs) { return new int3x4 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs, lhs.c3 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on an int value and an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator % (int lhs, int3x4 rhs) { return new int3x4 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2, lhs % rhs.c3); }
/// <summary>Returns the result of a componentwise increment operation on an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator ++ (int3x4 val) { return new int3x4 (++val.c0, ++val.c1, ++val.c2, ++val.c3); }
/// <summary>Returns the result of a componentwise decrement operation on an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator -- (int3x4 val) { return new int3x4 (--val.c0, --val.c1, --val.c2, --val.c3); }
/// <summary>Returns the result of a componentwise less than operation on two int3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator < (int3x4 lhs, int3x4 rhs) { return new bool3x4 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2, lhs.c3 < rhs.c3); }
/// <summary>Returns the result of a componentwise less than operation on an int3x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator < (int3x4 lhs, int rhs) { return new bool3x4 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs, lhs.c3 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on an int value and an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator < (int lhs, int3x4 rhs) { return new bool3x4 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2, lhs < rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on two int3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator <= (int3x4 lhs, int3x4 rhs) { return new bool3x4 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2, lhs.c3 <= rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on an int3x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator <= (int3x4 lhs, int rhs) { return new bool3x4 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs, lhs.c3 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on an int value and an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator <= (int lhs, int3x4 rhs) { return new bool3x4 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2, lhs <= rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on two int3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator > (int3x4 lhs, int3x4 rhs) { return new bool3x4 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2, lhs.c3 > rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on an int3x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator > (int3x4 lhs, int rhs) { return new bool3x4 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs, lhs.c3 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on an int value and an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator > (int lhs, int3x4 rhs) { return new bool3x4 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2, lhs > rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on two int3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator >= (int3x4 lhs, int3x4 rhs) { return new bool3x4 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2, lhs.c3 >= rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int3x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator >= (int3x4 lhs, int rhs) { return new bool3x4 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs, lhs.c3 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int value and an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator >= (int lhs, int3x4 rhs) { return new bool3x4 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2, lhs >= rhs.c3); }
/// <summary>Returns the result of a componentwise unary minus operation on an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator - (int3x4 val) { return new int3x4 (-val.c0, -val.c1, -val.c2, -val.c3); }
/// <summary>Returns the result of a componentwise unary plus operation on an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator + (int3x4 val) { return new int3x4 (+val.c0, +val.c1, +val.c2, +val.c3); }
/// <summary>Returns the result of a componentwise left shift operation on an int3x4 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator << (int3x4 x, int n) { return new int3x4 (x.c0 << n, x.c1 << n, x.c2 << n, x.c3 << n); }
/// <summary>Returns the result of a componentwise right shift operation on an int3x4 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator >> (int3x4 x, int n) { return new int3x4 (x.c0 >> n, x.c1 >> n, x.c2 >> n, x.c3 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two int3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (int3x4 lhs, int3x4 rhs) { return new bool3x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on an int3x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (int3x4 lhs, int rhs) { return new bool3x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on an int value and an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (int lhs, int3x4 rhs) { return new bool3x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two int3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (int3x4 lhs, int3x4 rhs) { return new bool3x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on an int3x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (int3x4 lhs, int rhs) { return new bool3x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on an int value and an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (int lhs, int3x4 rhs) { return new bool3x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise not operation on an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator ~ (int3x4 val) { return new int3x4 (~val.c0, ~val.c1, ~val.c2, ~val.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on two int3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator & (int3x4 lhs, int3x4 rhs) { return new int3x4 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2, lhs.c3 & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int3x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator & (int3x4 lhs, int rhs) { return new int3x4 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs, lhs.c3 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int value and an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator & (int lhs, int3x4 rhs) { return new int3x4 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2, lhs & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on two int3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator | (int3x4 lhs, int3x4 rhs) { return new int3x4 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2, lhs.c3 | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int3x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator | (int3x4 lhs, int rhs) { return new int3x4 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs, lhs.c3 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int value and an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator | (int lhs, int3x4 rhs) { return new int3x4 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2, lhs | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two int3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator ^ (int3x4 lhs, int3x4 rhs) { return new int3x4 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2, lhs.c3 ^ rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int3x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator ^ (int3x4 lhs, int rhs) { return new int3x4 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs, lhs.c3 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int value and an int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 operator ^ (int lhs, int3x4 rhs) { return new int3x4 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2, lhs ^ rhs.c3); }
/// <summary>Returns the int3 element at a specified index.</summary>
unsafe public ref int3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (int3x4* array = &this) { return ref ((int3*)array)[index]; }
}
}
/// <summary>Returns true if the int3x4 is equal to a given int3x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(int3x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the int3x4 is equal to a given int3x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((int3x4)o); }
/// <summary>Returns a hash code for the int3x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the int3x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("int3x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y, c0.z, c1.z, c2.z, c3.z);
}
/// <summary>Returns a string representation of the int3x4 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("int3x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c3.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider), c3.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider), c2.z.ToString(format, formatProvider), c3.z.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a int3x4 matrix constructed from four int3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 int3x4(int3 c0, int3 c1, int3 c2, int3 c3) { return new int3x4(c0, c1, c2, c3); }
/// <summary>Returns a int3x4 matrix constructed from from 12 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 int3x4(int m00, int m01, int m02, int m03,
int m10, int m11, int m12, int m13,
int m20, int m21, int m22, int m23)
{
return new int3x4(m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23);
}
/// <summary>Returns a int3x4 matrix constructed from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 int3x4(int v) { return new int3x4(v); }
/// <summary>Returns a int3x4 matrix constructed from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 int3x4(bool v) { return new int3x4(v); }
/// <summary>Return a int3x4 matrix constructed from a bool3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 int3x4(bool3x4 v) { return new int3x4(v); }
/// <summary>Returns a int3x4 matrix constructed from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 int3x4(uint v) { return new int3x4(v); }
/// <summary>Return a int3x4 matrix constructed from a uint3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 int3x4(uint3x4 v) { return new int3x4(v); }
/// <summary>Returns a int3x4 matrix constructed from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 int3x4(float v) { return new int3x4(v); }
/// <summary>Return a int3x4 matrix constructed from a float3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 int3x4(float3x4 v) { return new int3x4(v); }
/// <summary>Returns a int3x4 matrix constructed from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 int3x4(double v) { return new int3x4(v); }
/// <summary>Return a int3x4 matrix constructed from a double3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 int3x4(double3x4 v) { return new int3x4(v); }
/// <summary>Return the int4x3 transpose of a int3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 transpose(int3x4 v)
{
return int4x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z,
v.c2.x, v.c2.y, v.c2.z,
v.c3.x, v.c3.y, v.c3.z);
}
/// <summary>Returns a uint hash code of a int3x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(int3x4 v)
{
return csum(asuint(v.c0) * uint3(0x5AB3E8CDu, 0x676E8407u, 0xB36DE767u) +
asuint(v.c1) * uint3(0x6FCA387Du, 0xAF0F3103u, 0xE4A056C7u) +
asuint(v.c2) * uint3(0x841D8225u, 0xC9393C7Du, 0xD42EAFA3u) +
asuint(v.c3) * uint3(0xD9AFD06Du, 0x97A65421u, 0x7809205Fu)) + 0x9C9F0823u;
}
/// <summary>
/// Returns a uint3 vector hash code of a int3x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(int3x4 v)
{
return (asuint(v.c0) * uint3(0x5A9CA13Bu, 0xAFCDD5EFu, 0xA88D187Du) +
asuint(v.c1) * uint3(0xCF6EBA1Du, 0x9D88E5A1u, 0xEADF0775u) +
asuint(v.c2) * uint3(0x747A9D7Bu, 0x4111F799u, 0xB5F05AF1u) +
asuint(v.c3) * uint3(0xFD80290Bu, 0x8B65ADB7u, 0xDFF4F563u)) + 0x7069770Du;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,497 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct int4x2 : System.IEquatable<int4x2>, IFormattable
{
public int4 c0;
public int4 c1;
/// <summary>int4x2 zero value.</summary>
public static readonly int4x2 zero;
/// <summary>Constructs a int4x2 matrix from two int4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x2(int4 c0, int4 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a int4x2 matrix from 8 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x2(int m00, int m01,
int m10, int m11,
int m20, int m21,
int m30, int m31)
{
this.c0 = new int4(m00, m10, m20, m30);
this.c1 = new int4(m01, m11, m21, m31);
}
/// <summary>Constructs a int4x2 matrix from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x2(int v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a int4x2 matrix from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x2(bool v)
{
this.c0 = math.select(new int4(0), new int4(1), v);
this.c1 = math.select(new int4(0), new int4(1), v);
}
/// <summary>Constructs a int4x2 matrix from a bool4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x2(bool4x2 v)
{
this.c0 = math.select(new int4(0), new int4(1), v.c0);
this.c1 = math.select(new int4(0), new int4(1), v.c1);
}
/// <summary>Constructs a int4x2 matrix from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x2(uint v)
{
this.c0 = (int4)v;
this.c1 = (int4)v;
}
/// <summary>Constructs a int4x2 matrix from a uint4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x2(uint4x2 v)
{
this.c0 = (int4)v.c0;
this.c1 = (int4)v.c1;
}
/// <summary>Constructs a int4x2 matrix from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x2(float v)
{
this.c0 = (int4)v;
this.c1 = (int4)v;
}
/// <summary>Constructs a int4x2 matrix from a float4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x2(float4x2 v)
{
this.c0 = (int4)v.c0;
this.c1 = (int4)v.c1;
}
/// <summary>Constructs a int4x2 matrix from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x2(double v)
{
this.c0 = (int4)v;
this.c1 = (int4)v;
}
/// <summary>Constructs a int4x2 matrix from a double4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x2(double4x2 v)
{
this.c0 = (int4)v.c0;
this.c1 = (int4)v.c1;
}
/// <summary>Implicitly converts a single int value to a int4x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator int4x2(int v) { return new int4x2(v); }
/// <summary>Explicitly converts a single bool value to a int4x2 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x2(bool v) { return new int4x2(v); }
/// <summary>Explicitly converts a bool4x2 matrix to a int4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x2(bool4x2 v) { return new int4x2(v); }
/// <summary>Explicitly converts a single uint value to a int4x2 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x2(uint v) { return new int4x2(v); }
/// <summary>Explicitly converts a uint4x2 matrix to a int4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x2(uint4x2 v) { return new int4x2(v); }
/// <summary>Explicitly converts a single float value to a int4x2 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x2(float v) { return new int4x2(v); }
/// <summary>Explicitly converts a float4x2 matrix to a int4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x2(float4x2 v) { return new int4x2(v); }
/// <summary>Explicitly converts a single double value to a int4x2 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x2(double v) { return new int4x2(v); }
/// <summary>Explicitly converts a double4x2 matrix to a int4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x2(double4x2 v) { return new int4x2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two int4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator * (int4x2 lhs, int4x2 rhs) { return new int4x2 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1); }
/// <summary>Returns the result of a componentwise multiplication operation on an int4x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator * (int4x2 lhs, int rhs) { return new int4x2 (lhs.c0 * rhs, lhs.c1 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on an int value and an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator * (int lhs, int4x2 rhs) { return new int4x2 (lhs * rhs.c0, lhs * rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on two int4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator + (int4x2 lhs, int4x2 rhs) { return new int4x2 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on an int4x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator + (int4x2 lhs, int rhs) { return new int4x2 (lhs.c0 + rhs, lhs.c1 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on an int value and an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator + (int lhs, int4x2 rhs) { return new int4x2 (lhs + rhs.c0, lhs + rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on two int4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator - (int4x2 lhs, int4x2 rhs) { return new int4x2 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on an int4x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator - (int4x2 lhs, int rhs) { return new int4x2 (lhs.c0 - rhs, lhs.c1 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on an int value and an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator - (int lhs, int4x2 rhs) { return new int4x2 (lhs - rhs.c0, lhs - rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on two int4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator / (int4x2 lhs, int4x2 rhs) { return new int4x2 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on an int4x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator / (int4x2 lhs, int rhs) { return new int4x2 (lhs.c0 / rhs, lhs.c1 / rhs); }
/// <summary>Returns the result of a componentwise division operation on an int value and an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator / (int lhs, int4x2 rhs) { return new int4x2 (lhs / rhs.c0, lhs / rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on two int4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator % (int4x2 lhs, int4x2 rhs) { return new int4x2 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on an int4x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator % (int4x2 lhs, int rhs) { return new int4x2 (lhs.c0 % rhs, lhs.c1 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on an int value and an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator % (int lhs, int4x2 rhs) { return new int4x2 (lhs % rhs.c0, lhs % rhs.c1); }
/// <summary>Returns the result of a componentwise increment operation on an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator ++ (int4x2 val) { return new int4x2 (++val.c0, ++val.c1); }
/// <summary>Returns the result of a componentwise decrement operation on an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator -- (int4x2 val) { return new int4x2 (--val.c0, --val.c1); }
/// <summary>Returns the result of a componentwise less than operation on two int4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator < (int4x2 lhs, int4x2 rhs) { return new bool4x2 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1); }
/// <summary>Returns the result of a componentwise less than operation on an int4x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator < (int4x2 lhs, int rhs) { return new bool4x2 (lhs.c0 < rhs, lhs.c1 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on an int value and an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator < (int lhs, int4x2 rhs) { return new bool4x2 (lhs < rhs.c0, lhs < rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on two int4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator <= (int4x2 lhs, int4x2 rhs) { return new bool4x2 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on an int4x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator <= (int4x2 lhs, int rhs) { return new bool4x2 (lhs.c0 <= rhs, lhs.c1 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on an int value and an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator <= (int lhs, int4x2 rhs) { return new bool4x2 (lhs <= rhs.c0, lhs <= rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on two int4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator > (int4x2 lhs, int4x2 rhs) { return new bool4x2 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on an int4x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator > (int4x2 lhs, int rhs) { return new bool4x2 (lhs.c0 > rhs, lhs.c1 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on an int value and an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator > (int lhs, int4x2 rhs) { return new bool4x2 (lhs > rhs.c0, lhs > rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on two int4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator >= (int4x2 lhs, int4x2 rhs) { return new bool4x2 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int4x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator >= (int4x2 lhs, int rhs) { return new bool4x2 (lhs.c0 >= rhs, lhs.c1 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int value and an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator >= (int lhs, int4x2 rhs) { return new bool4x2 (lhs >= rhs.c0, lhs >= rhs.c1); }
/// <summary>Returns the result of a componentwise unary minus operation on an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator - (int4x2 val) { return new int4x2 (-val.c0, -val.c1); }
/// <summary>Returns the result of a componentwise unary plus operation on an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator + (int4x2 val) { return new int4x2 (+val.c0, +val.c1); }
/// <summary>Returns the result of a componentwise left shift operation on an int4x2 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator << (int4x2 x, int n) { return new int4x2 (x.c0 << n, x.c1 << n); }
/// <summary>Returns the result of a componentwise right shift operation on an int4x2 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator >> (int4x2 x, int n) { return new int4x2 (x.c0 >> n, x.c1 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two int4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (int4x2 lhs, int4x2 rhs) { return new bool4x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on an int4x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (int4x2 lhs, int rhs) { return new bool4x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on an int value and an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (int lhs, int4x2 rhs) { return new bool4x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two int4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (int4x2 lhs, int4x2 rhs) { return new bool4x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on an int4x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (int4x2 lhs, int rhs) { return new bool4x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on an int value and an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (int lhs, int4x2 rhs) { return new bool4x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise not operation on an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator ~ (int4x2 val) { return new int4x2 (~val.c0, ~val.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on two int4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator & (int4x2 lhs, int4x2 rhs) { return new int4x2 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int4x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator & (int4x2 lhs, int rhs) { return new int4x2 (lhs.c0 & rhs, lhs.c1 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int value and an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator & (int lhs, int4x2 rhs) { return new int4x2 (lhs & rhs.c0, lhs & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on two int4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator | (int4x2 lhs, int4x2 rhs) { return new int4x2 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int4x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator | (int4x2 lhs, int rhs) { return new int4x2 (lhs.c0 | rhs, lhs.c1 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int value and an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator | (int lhs, int4x2 rhs) { return new int4x2 (lhs | rhs.c0, lhs | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two int4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator ^ (int4x2 lhs, int4x2 rhs) { return new int4x2 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int4x2 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator ^ (int4x2 lhs, int rhs) { return new int4x2 (lhs.c0 ^ rhs, lhs.c1 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int value and an int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 operator ^ (int lhs, int4x2 rhs) { return new int4x2 (lhs ^ rhs.c0, lhs ^ rhs.c1); }
/// <summary>Returns the int4 element at a specified index.</summary>
unsafe public ref int4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (int4x2* array = &this) { return ref ((int4*)array)[index]; }
}
}
/// <summary>Returns true if the int4x2 is equal to a given int4x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(int4x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the int4x2 is equal to a given int4x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((int4x2)o); }
/// <summary>Returns a hash code for the int4x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the int4x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("int4x2({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x, c1.x, c0.y, c1.y, c0.z, c1.z, c0.w, c1.w);
}
/// <summary>Returns a string representation of the int4x2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("int4x2({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider), c0.w.ToString(format, formatProvider), c1.w.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a int4x2 matrix constructed from two int4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 int4x2(int4 c0, int4 c1) { return new int4x2(c0, c1); }
/// <summary>Returns a int4x2 matrix constructed from from 8 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 int4x2(int m00, int m01,
int m10, int m11,
int m20, int m21,
int m30, int m31)
{
return new int4x2(m00, m01,
m10, m11,
m20, m21,
m30, m31);
}
/// <summary>Returns a int4x2 matrix constructed from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 int4x2(int v) { return new int4x2(v); }
/// <summary>Returns a int4x2 matrix constructed from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 int4x2(bool v) { return new int4x2(v); }
/// <summary>Return a int4x2 matrix constructed from a bool4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 int4x2(bool4x2 v) { return new int4x2(v); }
/// <summary>Returns a int4x2 matrix constructed from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 int4x2(uint v) { return new int4x2(v); }
/// <summary>Return a int4x2 matrix constructed from a uint4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 int4x2(uint4x2 v) { return new int4x2(v); }
/// <summary>Returns a int4x2 matrix constructed from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 int4x2(float v) { return new int4x2(v); }
/// <summary>Return a int4x2 matrix constructed from a float4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 int4x2(float4x2 v) { return new int4x2(v); }
/// <summary>Returns a int4x2 matrix constructed from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 int4x2(double v) { return new int4x2(v); }
/// <summary>Return a int4x2 matrix constructed from a double4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x2 int4x2(double4x2 v) { return new int4x2(v); }
/// <summary>Return the int2x4 transpose of a int4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int2x4 transpose(int4x2 v)
{
return int2x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w);
}
/// <summary>Returns a uint hash code of a int4x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(int4x2 v)
{
return csum(asuint(v.c0) * uint4(0xFAAF07DDu, 0x625C45BDu, 0xC9F27FCBu, 0x6D2523B1u) +
asuint(v.c1) * uint4(0x6E2BF6A9u, 0xCC74B3B7u, 0x83B58237u, 0x833E3E29u)) + 0xA9D919BFu;
}
/// <summary>
/// Returns a uint4 vector hash code of a int4x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(int4x2 v)
{
return (asuint(v.c0) * uint4(0xC3EC1D97u, 0xB8B208C7u, 0x5D3ED947u, 0x4473BBB1u) +
asuint(v.c1) * uint4(0xCBA11D5Fu, 0x685835CFu, 0xC3D32AE1u, 0xB966942Fu)) + 0xFE9856B3u;
}
}
}

View File

@@ -0,0 +1,512 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct int4x3 : System.IEquatable<int4x3>, IFormattable
{
public int4 c0;
public int4 c1;
public int4 c2;
/// <summary>int4x3 zero value.</summary>
public static readonly int4x3 zero;
/// <summary>Constructs a int4x3 matrix from three int4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x3(int4 c0, int4 c1, int4 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a int4x3 matrix from 12 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x3(int m00, int m01, int m02,
int m10, int m11, int m12,
int m20, int m21, int m22,
int m30, int m31, int m32)
{
this.c0 = new int4(m00, m10, m20, m30);
this.c1 = new int4(m01, m11, m21, m31);
this.c2 = new int4(m02, m12, m22, m32);
}
/// <summary>Constructs a int4x3 matrix from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x3(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a int4x3 matrix from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x3(bool v)
{
this.c0 = math.select(new int4(0), new int4(1), v);
this.c1 = math.select(new int4(0), new int4(1), v);
this.c2 = math.select(new int4(0), new int4(1), v);
}
/// <summary>Constructs a int4x3 matrix from a bool4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x3(bool4x3 v)
{
this.c0 = math.select(new int4(0), new int4(1), v.c0);
this.c1 = math.select(new int4(0), new int4(1), v.c1);
this.c2 = math.select(new int4(0), new int4(1), v.c2);
}
/// <summary>Constructs a int4x3 matrix from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x3(uint v)
{
this.c0 = (int4)v;
this.c1 = (int4)v;
this.c2 = (int4)v;
}
/// <summary>Constructs a int4x3 matrix from a uint4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x3(uint4x3 v)
{
this.c0 = (int4)v.c0;
this.c1 = (int4)v.c1;
this.c2 = (int4)v.c2;
}
/// <summary>Constructs a int4x3 matrix from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x3(float v)
{
this.c0 = (int4)v;
this.c1 = (int4)v;
this.c2 = (int4)v;
}
/// <summary>Constructs a int4x3 matrix from a float4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x3(float4x3 v)
{
this.c0 = (int4)v.c0;
this.c1 = (int4)v.c1;
this.c2 = (int4)v.c2;
}
/// <summary>Constructs a int4x3 matrix from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x3(double v)
{
this.c0 = (int4)v;
this.c1 = (int4)v;
this.c2 = (int4)v;
}
/// <summary>Constructs a int4x3 matrix from a double4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x3(double4x3 v)
{
this.c0 = (int4)v.c0;
this.c1 = (int4)v.c1;
this.c2 = (int4)v.c2;
}
/// <summary>Implicitly converts a single int value to a int4x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator int4x3(int v) { return new int4x3(v); }
/// <summary>Explicitly converts a single bool value to a int4x3 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x3(bool v) { return new int4x3(v); }
/// <summary>Explicitly converts a bool4x3 matrix to a int4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x3(bool4x3 v) { return new int4x3(v); }
/// <summary>Explicitly converts a single uint value to a int4x3 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x3(uint v) { return new int4x3(v); }
/// <summary>Explicitly converts a uint4x3 matrix to a int4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x3(uint4x3 v) { return new int4x3(v); }
/// <summary>Explicitly converts a single float value to a int4x3 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x3(float v) { return new int4x3(v); }
/// <summary>Explicitly converts a float4x3 matrix to a int4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x3(float4x3 v) { return new int4x3(v); }
/// <summary>Explicitly converts a single double value to a int4x3 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x3(double v) { return new int4x3(v); }
/// <summary>Explicitly converts a double4x3 matrix to a int4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x3(double4x3 v) { return new int4x3(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two int4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator * (int4x3 lhs, int4x3 rhs) { return new int4x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); }
/// <summary>Returns the result of a componentwise multiplication operation on an int4x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator * (int4x3 lhs, int rhs) { return new int4x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on an int value and an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator * (int lhs, int4x3 rhs) { return new int4x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on two int4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator + (int4x3 lhs, int4x3 rhs) { return new int4x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on an int4x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator + (int4x3 lhs, int rhs) { return new int4x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on an int value and an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator + (int lhs, int4x3 rhs) { return new int4x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on two int4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator - (int4x3 lhs, int4x3 rhs) { return new int4x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on an int4x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator - (int4x3 lhs, int rhs) { return new int4x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on an int value and an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator - (int lhs, int4x3 rhs) { return new int4x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on two int4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator / (int4x3 lhs, int4x3 rhs) { return new int4x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on an int4x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator / (int4x3 lhs, int rhs) { return new int4x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); }
/// <summary>Returns the result of a componentwise division operation on an int value and an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator / (int lhs, int4x3 rhs) { return new int4x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on two int4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator % (int4x3 lhs, int4x3 rhs) { return new int4x3 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on an int4x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator % (int4x3 lhs, int rhs) { return new int4x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on an int value and an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator % (int lhs, int4x3 rhs) { return new int4x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); }
/// <summary>Returns the result of a componentwise increment operation on an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator ++ (int4x3 val) { return new int4x3 (++val.c0, ++val.c1, ++val.c2); }
/// <summary>Returns the result of a componentwise decrement operation on an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator -- (int4x3 val) { return new int4x3 (--val.c0, --val.c1, --val.c2); }
/// <summary>Returns the result of a componentwise less than operation on two int4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator < (int4x3 lhs, int4x3 rhs) { return new bool4x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); }
/// <summary>Returns the result of a componentwise less than operation on an int4x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator < (int4x3 lhs, int rhs) { return new bool4x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on an int value and an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator < (int lhs, int4x3 rhs) { return new bool4x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on two int4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator <= (int4x3 lhs, int4x3 rhs) { return new bool4x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on an int4x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator <= (int4x3 lhs, int rhs) { return new bool4x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on an int value and an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator <= (int lhs, int4x3 rhs) { return new bool4x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on two int4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator > (int4x3 lhs, int4x3 rhs) { return new bool4x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on an int4x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator > (int4x3 lhs, int rhs) { return new bool4x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on an int value and an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator > (int lhs, int4x3 rhs) { return new bool4x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on two int4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator >= (int4x3 lhs, int4x3 rhs) { return new bool4x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int4x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator >= (int4x3 lhs, int rhs) { return new bool4x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int value and an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator >= (int lhs, int4x3 rhs) { return new bool4x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); }
/// <summary>Returns the result of a componentwise unary minus operation on an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator - (int4x3 val) { return new int4x3 (-val.c0, -val.c1, -val.c2); }
/// <summary>Returns the result of a componentwise unary plus operation on an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator + (int4x3 val) { return new int4x3 (+val.c0, +val.c1, +val.c2); }
/// <summary>Returns the result of a componentwise left shift operation on an int4x3 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator << (int4x3 x, int n) { return new int4x3 (x.c0 << n, x.c1 << n, x.c2 << n); }
/// <summary>Returns the result of a componentwise right shift operation on an int4x3 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator >> (int4x3 x, int n) { return new int4x3 (x.c0 >> n, x.c1 >> n, x.c2 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two int4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (int4x3 lhs, int4x3 rhs) { return new bool4x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on an int4x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (int4x3 lhs, int rhs) { return new bool4x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on an int value and an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (int lhs, int4x3 rhs) { return new bool4x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two int4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (int4x3 lhs, int4x3 rhs) { return new bool4x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on an int4x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (int4x3 lhs, int rhs) { return new bool4x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on an int value and an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (int lhs, int4x3 rhs) { return new bool4x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise not operation on an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator ~ (int4x3 val) { return new int4x3 (~val.c0, ~val.c1, ~val.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on two int4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator & (int4x3 lhs, int4x3 rhs) { return new int4x3 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int4x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator & (int4x3 lhs, int rhs) { return new int4x3 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int value and an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator & (int lhs, int4x3 rhs) { return new int4x3 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on two int4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator | (int4x3 lhs, int4x3 rhs) { return new int4x3 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int4x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator | (int4x3 lhs, int rhs) { return new int4x3 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int value and an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator | (int lhs, int4x3 rhs) { return new int4x3 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two int4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator ^ (int4x3 lhs, int4x3 rhs) { return new int4x3 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int4x3 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator ^ (int4x3 lhs, int rhs) { return new int4x3 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int value and an int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 operator ^ (int lhs, int4x3 rhs) { return new int4x3 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2); }
/// <summary>Returns the int4 element at a specified index.</summary>
unsafe public ref int4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (int4x3* array = &this) { return ref ((int4*)array)[index]; }
}
}
/// <summary>Returns true if the int4x3 is equal to a given int4x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(int4x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the int4x3 is equal to a given int4x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((int4x3)o); }
/// <summary>Returns a hash code for the int4x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the int4x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("int4x3({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", c0.x, c1.x, c2.x, c0.y, c1.y, c2.y, c0.z, c1.z, c2.z, c0.w, c1.w, c2.w);
}
/// <summary>Returns a string representation of the int4x3 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("int4x3({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", 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), c0.w.ToString(format, formatProvider), c1.w.ToString(format, formatProvider), c2.w.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a int4x3 matrix constructed from three int4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 int4x3(int4 c0, int4 c1, int4 c2) { return new int4x3(c0, c1, c2); }
/// <summary>Returns a int4x3 matrix constructed from from 12 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 int4x3(int m00, int m01, int m02,
int m10, int m11, int m12,
int m20, int m21, int m22,
int m30, int m31, int m32)
{
return new int4x3(m00, m01, m02,
m10, m11, m12,
m20, m21, m22,
m30, m31, m32);
}
/// <summary>Returns a int4x3 matrix constructed from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 int4x3(int v) { return new int4x3(v); }
/// <summary>Returns a int4x3 matrix constructed from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 int4x3(bool v) { return new int4x3(v); }
/// <summary>Return a int4x3 matrix constructed from a bool4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 int4x3(bool4x3 v) { return new int4x3(v); }
/// <summary>Returns a int4x3 matrix constructed from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 int4x3(uint v) { return new int4x3(v); }
/// <summary>Return a int4x3 matrix constructed from a uint4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 int4x3(uint4x3 v) { return new int4x3(v); }
/// <summary>Returns a int4x3 matrix constructed from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 int4x3(float v) { return new int4x3(v); }
/// <summary>Return a int4x3 matrix constructed from a float4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 int4x3(float4x3 v) { return new int4x3(v); }
/// <summary>Returns a int4x3 matrix constructed from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 int4x3(double v) { return new int4x3(v); }
/// <summary>Return a int4x3 matrix constructed from a double4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x3 int4x3(double4x3 v) { return new int4x3(v); }
/// <summary>Return the int3x4 transpose of a int4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int3x4 transpose(int4x3 v)
{
return int3x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w,
v.c2.x, v.c2.y, v.c2.z, v.c2.w);
}
/// <summary>Returns a uint hash code of a int4x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(int4x3 v)
{
return csum(asuint(v.c0) * uint4(0x69B60C81u, 0xE0EB6C25u, 0xF648BEABu, 0x6BDB2B07u) +
asuint(v.c1) * uint4(0xEF63C699u, 0x9001903Fu, 0xA895B9CDu, 0x9D23B201u) +
asuint(v.c2) * uint4(0x4B01D3E1u, 0x7461CA0Du, 0x79725379u, 0xD6258E5Bu)) + 0xEE390C97u;
}
/// <summary>
/// Returns a uint4 vector hash code of a int4x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(int4x3 v)
{
return (asuint(v.c0) * uint4(0x9C8A2F05u, 0x4DDC6509u, 0x7CF083CBu, 0x5C4D6CEDu) +
asuint(v.c1) * uint4(0xF9137117u, 0xE857DCE1u, 0xF62213C5u, 0x9CDAA959u) +
asuint(v.c2) * uint4(0xAA269ABFu, 0xD54BA36Fu, 0xFD0847B9u, 0x8189A683u)) + 0xB139D651u;
}
}
}

View File

@@ -0,0 +1,546 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct int4x4 : System.IEquatable<int4x4>, IFormattable
{
public int4 c0;
public int4 c1;
public int4 c2;
public int4 c3;
/// <summary>int4x4 identity transform.</summary>
public static readonly int4x4 identity = new int4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
/// <summary>int4x4 zero value.</summary>
public static readonly int4x4 zero;
/// <summary>Constructs a int4x4 matrix from four int4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x4(int4 c0, int4 c1, int4 c2, int4 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a int4x4 matrix from 16 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x4(int m00, int m01, int m02, int m03,
int m10, int m11, int m12, int m13,
int m20, int m21, int m22, int m23,
int m30, int m31, int m32, int m33)
{
this.c0 = new int4(m00, m10, m20, m30);
this.c1 = new int4(m01, m11, m21, m31);
this.c2 = new int4(m02, m12, m22, m32);
this.c3 = new int4(m03, m13, m23, m33);
}
/// <summary>Constructs a int4x4 matrix from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x4(int v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a int4x4 matrix from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x4(bool v)
{
this.c0 = math.select(new int4(0), new int4(1), v);
this.c1 = math.select(new int4(0), new int4(1), v);
this.c2 = math.select(new int4(0), new int4(1), v);
this.c3 = math.select(new int4(0), new int4(1), v);
}
/// <summary>Constructs a int4x4 matrix from a bool4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x4(bool4x4 v)
{
this.c0 = math.select(new int4(0), new int4(1), v.c0);
this.c1 = math.select(new int4(0), new int4(1), v.c1);
this.c2 = math.select(new int4(0), new int4(1), v.c2);
this.c3 = math.select(new int4(0), new int4(1), v.c3);
}
/// <summary>Constructs a int4x4 matrix from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x4(uint v)
{
this.c0 = (int4)v;
this.c1 = (int4)v;
this.c2 = (int4)v;
this.c3 = (int4)v;
}
/// <summary>Constructs a int4x4 matrix from a uint4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x4(uint4x4 v)
{
this.c0 = (int4)v.c0;
this.c1 = (int4)v.c1;
this.c2 = (int4)v.c2;
this.c3 = (int4)v.c3;
}
/// <summary>Constructs a int4x4 matrix from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x4(float v)
{
this.c0 = (int4)v;
this.c1 = (int4)v;
this.c2 = (int4)v;
this.c3 = (int4)v;
}
/// <summary>Constructs a int4x4 matrix from a float4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x4(float4x4 v)
{
this.c0 = (int4)v.c0;
this.c1 = (int4)v.c1;
this.c2 = (int4)v.c2;
this.c3 = (int4)v.c3;
}
/// <summary>Constructs a int4x4 matrix from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x4(double v)
{
this.c0 = (int4)v;
this.c1 = (int4)v;
this.c2 = (int4)v;
this.c3 = (int4)v;
}
/// <summary>Constructs a int4x4 matrix from a double4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4x4(double4x4 v)
{
this.c0 = (int4)v.c0;
this.c1 = (int4)v.c1;
this.c2 = (int4)v.c2;
this.c3 = (int4)v.c3;
}
/// <summary>Implicitly converts a single int value to a int4x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator int4x4(int v) { return new int4x4(v); }
/// <summary>Explicitly converts a single bool value to a int4x4 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x4(bool v) { return new int4x4(v); }
/// <summary>Explicitly converts a bool4x4 matrix to a int4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x4(bool4x4 v) { return new int4x4(v); }
/// <summary>Explicitly converts a single uint value to a int4x4 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x4(uint v) { return new int4x4(v); }
/// <summary>Explicitly converts a uint4x4 matrix to a int4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x4(uint4x4 v) { return new int4x4(v); }
/// <summary>Explicitly converts a single float value to a int4x4 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x4(float v) { return new int4x4(v); }
/// <summary>Explicitly converts a float4x4 matrix to a int4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x4(float4x4 v) { return new int4x4(v); }
/// <summary>Explicitly converts a single double value to a int4x4 matrix by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x4(double v) { return new int4x4(v); }
/// <summary>Explicitly converts a double4x4 matrix to a int4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator int4x4(double4x4 v) { return new int4x4(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two int4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator * (int4x4 lhs, int4x4 rhs) { return new int4x4 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2, lhs.c3 * rhs.c3); }
/// <summary>Returns the result of a componentwise multiplication operation on an int4x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator * (int4x4 lhs, int rhs) { return new int4x4 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs, lhs.c3 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on an int value and an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator * (int lhs, int4x4 rhs) { return new int4x4 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2, lhs * rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on two int4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator + (int4x4 lhs, int4x4 rhs) { return new int4x4 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2, lhs.c3 + rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on an int4x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator + (int4x4 lhs, int rhs) { return new int4x4 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs, lhs.c3 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on an int value and an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator + (int lhs, int4x4 rhs) { return new int4x4 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2, lhs + rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on two int4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator - (int4x4 lhs, int4x4 rhs) { return new int4x4 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2, lhs.c3 - rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on an int4x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator - (int4x4 lhs, int rhs) { return new int4x4 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs, lhs.c3 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on an int value and an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator - (int lhs, int4x4 rhs) { return new int4x4 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2, lhs - rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on two int4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator / (int4x4 lhs, int4x4 rhs) { return new int4x4 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2, lhs.c3 / rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on an int4x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator / (int4x4 lhs, int rhs) { return new int4x4 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs, lhs.c3 / rhs); }
/// <summary>Returns the result of a componentwise division operation on an int value and an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator / (int lhs, int4x4 rhs) { return new int4x4 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2, lhs / rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on two int4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator % (int4x4 lhs, int4x4 rhs) { return new int4x4 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2, lhs.c3 % rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on an int4x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator % (int4x4 lhs, int rhs) { return new int4x4 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs, lhs.c3 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on an int value and an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator % (int lhs, int4x4 rhs) { return new int4x4 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2, lhs % rhs.c3); }
/// <summary>Returns the result of a componentwise increment operation on an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator ++ (int4x4 val) { return new int4x4 (++val.c0, ++val.c1, ++val.c2, ++val.c3); }
/// <summary>Returns the result of a componentwise decrement operation on an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator -- (int4x4 val) { return new int4x4 (--val.c0, --val.c1, --val.c2, --val.c3); }
/// <summary>Returns the result of a componentwise less than operation on two int4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator < (int4x4 lhs, int4x4 rhs) { return new bool4x4 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2, lhs.c3 < rhs.c3); }
/// <summary>Returns the result of a componentwise less than operation on an int4x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator < (int4x4 lhs, int rhs) { return new bool4x4 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs, lhs.c3 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on an int value and an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator < (int lhs, int4x4 rhs) { return new bool4x4 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2, lhs < rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on two int4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator <= (int4x4 lhs, int4x4 rhs) { return new bool4x4 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2, lhs.c3 <= rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on an int4x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator <= (int4x4 lhs, int rhs) { return new bool4x4 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs, lhs.c3 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on an int value and an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator <= (int lhs, int4x4 rhs) { return new bool4x4 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2, lhs <= rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on two int4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator > (int4x4 lhs, int4x4 rhs) { return new bool4x4 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2, lhs.c3 > rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on an int4x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator > (int4x4 lhs, int rhs) { return new bool4x4 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs, lhs.c3 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on an int value and an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator > (int lhs, int4x4 rhs) { return new bool4x4 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2, lhs > rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on two int4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator >= (int4x4 lhs, int4x4 rhs) { return new bool4x4 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2, lhs.c3 >= rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int4x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator >= (int4x4 lhs, int rhs) { return new bool4x4 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs, lhs.c3 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on an int value and an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator >= (int lhs, int4x4 rhs) { return new bool4x4 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2, lhs >= rhs.c3); }
/// <summary>Returns the result of a componentwise unary minus operation on an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator - (int4x4 val) { return new int4x4 (-val.c0, -val.c1, -val.c2, -val.c3); }
/// <summary>Returns the result of a componentwise unary plus operation on an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator + (int4x4 val) { return new int4x4 (+val.c0, +val.c1, +val.c2, +val.c3); }
/// <summary>Returns the result of a componentwise left shift operation on an int4x4 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator << (int4x4 x, int n) { return new int4x4 (x.c0 << n, x.c1 << n, x.c2 << n, x.c3 << n); }
/// <summary>Returns the result of a componentwise right shift operation on an int4x4 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator >> (int4x4 x, int n) { return new int4x4 (x.c0 >> n, x.c1 >> n, x.c2 >> n, x.c3 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two int4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (int4x4 lhs, int4x4 rhs) { return new bool4x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on an int4x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (int4x4 lhs, int rhs) { return new bool4x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on an int value and an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (int lhs, int4x4 rhs) { return new bool4x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two int4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (int4x4 lhs, int4x4 rhs) { return new bool4x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on an int4x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (int4x4 lhs, int rhs) { return new bool4x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on an int value and an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (int lhs, int4x4 rhs) { return new bool4x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise not operation on an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator ~ (int4x4 val) { return new int4x4 (~val.c0, ~val.c1, ~val.c2, ~val.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on two int4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator & (int4x4 lhs, int4x4 rhs) { return new int4x4 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2, lhs.c3 & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int4x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator & (int4x4 lhs, int rhs) { return new int4x4 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs, lhs.c3 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on an int value and an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator & (int lhs, int4x4 rhs) { return new int4x4 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2, lhs & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on two int4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator | (int4x4 lhs, int4x4 rhs) { return new int4x4 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2, lhs.c3 | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int4x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator | (int4x4 lhs, int rhs) { return new int4x4 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs, lhs.c3 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on an int value and an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator | (int lhs, int4x4 rhs) { return new int4x4 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2, lhs | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two int4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator ^ (int4x4 lhs, int4x4 rhs) { return new int4x4 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2, lhs.c3 ^ rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int4x4 matrix and an int value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator ^ (int4x4 lhs, int rhs) { return new int4x4 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs, lhs.c3 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on an int value and an int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 operator ^ (int lhs, int4x4 rhs) { return new int4x4 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2, lhs ^ rhs.c3); }
/// <summary>Returns the int4 element at a specified index.</summary>
unsafe public ref int4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (int4x4* array = &this) { return ref ((int4*)array)[index]; }
}
}
/// <summary>Returns true if the int4x4 is equal to a given int4x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(int4x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the int4x4 is equal to a given int4x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((int4x4)o); }
/// <summary>Returns a hash code for the int4x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the int4x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("int4x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15})", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y, c0.z, c1.z, c2.z, c3.z, c0.w, c1.w, c2.w, c3.w);
}
/// <summary>Returns a string representation of the int4x4 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("int4x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c3.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider), c3.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider), c2.z.ToString(format, formatProvider), c3.z.ToString(format, formatProvider), c0.w.ToString(format, formatProvider), c1.w.ToString(format, formatProvider), c2.w.ToString(format, formatProvider), c3.w.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a int4x4 matrix constructed from four int4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 int4x4(int4 c0, int4 c1, int4 c2, int4 c3) { return new int4x4(c0, c1, c2, c3); }
/// <summary>Returns a int4x4 matrix constructed from from 16 int values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 int4x4(int m00, int m01, int m02, int m03,
int m10, int m11, int m12, int m13,
int m20, int m21, int m22, int m23,
int m30, int m31, int m32, int m33)
{
return new int4x4(m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23,
m30, m31, m32, m33);
}
/// <summary>Returns a int4x4 matrix constructed from a single int value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 int4x4(int v) { return new int4x4(v); }
/// <summary>Returns a int4x4 matrix constructed from a single bool value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 int4x4(bool v) { return new int4x4(v); }
/// <summary>Return a int4x4 matrix constructed from a bool4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 int4x4(bool4x4 v) { return new int4x4(v); }
/// <summary>Returns a int4x4 matrix constructed from a single uint value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 int4x4(uint v) { return new int4x4(v); }
/// <summary>Return a int4x4 matrix constructed from a uint4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 int4x4(uint4x4 v) { return new int4x4(v); }
/// <summary>Returns a int4x4 matrix constructed from a single float value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 int4x4(float v) { return new int4x4(v); }
/// <summary>Return a int4x4 matrix constructed from a float4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 int4x4(float4x4 v) { return new int4x4(v); }
/// <summary>Returns a int4x4 matrix constructed from a single double value by converting it to int and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 int4x4(double v) { return new int4x4(v); }
/// <summary>Return a int4x4 matrix constructed from a double4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 int4x4(double4x4 v) { return new int4x4(v); }
/// <summary>Return the int4x4 transpose of a int4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int4x4 transpose(int4x4 v)
{
return int4x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w,
v.c2.x, v.c2.y, v.c2.z, v.c2.w,
v.c3.x, v.c3.y, v.c3.z, v.c3.w);
}
/// <summary>Returns the determinant of a int4x4 matrix.</summary>
public static int determinant(int4x4 m)
{
int4 c0 = m.c0;
int4 c1 = m.c1;
int4 c2 = m.c2;
int4 c3 = m.c3;
int m00 = c1.y * (c2.z * c3.w - c2.w * c3.z) - c2.y * (c1.z * c3.w - c1.w * c3.z) + c3.y * (c1.z * c2.w - c1.w * c2.z);
int m01 = c0.y * (c2.z * c3.w - c2.w * c3.z) - c2.y * (c0.z * c3.w - c0.w * c3.z) + c3.y * (c0.z * c2.w - c0.w * c2.z);
int m02 = c0.y * (c1.z * c3.w - c1.w * c3.z) - c1.y * (c0.z * c3.w - c0.w * c3.z) + c3.y * (c0.z * c1.w - c0.w * c1.z);
int m03 = c0.y * (c1.z * c2.w - c1.w * c2.z) - c1.y * (c0.z * c2.w - c0.w * c2.z) + c2.y * (c0.z * c1.w - c0.w * c1.z);
return c0.x * m00 - c1.x * m01 + c2.x * m02 - c3.x * m03;
}
/// <summary>Returns a uint hash code of a int4x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(int4x4 v)
{
return csum(asuint(v.c0) * uint4(0x5D1B165Bu, 0x87096CD7u, 0x4C7F6DD1u, 0x4822A3E9u) +
asuint(v.c1) * uint4(0xAAC3C25Du, 0xD21D0945u, 0x88FCAB2Du, 0x614DA60Du) +
asuint(v.c2) * uint4(0x5BA2C50Bu, 0x8C455ACBu, 0xCD266C89u, 0xF1852A33u) +
asuint(v.c3) * uint4(0x77E35E77u, 0x863E3729u, 0xE191B035u, 0x68586FAFu)) + 0xD4DFF6D3u;
}
/// <summary>
/// Returns a uint4 vector hash code of a int4x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(int4x4 v)
{
return (asuint(v.c0) * uint4(0xCB634F4Du, 0x9B13B92Du, 0x4ABF0813u, 0x86068063u) +
asuint(v.c1) * uint4(0xD75513F9u, 0x5AB3E8CDu, 0x676E8407u, 0xB36DE767u) +
asuint(v.c2) * uint4(0x6FCA387Du, 0xAF0F3103u, 0xE4A056C7u, 0x841D8225u) +
asuint(v.c3) * uint4(0xC9393C7Du, 0xD42EAFA3u, 0xD9AFD06Du, 0x97A65421u)) + 0x7809205Fu;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
#if !UNITY_DOTSPLAYER
using UnityEngine;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
public partial struct float2
{
public static implicit operator Vector2(float2 v) { return new Vector2(v.x, v.y); }
public static implicit operator float2(Vector2 v) { return new float2(v.x, v.y); }
}
public partial struct float3
{
public static implicit operator Vector3(float3 v) { return new Vector3(v.x, v.y, v.z); }
public static implicit operator float3(Vector3 v) { return new float3(v.x, v.y, v.z); }
}
public partial struct float4
{
public static implicit operator float4(Vector4 v) { return new float4(v.x, v.y, v.z, v.w); }
public static implicit operator Vector4(float4 v) { return new Vector4(v.x, v.y, v.z, v.w); }
}
public partial struct quaternion
{
public static implicit operator Quaternion(quaternion q) { return new Quaternion(q.value.x, q.value.y, q.value.z, q.value.w); }
public static implicit operator quaternion(Quaternion q) { return new quaternion(q.x, q.y, q.z, q.w); }
}
public partial struct float4x4
{
public static implicit operator float4x4(Matrix4x4 m) { return new float4x4(m.GetColumn(0), m.GetColumn(1), m.GetColumn(2), m.GetColumn(3)); }
public static implicit operator Matrix4x4(float4x4 m) { return new Matrix4x4(m.c0, m.c1, m.c2, m.c3); }
}
}
#endif

View File

@@ -0,0 +1,971 @@
using System.Runtime.CompilerServices;
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
public partial struct float2x2
{
/// <summary>Returns a float2x2 matrix representing a counter-clockwise rotation of angle degrees.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 Rotate(float angle)
{
float s, c;
sincos(angle, out s, out c);
return float2x2(c, -s,
s, c);
}
/// <summary>Returns a float2x2 matrix representing a uniform scaling of both axes by s.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 Scale(float s)
{
return float2x2(s, 0.0f,
0.0f, s);
}
/// <summary>Returns a float2x2 matrix representing a non-uniform axis scaling by x and y.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 Scale(float x, float y)
{
return float2x2(x, 0.0f,
0.0f, y);
}
/// <summary>Returns a float2x2 matrix representing a non-uniform axis scaling by the components of the float2 vector v.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2x2 Scale(float2 v)
{
return Scale(v.x, v.y);
}
}
public partial struct float3x3
{
/// <summary>
/// Constructs a float3x3 from the upper left 3x3 of a float4x4.
/// </summary>
/// <param name="f4x4"><see cref="float4x4"/> to extract a float3x3 from.</param>
public float3x3(float4x4 f4x4)
{
c0 = f4x4.c0.xyz;
c1 = f4x4.c1.xyz;
c2 = f4x4.c2.xyz;
}
/// <summary>Constructs a float3x3 matrix from a unit quaternion.</summary>
public float3x3(quaternion q)
{
float4 v = q.value;
float4 v2 = v + v;
uint3 npn = uint3(0x80000000, 0x00000000, 0x80000000);
uint3 nnp = uint3(0x80000000, 0x80000000, 0x00000000);
uint3 pnn = uint3(0x00000000, 0x80000000, 0x80000000);
c0 = v2.y * asfloat(asuint(v.yxw) ^ npn) - v2.z * asfloat(asuint(v.zwx) ^ pnn) + float3(1, 0, 0);
c1 = v2.z * asfloat(asuint(v.wzy) ^ nnp) - v2.x * asfloat(asuint(v.yxw) ^ npn) + float3(0, 1, 0);
c2 = v2.x * asfloat(asuint(v.zwx) ^ pnn) - v2.y * asfloat(asuint(v.wzy) ^ nnp) + float3(0, 0, 1);
}
/// <summary>
/// Returns a float3x3 matrix representing a rotation around a unit axis by an angle in radians.
/// The rotation direction is clockwise when looking along the rotation axis towards the origin.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 AxisAngle(float3 axis, float angle)
{
float sina, cosa;
math.sincos(angle, out sina, out cosa);
float3 u = axis;
float3 u_yzx = u.yzx;
float3 u_zxy = u.zxy;
float3 u_inv_cosa = u - u * cosa; // u * (1.0f - cosa);
float4 t = float4(u * sina, cosa);
uint3 ppn = uint3(0x00000000, 0x00000000, 0x80000000);
uint3 npp = uint3(0x80000000, 0x00000000, 0x00000000);
uint3 pnp = uint3(0x00000000, 0x80000000, 0x00000000);
return float3x3(
u.x * u_inv_cosa + asfloat(asuint(t.wzy) ^ ppn),
u.y * u_inv_cosa + asfloat(asuint(t.zwx) ^ npp),
u.z * u_inv_cosa + asfloat(asuint(t.yxw) ^ pnp)
);
/*
return float3x3(
cosa + u.x * u.x * (1.0f - cosa), u.y * u.x * (1.0f - cosa) - u.z * sina, u.z * u.x * (1.0f - cosa) + u.y * sina,
u.x * u.y * (1.0f - cosa) + u.z * sina, cosa + u.y * u.y * (1.0f - cosa), u.y * u.z * (1.0f - cosa) - u.x * sina,
u.x * u.z * (1.0f - cosa) - u.y * sina, u.y * u.z * (1.0f - cosa) + u.x * sina, cosa + u.z * u.z * (1.0f - cosa)
);
*/
}
/// <summary>
/// Returns a float3x3 rotation matrix constructed by first performing a rotation around the x-axis, then the y-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 EulerXYZ(float3 xyz)
{
// return mul(rotateZ(xyz.z), mul(rotateY(xyz.y), rotateX(xyz.x)));
float3 s, c;
sincos(xyz, out s, out c);
return float3x3(
c.y * c.z, c.z * s.x * s.y - c.x * s.z, c.x * c.z * s.y + s.x * s.z,
c.y * s.z, c.x * c.z + s.x * s.y * s.z, c.x * s.y * s.z - c.z * s.x,
-s.y, c.y * s.x, c.x * c.y
);
}
/// <summary>
/// Returns a float3x3 rotation matrix constructed by first performing a rotation around the x-axis, then the z-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 EulerXZY(float3 xyz)
{
// return mul(rotateY(xyz.y), mul(rotateZ(xyz.z), rotateX(xyz.x))); }
float3 s, c;
sincos(xyz, out s, out c);
return float3x3(
c.y * c.z, s.x * s.y - c.x * c.y * s.z, c.x * s.y + c.y * s.x * s.z,
s.z, c.x * c.z, -c.z * s.x,
-c.z * s.y, c.y * s.x + c.x * s.y * s.z, c.x * c.y - s.x * s.y * s.z
);
}
/// <summary>
/// Returns a float3x3 rotation matrix constructed by first performing a rotation around the y-axis, then the x-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 EulerYXZ(float3 xyz)
{
// return mul(rotateZ(xyz.z), mul(rotateX(xyz.x), rotateY(xyz.y)));
float3 s, c;
sincos(xyz, out s, out c);
return float3x3(
c.y * c.z - s.x * s.y * s.z, -c.x * s.z, c.z * s.y + c.y * s.x * s.z,
c.z * s.x * s.y + c.y * s.z, c.x * c.z, s.y * s.z - c.y * c.z * s.x,
-c.x * s.y, s.x, c.x * c.y
);
}
/// <summary>
/// Returns a float3x3 rotation matrix constructed by first performing a rotation around the y-axis, then the z-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 EulerYZX(float3 xyz)
{
// return mul(rotateX(xyz.x), mul(rotateZ(xyz.z), rotateY(xyz.y)));
float3 s, c;
sincos(xyz, out s, out c);
return float3x3(
c.y * c.z, -s.z, c.z * s.y,
s.x * s.y + c.x * c.y * s.z, c.x * c.z, c.x * s.y * s.z - c.y * s.x,
c.y * s.x * s.z - c.x * s.y, c.z * s.x, c.x * c.y + s.x * s.y * s.z
);
}
/// <summary>
/// Returns a float3x3 rotation matrix constructed by first performing a rotation around the z-axis, then the x-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// This is the default order rotation order in Unity.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 EulerZXY(float3 xyz)
{
// return mul(rotateY(xyz.y), mul(rotateX(xyz.x), rotateZ(xyz.z)));
float3 s, c;
sincos(xyz, out s, out c);
return float3x3(
c.y * c.z + s.x * s.y * s.z, c.z * s.x * s.y - c.y * s.z, c.x * s.y,
c.x * s.z, c.x * c.z, -s.x,
c.y * s.x * s.z - c.z * s.y, c.y * c.z * s.x + s.y * s.z, c.x * c.y
);
}
/// <summary>
/// Returns a float3x3 rotation matrix constructed by first performing a rotation around the z-axis, then the y-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 EulerZYX(float3 xyz)
{
// return mul(rotateX(xyz.x), mul(rotateY(xyz.y), rotateZ(xyz.z)));
float3 s, c;
sincos(xyz, out s, out c);
return float3x3(
c.y * c.z, -c.y * s.z, s.y,
c.z * s.x * s.y + c.x * s.z, c.x * c.z - s.x * s.y * s.z, -c.y * s.x,
s.x * s.z - c.x * c.z * s.y, c.z * s.x + c.x * s.y * s.z, c.x * c.y
);
}
/// <summary>
/// Returns a float3x3 rotation matrix constructed by first performing a rotation around the x-axis, then the y-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 EulerXYZ(float x, float y, float z) { return EulerXYZ(float3(x, y, z)); }
/// <summary>
/// Returns a float3x3 rotation matrix constructed by first performing a rotation around the x-axis, then the z-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 EulerXZY(float x, float y, float z) { return EulerXZY(float3(x, y, z)); }
/// <summary>
/// Returns a float3x3 rotation matrix constructed by first performing a rotation around the y-axis, then the x-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 EulerYXZ(float x, float y, float z) { return EulerYXZ(float3(x, y, z)); }
/// <summary>
/// Returns a float3x3 rotation matrix constructed by first performing a rotation around the y-axis, then the z-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 EulerYZX(float x, float y, float z) { return EulerYZX(float3(x, y, z)); }
/// <summary>
/// Returns a float3x3 rotation matrix constructed by first performing a rotation around the z-axis, then the x-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// This is the default order rotation order in Unity.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 EulerZXY(float x, float y, float z) { return EulerZXY(float3(x, y, z)); }
/// <summary>
/// Returns a float3x3 rotation matrix constructed by first performing a rotation around the z-axis, then the y-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 EulerZYX(float x, float y, float z) { return EulerZYX(float3(x, y, z)); }
/// <summary>
/// Returns a float3x3 rotation matrix constructed by first performing 3 rotations around the principal axes in a given order.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// When the rotation order is known at compile time, it is recommended for performance reasons to use specific
/// Euler rotation constructors such as EulerZXY(...).
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
/// <param name="order">The order in which the rotations are applied.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 Euler(float3 xyz, RotationOrder order = RotationOrder.Default)
{
switch (order)
{
case RotationOrder.XYZ:
return EulerXYZ(xyz);
case RotationOrder.XZY:
return EulerXZY(xyz);
case RotationOrder.YXZ:
return EulerYXZ(xyz);
case RotationOrder.YZX:
return EulerYZX(xyz);
case RotationOrder.ZXY:
return EulerZXY(xyz);
case RotationOrder.ZYX:
return EulerZYX(xyz);
default:
return float3x3.identity;
}
}
/// <summary>
/// Returns a float3x3 rotation matrix constructed by first performing 3 rotations around the principal axes in a given order.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// When the rotation order is known at compile time, it is recommended for performance reasons to use specific
/// Euler rotation constructors such as EulerZXY(...).
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
/// <param name="order">The order in which the rotations are applied.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 Euler(float x, float y, float z, RotationOrder order = RotationOrder.Default)
{
return Euler(float3(x, y, z), order);
}
/// <summary>Returns a float4x4 matrix that rotates around the x-axis by a given number of radians.</summary>
/// <param name="angle">The clockwise rotation angle when looking along the x-axis towards the origin in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 RotateX(float angle)
{
// {{1, 0, 0}, {0, c_0, -s_0}, {0, s_0, c_0}}
float s, c;
sincos(angle, out s, out c);
return float3x3(1.0f, 0.0f, 0.0f,
0.0f, c, -s,
0.0f, s, c);
}
/// <summary>Returns a float4x4 matrix that rotates around the y-axis by a given number of radians.</summary>
/// <param name="angle">The clockwise rotation angle when looking along the y-axis towards the origin in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 RotateY(float angle)
{
// {{c_1, 0, s_1}, {0, 1, 0}, {-s_1, 0, c_1}}
float s, c;
sincos(angle, out s, out c);
return float3x3(c, 0.0f, s,
0.0f, 1.0f, 0.0f,
-s, 0.0f, c);
}
/// <summary>Returns a float4x4 matrix that rotates around the z-axis by a given number of radians.</summary>
/// <param name="angle">The clockwise rotation angle when looking along the z-axis towards the origin in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 RotateZ(float angle)
{
// {{c_2, -s_2, 0}, {s_2, c_2, 0}, {0, 0, 1}}
float s, c;
sincos(angle, out s, out c);
return float3x3(c, -s, 0.0f,
s, c, 0.0f,
0.0f, 0.0f, 1.0f);
}
//<summary>Returns a float3x3 matrix representing a uniform scaling of all axes by s.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 Scale(float s)
{
return float3x3(s, 0.0f, 0.0f,
0.0f, s, 0.0f,
0.0f, 0.0f, s);
}
/// <summary>Returns a float3x3 matrix representing a non-uniform axis scaling by x, y and z.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 Scale(float x, float y, float z)
{
return float3x3(x, 0.0f, 0.0f,
0.0f, y, 0.0f,
0.0f, 0.0f, z);
}
/// <summary>Returns a float3x3 matrix representing a non-uniform axis scaling by the components of the float3 vector v.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 Scale(float3 v)
{
return Scale(v.x, v.y, v.z);
}
/// <summary>
/// Returns a float3x3 view rotation matrix given a unit length forward vector and a unit length up vector.
/// The two input vectors are assumed to be unit length and not collinear.
/// If these assumptions are not met use float3x3.LookRotationSafe instead.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 LookRotation(float3 forward, float3 up)
{
float3 t = normalize(cross(up, forward));
return float3x3(t, cross(forward, t), forward);
}
/// <summary>
/// Returns a float3x3 view rotation matrix given a forward vector and an up vector.
/// The two input vectors are not assumed to be unit length.
/// If the magnitude of either of the vectors is so extreme that the calculation cannot be carried out reliably or the vectors are collinear,
/// the identity will be returned instead.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 LookRotationSafe(float3 forward, float3 up)
{
float forwardLengthSq = dot(forward, forward);
float upLengthSq = dot(up, up);
forward *= rsqrt(forwardLengthSq);
up *= rsqrt(upLengthSq);
float3 t = cross(up, forward);
float tLengthSq = dot(t, t);
t *= rsqrt(tLengthSq);
float mn = min(min(forwardLengthSq, upLengthSq), tLengthSq);
float mx = max(max(forwardLengthSq, upLengthSq), tLengthSq);
bool accept = mn > 1e-35f && mx < 1e35f && isfinite(forwardLengthSq) && isfinite(upLengthSq) && isfinite(tLengthSq);
return float3x3(
select(float3(1,0,0), t, accept),
select(float3(0,1,0), cross(forward, t), accept),
select(float3(0,0,1), forward, accept));
}
public static explicit operator float3x3(float4x4 f4x4) => new float3x3(f4x4);
}
public partial struct float4x4
{
/// <summary>Constructs a float4x4 from a float3x3 rotation matrix and a float3 translation vector.</summary>
public float4x4(float3x3 rotation, float3 translation)
{
c0 = float4(rotation.c0, 0.0f);
c1 = float4(rotation.c1, 0.0f);
c2 = float4(rotation.c2, 0.0f);
c3 = float4(translation, 1.0f);
}
/// <summary>Constructs a float4x4 from a quaternion and a float3 translation vector.</summary>
public float4x4(quaternion rotation, float3 translation)
{
float3x3 rot = float3x3(rotation);
c0 = float4(rot.c0, 0.0f);
c1 = float4(rot.c1, 0.0f);
c2 = float4(rot.c2, 0.0f);
c3 = float4(translation, 1.0f);
}
/// <summary>Constructs a float4x4 from a RigidTransform.</summary>
public float4x4(RigidTransform transform)
{
float3x3 rot = float3x3(transform.rot);
c0 = float4(rot.c0, 0.0f);
c1 = float4(rot.c1, 0.0f);
c2 = float4(rot.c2, 0.0f);
c3 = float4(transform.pos, 1.0f);
}
/// <summary>
/// Returns a float4x4 matrix representing a rotation around a unit axis by an angle in radians.
/// The rotation direction is clockwise when looking along the rotation axis towards the origin.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 AxisAngle(float3 axis, float angle)
{
float sina, cosa;
math.sincos(angle, out sina, out cosa);
float4 u = float4(axis, 0.0f);
float4 u_yzx = u.yzxx;
float4 u_zxy = u.zxyx;
float4 u_inv_cosa = u - u * cosa; // u * (1.0f - cosa);
float4 t = float4(u.xyz * sina, cosa);
uint4 ppnp = uint4(0x00000000, 0x00000000, 0x80000000, 0x00000000);
uint4 nppp = uint4(0x80000000, 0x00000000, 0x00000000, 0x00000000);
uint4 pnpp = uint4(0x00000000, 0x80000000, 0x00000000, 0x00000000);
uint4 mask = uint4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000);
return float4x4(
u.x * u_inv_cosa + asfloat((asuint(t.wzyx) ^ ppnp) & mask),
u.y * u_inv_cosa + asfloat((asuint(t.zwxx) ^ nppp) & mask),
u.z * u_inv_cosa + asfloat((asuint(t.yxwx) ^ pnpp) & mask),
float4(0.0f, 0.0f, 0.0f, 1.0f)
);
}
/// <summary>
/// Returns a float4x4 rotation matrix constructed by first performing a rotation around the x-axis, then the y-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 EulerXYZ(float3 xyz)
{
// return mul(rotateZ(xyz.z), mul(rotateY(xyz.y), rotateX(xyz.x)));
float3 s, c;
sincos(xyz, out s, out c);
return float4x4(
c.y * c.z, c.z * s.x * s.y - c.x * s.z, c.x * c.z * s.y + s.x * s.z, 0.0f,
c.y * s.z, c.x * c.z + s.x * s.y * s.z, c.x * s.y * s.z - c.z * s.x, 0.0f,
-s.y, c.y * s.x, c.x * c.y, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
);
}
/// <summary>
/// Returns a float4x4 rotation matrix constructed by first performing a rotation around the x-axis, then the z-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 EulerXZY(float3 xyz)
{
// return mul(rotateY(xyz.y), mul(rotateZ(xyz.z), rotateX(xyz.x))); }
float3 s, c;
sincos(xyz, out s, out c);
return float4x4(
c.y * c.z, s.x * s.y - c.x * c.y * s.z, c.x * s.y + c.y * s.x * s.z, 0.0f,
s.z, c.x * c.z, -c.z * s.x, 0.0f,
-c.z * s.y, c.y * s.x + c.x * s.y * s.z, c.x * c.y - s.x * s.y * s.z, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
);
}
/// <summary>
/// Returns a float4x4 rotation matrix constructed by first performing a rotation around the y-axis, then the x-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 EulerYXZ(float3 xyz)
{
// return mul(rotateZ(xyz.z), mul(rotateX(xyz.x), rotateY(xyz.y)));
float3 s, c;
sincos(xyz, out s, out c);
return float4x4(
c.y * c.z - s.x * s.y * s.z, -c.x * s.z, c.z * s.y + c.y * s.x * s.z, 0.0f,
c.z * s.x * s.y + c.y * s.z, c.x * c.z, s.y * s.z - c.y * c.z * s.x, 0.0f,
-c.x * s.y, s.x, c.x * c.y, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
);
}
/// <summary>
/// Returns a float4x4 rotation matrix constructed by first performing a rotation around the y-axis, then the z-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 EulerYZX(float3 xyz)
{
// return mul(rotateX(xyz.x), mul(rotateZ(xyz.z), rotateY(xyz.y)));
float3 s, c;
sincos(xyz, out s, out c);
return float4x4(
c.y * c.z, -s.z, c.z * s.y, 0.0f,
s.x * s.y + c.x * c.y * s.z, c.x * c.z, c.x * s.y * s.z - c.y * s.x, 0.0f,
c.y * s.x * s.z - c.x * s.y, c.z * s.x, c.x * c.y + s.x * s.y * s.z, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
);
}
/// <summary>
/// Returns a float4x4 rotation matrix constructed by first performing a rotation around the z-axis, then the x-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// This is the default order rotation order in Unity.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 EulerZXY(float3 xyz)
{
// return mul(rotateY(xyz.y), mul(rotateX(xyz.x), rotateZ(xyz.z)));
float3 s, c;
sincos(xyz, out s, out c);
return float4x4(
c.y * c.z + s.x * s.y * s.z, c.z * s.x * s.y - c.y * s.z, c.x * s.y, 0.0f,
c.x * s.z, c.x * c.z, -s.x, 0.0f,
c.y * s.x * s.z - c.z * s.y, c.y * c.z * s.x + s.y * s.z, c.x * c.y, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
);
}
/// <summary>
/// Returns a float4x4 rotation matrix constructed by first performing a rotation around the z-axis, then the y-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 EulerZYX(float3 xyz)
{
// return mul(rotateX(xyz.x), mul(rotateY(xyz.y), rotateZ(xyz.z)));
float3 s, c;
sincos(xyz, out s, out c);
return float4x4(
c.y * c.z, -c.y * s.z, s.y, 0.0f,
c.z * s.x * s.y + c.x * s.z, c.x * c.z - s.x * s.y * s.z, -c.y * s.x, 0.0f,
s.x * s.z - c.x * c.z * s.y, c.z * s.x + c.x * s.y * s.z, c.x * c.y, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
);
}
/// <summary>
/// Returns a float4x4 rotation matrix constructed by first performing a rotation around the x-axis, then the y-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 EulerXYZ(float x, float y, float z) { return EulerXYZ(float3(x, y, z)); }
/// <summary>
/// Returns a float4x4 rotation matrix constructed by first performing a rotation around the x-axis, then the z-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 EulerXZY(float x, float y, float z) { return EulerXZY(float3(x, y, z)); }
/// <summary>
/// Returns a float4x4 rotation matrix constructed by first performing a rotation around the y-axis, then the x-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 EulerYXZ(float x, float y, float z) { return EulerYXZ(float3(x, y, z)); }
/// <summary>
/// Returns a float4x4 rotation matrix constructed by first performing a rotation around the y-axis, then the z-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 EulerYZX(float x, float y, float z) { return EulerYZX(float3(x, y, z)); }
/// <summary>
/// Returns a float4x4 rotation matrix constructed by first performing a rotation around the z-axis, then the x-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// This is the default order rotation order in Unity.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 EulerZXY(float x, float y, float z) { return EulerZXY(float3(x, y, z)); }
/// <summary>
/// Returns a float4x4 rotation matrix constructed by first performing a rotation around the z-axis, then the y-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 EulerZYX(float x, float y, float z) { return EulerZYX(float3(x, y, z)); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 Euler(float3 xyz, RotationOrder order = RotationOrder.Default)
{
switch (order)
{
case RotationOrder.XYZ:
return EulerXYZ(xyz);
case RotationOrder.XZY:
return EulerXZY(xyz);
case RotationOrder.YXZ:
return EulerYXZ(xyz);
case RotationOrder.YZX:
return EulerYZX(xyz);
case RotationOrder.ZXY:
return EulerZXY(xyz);
case RotationOrder.ZYX:
return EulerZYX(xyz);
default:
return float4x4.identity;
}
}
/// <summary>
/// Returns a float4x4 rotation matrix constructed by first performing 3 rotations around the principal axes in a given order.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// When the rotation order is known at compile time, it is recommended for performance reasons to use specific
/// Euler rotation constructors such as EulerZXY(...).
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
/// <param name="order">The order in which the rotations are applied.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 Euler(float x, float y, float z, RotationOrder order = RotationOrder.Default)
{
return Euler(float3(x, y, z), order);
}
/// <summary>Returns a float4x4 matrix that rotates around the x-axis by a given number of radians.</summary>
/// <param name="angle">The clockwise rotation angle when looking along the x-axis towards the origin in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 RotateX(float angle)
{
// {{1, 0, 0}, {0, c_0, -s_0}, {0, s_0, c_0}}
float s, c;
sincos(angle, out s, out c);
return float4x4(1.0f, 0.0f, 0.0f, 0.0f,
0.0f, c, -s, 0.0f,
0.0f, s, c, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
}
/// <summary>Returns a float4x4 matrix that rotates around the y-axis by a given number of radians.</summary>
/// <param name="angle">The clockwise rotation angle when looking along the y-axis towards the origin in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 RotateY(float angle)
{
// {{c_1, 0, s_1}, {0, 1, 0}, {-s_1, 0, c_1}}
float s, c;
sincos(angle, out s, out c);
return float4x4(c, 0.0f, s, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
-s, 0.0f, c, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
}
/// <summary>Returns a float4x4 matrix that rotates around the z-axis by a given number of radians.</summary>
/// <param name="angle">The clockwise rotation angle when looking along the z-axis towards the origin in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 RotateZ(float angle)
{
// {{c_2, -s_2, 0}, {s_2, c_2, 0}, {0, 0, 1}}
float s, c;
sincos(angle, out s, out c);
return float4x4(c, -s, 0.0f, 0.0f,
s, c, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
}
/// <summary>Returns a float4x4 scale matrix given 3 axis scales.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 Scale(float s)
{
return float4x4(s, 0.0f, 0.0f, 0.0f,
0.0f, s, 0.0f, 0.0f,
0.0f, 0.0f, s, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
}
/// <summary>Returns a float4x4 scale matrix given a float3 vector containing the 3 axis scales.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 Scale(float x, float y, float z)
{
return float4x4(x, 0.0f, 0.0f, 0.0f,
0.0f, y, 0.0f, 0.0f,
0.0f, 0.0f, z, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
}
/// <summary>Returns a float4x4 scale matrix given a float3 vector containing the 3 axis scales.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 Scale(float3 scales)
{
return Scale(scales.x, scales.y, scales.z);
}
/// <summary>Returns a float4x4 translation matrix given a float3 translation vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 Translate(float3 vector)
{
return float4x4(float4(1.0f, 0.0f, 0.0f, 0.0f),
float4(0.0f, 1.0f, 0.0f, 0.0f),
float4(0.0f, 0.0f, 1.0f, 0.0f),
float4(vector.x, vector.y, vector.z, 1.0f));
}
/// <summary>
/// Returns a float4x4 view matrix given an eye position, a target point and a unit length up vector.
/// The up vector is assumed to be unit length, the eye and target points are assumed to be distinct and
/// the vector between them is assumes to be collinear with the up vector.
/// If these assumptions are not met use float4x4.LookRotationSafe instead.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 LookAt(float3 eye, float3 target, float3 up)
{
float3x3 rot = float3x3.LookRotation(normalize(target - eye), up);
float4x4 matrix;
matrix.c0 = float4(rot.c0, 0.0F);
matrix.c1 = float4(rot.c1, 0.0F);
matrix.c2 = float4(rot.c2, 0.0F);
matrix.c3 = float4(eye, 1.0F);
return matrix;
}
/// <summary>
/// Returns a float4x4 centered orthographic projection matrix.
/// </summary>
/// <param name="width">The width of the view volume.</param>
/// <param name="height">The height of the view volume.</param>
/// <param name="near">The distance to the near plane.</param>
/// <param name="far">The distance to the far plane.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 Ortho(float width, float height, float near, float far)
{
float rcpdx = 1.0f / width;
float rcpdy = 1.0f / height;
float rcpdz = 1.0f / (far - near);
return float4x4(
2.0f * rcpdx, 0.0f, 0.0f, 0.0f,
0.0f, 2.0f * rcpdy, 0.0f, 0.0f,
0.0f, 0.0f, -2.0f * rcpdz, -(far + near) * rcpdz,
0.0f, 0.0f, 0.0f, 1.0f
);
}
/// <summary>
/// Returns a float4x4 off-center orthographic projection matrix.
/// </summary>
/// <param name="left">The minimum x-coordinate of the view volume.</param>
/// <param name="right">The maximum x-coordinate of the view volume.</param>
/// <param name="bottom">The minimum y-coordinate of the view volume.</param>
/// <param name="top">The minimum y-coordinate of the view volume.</param>
/// <param name="near">The distance to the near plane.</param>
/// <param name="far">The distance to the far plane.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 OrthoOffCenter(float left, float right, float bottom, float top, float near, float far)
{
float rcpdx = 1.0f / (right - left);
float rcpdy = 1.0f / (top - bottom);
float rcpdz = 1.0f / (far - near);
return float4x4(
2.0f * rcpdx, 0.0f, 0.0f, -(right + left) * rcpdx,
0.0f, 2.0f * rcpdy, 0.0f, -(top + bottom) * rcpdy,
0.0f, 0.0f, -2.0f * rcpdz, -(far + near) * rcpdz,
0.0f, 0.0f, 0.0f, 1.0f
);
}
/// <summary>
/// Returns a float4x4 perspective projection matrix based on field of view.
/// </summary>
/// <param name="verticalFov">Vertical Field of view in radians.</param>
/// <param name="aspect">X:Y aspect ratio.</param>
/// <param name="near">Distance to near plane. Must be greater than zero.</param>
/// <param name="far">Distance to far plane. Must be greater than zero.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 PerspectiveFov(float verticalFov, float aspect, float near, float far)
{
float cotangent = 1.0f / tan(verticalFov * 0.5f);
float rcpdz = 1.0f / (near - far);
return float4x4(
cotangent / aspect, 0.0f, 0.0f, 0.0f,
0.0f, cotangent, 0.0f, 0.0f,
0.0f, 0.0f, (far + near) * rcpdz, 2.0f * near * far * rcpdz,
0.0f, 0.0f, -1.0f, 0.0f
);
}
/// <summary>
/// Returns a float4x4 off-center perspective projection matrix.
/// </summary>
/// <param name="left">The x-coordinate of the left side of the clipping frustum at the near plane.</param>
/// <param name="right">The x-coordinate of the right side of the clipping frustum at the near plane.</param>
/// <param name="bottom">The y-coordinate of the bottom side of the clipping frustum at the near plane.</param>
/// <param name="top">The y-coordinate of the top side of the clipping frustum at the near plane.</param>
/// <param name="near">Distance to the near plane. Must be greater than zero.</param>
/// <param name="far">Distance to the far plane. Must be greater than zero.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 PerspectiveOffCenter(float left, float right, float bottom, float top, float near, float far)
{
float rcpdz = 1.0f / (near - far);
float rcpWidth = 1.0f / (right - left);
float rcpHeight = 1.0f / (top - bottom);
return float4x4(
2.0f * near * rcpWidth, 0.0f, (left + right) * rcpWidth, 0.0f,
0.0f, 2.0f * near * rcpHeight, (bottom + top) * rcpHeight, 0.0f,
0.0f, 0.0f, (far + near) * rcpdz, 2.0f * near * far * rcpdz,
0.0f, 0.0f, -1.0f, 0.0f
);
}
/// <summary>
/// Returns a float4x4 matrix representing a combined scale-, rotation- and translation transform.
/// Equivalent to mul(translationTransform, mul(rotationTransform, scaleTransform)).
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 TRS(float3 translation, quaternion rotation, float3 scale)
{
float3x3 r = float3x3(rotation);
return float4x4( float4(r.c0 * scale.x, 0.0f),
float4(r.c1 * scale.y, 0.0f),
float4(r.c2 * scale.z, 0.0f),
float4(translation, 1.0f));
}
}
partial class math
{
/// <summary>
/// Extracts a float3x3 from the upper left 3x3 of a float4x4.
/// </summary>
/// <param name="f4x4"><see cref="float4x4"/> to extract a float3x3 from.</param>
/// <returns>Upper left 3x3 matrix as float3x3.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 float3x3(float4x4 f4x4)
{
return new float3x3(f4x4);
}
/// <summary>Returns a float3x3 matrix constructed from a quaternion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 float3x3(quaternion rotation)
{
return new float3x3(rotation);
}
/// <summary>Returns a float4x4 constructed from a float3x3 rotation matrix and a float3 translation vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 float4x4(float3x3 rotation, float3 translation)
{
return new float4x4(rotation, translation);
}
/// <summary>Returns a float4x4 constructed from a quaternion and a float3 translation vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 float4x4(quaternion rotation, float3 translation)
{
return new float4x4(rotation, translation);
}
/// <summary>Returns a float4x4 constructed from a RigidTransform.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4x4 float4x4(RigidTransform transform)
{
return new float4x4(transform);
}
/// <summary>Returns an orthonormalized version of a float3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3x3 orthonormalize(float3x3 i)
{
float3x3 o;
float3 u = i.c0;
float3 v = i.c1 - i.c0 * math.dot(i.c1, i.c0);
float lenU = math.length(u);
float lenV = math.length(v);
bool c = lenU > 1e-30f && lenV > 1e-30f;
o.c0 = math.select(float3(1, 0, 0), u / lenU, c);
o.c1 = math.select(float3(0, 1, 0), v / lenV, c);
o.c2 = math.cross(o.c0, o.c1);
return o;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,620 @@
using System;
using System.Runtime.CompilerServices;
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
[Serializable]
public partial struct quaternion : System.IEquatable<quaternion>, IFormattable
{
public float4 value;
/// <summary>A quaternion representing the identity transform.</summary>
public static readonly quaternion identity = new quaternion(0.0f, 0.0f, 0.0f, 1.0f);
/// <summary>Constructs a quaternion from four float values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public quaternion(float x, float y, float z, float w) { value.x = x; value.y = y; value.z = z; value.w = w; }
/// <summary>Constructs a quaternion from float4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public quaternion(float4 value) { this.value = value; }
/// <summary>Implicitly converts a float4 vector to a quaternion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator quaternion(float4 v) { return new quaternion(v); }
/// <summary>Constructs a unit quaternion from a float3x3 rotation matrix. The matrix must be orthonormal.</summary>
public quaternion(float3x3 m)
{
float3 u = m.c0;
float3 v = m.c1;
float3 w = m.c2;
uint u_sign = (asuint(u.x) & 0x80000000);
float t = v.y + asfloat(asuint(w.z) ^ u_sign);
uint4 u_mask = uint4((int)u_sign >> 31);
uint4 t_mask = uint4(asint(t) >> 31);
float tr = 1.0f + abs(u.x);
uint4 sign_flips = uint4(0x00000000, 0x80000000, 0x80000000, 0x80000000) ^ (u_mask & uint4(0x00000000, 0x80000000, 0x00000000, 0x80000000)) ^ (t_mask & uint4(0x80000000, 0x80000000, 0x80000000, 0x00000000));
value = float4(tr, u.y, w.x, v.z) + asfloat(asuint(float4(t, v.x, u.z, w.y)) ^ sign_flips); // +---, +++-, ++-+, +-++
value = asfloat((asuint(value) & ~u_mask) | (asuint(value.zwxy) & u_mask));
value = asfloat((asuint(value.wzyx) & ~t_mask) | (asuint(value) & t_mask));
value = normalize(value);
}
/// <summary>Constructs a unit quaternion from an orthonormal float4x4 matrix.</summary>
public quaternion(float4x4 m)
{
float4 u = m.c0;
float4 v = m.c1;
float4 w = m.c2;
uint u_sign = (asuint(u.x) & 0x80000000);
float t = v.y + asfloat(asuint(w.z) ^ u_sign);
uint4 u_mask = uint4((int)u_sign >> 31);
uint4 t_mask = uint4(asint(t) >> 31);
float tr = 1.0f + abs(u.x);
uint4 sign_flips = uint4(0x00000000, 0x80000000, 0x80000000, 0x80000000) ^ (u_mask & uint4(0x00000000, 0x80000000, 0x00000000, 0x80000000)) ^ (t_mask & uint4(0x80000000, 0x80000000, 0x80000000, 0x00000000));
value = float4(tr, u.y, w.x, v.z) + asfloat(asuint(float4(t, v.x, u.z, w.y)) ^ sign_flips); // +---, +++-, ++-+, +-++
value = asfloat((asuint(value) & ~u_mask) | (asuint(value.zwxy) & u_mask));
value = asfloat((asuint(value.wzyx) & ~t_mask) | (asuint(value) & t_mask));
value = normalize(value);
}
/// <summary>
/// Returns a quaternion representing a rotation around a unit axis by an angle in radians.
/// The rotation direction is clockwise when looking along the rotation axis towards the origin.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion AxisAngle(float3 axis, float angle)
{
float sina, cosa;
math.sincos(0.5f * angle, out sina, out cosa);
return quaternion(float4(axis * sina, cosa));
}
/// <summary>
/// Returns a quaternion constructed by first performing a rotation around the x-axis, then the y-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion EulerXYZ(float3 xyz)
{
// return mul(rotateZ(xyz.z), mul(rotateY(xyz.y), rotateX(xyz.x)));
float3 s, c;
sincos(0.5f * xyz, out s, out c);
return quaternion(
// s.x * c.y * c.z - s.y * s.z * c.x,
// s.y * c.x * c.z + s.x * s.z * c.y,
// s.z * c.x * c.y - s.x * s.y * c.z,
// c.x * c.y * c.z + s.y * s.z * s.x
float4(s.xyz, c.x) * c.yxxy * c.zzyz + s.yxxy * s.zzyz * float4(c.xyz, s.x) * float4(-1.0f, 1.0f, -1.0f, 1.0f)
);
}
/// <summary>
/// Returns a quaternion constructed by first performing a rotation around the x-axis, then the z-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion EulerXZY(float3 xyz)
{
// return mul(rotateY(xyz.y), mul(rotateZ(xyz.z), rotateX(xyz.x)));
float3 s, c;
sincos(0.5f * xyz, out s, out c);
return quaternion(
// s.x * c.y * c.z + s.y * s.z * c.x,
// s.y * c.x * c.z + s.x * s.z * c.y,
// s.z * c.x * c.y - s.x * s.y * c.z,
// c.x * c.y * c.z - s.y * s.z * s.x
float4(s.xyz, c.x) * c.yxxy * c.zzyz + s.yxxy * s.zzyz * float4(c.xyz, s.x) * float4(1.0f, 1.0f, -1.0f, -1.0f)
);
}
/// <summary>
/// Returns a quaternion constructed by first performing a rotation around the y-axis, then the x-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion EulerYXZ(float3 xyz)
{
// return mul(rotateZ(xyz.z), mul(rotateX(xyz.x), rotateY(xyz.y)));
float3 s, c;
sincos(0.5f * xyz, out s, out c);
return quaternion(
// s.x * c.y * c.z - s.y * s.z * c.x,
// s.y * c.x * c.z + s.x * s.z * c.y,
// s.z * c.x * c.y + s.x * s.y * c.z,
// c.x * c.y * c.z - s.y * s.z * s.x
float4(s.xyz, c.x) * c.yxxy * c.zzyz + s.yxxy * s.zzyz * float4(c.xyz, s.x) * float4(-1.0f, 1.0f, 1.0f, -1.0f)
);
}
/// <summary>
/// Returns a quaternion constructed by first performing a rotation around the y-axis, then the z-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion EulerYZX(float3 xyz)
{
// return mul(rotateX(xyz.x), mul(rotateZ(xyz.z), rotateY(xyz.y)));
float3 s, c;
sincos(0.5f * xyz, out s, out c);
return quaternion(
// s.x * c.y * c.z - s.y * s.z * c.x,
// s.y * c.x * c.z - s.x * s.z * c.y,
// s.z * c.x * c.y + s.x * s.y * c.z,
// c.x * c.y * c.z + s.y * s.z * s.x
float4(s.xyz, c.x) * c.yxxy * c.zzyz + s.yxxy * s.zzyz * float4(c.xyz, s.x) * float4(-1.0f, -1.0f, 1.0f, 1.0f)
);
}
/// <summary>
/// Returns a quaternion constructed by first performing a rotation around the z-axis, then the x-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// This is the default order rotation order in Unity.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion EulerZXY(float3 xyz)
{
// return mul(rotateY(xyz.y), mul(rotateX(xyz.x), rotateZ(xyz.z)));
float3 s, c;
sincos(0.5f * xyz, out s, out c);
return quaternion(
// s.x * c.y * c.z + s.y * s.z * c.x,
// s.y * c.x * c.z - s.x * s.z * c.y,
// s.z * c.x * c.y - s.x * s.y * c.z,
// c.x * c.y * c.z + s.y * s.z * s.x
float4(s.xyz, c.x) * c.yxxy * c.zzyz + s.yxxy * s.zzyz * float4(c.xyz, s.x) * float4(1.0f, -1.0f, -1.0f, 1.0f)
);
}
/// <summary>
/// Returns a quaternion constructed by first performing a rotation around the z-axis, then the y-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion EulerZYX(float3 xyz)
{
// return mul(rotateX(xyz.x), mul(rotateY(xyz.y), rotateZ(xyz.z)));
float3 s, c;
sincos(0.5f * xyz, out s, out c);
return quaternion(
// s.x * c.y * c.z + s.y * s.z * c.x,
// s.y * c.x * c.z - s.x * s.z * c.y,
// s.z * c.x * c.y + s.x * s.y * c.z,
// c.x * c.y * c.z - s.y * s.x * s.z
float4(s.xyz, c.x) * c.yxxy * c.zzyz + s.yxxy * s.zzyz * float4(c.xyz, s.x) * float4(1.0f, -1.0f, 1.0f, -1.0f)
);
}
/// <summary>
/// Returns a quaternion constructed by first performing a rotation around the x-axis, then the y-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion EulerXYZ(float x, float y, float z) { return EulerXYZ(float3(x, y, z)); }
/// <summary>
/// Returns a quaternion constructed by first performing a rotation around the x-axis, then the z-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion EulerXZY(float x, float y, float z) { return EulerXZY(float3(x, y, z)); }
/// <summary>
/// Returns a quaternion constructed by first performing a rotation around the y-axis, then the x-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion EulerYXZ(float x, float y, float z) { return EulerYXZ(float3(x, y, z)); }
/// <summary>
/// Returns a quaternion constructed by first performing a rotation around the y-axis, then the z-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion EulerYZX(float x, float y, float z) { return EulerYZX(float3(x, y, z)); }
/// <summary>
/// Returns a quaternion constructed by first performing a rotation around the z-axis, then the x-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// This is the default order rotation order in Unity.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion EulerZXY(float x, float y, float z) { return EulerZXY(float3(x, y, z)); }
/// <summary>
/// Returns a quaternion constructed by first performing a rotation around the z-axis, then the y-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion EulerZYX(float x, float y, float z) { return EulerZYX(float3(x, y, z)); }
/// <summary>
/// Returns a quaternion constructed by first performing 3 rotations around the principal axes in a given order.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// When the rotation order is known at compile time, it is recommended for performance reasons to use specific
/// Euler rotation constructors such as EulerZXY(...).
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
/// <param name="order">The order in which the rotations are applied.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion Euler(float3 xyz, RotationOrder order = RotationOrder.ZXY)
{
switch (order)
{
case RotationOrder.XYZ:
return EulerXYZ(xyz);
case RotationOrder.XZY:
return EulerXZY(xyz);
case RotationOrder.YXZ:
return EulerYXZ(xyz);
case RotationOrder.YZX:
return EulerYZX(xyz);
case RotationOrder.ZXY:
return EulerZXY(xyz);
case RotationOrder.ZYX:
return EulerZYX(xyz);
default:
return quaternion.identity;
}
}
/// <summary>
/// Returns a quaternion constructed by first performing 3 rotations around the principal axes in a given order.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// When the rotation order is known at compile time, it is recommended for performance reasons to use specific
/// Euler rotation constructors such as EulerZXY(...).
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
/// <param name="order">The order in which the rotations are applied.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion Euler(float x, float y, float z, RotationOrder order = RotationOrder.Default)
{
return Euler(float3(x, y, z), order);
}
/// <summary>Returns a quaternion that rotates around the x-axis by a given number of radians.</summary>
/// <param name="angle">The clockwise rotation angle when looking along the x-axis towards the origin in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion RotateX(float angle)
{
float sina, cosa;
math.sincos(0.5f * angle, out sina, out cosa);
return quaternion(sina, 0.0f, 0.0f, cosa);
}
/// <summary>Returns a quaternion that rotates around the y-axis by a given number of radians.</summary>
/// <param name="angle">The clockwise rotation angle when looking along the y-axis towards the origin in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion RotateY(float angle)
{
float sina, cosa;
math.sincos(0.5f * angle, out sina, out cosa);
return quaternion(0.0f, sina, 0.0f, cosa);
}
/// <summary>Returns a quaternion that rotates around the z-axis by a given number of radians.</summary>
/// <param name="angle">The clockwise rotation angle when looking along the z-axis towards the origin in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion RotateZ(float angle)
{
float sina, cosa;
math.sincos(0.5f * angle, out sina, out cosa);
return quaternion(0.0f, 0.0f, sina, cosa);
}
/// <summary>
/// Returns a quaternion view rotation given a unit length forward vector and a unit length up vector.
/// The two input vectors are assumed to be unit length and not collinear.
/// If these assumptions are not met use float3x3.LookRotationSafe instead.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion LookRotation(float3 forward, float3 up)
{
float3 t = normalize(cross(up, forward));
return quaternion(float3x3(t, cross(forward, t), forward));
}
/// <summary>
/// Returns a quaternion view rotation given a forward vector and an up vector.
/// The two input vectors are not assumed to be unit length.
/// If the magnitude of either of the vectors is so extreme that the calculation cannot be carried out reliably or the vectors are collinear,
/// the identity will be returned instead.
/// </summary>
public static quaternion LookRotationSafe(float3 forward, float3 up)
{
float forwardLengthSq = dot(forward, forward);
float upLengthSq = dot(up, up);
forward *= rsqrt(forwardLengthSq);
up *= rsqrt(upLengthSq);
float3 t = cross(up, forward);
float tLengthSq = dot(t, t);
t *= rsqrt(tLengthSq);
float mn = min(min(forwardLengthSq, upLengthSq), tLengthSq);
float mx = max(max(forwardLengthSq, upLengthSq), tLengthSq);
bool accept = mn > 1e-35f && mx < 1e35f && isfinite(forwardLengthSq) && isfinite(upLengthSq) && isfinite(tLengthSq);
return quaternion(select(float4(0.0f, 0.0f, 0.0f, 1.0f), quaternion(float3x3(t, cross(forward, t),forward)).value, accept));
}
/// <summary>Returns true if the quaternion is equal to a given quaternion, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(quaternion x) { return value.x == x.value.x && value.y == x.value.y && value.z == x.value.z && value.w == x.value.w; }
/// <summary>Returns whether true if the quaternion is equal to a given quaternion, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object x) { return Equals((quaternion)x); }
/// <summary>Returns a hash code for the quaternion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the quaternion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("quaternion({0}f, {1}f, {2}f, {3}f)", value.x, value.y, value.z, value.w);
}
/// <summary>Returns a string representation of the quaternion using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("quaternion({0}f, {1}f, {2}f, {3}f)", value.x.ToString(format, formatProvider), value.y.ToString(format, formatProvider), value.z.ToString(format, formatProvider), value.w.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a quaternion constructed from four float values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion quaternion(float x, float y, float z, float w) { return new quaternion(x, y, z, w); }
/// <summary>Returns a quaternion constructed from a float4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion quaternion(float4 value) { return new quaternion(value); }
/// <summary>Returns a unit quaternion constructed from a float3x3 rotation matrix. The matrix must be orthonormal.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion quaternion(float3x3 m) { return new quaternion(m); }
/// <summary>Returns a unit quaternion constructed from a float4x4 matrix. The matrix must be orthonormal.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion quaternion(float4x4 m) { return new quaternion(m); }
/// <summary>Returns the conjugate of a quaternion value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion conjugate(quaternion q)
{
return quaternion(q.value * float4(-1.0f, -1.0f, -1.0f, 1.0f));
}
/// <summary>Returns the inverse of a quaternion value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion inverse(quaternion q)
{
float4 x = q.value;
return quaternion(rcp(dot(x, x)) * x * float4(-1.0f, -1.0f, -1.0f, 1.0f));
}
/// <summary>Returns the dot product of two quaternions.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float dot(quaternion a, quaternion b)
{
return dot(a.value, b.value);
}
/// <summary>Returns the length of a quaternion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float length(quaternion q)
{
return sqrt(dot(q.value, q.value));
}
/// <summary>Returns the squared length of a quaternion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float lengthsq(quaternion q)
{
return dot(q.value, q.value);
}
/// <summary>Returns a normalized version of a quaternion q by scaling it by 1 / length(q).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion normalize(quaternion q)
{
float4 x = q.value;
return quaternion(rsqrt(dot(x, x)) * x);
}
/// <summary>
/// Returns a safe normalized version of the q by scaling it by 1 / length(q).
/// Returns the identity when 1 / length(q) does not produce a finite number.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion normalizesafe(quaternion q)
{
float4 x = q.value;
float len = math.dot(x, x);
return quaternion(math.select(Mathematics.quaternion.identity.value, x * math.rsqrt(len), len > FLT_MIN_NORMAL));
}
/// <summary>
/// Returns a safe normalized version of the q by scaling it by 1 / length(q).
/// Returns the given default value when 1 / length(q) does not produce a finite number.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion normalizesafe(quaternion q, quaternion defaultvalue)
{
float4 x = q.value;
float len = math.dot(x, x);
return quaternion(math.select(defaultvalue.value, x * math.rsqrt(len), len > FLT_MIN_NORMAL));
}
/// <summary>Returns the natural exponent of a quaternion. Assumes w is zero.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion unitexp(quaternion q)
{
float v_rcp_len = rsqrt(dot(q.value.xyz, q.value.xyz));
float v_len = rcp(v_rcp_len);
float sin_v_len, cos_v_len;
sincos(v_len, out sin_v_len, out cos_v_len);
return quaternion(float4(q.value.xyz * v_rcp_len * sin_v_len, cos_v_len));
}
/// <summary>Returns the natural exponent of a quaternion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion exp(quaternion q)
{
float v_rcp_len = rsqrt(dot(q.value.xyz, q.value.xyz));
float v_len = rcp(v_rcp_len);
float sin_v_len, cos_v_len;
sincos(v_len, out sin_v_len, out cos_v_len);
return quaternion(float4(q.value.xyz * v_rcp_len * sin_v_len, cos_v_len) * exp(q.value.w));
}
/// <summary>Returns the natural logarithm of a unit length quaternion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion unitlog(quaternion q)
{
float w = clamp(q.value.w, -1.0f, 1.0f);
float s = acos(w) * rsqrt(1.0f - w*w);
return quaternion(float4(q.value.xyz * s, 0.0f));
}
/// <summary>Returns the natural logarithm of a quaternion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion log(quaternion q)
{
float v_len_sq = dot(q.value.xyz, q.value.xyz);
float q_len_sq = v_len_sq + q.value.w*q.value.w;
float s = acos(clamp(q.value.w * rsqrt(q_len_sq), -1.0f, 1.0f)) * rsqrt(v_len_sq);
return quaternion(float4(q.value.xyz * s, 0.5f * log(q_len_sq)));
}
/// <summary>Returns the result of transforming the quaternion b by the quaternion a.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion mul(quaternion a, quaternion b)
{
return quaternion(a.value.wwww * b.value + (a.value.xyzx * b.value.wwwx + a.value.yzxy * b.value.zxyy) * float4(1.0f, 1.0f, 1.0f, -1.0f) - a.value.zxyz * b.value.yzxz);
}
/// <summary>Returns the result of transforming a vector by a quaternion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3 mul(quaternion q, float3 v)
{
float3 t = 2 * cross(q.value.xyz, v);
return v + q.value.w * t + cross(q.value.xyz, t);
}
/// <summary>Returns the result of rotating a vector by a unit quaternion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3 rotate(quaternion q, float3 v)
{
float3 t = 2 * cross(q.value.xyz, v);
return v + q.value.w * t + cross(q.value.xyz, t);
}
/// <summary>Returns the result of a normalized linear interpolation between two quaternions q1 and a2 using an interpolation parameter t.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion nlerp(quaternion q1, quaternion q2, float t)
{
float dt = dot(q1, q2);
if(dt < 0.0f)
{
q2.value = -q2.value;
}
return normalize(quaternion(lerp(q1.value, q2.value, t)));
}
/// <summary>Returns the result of a spherical interpolation between two quaternions q1 and a2 using an interpolation parameter t.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static quaternion slerp(quaternion q1, quaternion q2, float t)
{
float dt = dot(q1, q2);
if (dt < 0.0f)
{
dt = -dt;
q2.value = -q2.value;
}
if (dt < 0.9995f)
{
float angle = acos(dt);
float s = rsqrt(1.0f - dt * dt); // 1.0f / sin(angle)
float w1 = sin(angle * (1.0f - t)) * s;
float w2 = sin(angle * t) * s;
return quaternion(q1.value * w1 + q2.value * w2);
}
else
{
// if the angle is small, use linear interpolation
return nlerp(q1, q2, t);
}
}
/// <summary>Returns a uint hash code of a quaternion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(quaternion q)
{
return hash(q.value);
}
/// <summary>
/// Returns a uint4 vector hash code of a quaternion.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(quaternion q)
{
return hashwide(q.value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3 forward(quaternion q) { return mul(q, float3(0, 0, 1)); } // for compatibility
}
}

View File

@@ -0,0 +1,621 @@
using System;
using System.Runtime.CompilerServices;
using static Unity.Mathematics.math;
using System.Diagnostics;
namespace Unity.Mathematics
{
/// <summary>
/// Random Number Generator based on xorshift.
/// Designed for minimal state (32bits) to be easily embeddable into components.
/// Core functionality is integer multiplication free to improve vectorization
/// on less capable SIMD instruction sets.
/// </summary>
[Serializable]
public partial struct Random
{
public uint state;
/// <summary>
/// Constructs a Random instance with a given seed value. The seed must be non-zero.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Random(uint seed)
{
state = seed;
CheckInitState();
NextState();
}
/// <summary>
/// Constructs a <see cref="Random"/> instance with an index that gets hashed. The index must not be uint.MaxValue.
/// </summary>
/// <remarks>
/// Use this function when you expect to create several Random instances in a loop.
/// </remarks>
/// <example>
/// <code>
/// for (uint i = 0; i &lt; 4096; ++i)
/// {
/// Random rand = Random.CreateFromIndex(i);
///
/// // Random numbers drawn from loop iteration j will be very different
/// // from every other loop iteration k.
/// rand.NextUInt();
/// }
/// </code>
/// </example>
/// <param name="index">An index that will be hashed for Random creation. Must not be uint.MaxValue.</param>
/// <returns><see cref="Random"/> created from an index.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Random CreateFromIndex(uint index)
{
CheckIndexForHash(index);
// Wang hash will hash 61 to zero but we want uint.MaxValue to hash to zero. To make this happen
// we must offset by 62.
return new Random(WangHash(index + 62u));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static uint WangHash(uint n)
{
// https://gist.github.com/badboy/6267743#hash-function-construction-principles
// Wang hash: this has the property that none of the outputs will
// collide with each other, which is important for the purposes of
// seeding a random number generator. This was verified empirically
// by checking all 2^32 uints.
n = (n ^ 61u) ^ (n >> 16);
n *= 9u;
n = n ^ (n >> 4);
n *= 0x27d4eb2du;
n = n ^ (n >> 15);
return n;
}
/// <summary>
/// Initialized the state of the Random instance with a given seed value. The seed must be non-zero.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InitState(uint seed = 0x6E624EB7u)
{
state = seed;
NextState();
}
/// <summary>Returns a uniformly random bool value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool NextBool()
{
return (NextState() & 1) == 1;
}
/// <summary>Returns a uniformly random bool2 value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool2 NextBool2()
{
uint v = NextState();
return (uint2(v) & uint2(1, 2)) == 0;
}
/// <summary>Returns a uniformly random bool3 value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool3 NextBool3()
{
uint v = NextState();
return (uint3(v) & uint3(1, 2, 4)) == 0;
}
/// <summary>Returns a uniformly random bool4 value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool4 NextBool4()
{
uint v = NextState();
return (uint4(v) & uint4(1, 2, 4, 8)) == 0;
}
/// <summary>Returns a uniformly random int value in the interval [-2147483647, 2147483647].</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int NextInt()
{
return (int)NextState() ^ -2147483648;
}
/// <summary>Returns a uniformly random int2 value with all components in the interval [-2147483647, 2147483647].</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2 NextInt2()
{
return int2((int)NextState(), (int)NextState()) ^ -2147483648;
}
/// <summary>Returns a uniformly random int3 value with all components in the interval [-2147483647, 2147483647].</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3 NextInt3()
{
return int3((int)NextState(), (int)NextState(), (int)NextState()) ^ -2147483648;
}
/// <summary>Returns a uniformly random int4 value with all components in the interval [-2147483647, 2147483647].</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4 NextInt4()
{
return int4((int)NextState(), (int)NextState(), (int)NextState(), (int)NextState()) ^ -2147483648;
}
/// <summary>Returns a uniformly random int value in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int NextInt(int max)
{
CheckNextIntMax(max);
return (int)((NextState() * (ulong)max) >> 32);
}
/// <summary>Returns a uniformly random int2 value with all components in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2 NextInt2(int2 max)
{
CheckNextIntMax(max.x);
CheckNextIntMax(max.y);
return int2((int)(NextState() * (ulong)max.x >> 32),
(int)(NextState() * (ulong)max.y >> 32));
}
/// <summary>Returns a uniformly random int3 value with all components in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3 NextInt3(int3 max)
{
CheckNextIntMax(max.x);
CheckNextIntMax(max.y);
CheckNextIntMax(max.z);
return int3((int)(NextState() * (ulong)max.x >> 32),
(int)(NextState() * (ulong)max.y >> 32),
(int)(NextState() * (ulong)max.z >> 32));
}
/// <summary>Returns a uniformly random int4 value with all components in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4 NextInt4(int4 max)
{
CheckNextIntMax(max.x);
CheckNextIntMax(max.y);
CheckNextIntMax(max.z);
CheckNextIntMax(max.w);
return int4((int)(NextState() * (ulong)max.x >> 32),
(int)(NextState() * (ulong)max.y >> 32),
(int)(NextState() * (ulong)max.z >> 32),
(int)(NextState() * (ulong)max.w >> 32));
}
/// <summary>Returns a uniformly random int value in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int NextInt(int min, int max)
{
CheckNextIntMinMax(min, max);
uint range = (uint)(max - min);
return (int)(NextState() * (ulong)range >> 32) + min;
}
/// <summary>Returns a uniformly random int2 value with all components in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int2 NextInt2(int2 min, int2 max)
{
CheckNextIntMinMax(min.x, max.x);
CheckNextIntMinMax(min.y, max.y);
uint2 range = (uint2)(max - min);
return int2((int)(NextState() * (ulong)range.x >> 32),
(int)(NextState() * (ulong)range.y >> 32)) + min;
}
/// <summary>Returns a uniformly random int3 value with all components in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int3 NextInt3(int3 min, int3 max)
{
CheckNextIntMinMax(min.x, max.x);
CheckNextIntMinMax(min.y, max.y);
CheckNextIntMinMax(min.z, max.z);
uint3 range = (uint3)(max - min);
return int3((int)(NextState() * (ulong)range.x >> 32),
(int)(NextState() * (ulong)range.y >> 32),
(int)(NextState() * (ulong)range.z >> 32)) + min;
}
/// <summary>Returns a uniformly random int4 value with all components in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int4 NextInt4(int4 min, int4 max)
{
CheckNextIntMinMax(min.x, max.x);
CheckNextIntMinMax(min.y, max.y);
CheckNextIntMinMax(min.z, max.z);
CheckNextIntMinMax(min.w, max.w);
uint4 range = (uint4)(max - min);
return int4((int)(NextState() * (ulong)range.x >> 32),
(int)(NextState() * (ulong)range.y >> 32),
(int)(NextState() * (ulong)range.z >> 32),
(int)(NextState() * (ulong)range.w >> 32)) + min;
}
/// <summary>Returns a uniformly random uint value in the interval [0, 4294967294].</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint NextUInt()
{
return NextState() - 1u;
}
/// <summary>Returns a uniformly random uint2 value with all components in the interval [0, 4294967294].</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2 NextUInt2()
{
return uint2(NextState(), NextState()) - 1u;
}
/// <summary>Returns a uniformly random uint3 value with all components in the interval [0, 4294967294].</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3 NextUInt3()
{
return uint3(NextState(), NextState(), NextState()) - 1u;
}
/// <summary>Returns a uniformly random uint4 value with all components in the interval [0, 4294967294].</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4 NextUInt4()
{
return uint4(NextState(), NextState(), NextState(), NextState()) - 1u;
}
/// <summary>Returns a uniformly random uint value in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint NextUInt(uint max)
{
return (uint)((NextState() * (ulong)max) >> 32);
}
/// <summary>Returns a uniformly random uint2 value with all components in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2 NextUInt2(uint2 max)
{
return uint2( (uint)(NextState() * (ulong)max.x >> 32),
(uint)(NextState() * (ulong)max.y >> 32));
}
/// <summary>Returns a uniformly random uint3 value with all components in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3 NextUInt3(uint3 max)
{
return uint3( (uint)(NextState() * (ulong)max.x >> 32),
(uint)(NextState() * (ulong)max.y >> 32),
(uint)(NextState() * (ulong)max.z >> 32));
}
/// <summary>Returns a uniformly random uint4 value with all components in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4 NextUInt4(uint4 max)
{
return uint4( (uint)(NextState() * (ulong)max.x >> 32),
(uint)(NextState() * (ulong)max.y >> 32),
(uint)(NextState() * (ulong)max.z >> 32),
(uint)(NextState() * (ulong)max.w >> 32));
}
/// <summary>Returns a uniformly random uint value in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint NextUInt(uint min, uint max)
{
CheckNextUIntMinMax(min, max);
uint range = max - min;
return (uint)(NextState() * (ulong)range >> 32) + min;
}
/// <summary>Returns a uniformly random uint2 value with all components in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2 NextUInt2(uint2 min, uint2 max)
{
CheckNextUIntMinMax(min.x, max.x);
CheckNextUIntMinMax(min.y, max.y);
uint2 range = max - min;
return uint2((uint)(NextState() * (ulong)range.x >> 32),
(uint)(NextState() * (ulong)range.y >> 32)) + min;
}
/// <summary>Returns a uniformly random uint3 value with all components in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3 NextUInt3(uint3 min, uint3 max)
{
CheckNextUIntMinMax(min.x, max.x);
CheckNextUIntMinMax(min.y, max.y);
CheckNextUIntMinMax(min.z, max.z);
uint3 range = max - min;
return uint3((uint)(NextState() * (ulong)range.x >> 32),
(uint)(NextState() * (ulong)range.y >> 32),
(uint)(NextState() * (ulong)range.z >> 32)) + min;
}
/// <summary>Returns a uniformly random uint4 value with all components in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4 NextUInt4(uint4 min, uint4 max)
{
CheckNextUIntMinMax(min.x, max.x);
CheckNextUIntMinMax(min.y, max.y);
CheckNextUIntMinMax(min.z, max.z);
CheckNextUIntMinMax(min.w, max.w);
uint4 range = (uint4)(max - min);
return uint4((uint)(NextState() * (ulong)range.x >> 32),
(uint)(NextState() * (ulong)range.y >> 32),
(uint)(NextState() * (ulong)range.z >> 32),
(uint)(NextState() * (ulong)range.w >> 32)) + min;
}
/// <summary>Returns a uniformly random float value in the interval [0, 1).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float NextFloat()
{
return asfloat(0x3f800000 | (NextState() >> 9)) - 1.0f;
}
/// <summary>Returns a uniformly random float2 value with all components in the interval [0, 1).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2 NextFloat2()
{
return asfloat(0x3f800000 | (uint2(NextState(), NextState()) >> 9)) - 1.0f;
}
/// <summary>Returns a uniformly random float3 value with all components in the interval [0, 1).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3 NextFloat3()
{
return asfloat(0x3f800000 | (uint3(NextState(), NextState(), NextState()) >> 9)) - 1.0f;
}
/// <summary>Returns a uniformly random float4 value with all components in the interval [0, 1).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4 NextFloat4()
{
return asfloat(0x3f800000 | (uint4(NextState(), NextState(), NextState(), NextState()) >> 9)) - 1.0f;
}
/// <summary>Returns a uniformly random float value in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float NextFloat(float max) { return NextFloat() * max; }
/// <summary>Returns a uniformly random float2 value with all components in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2 NextFloat2(float2 max) { return NextFloat2() * max; }
/// <summary>Returns a uniformly random float3 value with all components in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3 NextFloat3(float3 max) { return NextFloat3() * max; }
/// <summary>Returns a uniformly random float4 value with all components in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4 NextFloat4(float4 max) { return NextFloat4() * max; }
/// <summary>Returns a uniformly random float value in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float NextFloat(float min, float max) { return NextFloat() * (max - min) + min; }
/// <summary>Returns a uniformly random float2 value with all components in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2 NextFloat2(float2 min, float2 max) { return NextFloat2() * (max - min) + min; }
/// <summary>Returns a uniformly random float3 value with all components in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3 NextFloat3(float3 min, float3 max) { return NextFloat3() * (max - min) + min; }
/// <summary>Returns a uniformly random float4 value with all components in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4 NextFloat4(float4 min, float4 max) { return NextFloat4() * (max - min) + min; }
/// <summary>Returns a uniformly random double value in the interval [0, 1).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double NextDouble()
{
ulong sx = ((ulong)NextState() << 20) ^ NextState();
return asdouble(0x3ff0000000000000 | sx) - 1.0;
}
/// <summary>Returns a uniformly random double2 value with all components in the interval [0, 1).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2 NextDouble2()
{
ulong sx = ((ulong)NextState() << 20) ^ NextState();
ulong sy = ((ulong)NextState() << 20) ^ NextState();
return double2(asdouble(0x3ff0000000000000 | sx),
asdouble(0x3ff0000000000000 | sy)) - 1.0;
}
/// <summary>Returns a uniformly random double3 value with all components in the interval [0, 1).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3 NextDouble3()
{
ulong sx = ((ulong)NextState() << 20) ^ NextState();
ulong sy = ((ulong)NextState() << 20) ^ NextState();
ulong sz = ((ulong)NextState() << 20) ^ NextState();
return double3(asdouble(0x3ff0000000000000 | sx),
asdouble(0x3ff0000000000000 | sy),
asdouble(0x3ff0000000000000 | sz)) - 1.0;
}
/// <summary>Returns a uniformly random double4 value with all components in the interval [0, 1).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4 NextDouble4()
{
ulong sx = ((ulong)NextState() << 20) ^ NextState();
ulong sy = ((ulong)NextState() << 20) ^ NextState();
ulong sz = ((ulong)NextState() << 20) ^ NextState();
ulong sw = ((ulong)NextState() << 20) ^ NextState();
return double4(asdouble(0x3ff0000000000000 | sx),
asdouble(0x3ff0000000000000 | sy),
asdouble(0x3ff0000000000000 | sz),
asdouble(0x3ff0000000000000 | sw)) - 1.0;
}
/// <summary>Returns a uniformly random double value in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double NextDouble(double max) { return NextDouble() * max; }
/// <summary>Returns a uniformly random double2 value with all components in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2 NextDouble2(double2 max) { return NextDouble2() * max; }
/// <summary>Returns a uniformly random double3 value with all components in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3 NextDouble3(double3 max) { return NextDouble3() * max; }
/// <summary>Returns a uniformly random double4 value with all components in the interval [0, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4 NextDouble4(double4 max) { return NextDouble4() * max; }
/// <summary>Returns a uniformly random double value in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double NextDouble(double min, double max) { return NextDouble() * (max - min) + min; }
/// <summary>Returns a uniformly random double2 value with all components in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2 NextDouble2(double2 min, double2 max) { return NextDouble2() * (max - min) + min; }
/// <summary>Returns a uniformly random double3 value with all components in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3 NextDouble3(double3 min, double3 max) { return NextDouble3() * (max - min) + min; }
/// <summary>Returns a uniformly random double4 value with all components in the interval [min, max).</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4 NextDouble4(double4 min, double4 max) { return NextDouble4() * (max - min) + min; }
/// <summary>Returns a unit length float2 vector representing a uniformly random 2D direction.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2 NextFloat2Direction()
{
float angle = NextFloat() * PI * 2.0f;
float s, c;
sincos(angle, out s, out c);
return float2(c, s);
}
/// <summary>Returns a unit length double2 vector representing a uniformly random 2D direction.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2 NextDouble2Direction()
{
double angle = NextDouble() * PI_DBL * 2.0;
double s, c;
sincos(angle, out s, out c);
return double2(c, s);
}
/// <summary>Returns a unit length float3 vector representing a uniformly random 3D direction.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3 NextFloat3Direction()
{
float2 rnd = NextFloat2();
float z = rnd.x * 2.0f - 1.0f;
float r = sqrt(max(1.0f - z * z, 0.0f));
float angle = rnd.y * PI * 2.0f;
float s, c;
sincos(angle, out s, out c);
return float3(c*r, s*r, z);
}
/// <summary>Returns a unit length double3 vector representing a uniformly random 3D direction.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3 NextDouble3Direction()
{
double2 rnd = NextDouble2();
double z = rnd.x * 2.0 - 1.0;
double r = sqrt(max(1.0 - z * z, 0.0));
double angle = rnd.y * PI_DBL * 2.0;
double s, c;
sincos(angle, out s, out c);
return double3(c * r, s * r, z);
}
/// <summary>Returns a unit length quaternion representing a uniformly 3D rotation.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public quaternion NextQuaternionRotation()
{
float3 rnd = NextFloat3(float3(2.0f * PI, 2.0f * PI, 1.0f));
float u1 = rnd.z;
float2 theta_rho = rnd.xy;
float i = sqrt(1.0f - u1);
float j = sqrt(u1);
float2 sin_theta_rho;
float2 cos_theta_rho;
sincos(theta_rho, out sin_theta_rho, out cos_theta_rho);
quaternion q = quaternion(i * sin_theta_rho.x, i * cos_theta_rho.x, j * sin_theta_rho.y, j * cos_theta_rho.y);
return quaternion(select(q.value, -q.value, q.value.w < 0.0f));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private uint NextState()
{
CheckState();
uint t = state;
state ^= state << 13;
state ^= state >> 17;
state ^= state << 5;
return t;
}
[Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")]
private void CheckInitState()
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if (state == 0)
throw new System.ArgumentException("Seed must be non-zero");
#endif
}
[Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")]
static void CheckIndexForHash(uint index)
{
if (index == uint.MaxValue)
throw new System.ArgumentException("Index must not be uint.MaxValue");
}
[Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")]
private void CheckState()
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if(state == 0)
throw new System.ArgumentException("Invalid state 0. Random object has not been properly initialized");
#endif
}
[Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")]
private void CheckNextIntMax(int max)
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if (max < 0)
throw new System.ArgumentException("max must be positive");
#endif
}
[Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")]
private void CheckNextIntMinMax(int min, int max)
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if (min > max)
throw new System.ArgumentException("min must be less than or equal to max");
#endif
}
[Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")]
private void CheckNextUIntMinMax(uint min, uint max)
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if (min > max)
throw new System.ArgumentException("min must be less than or equal to max");
#endif
}
}
}

View File

@@ -0,0 +1,341 @@
using System;
using System.Runtime.CompilerServices;
using static Unity.Mathematics.math;
namespace Unity.Mathematics
{
[Serializable]
public struct RigidTransform
{
public quaternion rot;
public float3 pos;
/// <summary>A RigidTransform representing the identity transform.</summary>
public static readonly RigidTransform identity = new RigidTransform(new quaternion(0.0f, 0.0f, 0.0f, 1.0f), new float3(0.0f, 0.0f, 0.0f));
/// <summary>Constructs a RigidTransform from a rotation represented by a unit quaternion and a translation represented by a float3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public RigidTransform(quaternion rotation, float3 translation)
{
this.rot = rotation;
this.pos = translation;
}
/// <summary>Constructs a RigidTransform from a rotation represented by a float3x3 matrix and a translation represented by a float3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public RigidTransform(float3x3 rotation, float3 translation)
{
this.rot = new quaternion(rotation);
this.pos = translation;
}
/// <summary>Constructs a RigidTransform from a float4x4. Assumes the matrix is orthonormal.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public RigidTransform(float4x4 transform)
{
this.rot = new quaternion(transform);
this.pos = transform.c3.xyz;
}
/// <summary>
/// Returns a RigidTransform representing a rotation around a unit axis by an angle in radians.
/// The rotation direction is clockwise when looking along the rotation axis towards the origin.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform AxisAngle(float3 axis, float angle) { return new RigidTransform(quaternion.AxisAngle(axis, angle), float3.zero); }
/// <summary>
/// Returns a RigidTransform constructed by first performing a rotation around the x-axis, then the y-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform EulerXYZ(float3 xyz) { return new RigidTransform(quaternion.EulerXYZ(xyz), float3.zero); }
/// <summary>
/// Returns a RigidTransform constructed by first performing a rotation around the x-axis, then the z-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform EulerXZY(float3 xyz) { return new RigidTransform(quaternion.EulerXZY(xyz), float3.zero); }
/// <summary>
/// Returns a RigidTransform constructed by first performing a rotation around the y-axis, then the x-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform EulerYXZ(float3 xyz) { return new RigidTransform(quaternion.EulerYXZ(xyz), float3.zero); }
/// <summary>
/// Returns a RigidTransform constructed by first performing a rotation around the y-axis, then the z-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform EulerYZX(float3 xyz) { return new RigidTransform(quaternion.EulerYZX(xyz), float3.zero); }
/// <summary>
/// Returns a RigidTransform constructed by first performing a rotation around the z-axis, then the x-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// This is the default order rotation order in Unity.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform EulerZXY(float3 xyz) { return new RigidTransform(quaternion.EulerZXY(xyz), float3.zero); }
/// <summary>
/// Returns a RigidTransform constructed by first performing a rotation around the z-axis, then the y-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform EulerZYX(float3 xyz) { return new RigidTransform(quaternion.EulerZYX(xyz), float3.zero); }
/// <summary>
/// Returns a RigidTransform constructed by first performing a rotation around the x-axis, then the y-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform EulerXYZ(float x, float y, float z) { return EulerXYZ(float3(x, y, z)); }
/// <summary>
/// Returns a RigidTransform constructed by first performing a rotation around the x-axis, then the z-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform EulerXZY(float x, float y, float z) { return EulerXZY(float3(x, y, z)); }
/// <summary>
/// Returns a RigidTransform constructed by first performing a rotation around the y-axis, then the x-axis and finally the z-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform EulerYXZ(float x, float y, float z) { return EulerYXZ(float3(x, y, z)); }
/// <summary>
/// Returns a RigidTransform constructed by first performing a rotation around the y-axis, then the z-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform EulerYZX(float x, float y, float z) { return EulerYZX(float3(x, y, z)); }
/// <summary>
/// Returns a RigidTransform constructed by first performing a rotation around the z-axis, then the x-axis and finally the y-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// This is the default order rotation order in Unity.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform EulerZXY(float x, float y, float z) { return EulerZXY(float3(x, y, z)); }
/// <summary>
/// Returns a RigidTransform constructed by first performing a rotation around the z-axis, then the y-axis and finally the x-axis.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform EulerZYX(float x, float y, float z) { return EulerZYX(float3(x, y, z)); }
/// <summary>
/// Returns a RigidTransform constructed by first performing 3 rotations around the principal axes in a given order.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// When the rotation order is known at compile time, it is recommended for performance reasons to use specific
/// Euler rotation constructors such as EulerZXY(...).
/// </summary>
/// <param name="xyz">A float3 vector containing the rotation angles around the x-, y- and z-axis measures in radians.</param>
/// <param name="order">The order in which the rotations are applied.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform Euler(float3 xyz, RotationOrder order = RotationOrder.ZXY)
{
switch (order)
{
case RotationOrder.XYZ:
return EulerXYZ(xyz);
case RotationOrder.XZY:
return EulerXZY(xyz);
case RotationOrder.YXZ:
return EulerYXZ(xyz);
case RotationOrder.YZX:
return EulerYZX(xyz);
case RotationOrder.ZXY:
return EulerZXY(xyz);
case RotationOrder.ZYX:
return EulerZYX(xyz);
default:
return RigidTransform.identity;
}
}
/// <summary>
/// Returns a RigidTransform constructed by first performing 3 rotations around the principal axes in a given order.
/// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
/// When the rotation order is known at compile time, it is recommended for performance reasons to use specific
/// Euler rotation constructors such as EulerZXY(...).
/// </summary>
/// <param name="x">The rotation angle around the x-axis in radians.</param>
/// <param name="y">The rotation angle around the y-axis in radians.</param>
/// <param name="z">The rotation angle around the z-axis in radians.</param>
/// <param name="order">The order in which the rotations are applied.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform Euler(float x, float y, float z, RotationOrder order = RotationOrder.Default)
{
return Euler(float3(x, y, z), order);
}
/// <summary>Returns a float4x4 matrix that rotates around the x-axis by a given number of radians.</summary>
/// <param name="angle">The clockwise rotation angle when looking along the x-axis towards the origin in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform RotateX(float angle)
{
return new RigidTransform(quaternion.RotateX(angle), float3.zero);
}
/// <summary>Returns a float4x4 matrix that rotates around the y-axis by a given number of radians.</summary>
/// <param name="angle">The clockwise rotation angle when looking along the y-axis towards the origin in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform RotateY(float angle)
{
return new RigidTransform(quaternion.RotateY(angle), float3.zero);
}
/// <summary>Returns a float4x4 matrix that rotates around the z-axis by a given number of radians.</summary>
/// <param name="angle">The clockwise rotation angle when looking along the z-axis towards the origin in radians.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform RotateZ(float angle)
{
return new RigidTransform(quaternion.RotateZ(angle), float3.zero);
}
/// <summary>Returns a RigidTransform that translates by an amount specified by a float3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform Translate(float3 vector)
{
return new RigidTransform(quaternion.identity, vector);
}
/// <summary>Returns true if the RigidTransform is equal to a given RigidTransform, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(RigidTransform x) { return rot.Equals(x.rot) && pos.Equals(x.pos); }
/// <summary>Returns true if the RigidTransform is equal to a given RigidTransform, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object x) { return Equals((RigidTransform)x); }
/// <summary>Returns a hash code for the RigidTransform.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the RigidTransform.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("RigidTransform(({0}f, {1}f, {2}f, {3}f), ({4}f, {5}f, {6}f))",
rot.value.x, rot.value.y, rot.value.z, rot.value.w, pos.x, pos.y, pos.z);
}
/// <summary>Returns a string representation of the quaternion using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("float4x4(({0}f, {1}f, {2}f, {3}f), ({4}f, {5}f, {6}f))",
rot.value.x.ToString(format, formatProvider),
rot.value.y.ToString(format, formatProvider),
rot.value.z.ToString(format, formatProvider),
rot.value.w.ToString(format, formatProvider),
pos.x.ToString(format, formatProvider),
pos.y.ToString(format, formatProvider),
pos.z.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a RigidTransform constructed from a rotation represented by a unit quaternion and a translation represented by a float3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform RigidTransform(quaternion rot, float3 pos) { return new RigidTransform(rot, pos); }
/// <summary>Returns a RigidTransform constructed from a rotation represented by a unit quaternion and a translation represented by a float3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform RigidTransform(float3x3 rotation, float3 translation) { return new RigidTransform(rotation, translation); }
/// <summary>Returns a RigidTransform constructed from a rotation represented by a float3x3 matrix and a translation represented by a float3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform RigidTransform(float4x4 transform) { return new RigidTransform(transform); }
/// <summary>Returns the inverse of a RigidTransform.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform inverse(RigidTransform t)
{
quaternion invRotation = inverse(t.rot);
float3 invTranslation = mul(invRotation, -t.pos);
return new RigidTransform(invRotation, invTranslation);
}
/// <summary>Returns the result of transforming the RigidTransform b by the RigidTransform a.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RigidTransform mul(RigidTransform a, RigidTransform b)
{
return new RigidTransform(mul(a.rot, b.rot), mul(a.rot, b.pos) + a.pos);
}
/// <summary>Returns the result of transforming a float4 homogeneous coordinate by a RigidTransform.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float4 mul(RigidTransform a, float4 pos)
{
return float4(mul(a.rot, pos.xyz) + a.pos * pos.w, pos.w);
}
/// <summary>Returns the result of rotating a float3 vector by a RigidTransform.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3 rotate(RigidTransform a, float3 dir)
{
return mul(a.rot, dir);
}
/// <summary>Returns the result of transforming a float3 point by a RigidTransform.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float3 transform(RigidTransform a, float3 pos)
{
return mul(a.rot, pos) + a.pos;
}
/// <summary>Returns a uint hash code of a RigidTransform.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(RigidTransform t)
{
return hash(t.rot) + 0xC5C5394Bu * hash(t.pos);
}
/// <summary>
/// Returns a uint4 vector hash code of a RigidTransform.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(RigidTransform t)
{
return hashwide(t.rot) + 0xC5C5394Bu * hashwide(t.pos).xyzz;
}
}
}

View File

@@ -0,0 +1,780 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
using System.Diagnostics;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[DebuggerTypeProxy(typeof(uint2.DebuggerProxy))]
[System.Serializable]
public partial struct uint2 : System.IEquatable<uint2>, IFormattable
{
public uint x;
public uint y;
/// <summary>uint2 zero value.</summary>
public static readonly uint2 zero;
/// <summary>Constructs a uint2 vector from two uint values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2(uint x, uint y)
{
this.x = x;
this.y = y;
}
/// <summary>Constructs a uint2 vector from a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2(uint2 xy)
{
this.x = xy.x;
this.y = xy.y;
}
/// <summary>Constructs a uint2 vector from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2(uint v)
{
this.x = v;
this.y = v;
}
/// <summary>Constructs a uint2 vector from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2(bool v)
{
this.x = v ? 1u : 0u;
this.y = v ? 1u : 0u;
}
/// <summary>Constructs a uint2 vector from a bool2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2(bool2 v)
{
this.x = v.x ? 1u : 0u;
this.y = v.y ? 1u : 0u;
}
/// <summary>Constructs a uint2 vector from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2(int v)
{
this.x = (uint)v;
this.y = (uint)v;
}
/// <summary>Constructs a uint2 vector from a int2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2(int2 v)
{
this.x = (uint)v.x;
this.y = (uint)v.y;
}
/// <summary>Constructs a uint2 vector from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2(float v)
{
this.x = (uint)v;
this.y = (uint)v;
}
/// <summary>Constructs a uint2 vector from a float2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2(float2 v)
{
this.x = (uint)v.x;
this.y = (uint)v.y;
}
/// <summary>Constructs a uint2 vector from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2(double v)
{
this.x = (uint)v;
this.y = (uint)v;
}
/// <summary>Constructs a uint2 vector from a double2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2(double2 v)
{
this.x = (uint)v.x;
this.y = (uint)v.y;
}
/// <summary>Implicitly converts a single uint value to a uint2 vector by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator uint2(uint v) { return new uint2(v); }
/// <summary>Explicitly converts a single bool value to a uint2 vector by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2(bool v) { return new uint2(v); }
/// <summary>Explicitly converts a bool2 vector to a uint2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2(bool2 v) { return new uint2(v); }
/// <summary>Explicitly converts a single int value to a uint2 vector by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2(int v) { return new uint2(v); }
/// <summary>Explicitly converts a int2 vector to a uint2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2(int2 v) { return new uint2(v); }
/// <summary>Explicitly converts a single float value to a uint2 vector by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2(float v) { return new uint2(v); }
/// <summary>Explicitly converts a float2 vector to a uint2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2(float2 v) { return new uint2(v); }
/// <summary>Explicitly converts a single double value to a uint2 vector by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2(double v) { return new uint2(v); }
/// <summary>Explicitly converts a double2 vector to a uint2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2(double2 v) { return new uint2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator * (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x * rhs.x, lhs.y * rhs.y); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint2 vector and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator * (uint2 lhs, uint rhs) { return new uint2 (lhs.x * rhs, lhs.y * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint value and a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator * (uint lhs, uint2 rhs) { return new uint2 (lhs * rhs.x, lhs * rhs.y); }
/// <summary>Returns the result of a componentwise addition operation on two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator + (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x + rhs.x, lhs.y + rhs.y); }
/// <summary>Returns the result of a componentwise addition operation on a uint2 vector and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator + (uint2 lhs, uint rhs) { return new uint2 (lhs.x + rhs, lhs.y + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a uint value and a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator + (uint lhs, uint2 rhs) { return new uint2 (lhs + rhs.x, lhs + rhs.y); }
/// <summary>Returns the result of a componentwise subtraction operation on two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator - (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x - rhs.x, lhs.y - rhs.y); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint2 vector and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator - (uint2 lhs, uint rhs) { return new uint2 (lhs.x - rhs, lhs.y - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint value and a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator - (uint lhs, uint2 rhs) { return new uint2 (lhs - rhs.x, lhs - rhs.y); }
/// <summary>Returns the result of a componentwise division operation on two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator / (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x / rhs.x, lhs.y / rhs.y); }
/// <summary>Returns the result of a componentwise division operation on a uint2 vector and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator / (uint2 lhs, uint rhs) { return new uint2 (lhs.x / rhs, lhs.y / rhs); }
/// <summary>Returns the result of a componentwise division operation on a uint value and a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator / (uint lhs, uint2 rhs) { return new uint2 (lhs / rhs.x, lhs / rhs.y); }
/// <summary>Returns the result of a componentwise modulus operation on two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator % (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x % rhs.x, lhs.y % rhs.y); }
/// <summary>Returns the result of a componentwise modulus operation on a uint2 vector and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator % (uint2 lhs, uint rhs) { return new uint2 (lhs.x % rhs, lhs.y % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a uint value and a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator % (uint lhs, uint2 rhs) { return new uint2 (lhs % rhs.x, lhs % rhs.y); }
/// <summary>Returns the result of a componentwise increment operation on a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator ++ (uint2 val) { return new uint2 (++val.x, ++val.y); }
/// <summary>Returns the result of a componentwise decrement operation on a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator -- (uint2 val) { return new uint2 (--val.x, --val.y); }
/// <summary>Returns the result of a componentwise less than operation on two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator < (uint2 lhs, uint2 rhs) { return new bool2 (lhs.x < rhs.x, lhs.y < rhs.y); }
/// <summary>Returns the result of a componentwise less than operation on a uint2 vector and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator < (uint2 lhs, uint rhs) { return new bool2 (lhs.x < rhs, lhs.y < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a uint value and a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator < (uint lhs, uint2 rhs) { return new bool2 (lhs < rhs.x, lhs < rhs.y); }
/// <summary>Returns the result of a componentwise less or equal operation on two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator <= (uint2 lhs, uint2 rhs) { return new bool2 (lhs.x <= rhs.x, lhs.y <= rhs.y); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint2 vector and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator <= (uint2 lhs, uint rhs) { return new bool2 (lhs.x <= rhs, lhs.y <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint value and a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator <= (uint lhs, uint2 rhs) { return new bool2 (lhs <= rhs.x, lhs <= rhs.y); }
/// <summary>Returns the result of a componentwise greater than operation on two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator > (uint2 lhs, uint2 rhs) { return new bool2 (lhs.x > rhs.x, lhs.y > rhs.y); }
/// <summary>Returns the result of a componentwise greater than operation on a uint2 vector and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator > (uint2 lhs, uint rhs) { return new bool2 (lhs.x > rhs, lhs.y > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a uint value and a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator > (uint lhs, uint2 rhs) { return new bool2 (lhs > rhs.x, lhs > rhs.y); }
/// <summary>Returns the result of a componentwise greater or equal operation on two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator >= (uint2 lhs, uint2 rhs) { return new bool2 (lhs.x >= rhs.x, lhs.y >= rhs.y); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint2 vector and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator >= (uint2 lhs, uint rhs) { return new bool2 (lhs.x >= rhs, lhs.y >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint value and a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator >= (uint lhs, uint2 rhs) { return new bool2 (lhs >= rhs.x, lhs >= rhs.y); }
/// <summary>Returns the result of a componentwise unary minus operation on a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator - (uint2 val) { return new uint2 ((uint)-val.x, (uint)-val.y); }
/// <summary>Returns the result of a componentwise unary plus operation on a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator + (uint2 val) { return new uint2 (+val.x, +val.y); }
/// <summary>Returns the result of a componentwise left shift operation on a uint2 vector by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator << (uint2 x, int n) { return new uint2 (x.x << n, x.y << n); }
/// <summary>Returns the result of a componentwise right shift operation on a uint2 vector by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator >> (uint2 x, int n) { return new uint2 (x.x >> n, x.y >> n); }
/// <summary>Returns the result of a componentwise equality operation on two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (uint2 lhs, uint2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); }
/// <summary>Returns the result of a componentwise equality operation on a uint2 vector and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (uint2 lhs, uint rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a uint value and a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator == (uint lhs, uint2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); }
/// <summary>Returns the result of a componentwise not equal operation on two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (uint2 lhs, uint2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); }
/// <summary>Returns the result of a componentwise not equal operation on a uint2 vector and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (uint2 lhs, uint rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a uint value and a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2 operator != (uint lhs, uint2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); }
/// <summary>Returns the result of a componentwise bitwise not operation on a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator ~ (uint2 val) { return new uint2 (~val.x, ~val.y); }
/// <summary>Returns the result of a componentwise bitwise and operation on two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator & (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x & rhs.x, lhs.y & rhs.y); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint2 vector and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator & (uint2 lhs, uint rhs) { return new uint2 (lhs.x & rhs, lhs.y & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint value and a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator & (uint lhs, uint2 rhs) { return new uint2 (lhs & rhs.x, lhs & rhs.y); }
/// <summary>Returns the result of a componentwise bitwise or operation on two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator | (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x | rhs.x, lhs.y | rhs.y); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint2 vector and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator | (uint2 lhs, uint rhs) { return new uint2 (lhs.x | rhs, lhs.y | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint value and a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator | (uint lhs, uint2 rhs) { return new uint2 (lhs | rhs.x, lhs | rhs.y); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator ^ (uint2 lhs, uint2 rhs) { return new uint2 (lhs.x ^ rhs.x, lhs.y ^ rhs.y); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint2 vector and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator ^ (uint2 lhs, uint rhs) { return new uint2 (lhs.x ^ rhs, lhs.y ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 operator ^ (uint lhs, uint2 rhs) { return new uint2 (lhs ^ rhs.x, lhs ^ rhs.y); }
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 xxxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(x, x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 xxxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(x, x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 xxyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(x, x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 xxyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(x, x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 xyxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(x, y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 xyxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(x, y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 xyyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(x, y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 xyyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(x, y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 yxxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(y, x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 yxxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(y, x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 yxyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(y, x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 yxyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(y, x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 yyxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(y, y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 yyxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(y, y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 yyyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(y, y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint4 yyyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint4(y, y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint3 xxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint3(x, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint3 xxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint3(x, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint3 xyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint3(x, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint3 xyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint3(x, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint3 yxx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint3(y, x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint3 yxy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint3(y, x, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint3 yyx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint3(y, y, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint3 yyy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint3(y, y, y); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint2 xx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint2(x, x); }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint2 xy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint2(x, y); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set { x = value.x; y = value.y; }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint2 yx
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint2(y, x); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set { y = value.x; x = value.y; }
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public uint2 yy
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new uint2(y, y); }
}
/// <summary>Returns the uint element at a specified index.</summary>
unsafe public uint this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (uint2* array = &this) { return ((uint*)array)[index]; }
}
set
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (uint* array = &x) { array[index] = value; }
}
}
/// <summary>Returns true if the uint2 is equal to a given uint2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(uint2 rhs) { return x == rhs.x && y == rhs.y; }
/// <summary>Returns true if the uint2 is equal to a given uint2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((uint2)o); }
/// <summary>Returns a hash code for the uint2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the uint2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("uint2({0}, {1})", x, y);
}
/// <summary>Returns a string representation of the uint2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("uint2({0}, {1})", x.ToString(format, formatProvider), y.ToString(format, formatProvider));
}
internal sealed class DebuggerProxy
{
public uint x;
public uint y;
public DebuggerProxy(uint2 v)
{
x = v.x;
y = v.y;
}
}
}
public static partial class math
{
/// <summary>Returns a uint2 vector constructed from two uint values.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 uint2(uint x, uint y) { return new uint2(x, y); }
/// <summary>Returns a uint2 vector constructed from a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 uint2(uint2 xy) { return new uint2(xy); }
/// <summary>Returns a uint2 vector constructed from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 uint2(uint v) { return new uint2(v); }
/// <summary>Returns a uint2 vector constructed from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 uint2(bool v) { return new uint2(v); }
/// <summary>Return a uint2 vector constructed from a bool2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 uint2(bool2 v) { return new uint2(v); }
/// <summary>Returns a uint2 vector constructed from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 uint2(int v) { return new uint2(v); }
/// <summary>Return a uint2 vector constructed from a int2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 uint2(int2 v) { return new uint2(v); }
/// <summary>Returns a uint2 vector constructed from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 uint2(float v) { return new uint2(v); }
/// <summary>Return a uint2 vector constructed from a float2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 uint2(float2 v) { return new uint2(v); }
/// <summary>Returns a uint2 vector constructed from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 uint2(double v) { return new uint2(v); }
/// <summary>Return a uint2 vector constructed from a double2 vector by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 uint2(double2 v) { return new uint2(v); }
/// <summary>Returns a uint hash code of a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(uint2 v)
{
return csum(v * uint2(0x4473BBB1u, 0xCBA11D5Fu)) + 0x685835CFu;
}
/// <summary>
/// Returns a uint2 vector hash code of a uint2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(uint2 v)
{
return (v * uint2(0xC3D32AE1u, 0xB966942Fu)) + 0xFE9856B3u;
}
/// <summary>Returns the result of specified shuffling of the components from two uint2 vectors into a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint shuffle(uint2 a, uint2 b, ShuffleComponent x)
{
return select_shuffle_component(a, b, x);
}
/// <summary>Returns the result of specified shuffling of the components from two uint2 vectors into a uint2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 shuffle(uint2 a, uint2 b, ShuffleComponent x, ShuffleComponent y)
{
return uint2(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y));
}
/// <summary>Returns the result of specified shuffling of the components from two uint2 vectors into a uint3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 shuffle(uint2 a, uint2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z)
{
return uint3(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y),
select_shuffle_component(a, b, z));
}
/// <summary>Returns the result of specified shuffling of the components from two uint2 vectors into a uint4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 shuffle(uint2 a, uint2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z, ShuffleComponent w)
{
return uint4(
select_shuffle_component(a, b, x),
select_shuffle_component(a, b, y),
select_shuffle_component(a, b, z),
select_shuffle_component(a, b, w));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static uint select_shuffle_component(uint2 a, uint2 b, ShuffleComponent component)
{
switch(component)
{
case ShuffleComponent.LeftX:
return a.x;
case ShuffleComponent.LeftY:
return a.y;
case ShuffleComponent.RightX:
return b.x;
case ShuffleComponent.RightY:
return b.y;
default:
throw new System.ArgumentException("Invalid shuffle component: " + component);
}
}
}
}

View File

@@ -0,0 +1,494 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct uint2x2 : System.IEquatable<uint2x2>, IFormattable
{
public uint2 c0;
public uint2 c1;
/// <summary>uint2x2 identity transform.</summary>
public static readonly uint2x2 identity = new uint2x2(1u, 0u, 0u, 1u);
/// <summary>uint2x2 zero value.</summary>
public static readonly uint2x2 zero;
/// <summary>Constructs a uint2x2 matrix from two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x2(uint2 c0, uint2 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a uint2x2 matrix from 4 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x2(uint m00, uint m01,
uint m10, uint m11)
{
this.c0 = new uint2(m00, m10);
this.c1 = new uint2(m01, m11);
}
/// <summary>Constructs a uint2x2 matrix from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x2(uint v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a uint2x2 matrix from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x2(bool v)
{
this.c0 = math.select(new uint2(0u), new uint2(1u), v);
this.c1 = math.select(new uint2(0u), new uint2(1u), v);
}
/// <summary>Constructs a uint2x2 matrix from a bool2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x2(bool2x2 v)
{
this.c0 = math.select(new uint2(0u), new uint2(1u), v.c0);
this.c1 = math.select(new uint2(0u), new uint2(1u), v.c1);
}
/// <summary>Constructs a uint2x2 matrix from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x2(int v)
{
this.c0 = (uint2)v;
this.c1 = (uint2)v;
}
/// <summary>Constructs a uint2x2 matrix from a int2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x2(int2x2 v)
{
this.c0 = (uint2)v.c0;
this.c1 = (uint2)v.c1;
}
/// <summary>Constructs a uint2x2 matrix from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x2(float v)
{
this.c0 = (uint2)v;
this.c1 = (uint2)v;
}
/// <summary>Constructs a uint2x2 matrix from a float2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x2(float2x2 v)
{
this.c0 = (uint2)v.c0;
this.c1 = (uint2)v.c1;
}
/// <summary>Constructs a uint2x2 matrix from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x2(double v)
{
this.c0 = (uint2)v;
this.c1 = (uint2)v;
}
/// <summary>Constructs a uint2x2 matrix from a double2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x2(double2x2 v)
{
this.c0 = (uint2)v.c0;
this.c1 = (uint2)v.c1;
}
/// <summary>Implicitly converts a single uint value to a uint2x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator uint2x2(uint v) { return new uint2x2(v); }
/// <summary>Explicitly converts a single bool value to a uint2x2 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x2(bool v) { return new uint2x2(v); }
/// <summary>Explicitly converts a bool2x2 matrix to a uint2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x2(bool2x2 v) { return new uint2x2(v); }
/// <summary>Explicitly converts a single int value to a uint2x2 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x2(int v) { return new uint2x2(v); }
/// <summary>Explicitly converts a int2x2 matrix to a uint2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x2(int2x2 v) { return new uint2x2(v); }
/// <summary>Explicitly converts a single float value to a uint2x2 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x2(float v) { return new uint2x2(v); }
/// <summary>Explicitly converts a float2x2 matrix to a uint2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x2(float2x2 v) { return new uint2x2(v); }
/// <summary>Explicitly converts a single double value to a uint2x2 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x2(double v) { return new uint2x2(v); }
/// <summary>Explicitly converts a double2x2 matrix to a uint2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x2(double2x2 v) { return new uint2x2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two uint2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator * (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint2x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator * (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 * rhs, lhs.c1 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint value and a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator * (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs * rhs.c0, lhs * rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on two uint2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator + (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on a uint2x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator + (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 + rhs, lhs.c1 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a uint value and a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator + (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs + rhs.c0, lhs + rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on two uint2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator - (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint2x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator - (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 - rhs, lhs.c1 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint value and a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator - (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs - rhs.c0, lhs - rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on two uint2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator / (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on a uint2x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator / (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 / rhs, lhs.c1 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a uint value and a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator / (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs / rhs.c0, lhs / rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on two uint2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator % (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on a uint2x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator % (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 % rhs, lhs.c1 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a uint value and a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator % (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs % rhs.c0, lhs % rhs.c1); }
/// <summary>Returns the result of a componentwise increment operation on a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator ++ (uint2x2 val) { return new uint2x2 (++val.c0, ++val.c1); }
/// <summary>Returns the result of a componentwise decrement operation on a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator -- (uint2x2 val) { return new uint2x2 (--val.c0, --val.c1); }
/// <summary>Returns the result of a componentwise less than operation on two uint2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator < (uint2x2 lhs, uint2x2 rhs) { return new bool2x2 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1); }
/// <summary>Returns the result of a componentwise less than operation on a uint2x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator < (uint2x2 lhs, uint rhs) { return new bool2x2 (lhs.c0 < rhs, lhs.c1 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a uint value and a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator < (uint lhs, uint2x2 rhs) { return new bool2x2 (lhs < rhs.c0, lhs < rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on two uint2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator <= (uint2x2 lhs, uint2x2 rhs) { return new bool2x2 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint2x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator <= (uint2x2 lhs, uint rhs) { return new bool2x2 (lhs.c0 <= rhs, lhs.c1 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint value and a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator <= (uint lhs, uint2x2 rhs) { return new bool2x2 (lhs <= rhs.c0, lhs <= rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on two uint2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator > (uint2x2 lhs, uint2x2 rhs) { return new bool2x2 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on a uint2x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator > (uint2x2 lhs, uint rhs) { return new bool2x2 (lhs.c0 > rhs, lhs.c1 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a uint value and a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator > (uint lhs, uint2x2 rhs) { return new bool2x2 (lhs > rhs.c0, lhs > rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on two uint2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator >= (uint2x2 lhs, uint2x2 rhs) { return new bool2x2 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint2x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator >= (uint2x2 lhs, uint rhs) { return new bool2x2 (lhs.c0 >= rhs, lhs.c1 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint value and a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator >= (uint lhs, uint2x2 rhs) { return new bool2x2 (lhs >= rhs.c0, lhs >= rhs.c1); }
/// <summary>Returns the result of a componentwise unary minus operation on a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator - (uint2x2 val) { return new uint2x2 (-val.c0, -val.c1); }
/// <summary>Returns the result of a componentwise unary plus operation on a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator + (uint2x2 val) { return new uint2x2 (+val.c0, +val.c1); }
/// <summary>Returns the result of a componentwise left shift operation on a uint2x2 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator << (uint2x2 x, int n) { return new uint2x2 (x.c0 << n, x.c1 << n); }
/// <summary>Returns the result of a componentwise right shift operation on a uint2x2 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator >> (uint2x2 x, int n) { return new uint2x2 (x.c0 >> n, x.c1 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two uint2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (uint2x2 lhs, uint2x2 rhs) { return new bool2x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on a uint2x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (uint2x2 lhs, uint rhs) { return new bool2x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a uint value and a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator == (uint lhs, uint2x2 rhs) { return new bool2x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two uint2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (uint2x2 lhs, uint2x2 rhs) { return new bool2x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on a uint2x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (uint2x2 lhs, uint rhs) { return new bool2x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a uint value and a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x2 operator != (uint lhs, uint2x2 rhs) { return new bool2x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise not operation on a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator ~ (uint2x2 val) { return new uint2x2 (~val.c0, ~val.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on two uint2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator & (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint2x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator & (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 & rhs, lhs.c1 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint value and a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator & (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs & rhs.c0, lhs & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on two uint2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator | (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint2x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator | (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 | rhs, lhs.c1 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint value and a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator | (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs | rhs.c0, lhs | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two uint2x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator ^ (uint2x2 lhs, uint2x2 rhs) { return new uint2x2 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint2x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator ^ (uint2x2 lhs, uint rhs) { return new uint2x2 (lhs.c0 ^ rhs, lhs.c1 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 operator ^ (uint lhs, uint2x2 rhs) { return new uint2x2 (lhs ^ rhs.c0, lhs ^ rhs.c1); }
/// <summary>Returns the uint2 element at a specified index.</summary>
unsafe public ref uint2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (uint2x2* array = &this) { return ref ((uint2*)array)[index]; }
}
}
/// <summary>Returns true if the uint2x2 is equal to a given uint2x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(uint2x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the uint2x2 is equal to a given uint2x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((uint2x2)o); }
/// <summary>Returns a hash code for the uint2x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the uint2x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("uint2x2({0}, {1}, {2}, {3})", c0.x, c1.x, c0.y, c1.y);
}
/// <summary>Returns a string representation of the uint2x2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("uint2x2({0}, {1}, {2}, {3})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a uint2x2 matrix constructed from two uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 uint2x2(uint2 c0, uint2 c1) { return new uint2x2(c0, c1); }
/// <summary>Returns a uint2x2 matrix constructed from from 4 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 uint2x2(uint m00, uint m01,
uint m10, uint m11)
{
return new uint2x2(m00, m01,
m10, m11);
}
/// <summary>Returns a uint2x2 matrix constructed from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 uint2x2(uint v) { return new uint2x2(v); }
/// <summary>Returns a uint2x2 matrix constructed from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 uint2x2(bool v) { return new uint2x2(v); }
/// <summary>Return a uint2x2 matrix constructed from a bool2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 uint2x2(bool2x2 v) { return new uint2x2(v); }
/// <summary>Returns a uint2x2 matrix constructed from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 uint2x2(int v) { return new uint2x2(v); }
/// <summary>Return a uint2x2 matrix constructed from a int2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 uint2x2(int2x2 v) { return new uint2x2(v); }
/// <summary>Returns a uint2x2 matrix constructed from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 uint2x2(float v) { return new uint2x2(v); }
/// <summary>Return a uint2x2 matrix constructed from a float2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 uint2x2(float2x2 v) { return new uint2x2(v); }
/// <summary>Returns a uint2x2 matrix constructed from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 uint2x2(double v) { return new uint2x2(v); }
/// <summary>Return a uint2x2 matrix constructed from a double2x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 uint2x2(double2x2 v) { return new uint2x2(v); }
/// <summary>Return the uint2x2 transpose of a uint2x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x2 transpose(uint2x2 v)
{
return uint2x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y);
}
/// <summary>Returns a uint hash code of a uint2x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(uint2x2 v)
{
return csum(v.c0 * uint2(0xB36DE767u, 0x6FCA387Du) +
v.c1 * uint2(0xAF0F3103u, 0xE4A056C7u)) + 0x841D8225u;
}
/// <summary>
/// Returns a uint2 vector hash code of a uint2x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(uint2x2 v)
{
return (v.c0 * uint2(0xC9393C7Du, 0xD42EAFA3u) +
v.c1 * uint2(0xD9AFD06Du, 0x97A65421u)) + 0x7809205Fu;
}
}
}

View File

@@ -0,0 +1,506 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct uint2x3 : System.IEquatable<uint2x3>, IFormattable
{
public uint2 c0;
public uint2 c1;
public uint2 c2;
/// <summary>uint2x3 zero value.</summary>
public static readonly uint2x3 zero;
/// <summary>Constructs a uint2x3 matrix from three uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x3(uint2 c0, uint2 c1, uint2 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a uint2x3 matrix from 6 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x3(uint m00, uint m01, uint m02,
uint m10, uint m11, uint m12)
{
this.c0 = new uint2(m00, m10);
this.c1 = new uint2(m01, m11);
this.c2 = new uint2(m02, m12);
}
/// <summary>Constructs a uint2x3 matrix from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x3(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a uint2x3 matrix from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x3(bool v)
{
this.c0 = math.select(new uint2(0u), new uint2(1u), v);
this.c1 = math.select(new uint2(0u), new uint2(1u), v);
this.c2 = math.select(new uint2(0u), new uint2(1u), v);
}
/// <summary>Constructs a uint2x3 matrix from a bool2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x3(bool2x3 v)
{
this.c0 = math.select(new uint2(0u), new uint2(1u), v.c0);
this.c1 = math.select(new uint2(0u), new uint2(1u), v.c1);
this.c2 = math.select(new uint2(0u), new uint2(1u), v.c2);
}
/// <summary>Constructs a uint2x3 matrix from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x3(int v)
{
this.c0 = (uint2)v;
this.c1 = (uint2)v;
this.c2 = (uint2)v;
}
/// <summary>Constructs a uint2x3 matrix from a int2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x3(int2x3 v)
{
this.c0 = (uint2)v.c0;
this.c1 = (uint2)v.c1;
this.c2 = (uint2)v.c2;
}
/// <summary>Constructs a uint2x3 matrix from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x3(float v)
{
this.c0 = (uint2)v;
this.c1 = (uint2)v;
this.c2 = (uint2)v;
}
/// <summary>Constructs a uint2x3 matrix from a float2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x3(float2x3 v)
{
this.c0 = (uint2)v.c0;
this.c1 = (uint2)v.c1;
this.c2 = (uint2)v.c2;
}
/// <summary>Constructs a uint2x3 matrix from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x3(double v)
{
this.c0 = (uint2)v;
this.c1 = (uint2)v;
this.c2 = (uint2)v;
}
/// <summary>Constructs a uint2x3 matrix from a double2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x3(double2x3 v)
{
this.c0 = (uint2)v.c0;
this.c1 = (uint2)v.c1;
this.c2 = (uint2)v.c2;
}
/// <summary>Implicitly converts a single uint value to a uint2x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator uint2x3(uint v) { return new uint2x3(v); }
/// <summary>Explicitly converts a single bool value to a uint2x3 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x3(bool v) { return new uint2x3(v); }
/// <summary>Explicitly converts a bool2x3 matrix to a uint2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x3(bool2x3 v) { return new uint2x3(v); }
/// <summary>Explicitly converts a single int value to a uint2x3 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x3(int v) { return new uint2x3(v); }
/// <summary>Explicitly converts a int2x3 matrix to a uint2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x3(int2x3 v) { return new uint2x3(v); }
/// <summary>Explicitly converts a single float value to a uint2x3 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x3(float v) { return new uint2x3(v); }
/// <summary>Explicitly converts a float2x3 matrix to a uint2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x3(float2x3 v) { return new uint2x3(v); }
/// <summary>Explicitly converts a single double value to a uint2x3 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x3(double v) { return new uint2x3(v); }
/// <summary>Explicitly converts a double2x3 matrix to a uint2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x3(double2x3 v) { return new uint2x3(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two uint2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator * (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint2x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator * (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint value and a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator * (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on two uint2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator + (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on a uint2x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator + (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a uint value and a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator + (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on two uint2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator - (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint2x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator - (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint value and a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator - (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on two uint2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator / (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on a uint2x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator / (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a uint value and a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator / (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on two uint2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator % (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on a uint2x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator % (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a uint value and a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator % (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); }
/// <summary>Returns the result of a componentwise increment operation on a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator ++ (uint2x3 val) { return new uint2x3 (++val.c0, ++val.c1, ++val.c2); }
/// <summary>Returns the result of a componentwise decrement operation on a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator -- (uint2x3 val) { return new uint2x3 (--val.c0, --val.c1, --val.c2); }
/// <summary>Returns the result of a componentwise less than operation on two uint2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator < (uint2x3 lhs, uint2x3 rhs) { return new bool2x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); }
/// <summary>Returns the result of a componentwise less than operation on a uint2x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator < (uint2x3 lhs, uint rhs) { return new bool2x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a uint value and a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator < (uint lhs, uint2x3 rhs) { return new bool2x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on two uint2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator <= (uint2x3 lhs, uint2x3 rhs) { return new bool2x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint2x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator <= (uint2x3 lhs, uint rhs) { return new bool2x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint value and a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator <= (uint lhs, uint2x3 rhs) { return new bool2x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on two uint2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator > (uint2x3 lhs, uint2x3 rhs) { return new bool2x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on a uint2x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator > (uint2x3 lhs, uint rhs) { return new bool2x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a uint value and a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator > (uint lhs, uint2x3 rhs) { return new bool2x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on two uint2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator >= (uint2x3 lhs, uint2x3 rhs) { return new bool2x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint2x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator >= (uint2x3 lhs, uint rhs) { return new bool2x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint value and a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator >= (uint lhs, uint2x3 rhs) { return new bool2x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); }
/// <summary>Returns the result of a componentwise unary minus operation on a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator - (uint2x3 val) { return new uint2x3 (-val.c0, -val.c1, -val.c2); }
/// <summary>Returns the result of a componentwise unary plus operation on a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator + (uint2x3 val) { return new uint2x3 (+val.c0, +val.c1, +val.c2); }
/// <summary>Returns the result of a componentwise left shift operation on a uint2x3 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator << (uint2x3 x, int n) { return new uint2x3 (x.c0 << n, x.c1 << n, x.c2 << n); }
/// <summary>Returns the result of a componentwise right shift operation on a uint2x3 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator >> (uint2x3 x, int n) { return new uint2x3 (x.c0 >> n, x.c1 >> n, x.c2 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two uint2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (uint2x3 lhs, uint2x3 rhs) { return new bool2x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on a uint2x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (uint2x3 lhs, uint rhs) { return new bool2x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a uint value and a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator == (uint lhs, uint2x3 rhs) { return new bool2x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two uint2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (uint2x3 lhs, uint2x3 rhs) { return new bool2x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on a uint2x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (uint2x3 lhs, uint rhs) { return new bool2x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a uint value and a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x3 operator != (uint lhs, uint2x3 rhs) { return new bool2x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise not operation on a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator ~ (uint2x3 val) { return new uint2x3 (~val.c0, ~val.c1, ~val.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on two uint2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator & (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint2x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator & (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint value and a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator & (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on two uint2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator | (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint2x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator | (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint value and a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator | (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two uint2x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator ^ (uint2x3 lhs, uint2x3 rhs) { return new uint2x3 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint2x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator ^ (uint2x3 lhs, uint rhs) { return new uint2x3 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 operator ^ (uint lhs, uint2x3 rhs) { return new uint2x3 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2); }
/// <summary>Returns the uint2 element at a specified index.</summary>
unsafe public ref uint2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (uint2x3* array = &this) { return ref ((uint2*)array)[index]; }
}
}
/// <summary>Returns true if the uint2x3 is equal to a given uint2x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(uint2x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the uint2x3 is equal to a given uint2x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((uint2x3)o); }
/// <summary>Returns a hash code for the uint2x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the uint2x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("uint2x3({0}, {1}, {2}, {3}, {4}, {5})", c0.x, c1.x, c2.x, c0.y, c1.y, c2.y);
}
/// <summary>Returns a string representation of the uint2x3 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("uint2x3({0}, {1}, {2}, {3}, {4}, {5})", 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));
}
}
public static partial class math
{
/// <summary>Returns a uint2x3 matrix constructed from three uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 uint2x3(uint2 c0, uint2 c1, uint2 c2) { return new uint2x3(c0, c1, c2); }
/// <summary>Returns a uint2x3 matrix constructed from from 6 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 uint2x3(uint m00, uint m01, uint m02,
uint m10, uint m11, uint m12)
{
return new uint2x3(m00, m01, m02,
m10, m11, m12);
}
/// <summary>Returns a uint2x3 matrix constructed from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 uint2x3(uint v) { return new uint2x3(v); }
/// <summary>Returns a uint2x3 matrix constructed from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 uint2x3(bool v) { return new uint2x3(v); }
/// <summary>Return a uint2x3 matrix constructed from a bool2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 uint2x3(bool2x3 v) { return new uint2x3(v); }
/// <summary>Returns a uint2x3 matrix constructed from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 uint2x3(int v) { return new uint2x3(v); }
/// <summary>Return a uint2x3 matrix constructed from a int2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 uint2x3(int2x3 v) { return new uint2x3(v); }
/// <summary>Returns a uint2x3 matrix constructed from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 uint2x3(float v) { return new uint2x3(v); }
/// <summary>Return a uint2x3 matrix constructed from a float2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 uint2x3(float2x3 v) { return new uint2x3(v); }
/// <summary>Returns a uint2x3 matrix constructed from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 uint2x3(double v) { return new uint2x3(v); }
/// <summary>Return a uint2x3 matrix constructed from a double2x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 uint2x3(double2x3 v) { return new uint2x3(v); }
/// <summary>Return the uint3x2 transpose of a uint2x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 transpose(uint2x3 v)
{
return uint3x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y,
v.c2.x, v.c2.y);
}
/// <summary>Returns a uint hash code of a uint2x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(uint2x3 v)
{
return csum(v.c0 * uint2(0xEF63C699u, 0x9001903Fu) +
v.c1 * uint2(0xA895B9CDu, 0x9D23B201u) +
v.c2 * uint2(0x4B01D3E1u, 0x7461CA0Du)) + 0x79725379u;
}
/// <summary>
/// Returns a uint2 vector hash code of a uint2x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(uint2x3 v)
{
return (v.c0 * uint2(0xD6258E5Bu, 0xEE390C97u) +
v.c1 * uint2(0x9C8A2F05u, 0x4DDC6509u) +
v.c2 * uint2(0x7CF083CBu, 0x5C4D6CEDu)) + 0xF9137117u;
}
}
}

View File

@@ -0,0 +1,521 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct uint2x4 : System.IEquatable<uint2x4>, IFormattable
{
public uint2 c0;
public uint2 c1;
public uint2 c2;
public uint2 c3;
/// <summary>uint2x4 zero value.</summary>
public static readonly uint2x4 zero;
/// <summary>Constructs a uint2x4 matrix from four uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x4(uint2 c0, uint2 c1, uint2 c2, uint2 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a uint2x4 matrix from 8 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x4(uint m00, uint m01, uint m02, uint m03,
uint m10, uint m11, uint m12, uint m13)
{
this.c0 = new uint2(m00, m10);
this.c1 = new uint2(m01, m11);
this.c2 = new uint2(m02, m12);
this.c3 = new uint2(m03, m13);
}
/// <summary>Constructs a uint2x4 matrix from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x4(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a uint2x4 matrix from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x4(bool v)
{
this.c0 = math.select(new uint2(0u), new uint2(1u), v);
this.c1 = math.select(new uint2(0u), new uint2(1u), v);
this.c2 = math.select(new uint2(0u), new uint2(1u), v);
this.c3 = math.select(new uint2(0u), new uint2(1u), v);
}
/// <summary>Constructs a uint2x4 matrix from a bool2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x4(bool2x4 v)
{
this.c0 = math.select(new uint2(0u), new uint2(1u), v.c0);
this.c1 = math.select(new uint2(0u), new uint2(1u), v.c1);
this.c2 = math.select(new uint2(0u), new uint2(1u), v.c2);
this.c3 = math.select(new uint2(0u), new uint2(1u), v.c3);
}
/// <summary>Constructs a uint2x4 matrix from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x4(int v)
{
this.c0 = (uint2)v;
this.c1 = (uint2)v;
this.c2 = (uint2)v;
this.c3 = (uint2)v;
}
/// <summary>Constructs a uint2x4 matrix from a int2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x4(int2x4 v)
{
this.c0 = (uint2)v.c0;
this.c1 = (uint2)v.c1;
this.c2 = (uint2)v.c2;
this.c3 = (uint2)v.c3;
}
/// <summary>Constructs a uint2x4 matrix from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x4(float v)
{
this.c0 = (uint2)v;
this.c1 = (uint2)v;
this.c2 = (uint2)v;
this.c3 = (uint2)v;
}
/// <summary>Constructs a uint2x4 matrix from a float2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x4(float2x4 v)
{
this.c0 = (uint2)v.c0;
this.c1 = (uint2)v.c1;
this.c2 = (uint2)v.c2;
this.c3 = (uint2)v.c3;
}
/// <summary>Constructs a uint2x4 matrix from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x4(double v)
{
this.c0 = (uint2)v;
this.c1 = (uint2)v;
this.c2 = (uint2)v;
this.c3 = (uint2)v;
}
/// <summary>Constructs a uint2x4 matrix from a double2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint2x4(double2x4 v)
{
this.c0 = (uint2)v.c0;
this.c1 = (uint2)v.c1;
this.c2 = (uint2)v.c2;
this.c3 = (uint2)v.c3;
}
/// <summary>Implicitly converts a single uint value to a uint2x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator uint2x4(uint v) { return new uint2x4(v); }
/// <summary>Explicitly converts a single bool value to a uint2x4 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x4(bool v) { return new uint2x4(v); }
/// <summary>Explicitly converts a bool2x4 matrix to a uint2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x4(bool2x4 v) { return new uint2x4(v); }
/// <summary>Explicitly converts a single int value to a uint2x4 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x4(int v) { return new uint2x4(v); }
/// <summary>Explicitly converts a int2x4 matrix to a uint2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x4(int2x4 v) { return new uint2x4(v); }
/// <summary>Explicitly converts a single float value to a uint2x4 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x4(float v) { return new uint2x4(v); }
/// <summary>Explicitly converts a float2x4 matrix to a uint2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x4(float2x4 v) { return new uint2x4(v); }
/// <summary>Explicitly converts a single double value to a uint2x4 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x4(double v) { return new uint2x4(v); }
/// <summary>Explicitly converts a double2x4 matrix to a uint2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint2x4(double2x4 v) { return new uint2x4(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two uint2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator * (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2, lhs.c3 * rhs.c3); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint2x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator * (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs, lhs.c3 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint value and a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator * (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2, lhs * rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on two uint2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator + (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2, lhs.c3 + rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on a uint2x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator + (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs, lhs.c3 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a uint value and a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator + (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2, lhs + rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on two uint2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator - (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2, lhs.c3 - rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint2x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator - (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs, lhs.c3 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint value and a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator - (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2, lhs - rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on two uint2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator / (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2, lhs.c3 / rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on a uint2x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator / (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs, lhs.c3 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a uint value and a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator / (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2, lhs / rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on two uint2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator % (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2, lhs.c3 % rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on a uint2x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator % (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs, lhs.c3 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a uint value and a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator % (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2, lhs % rhs.c3); }
/// <summary>Returns the result of a componentwise increment operation on a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator ++ (uint2x4 val) { return new uint2x4 (++val.c0, ++val.c1, ++val.c2, ++val.c3); }
/// <summary>Returns the result of a componentwise decrement operation on a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator -- (uint2x4 val) { return new uint2x4 (--val.c0, --val.c1, --val.c2, --val.c3); }
/// <summary>Returns the result of a componentwise less than operation on two uint2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator < (uint2x4 lhs, uint2x4 rhs) { return new bool2x4 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2, lhs.c3 < rhs.c3); }
/// <summary>Returns the result of a componentwise less than operation on a uint2x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator < (uint2x4 lhs, uint rhs) { return new bool2x4 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs, lhs.c3 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a uint value and a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator < (uint lhs, uint2x4 rhs) { return new bool2x4 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2, lhs < rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on two uint2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator <= (uint2x4 lhs, uint2x4 rhs) { return new bool2x4 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2, lhs.c3 <= rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint2x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator <= (uint2x4 lhs, uint rhs) { return new bool2x4 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs, lhs.c3 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint value and a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator <= (uint lhs, uint2x4 rhs) { return new bool2x4 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2, lhs <= rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on two uint2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator > (uint2x4 lhs, uint2x4 rhs) { return new bool2x4 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2, lhs.c3 > rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on a uint2x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator > (uint2x4 lhs, uint rhs) { return new bool2x4 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs, lhs.c3 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a uint value and a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator > (uint lhs, uint2x4 rhs) { return new bool2x4 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2, lhs > rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on two uint2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator >= (uint2x4 lhs, uint2x4 rhs) { return new bool2x4 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2, lhs.c3 >= rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint2x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator >= (uint2x4 lhs, uint rhs) { return new bool2x4 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs, lhs.c3 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint value and a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator >= (uint lhs, uint2x4 rhs) { return new bool2x4 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2, lhs >= rhs.c3); }
/// <summary>Returns the result of a componentwise unary minus operation on a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator - (uint2x4 val) { return new uint2x4 (-val.c0, -val.c1, -val.c2, -val.c3); }
/// <summary>Returns the result of a componentwise unary plus operation on a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator + (uint2x4 val) { return new uint2x4 (+val.c0, +val.c1, +val.c2, +val.c3); }
/// <summary>Returns the result of a componentwise left shift operation on a uint2x4 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator << (uint2x4 x, int n) { return new uint2x4 (x.c0 << n, x.c1 << n, x.c2 << n, x.c3 << n); }
/// <summary>Returns the result of a componentwise right shift operation on a uint2x4 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator >> (uint2x4 x, int n) { return new uint2x4 (x.c0 >> n, x.c1 >> n, x.c2 >> n, x.c3 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two uint2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (uint2x4 lhs, uint2x4 rhs) { return new bool2x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on a uint2x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (uint2x4 lhs, uint rhs) { return new bool2x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a uint value and a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator == (uint lhs, uint2x4 rhs) { return new bool2x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two uint2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (uint2x4 lhs, uint2x4 rhs) { return new bool2x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on a uint2x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (uint2x4 lhs, uint rhs) { return new bool2x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a uint value and a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool2x4 operator != (uint lhs, uint2x4 rhs) { return new bool2x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise not operation on a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator ~ (uint2x4 val) { return new uint2x4 (~val.c0, ~val.c1, ~val.c2, ~val.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on two uint2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator & (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2, lhs.c3 & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint2x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator & (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs, lhs.c3 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint value and a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator & (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2, lhs & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on two uint2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator | (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2, lhs.c3 | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint2x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator | (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs, lhs.c3 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint value and a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator | (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2, lhs | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two uint2x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator ^ (uint2x4 lhs, uint2x4 rhs) { return new uint2x4 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2, lhs.c3 ^ rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint2x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator ^ (uint2x4 lhs, uint rhs) { return new uint2x4 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs, lhs.c3 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 operator ^ (uint lhs, uint2x4 rhs) { return new uint2x4 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2, lhs ^ rhs.c3); }
/// <summary>Returns the uint2 element at a specified index.</summary>
unsafe public ref uint2 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (uint2x4* array = &this) { return ref ((uint2*)array)[index]; }
}
}
/// <summary>Returns true if the uint2x4 is equal to a given uint2x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(uint2x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the uint2x4 is equal to a given uint2x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((uint2x4)o); }
/// <summary>Returns a hash code for the uint2x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the uint2x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("uint2x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y);
}
/// <summary>Returns a string representation of the uint2x4 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("uint2x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c3.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider), c3.y.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a uint2x4 matrix constructed from four uint2 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 uint2x4(uint2 c0, uint2 c1, uint2 c2, uint2 c3) { return new uint2x4(c0, c1, c2, c3); }
/// <summary>Returns a uint2x4 matrix constructed from from 8 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 uint2x4(uint m00, uint m01, uint m02, uint m03,
uint m10, uint m11, uint m12, uint m13)
{
return new uint2x4(m00, m01, m02, m03,
m10, m11, m12, m13);
}
/// <summary>Returns a uint2x4 matrix constructed from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 uint2x4(uint v) { return new uint2x4(v); }
/// <summary>Returns a uint2x4 matrix constructed from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 uint2x4(bool v) { return new uint2x4(v); }
/// <summary>Return a uint2x4 matrix constructed from a bool2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 uint2x4(bool2x4 v) { return new uint2x4(v); }
/// <summary>Returns a uint2x4 matrix constructed from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 uint2x4(int v) { return new uint2x4(v); }
/// <summary>Return a uint2x4 matrix constructed from a int2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 uint2x4(int2x4 v) { return new uint2x4(v); }
/// <summary>Returns a uint2x4 matrix constructed from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 uint2x4(float v) { return new uint2x4(v); }
/// <summary>Return a uint2x4 matrix constructed from a float2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 uint2x4(float2x4 v) { return new uint2x4(v); }
/// <summary>Returns a uint2x4 matrix constructed from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 uint2x4(double v) { return new uint2x4(v); }
/// <summary>Return a uint2x4 matrix constructed from a double2x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 uint2x4(double2x4 v) { return new uint2x4(v); }
/// <summary>Return the uint4x2 transpose of a uint2x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 transpose(uint2x4 v)
{
return uint4x2(
v.c0.x, v.c0.y,
v.c1.x, v.c1.y,
v.c2.x, v.c2.y,
v.c3.x, v.c3.y);
}
/// <summary>Returns a uint hash code of a uint2x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(uint2x4 v)
{
return csum(v.c0 * uint2(0x9DF50593u, 0xF18EEB85u) +
v.c1 * uint2(0x9E19BFC3u, 0x8196B06Fu) +
v.c2 * uint2(0xD24EFA19u, 0x7D8048BBu) +
v.c3 * uint2(0x713BD06Fu, 0x753AD6ADu)) + 0xD19764C7u;
}
/// <summary>
/// Returns a uint2 vector hash code of a uint2x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2 hashwide(uint2x4 v)
{
return (v.c0 * uint2(0xB5D0BF63u, 0xF9102C5Fu) +
v.c1 * uint2(0x9881FB9Fu, 0x56A1530Du) +
v.c2 * uint2(0x804B722Du, 0x738E50E5u) +
v.c3 * uint2(0x4FC93C25u, 0xCD0445A5u)) + 0xD2B90D9Bu;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,494 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct uint3x2 : System.IEquatable<uint3x2>, IFormattable
{
public uint3 c0;
public uint3 c1;
/// <summary>uint3x2 zero value.</summary>
public static readonly uint3x2 zero;
/// <summary>Constructs a uint3x2 matrix from two uint3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x2(uint3 c0, uint3 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a uint3x2 matrix from 6 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x2(uint m00, uint m01,
uint m10, uint m11,
uint m20, uint m21)
{
this.c0 = new uint3(m00, m10, m20);
this.c1 = new uint3(m01, m11, m21);
}
/// <summary>Constructs a uint3x2 matrix from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x2(uint v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a uint3x2 matrix from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x2(bool v)
{
this.c0 = math.select(new uint3(0u), new uint3(1u), v);
this.c1 = math.select(new uint3(0u), new uint3(1u), v);
}
/// <summary>Constructs a uint3x2 matrix from a bool3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x2(bool3x2 v)
{
this.c0 = math.select(new uint3(0u), new uint3(1u), v.c0);
this.c1 = math.select(new uint3(0u), new uint3(1u), v.c1);
}
/// <summary>Constructs a uint3x2 matrix from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x2(int v)
{
this.c0 = (uint3)v;
this.c1 = (uint3)v;
}
/// <summary>Constructs a uint3x2 matrix from a int3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x2(int3x2 v)
{
this.c0 = (uint3)v.c0;
this.c1 = (uint3)v.c1;
}
/// <summary>Constructs a uint3x2 matrix from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x2(float v)
{
this.c0 = (uint3)v;
this.c1 = (uint3)v;
}
/// <summary>Constructs a uint3x2 matrix from a float3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x2(float3x2 v)
{
this.c0 = (uint3)v.c0;
this.c1 = (uint3)v.c1;
}
/// <summary>Constructs a uint3x2 matrix from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x2(double v)
{
this.c0 = (uint3)v;
this.c1 = (uint3)v;
}
/// <summary>Constructs a uint3x2 matrix from a double3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x2(double3x2 v)
{
this.c0 = (uint3)v.c0;
this.c1 = (uint3)v.c1;
}
/// <summary>Implicitly converts a single uint value to a uint3x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator uint3x2(uint v) { return new uint3x2(v); }
/// <summary>Explicitly converts a single bool value to a uint3x2 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x2(bool v) { return new uint3x2(v); }
/// <summary>Explicitly converts a bool3x2 matrix to a uint3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x2(bool3x2 v) { return new uint3x2(v); }
/// <summary>Explicitly converts a single int value to a uint3x2 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x2(int v) { return new uint3x2(v); }
/// <summary>Explicitly converts a int3x2 matrix to a uint3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x2(int3x2 v) { return new uint3x2(v); }
/// <summary>Explicitly converts a single float value to a uint3x2 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x2(float v) { return new uint3x2(v); }
/// <summary>Explicitly converts a float3x2 matrix to a uint3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x2(float3x2 v) { return new uint3x2(v); }
/// <summary>Explicitly converts a single double value to a uint3x2 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x2(double v) { return new uint3x2(v); }
/// <summary>Explicitly converts a double3x2 matrix to a uint3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x2(double3x2 v) { return new uint3x2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two uint3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator * (uint3x2 lhs, uint3x2 rhs) { return new uint3x2 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint3x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator * (uint3x2 lhs, uint rhs) { return new uint3x2 (lhs.c0 * rhs, lhs.c1 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint value and a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator * (uint lhs, uint3x2 rhs) { return new uint3x2 (lhs * rhs.c0, lhs * rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on two uint3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator + (uint3x2 lhs, uint3x2 rhs) { return new uint3x2 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on a uint3x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator + (uint3x2 lhs, uint rhs) { return new uint3x2 (lhs.c0 + rhs, lhs.c1 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a uint value and a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator + (uint lhs, uint3x2 rhs) { return new uint3x2 (lhs + rhs.c0, lhs + rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on two uint3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator - (uint3x2 lhs, uint3x2 rhs) { return new uint3x2 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint3x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator - (uint3x2 lhs, uint rhs) { return new uint3x2 (lhs.c0 - rhs, lhs.c1 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint value and a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator - (uint lhs, uint3x2 rhs) { return new uint3x2 (lhs - rhs.c0, lhs - rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on two uint3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator / (uint3x2 lhs, uint3x2 rhs) { return new uint3x2 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on a uint3x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator / (uint3x2 lhs, uint rhs) { return new uint3x2 (lhs.c0 / rhs, lhs.c1 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a uint value and a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator / (uint lhs, uint3x2 rhs) { return new uint3x2 (lhs / rhs.c0, lhs / rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on two uint3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator % (uint3x2 lhs, uint3x2 rhs) { return new uint3x2 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on a uint3x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator % (uint3x2 lhs, uint rhs) { return new uint3x2 (lhs.c0 % rhs, lhs.c1 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a uint value and a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator % (uint lhs, uint3x2 rhs) { return new uint3x2 (lhs % rhs.c0, lhs % rhs.c1); }
/// <summary>Returns the result of a componentwise increment operation on a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator ++ (uint3x2 val) { return new uint3x2 (++val.c0, ++val.c1); }
/// <summary>Returns the result of a componentwise decrement operation on a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator -- (uint3x2 val) { return new uint3x2 (--val.c0, --val.c1); }
/// <summary>Returns the result of a componentwise less than operation on two uint3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator < (uint3x2 lhs, uint3x2 rhs) { return new bool3x2 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1); }
/// <summary>Returns the result of a componentwise less than operation on a uint3x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator < (uint3x2 lhs, uint rhs) { return new bool3x2 (lhs.c0 < rhs, lhs.c1 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a uint value and a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator < (uint lhs, uint3x2 rhs) { return new bool3x2 (lhs < rhs.c0, lhs < rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on two uint3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator <= (uint3x2 lhs, uint3x2 rhs) { return new bool3x2 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint3x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator <= (uint3x2 lhs, uint rhs) { return new bool3x2 (lhs.c0 <= rhs, lhs.c1 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint value and a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator <= (uint lhs, uint3x2 rhs) { return new bool3x2 (lhs <= rhs.c0, lhs <= rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on two uint3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator > (uint3x2 lhs, uint3x2 rhs) { return new bool3x2 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on a uint3x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator > (uint3x2 lhs, uint rhs) { return new bool3x2 (lhs.c0 > rhs, lhs.c1 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a uint value and a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator > (uint lhs, uint3x2 rhs) { return new bool3x2 (lhs > rhs.c0, lhs > rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on two uint3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator >= (uint3x2 lhs, uint3x2 rhs) { return new bool3x2 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint3x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator >= (uint3x2 lhs, uint rhs) { return new bool3x2 (lhs.c0 >= rhs, lhs.c1 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint value and a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator >= (uint lhs, uint3x2 rhs) { return new bool3x2 (lhs >= rhs.c0, lhs >= rhs.c1); }
/// <summary>Returns the result of a componentwise unary minus operation on a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator - (uint3x2 val) { return new uint3x2 (-val.c0, -val.c1); }
/// <summary>Returns the result of a componentwise unary plus operation on a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator + (uint3x2 val) { return new uint3x2 (+val.c0, +val.c1); }
/// <summary>Returns the result of a componentwise left shift operation on a uint3x2 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator << (uint3x2 x, int n) { return new uint3x2 (x.c0 << n, x.c1 << n); }
/// <summary>Returns the result of a componentwise right shift operation on a uint3x2 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator >> (uint3x2 x, int n) { return new uint3x2 (x.c0 >> n, x.c1 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two uint3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (uint3x2 lhs, uint3x2 rhs) { return new bool3x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on a uint3x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (uint3x2 lhs, uint rhs) { return new bool3x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a uint value and a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator == (uint lhs, uint3x2 rhs) { return new bool3x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two uint3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (uint3x2 lhs, uint3x2 rhs) { return new bool3x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on a uint3x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (uint3x2 lhs, uint rhs) { return new bool3x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a uint value and a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x2 operator != (uint lhs, uint3x2 rhs) { return new bool3x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise not operation on a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator ~ (uint3x2 val) { return new uint3x2 (~val.c0, ~val.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on two uint3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator & (uint3x2 lhs, uint3x2 rhs) { return new uint3x2 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint3x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator & (uint3x2 lhs, uint rhs) { return new uint3x2 (lhs.c0 & rhs, lhs.c1 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint value and a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator & (uint lhs, uint3x2 rhs) { return new uint3x2 (lhs & rhs.c0, lhs & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on two uint3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator | (uint3x2 lhs, uint3x2 rhs) { return new uint3x2 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint3x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator | (uint3x2 lhs, uint rhs) { return new uint3x2 (lhs.c0 | rhs, lhs.c1 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint value and a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator | (uint lhs, uint3x2 rhs) { return new uint3x2 (lhs | rhs.c0, lhs | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two uint3x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator ^ (uint3x2 lhs, uint3x2 rhs) { return new uint3x2 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint3x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator ^ (uint3x2 lhs, uint rhs) { return new uint3x2 (lhs.c0 ^ rhs, lhs.c1 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 operator ^ (uint lhs, uint3x2 rhs) { return new uint3x2 (lhs ^ rhs.c0, lhs ^ rhs.c1); }
/// <summary>Returns the uint3 element at a specified index.</summary>
unsafe public ref uint3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (uint3x2* array = &this) { return ref ((uint3*)array)[index]; }
}
}
/// <summary>Returns true if the uint3x2 is equal to a given uint3x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(uint3x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the uint3x2 is equal to a given uint3x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((uint3x2)o); }
/// <summary>Returns a hash code for the uint3x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the uint3x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("uint3x2({0}, {1}, {2}, {3}, {4}, {5})", c0.x, c1.x, c0.y, c1.y, c0.z, c1.z);
}
/// <summary>Returns a string representation of the uint3x2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("uint3x2({0}, {1}, {2}, {3}, {4}, {5})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a uint3x2 matrix constructed from two uint3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 uint3x2(uint3 c0, uint3 c1) { return new uint3x2(c0, c1); }
/// <summary>Returns a uint3x2 matrix constructed from from 6 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 uint3x2(uint m00, uint m01,
uint m10, uint m11,
uint m20, uint m21)
{
return new uint3x2(m00, m01,
m10, m11,
m20, m21);
}
/// <summary>Returns a uint3x2 matrix constructed from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 uint3x2(uint v) { return new uint3x2(v); }
/// <summary>Returns a uint3x2 matrix constructed from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 uint3x2(bool v) { return new uint3x2(v); }
/// <summary>Return a uint3x2 matrix constructed from a bool3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 uint3x2(bool3x2 v) { return new uint3x2(v); }
/// <summary>Returns a uint3x2 matrix constructed from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 uint3x2(int v) { return new uint3x2(v); }
/// <summary>Return a uint3x2 matrix constructed from a int3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 uint3x2(int3x2 v) { return new uint3x2(v); }
/// <summary>Returns a uint3x2 matrix constructed from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 uint3x2(float v) { return new uint3x2(v); }
/// <summary>Return a uint3x2 matrix constructed from a float3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 uint3x2(float3x2 v) { return new uint3x2(v); }
/// <summary>Returns a uint3x2 matrix constructed from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 uint3x2(double v) { return new uint3x2(v); }
/// <summary>Return a uint3x2 matrix constructed from a double3x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x2 uint3x2(double3x2 v) { return new uint3x2(v); }
/// <summary>Return the uint2x3 transpose of a uint3x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x3 transpose(uint3x2 v)
{
return uint2x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z);
}
/// <summary>Returns a uint hash code of a uint3x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(uint3x2 v)
{
return csum(v.c0 * uint3(0x515D90F5u, 0xEC9F68F3u, 0xF9EA92D5u) +
v.c1 * uint3(0xC2FAFCB9u, 0x616E9CA1u, 0xC5C5394Bu)) + 0xCAE78587u;
}
/// <summary>
/// Returns a uint3 vector hash code of a uint3x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(uint3x2 v)
{
return (v.c0 * uint3(0x7A1541C9u, 0xF83BD927u, 0x6A243BCBu) +
v.c1 * uint3(0x509B84C9u, 0x91D13847u, 0x52F7230Fu)) + 0xCF286E83u;
}
}
}

View File

@@ -0,0 +1,512 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct uint3x3 : System.IEquatable<uint3x3>, IFormattable
{
public uint3 c0;
public uint3 c1;
public uint3 c2;
/// <summary>uint3x3 identity transform.</summary>
public static readonly uint3x3 identity = new uint3x3(1u, 0u, 0u, 0u, 1u, 0u, 0u, 0u, 1u);
/// <summary>uint3x3 zero value.</summary>
public static readonly uint3x3 zero;
/// <summary>Constructs a uint3x3 matrix from three uint3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x3(uint3 c0, uint3 c1, uint3 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a uint3x3 matrix from 9 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x3(uint m00, uint m01, uint m02,
uint m10, uint m11, uint m12,
uint m20, uint m21, uint m22)
{
this.c0 = new uint3(m00, m10, m20);
this.c1 = new uint3(m01, m11, m21);
this.c2 = new uint3(m02, m12, m22);
}
/// <summary>Constructs a uint3x3 matrix from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x3(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a uint3x3 matrix from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x3(bool v)
{
this.c0 = math.select(new uint3(0u), new uint3(1u), v);
this.c1 = math.select(new uint3(0u), new uint3(1u), v);
this.c2 = math.select(new uint3(0u), new uint3(1u), v);
}
/// <summary>Constructs a uint3x3 matrix from a bool3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x3(bool3x3 v)
{
this.c0 = math.select(new uint3(0u), new uint3(1u), v.c0);
this.c1 = math.select(new uint3(0u), new uint3(1u), v.c1);
this.c2 = math.select(new uint3(0u), new uint3(1u), v.c2);
}
/// <summary>Constructs a uint3x3 matrix from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x3(int v)
{
this.c0 = (uint3)v;
this.c1 = (uint3)v;
this.c2 = (uint3)v;
}
/// <summary>Constructs a uint3x3 matrix from a int3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x3(int3x3 v)
{
this.c0 = (uint3)v.c0;
this.c1 = (uint3)v.c1;
this.c2 = (uint3)v.c2;
}
/// <summary>Constructs a uint3x3 matrix from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x3(float v)
{
this.c0 = (uint3)v;
this.c1 = (uint3)v;
this.c2 = (uint3)v;
}
/// <summary>Constructs a uint3x3 matrix from a float3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x3(float3x3 v)
{
this.c0 = (uint3)v.c0;
this.c1 = (uint3)v.c1;
this.c2 = (uint3)v.c2;
}
/// <summary>Constructs a uint3x3 matrix from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x3(double v)
{
this.c0 = (uint3)v;
this.c1 = (uint3)v;
this.c2 = (uint3)v;
}
/// <summary>Constructs a uint3x3 matrix from a double3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x3(double3x3 v)
{
this.c0 = (uint3)v.c0;
this.c1 = (uint3)v.c1;
this.c2 = (uint3)v.c2;
}
/// <summary>Implicitly converts a single uint value to a uint3x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator uint3x3(uint v) { return new uint3x3(v); }
/// <summary>Explicitly converts a single bool value to a uint3x3 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x3(bool v) { return new uint3x3(v); }
/// <summary>Explicitly converts a bool3x3 matrix to a uint3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x3(bool3x3 v) { return new uint3x3(v); }
/// <summary>Explicitly converts a single int value to a uint3x3 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x3(int v) { return new uint3x3(v); }
/// <summary>Explicitly converts a int3x3 matrix to a uint3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x3(int3x3 v) { return new uint3x3(v); }
/// <summary>Explicitly converts a single float value to a uint3x3 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x3(float v) { return new uint3x3(v); }
/// <summary>Explicitly converts a float3x3 matrix to a uint3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x3(float3x3 v) { return new uint3x3(v); }
/// <summary>Explicitly converts a single double value to a uint3x3 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x3(double v) { return new uint3x3(v); }
/// <summary>Explicitly converts a double3x3 matrix to a uint3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x3(double3x3 v) { return new uint3x3(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two uint3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator * (uint3x3 lhs, uint3x3 rhs) { return new uint3x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint3x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator * (uint3x3 lhs, uint rhs) { return new uint3x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint value and a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator * (uint lhs, uint3x3 rhs) { return new uint3x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on two uint3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator + (uint3x3 lhs, uint3x3 rhs) { return new uint3x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on a uint3x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator + (uint3x3 lhs, uint rhs) { return new uint3x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a uint value and a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator + (uint lhs, uint3x3 rhs) { return new uint3x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on two uint3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator - (uint3x3 lhs, uint3x3 rhs) { return new uint3x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint3x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator - (uint3x3 lhs, uint rhs) { return new uint3x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint value and a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator - (uint lhs, uint3x3 rhs) { return new uint3x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on two uint3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator / (uint3x3 lhs, uint3x3 rhs) { return new uint3x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on a uint3x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator / (uint3x3 lhs, uint rhs) { return new uint3x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a uint value and a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator / (uint lhs, uint3x3 rhs) { return new uint3x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on two uint3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator % (uint3x3 lhs, uint3x3 rhs) { return new uint3x3 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on a uint3x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator % (uint3x3 lhs, uint rhs) { return new uint3x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a uint value and a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator % (uint lhs, uint3x3 rhs) { return new uint3x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); }
/// <summary>Returns the result of a componentwise increment operation on a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator ++ (uint3x3 val) { return new uint3x3 (++val.c0, ++val.c1, ++val.c2); }
/// <summary>Returns the result of a componentwise decrement operation on a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator -- (uint3x3 val) { return new uint3x3 (--val.c0, --val.c1, --val.c2); }
/// <summary>Returns the result of a componentwise less than operation on two uint3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator < (uint3x3 lhs, uint3x3 rhs) { return new bool3x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); }
/// <summary>Returns the result of a componentwise less than operation on a uint3x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator < (uint3x3 lhs, uint rhs) { return new bool3x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a uint value and a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator < (uint lhs, uint3x3 rhs) { return new bool3x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on two uint3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator <= (uint3x3 lhs, uint3x3 rhs) { return new bool3x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint3x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator <= (uint3x3 lhs, uint rhs) { return new bool3x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint value and a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator <= (uint lhs, uint3x3 rhs) { return new bool3x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on two uint3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator > (uint3x3 lhs, uint3x3 rhs) { return new bool3x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on a uint3x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator > (uint3x3 lhs, uint rhs) { return new bool3x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a uint value and a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator > (uint lhs, uint3x3 rhs) { return new bool3x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on two uint3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator >= (uint3x3 lhs, uint3x3 rhs) { return new bool3x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint3x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator >= (uint3x3 lhs, uint rhs) { return new bool3x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint value and a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator >= (uint lhs, uint3x3 rhs) { return new bool3x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); }
/// <summary>Returns the result of a componentwise unary minus operation on a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator - (uint3x3 val) { return new uint3x3 (-val.c0, -val.c1, -val.c2); }
/// <summary>Returns the result of a componentwise unary plus operation on a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator + (uint3x3 val) { return new uint3x3 (+val.c0, +val.c1, +val.c2); }
/// <summary>Returns the result of a componentwise left shift operation on a uint3x3 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator << (uint3x3 x, int n) { return new uint3x3 (x.c0 << n, x.c1 << n, x.c2 << n); }
/// <summary>Returns the result of a componentwise right shift operation on a uint3x3 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator >> (uint3x3 x, int n) { return new uint3x3 (x.c0 >> n, x.c1 >> n, x.c2 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two uint3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (uint3x3 lhs, uint3x3 rhs) { return new bool3x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on a uint3x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (uint3x3 lhs, uint rhs) { return new bool3x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a uint value and a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator == (uint lhs, uint3x3 rhs) { return new bool3x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two uint3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (uint3x3 lhs, uint3x3 rhs) { return new bool3x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on a uint3x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (uint3x3 lhs, uint rhs) { return new bool3x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a uint value and a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x3 operator != (uint lhs, uint3x3 rhs) { return new bool3x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise not operation on a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator ~ (uint3x3 val) { return new uint3x3 (~val.c0, ~val.c1, ~val.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on two uint3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator & (uint3x3 lhs, uint3x3 rhs) { return new uint3x3 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint3x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator & (uint3x3 lhs, uint rhs) { return new uint3x3 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint value and a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator & (uint lhs, uint3x3 rhs) { return new uint3x3 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on two uint3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator | (uint3x3 lhs, uint3x3 rhs) { return new uint3x3 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint3x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator | (uint3x3 lhs, uint rhs) { return new uint3x3 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint value and a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator | (uint lhs, uint3x3 rhs) { return new uint3x3 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two uint3x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator ^ (uint3x3 lhs, uint3x3 rhs) { return new uint3x3 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint3x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator ^ (uint3x3 lhs, uint rhs) { return new uint3x3 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 operator ^ (uint lhs, uint3x3 rhs) { return new uint3x3 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2); }
/// <summary>Returns the uint3 element at a specified index.</summary>
unsafe public ref uint3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (uint3x3* array = &this) { return ref ((uint3*)array)[index]; }
}
}
/// <summary>Returns true if the uint3x3 is equal to a given uint3x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(uint3x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the uint3x3 is equal to a given uint3x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((uint3x3)o); }
/// <summary>Returns a hash code for the uint3x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the uint3x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("uint3x3({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);
}
/// <summary>Returns a string representation of the uint3x3 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("uint3x3({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));
}
}
public static partial class math
{
/// <summary>Returns a uint3x3 matrix constructed from three uint3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 uint3x3(uint3 c0, uint3 c1, uint3 c2) { return new uint3x3(c0, c1, c2); }
/// <summary>Returns a uint3x3 matrix constructed from from 9 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 uint3x3(uint m00, uint m01, uint m02,
uint m10, uint m11, uint m12,
uint m20, uint m21, uint m22)
{
return new uint3x3(m00, m01, m02,
m10, m11, m12,
m20, m21, m22);
}
/// <summary>Returns a uint3x3 matrix constructed from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 uint3x3(uint v) { return new uint3x3(v); }
/// <summary>Returns a uint3x3 matrix constructed from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 uint3x3(bool v) { return new uint3x3(v); }
/// <summary>Return a uint3x3 matrix constructed from a bool3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 uint3x3(bool3x3 v) { return new uint3x3(v); }
/// <summary>Returns a uint3x3 matrix constructed from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 uint3x3(int v) { return new uint3x3(v); }
/// <summary>Return a uint3x3 matrix constructed from a int3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 uint3x3(int3x3 v) { return new uint3x3(v); }
/// <summary>Returns a uint3x3 matrix constructed from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 uint3x3(float v) { return new uint3x3(v); }
/// <summary>Return a uint3x3 matrix constructed from a float3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 uint3x3(float3x3 v) { return new uint3x3(v); }
/// <summary>Returns a uint3x3 matrix constructed from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 uint3x3(double v) { return new uint3x3(v); }
/// <summary>Return a uint3x3 matrix constructed from a double3x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 uint3x3(double3x3 v) { return new uint3x3(v); }
/// <summary>Return the uint3x3 transpose of a uint3x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x3 transpose(uint3x3 v)
{
return uint3x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z,
v.c2.x, v.c2.y, v.c2.z);
}
/// <summary>Returns a uint hash code of a uint3x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(uint3x3 v)
{
return csum(v.c0 * uint3(0xAC60D0C3u, 0x9263662Fu, 0xE69626FFu) +
v.c1 * uint3(0xBD010EEBu, 0x9CEDE1D1u, 0x43BE0B51u) +
v.c2 * uint3(0xAF836EE1u, 0xB130C137u, 0x54834775u)) + 0x7C022221u;
}
/// <summary>
/// Returns a uint3 vector hash code of a uint3x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(uint3x3 v)
{
return (v.c0 * uint3(0xA2D00EDFu, 0xA8977779u, 0x9F1C739Bu) +
v.c1 * uint3(0x4B1BD187u, 0x9DF50593u, 0xF18EEB85u) +
v.c2 * uint3(0x9E19BFC3u, 0x8196B06Fu, 0xD24EFA19u)) + 0x7D8048BBu;
}
}
}

View File

@@ -0,0 +1,524 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct uint3x4 : System.IEquatable<uint3x4>, IFormattable
{
public uint3 c0;
public uint3 c1;
public uint3 c2;
public uint3 c3;
/// <summary>uint3x4 zero value.</summary>
public static readonly uint3x4 zero;
/// <summary>Constructs a uint3x4 matrix from four uint3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x4(uint3 c0, uint3 c1, uint3 c2, uint3 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a uint3x4 matrix from 12 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x4(uint m00, uint m01, uint m02, uint m03,
uint m10, uint m11, uint m12, uint m13,
uint m20, uint m21, uint m22, uint m23)
{
this.c0 = new uint3(m00, m10, m20);
this.c1 = new uint3(m01, m11, m21);
this.c2 = new uint3(m02, m12, m22);
this.c3 = new uint3(m03, m13, m23);
}
/// <summary>Constructs a uint3x4 matrix from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x4(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a uint3x4 matrix from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x4(bool v)
{
this.c0 = math.select(new uint3(0u), new uint3(1u), v);
this.c1 = math.select(new uint3(0u), new uint3(1u), v);
this.c2 = math.select(new uint3(0u), new uint3(1u), v);
this.c3 = math.select(new uint3(0u), new uint3(1u), v);
}
/// <summary>Constructs a uint3x4 matrix from a bool3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x4(bool3x4 v)
{
this.c0 = math.select(new uint3(0u), new uint3(1u), v.c0);
this.c1 = math.select(new uint3(0u), new uint3(1u), v.c1);
this.c2 = math.select(new uint3(0u), new uint3(1u), v.c2);
this.c3 = math.select(new uint3(0u), new uint3(1u), v.c3);
}
/// <summary>Constructs a uint3x4 matrix from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x4(int v)
{
this.c0 = (uint3)v;
this.c1 = (uint3)v;
this.c2 = (uint3)v;
this.c3 = (uint3)v;
}
/// <summary>Constructs a uint3x4 matrix from a int3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x4(int3x4 v)
{
this.c0 = (uint3)v.c0;
this.c1 = (uint3)v.c1;
this.c2 = (uint3)v.c2;
this.c3 = (uint3)v.c3;
}
/// <summary>Constructs a uint3x4 matrix from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x4(float v)
{
this.c0 = (uint3)v;
this.c1 = (uint3)v;
this.c2 = (uint3)v;
this.c3 = (uint3)v;
}
/// <summary>Constructs a uint3x4 matrix from a float3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x4(float3x4 v)
{
this.c0 = (uint3)v.c0;
this.c1 = (uint3)v.c1;
this.c2 = (uint3)v.c2;
this.c3 = (uint3)v.c3;
}
/// <summary>Constructs a uint3x4 matrix from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x4(double v)
{
this.c0 = (uint3)v;
this.c1 = (uint3)v;
this.c2 = (uint3)v;
this.c3 = (uint3)v;
}
/// <summary>Constructs a uint3x4 matrix from a double3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint3x4(double3x4 v)
{
this.c0 = (uint3)v.c0;
this.c1 = (uint3)v.c1;
this.c2 = (uint3)v.c2;
this.c3 = (uint3)v.c3;
}
/// <summary>Implicitly converts a single uint value to a uint3x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator uint3x4(uint v) { return new uint3x4(v); }
/// <summary>Explicitly converts a single bool value to a uint3x4 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x4(bool v) { return new uint3x4(v); }
/// <summary>Explicitly converts a bool3x4 matrix to a uint3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x4(bool3x4 v) { return new uint3x4(v); }
/// <summary>Explicitly converts a single int value to a uint3x4 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x4(int v) { return new uint3x4(v); }
/// <summary>Explicitly converts a int3x4 matrix to a uint3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x4(int3x4 v) { return new uint3x4(v); }
/// <summary>Explicitly converts a single float value to a uint3x4 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x4(float v) { return new uint3x4(v); }
/// <summary>Explicitly converts a float3x4 matrix to a uint3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x4(float3x4 v) { return new uint3x4(v); }
/// <summary>Explicitly converts a single double value to a uint3x4 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x4(double v) { return new uint3x4(v); }
/// <summary>Explicitly converts a double3x4 matrix to a uint3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint3x4(double3x4 v) { return new uint3x4(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two uint3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator * (uint3x4 lhs, uint3x4 rhs) { return new uint3x4 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2, lhs.c3 * rhs.c3); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint3x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator * (uint3x4 lhs, uint rhs) { return new uint3x4 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs, lhs.c3 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint value and a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator * (uint lhs, uint3x4 rhs) { return new uint3x4 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2, lhs * rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on two uint3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator + (uint3x4 lhs, uint3x4 rhs) { return new uint3x4 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2, lhs.c3 + rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on a uint3x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator + (uint3x4 lhs, uint rhs) { return new uint3x4 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs, lhs.c3 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a uint value and a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator + (uint lhs, uint3x4 rhs) { return new uint3x4 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2, lhs + rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on two uint3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator - (uint3x4 lhs, uint3x4 rhs) { return new uint3x4 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2, lhs.c3 - rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint3x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator - (uint3x4 lhs, uint rhs) { return new uint3x4 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs, lhs.c3 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint value and a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator - (uint lhs, uint3x4 rhs) { return new uint3x4 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2, lhs - rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on two uint3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator / (uint3x4 lhs, uint3x4 rhs) { return new uint3x4 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2, lhs.c3 / rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on a uint3x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator / (uint3x4 lhs, uint rhs) { return new uint3x4 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs, lhs.c3 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a uint value and a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator / (uint lhs, uint3x4 rhs) { return new uint3x4 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2, lhs / rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on two uint3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator % (uint3x4 lhs, uint3x4 rhs) { return new uint3x4 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2, lhs.c3 % rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on a uint3x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator % (uint3x4 lhs, uint rhs) { return new uint3x4 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs, lhs.c3 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a uint value and a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator % (uint lhs, uint3x4 rhs) { return new uint3x4 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2, lhs % rhs.c3); }
/// <summary>Returns the result of a componentwise increment operation on a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator ++ (uint3x4 val) { return new uint3x4 (++val.c0, ++val.c1, ++val.c2, ++val.c3); }
/// <summary>Returns the result of a componentwise decrement operation on a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator -- (uint3x4 val) { return new uint3x4 (--val.c0, --val.c1, --val.c2, --val.c3); }
/// <summary>Returns the result of a componentwise less than operation on two uint3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator < (uint3x4 lhs, uint3x4 rhs) { return new bool3x4 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2, lhs.c3 < rhs.c3); }
/// <summary>Returns the result of a componentwise less than operation on a uint3x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator < (uint3x4 lhs, uint rhs) { return new bool3x4 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs, lhs.c3 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a uint value and a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator < (uint lhs, uint3x4 rhs) { return new bool3x4 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2, lhs < rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on two uint3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator <= (uint3x4 lhs, uint3x4 rhs) { return new bool3x4 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2, lhs.c3 <= rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint3x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator <= (uint3x4 lhs, uint rhs) { return new bool3x4 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs, lhs.c3 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint value and a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator <= (uint lhs, uint3x4 rhs) { return new bool3x4 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2, lhs <= rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on two uint3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator > (uint3x4 lhs, uint3x4 rhs) { return new bool3x4 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2, lhs.c3 > rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on a uint3x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator > (uint3x4 lhs, uint rhs) { return new bool3x4 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs, lhs.c3 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a uint value and a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator > (uint lhs, uint3x4 rhs) { return new bool3x4 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2, lhs > rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on two uint3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator >= (uint3x4 lhs, uint3x4 rhs) { return new bool3x4 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2, lhs.c3 >= rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint3x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator >= (uint3x4 lhs, uint rhs) { return new bool3x4 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs, lhs.c3 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint value and a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator >= (uint lhs, uint3x4 rhs) { return new bool3x4 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2, lhs >= rhs.c3); }
/// <summary>Returns the result of a componentwise unary minus operation on a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator - (uint3x4 val) { return new uint3x4 (-val.c0, -val.c1, -val.c2, -val.c3); }
/// <summary>Returns the result of a componentwise unary plus operation on a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator + (uint3x4 val) { return new uint3x4 (+val.c0, +val.c1, +val.c2, +val.c3); }
/// <summary>Returns the result of a componentwise left shift operation on a uint3x4 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator << (uint3x4 x, int n) { return new uint3x4 (x.c0 << n, x.c1 << n, x.c2 << n, x.c3 << n); }
/// <summary>Returns the result of a componentwise right shift operation on a uint3x4 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator >> (uint3x4 x, int n) { return new uint3x4 (x.c0 >> n, x.c1 >> n, x.c2 >> n, x.c3 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two uint3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (uint3x4 lhs, uint3x4 rhs) { return new bool3x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on a uint3x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (uint3x4 lhs, uint rhs) { return new bool3x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a uint value and a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator == (uint lhs, uint3x4 rhs) { return new bool3x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two uint3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (uint3x4 lhs, uint3x4 rhs) { return new bool3x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on a uint3x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (uint3x4 lhs, uint rhs) { return new bool3x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a uint value and a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool3x4 operator != (uint lhs, uint3x4 rhs) { return new bool3x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise not operation on a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator ~ (uint3x4 val) { return new uint3x4 (~val.c0, ~val.c1, ~val.c2, ~val.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on two uint3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator & (uint3x4 lhs, uint3x4 rhs) { return new uint3x4 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2, lhs.c3 & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint3x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator & (uint3x4 lhs, uint rhs) { return new uint3x4 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs, lhs.c3 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint value and a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator & (uint lhs, uint3x4 rhs) { return new uint3x4 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2, lhs & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on two uint3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator | (uint3x4 lhs, uint3x4 rhs) { return new uint3x4 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2, lhs.c3 | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint3x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator | (uint3x4 lhs, uint rhs) { return new uint3x4 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs, lhs.c3 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint value and a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator | (uint lhs, uint3x4 rhs) { return new uint3x4 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2, lhs | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two uint3x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator ^ (uint3x4 lhs, uint3x4 rhs) { return new uint3x4 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2, lhs.c3 ^ rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint3x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator ^ (uint3x4 lhs, uint rhs) { return new uint3x4 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs, lhs.c3 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 operator ^ (uint lhs, uint3x4 rhs) { return new uint3x4 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2, lhs ^ rhs.c3); }
/// <summary>Returns the uint3 element at a specified index.</summary>
unsafe public ref uint3 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (uint3x4* array = &this) { return ref ((uint3*)array)[index]; }
}
}
/// <summary>Returns true if the uint3x4 is equal to a given uint3x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(uint3x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the uint3x4 is equal to a given uint3x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((uint3x4)o); }
/// <summary>Returns a hash code for the uint3x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the uint3x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("uint3x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y, c0.z, c1.z, c2.z, c3.z);
}
/// <summary>Returns a string representation of the uint3x4 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("uint3x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c3.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider), c3.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider), c2.z.ToString(format, formatProvider), c3.z.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a uint3x4 matrix constructed from four uint3 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 uint3x4(uint3 c0, uint3 c1, uint3 c2, uint3 c3) { return new uint3x4(c0, c1, c2, c3); }
/// <summary>Returns a uint3x4 matrix constructed from from 12 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 uint3x4(uint m00, uint m01, uint m02, uint m03,
uint m10, uint m11, uint m12, uint m13,
uint m20, uint m21, uint m22, uint m23)
{
return new uint3x4(m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23);
}
/// <summary>Returns a uint3x4 matrix constructed from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 uint3x4(uint v) { return new uint3x4(v); }
/// <summary>Returns a uint3x4 matrix constructed from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 uint3x4(bool v) { return new uint3x4(v); }
/// <summary>Return a uint3x4 matrix constructed from a bool3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 uint3x4(bool3x4 v) { return new uint3x4(v); }
/// <summary>Returns a uint3x4 matrix constructed from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 uint3x4(int v) { return new uint3x4(v); }
/// <summary>Return a uint3x4 matrix constructed from a int3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 uint3x4(int3x4 v) { return new uint3x4(v); }
/// <summary>Returns a uint3x4 matrix constructed from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 uint3x4(float v) { return new uint3x4(v); }
/// <summary>Return a uint3x4 matrix constructed from a float3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 uint3x4(float3x4 v) { return new uint3x4(v); }
/// <summary>Returns a uint3x4 matrix constructed from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 uint3x4(double v) { return new uint3x4(v); }
/// <summary>Return a uint3x4 matrix constructed from a double3x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 uint3x4(double3x4 v) { return new uint3x4(v); }
/// <summary>Return the uint4x3 transpose of a uint3x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 transpose(uint3x4 v)
{
return uint4x3(
v.c0.x, v.c0.y, v.c0.z,
v.c1.x, v.c1.y, v.c1.z,
v.c2.x, v.c2.y, v.c2.z,
v.c3.x, v.c3.y, v.c3.z);
}
/// <summary>Returns a uint hash code of a uint3x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(uint3x4 v)
{
return csum(v.c0 * uint3(0xD1224537u, 0xE99ED6F3u, 0x48125549u) +
v.c1 * uint3(0xEEE2123Bu, 0xE3AD9FE5u, 0xCE1CF8BFu) +
v.c2 * uint3(0x7BE39F3Bu, 0xFAB9913Fu, 0xB4501269u) +
v.c3 * uint3(0xE04B89FDu, 0xDB3DE101u, 0x7B6D1B4Bu)) + 0x58399E77u;
}
/// <summary>
/// Returns a uint3 vector hash code of a uint3x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3 hashwide(uint3x4 v)
{
return (v.c0 * uint3(0x5EAC29C9u, 0xFC6014F9u, 0x6BF6693Fu) +
v.c1 * uint3(0x9D1B1D9Bu, 0xF842F5C1u, 0xA47EC335u) +
v.c2 * uint3(0xA477DF57u, 0xC4B1493Fu, 0xBA0966D3u) +
v.c3 * uint3(0xAFBEE253u, 0x5B419C01u, 0x515D90F5u)) + 0xEC9F68F3u;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,497 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct uint4x2 : System.IEquatable<uint4x2>, IFormattable
{
public uint4 c0;
public uint4 c1;
/// <summary>uint4x2 zero value.</summary>
public static readonly uint4x2 zero;
/// <summary>Constructs a uint4x2 matrix from two uint4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x2(uint4 c0, uint4 c1)
{
this.c0 = c0;
this.c1 = c1;
}
/// <summary>Constructs a uint4x2 matrix from 8 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x2(uint m00, uint m01,
uint m10, uint m11,
uint m20, uint m21,
uint m30, uint m31)
{
this.c0 = new uint4(m00, m10, m20, m30);
this.c1 = new uint4(m01, m11, m21, m31);
}
/// <summary>Constructs a uint4x2 matrix from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x2(uint v)
{
this.c0 = v;
this.c1 = v;
}
/// <summary>Constructs a uint4x2 matrix from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x2(bool v)
{
this.c0 = math.select(new uint4(0u), new uint4(1u), v);
this.c1 = math.select(new uint4(0u), new uint4(1u), v);
}
/// <summary>Constructs a uint4x2 matrix from a bool4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x2(bool4x2 v)
{
this.c0 = math.select(new uint4(0u), new uint4(1u), v.c0);
this.c1 = math.select(new uint4(0u), new uint4(1u), v.c1);
}
/// <summary>Constructs a uint4x2 matrix from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x2(int v)
{
this.c0 = (uint4)v;
this.c1 = (uint4)v;
}
/// <summary>Constructs a uint4x2 matrix from a int4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x2(int4x2 v)
{
this.c0 = (uint4)v.c0;
this.c1 = (uint4)v.c1;
}
/// <summary>Constructs a uint4x2 matrix from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x2(float v)
{
this.c0 = (uint4)v;
this.c1 = (uint4)v;
}
/// <summary>Constructs a uint4x2 matrix from a float4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x2(float4x2 v)
{
this.c0 = (uint4)v.c0;
this.c1 = (uint4)v.c1;
}
/// <summary>Constructs a uint4x2 matrix from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x2(double v)
{
this.c0 = (uint4)v;
this.c1 = (uint4)v;
}
/// <summary>Constructs a uint4x2 matrix from a double4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x2(double4x2 v)
{
this.c0 = (uint4)v.c0;
this.c1 = (uint4)v.c1;
}
/// <summary>Implicitly converts a single uint value to a uint4x2 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator uint4x2(uint v) { return new uint4x2(v); }
/// <summary>Explicitly converts a single bool value to a uint4x2 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x2(bool v) { return new uint4x2(v); }
/// <summary>Explicitly converts a bool4x2 matrix to a uint4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x2(bool4x2 v) { return new uint4x2(v); }
/// <summary>Explicitly converts a single int value to a uint4x2 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x2(int v) { return new uint4x2(v); }
/// <summary>Explicitly converts a int4x2 matrix to a uint4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x2(int4x2 v) { return new uint4x2(v); }
/// <summary>Explicitly converts a single float value to a uint4x2 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x2(float v) { return new uint4x2(v); }
/// <summary>Explicitly converts a float4x2 matrix to a uint4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x2(float4x2 v) { return new uint4x2(v); }
/// <summary>Explicitly converts a single double value to a uint4x2 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x2(double v) { return new uint4x2(v); }
/// <summary>Explicitly converts a double4x2 matrix to a uint4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x2(double4x2 v) { return new uint4x2(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two uint4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator * (uint4x2 lhs, uint4x2 rhs) { return new uint4x2 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint4x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator * (uint4x2 lhs, uint rhs) { return new uint4x2 (lhs.c0 * rhs, lhs.c1 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint value and a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator * (uint lhs, uint4x2 rhs) { return new uint4x2 (lhs * rhs.c0, lhs * rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on two uint4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator + (uint4x2 lhs, uint4x2 rhs) { return new uint4x2 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1); }
/// <summary>Returns the result of a componentwise addition operation on a uint4x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator + (uint4x2 lhs, uint rhs) { return new uint4x2 (lhs.c0 + rhs, lhs.c1 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a uint value and a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator + (uint lhs, uint4x2 rhs) { return new uint4x2 (lhs + rhs.c0, lhs + rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on two uint4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator - (uint4x2 lhs, uint4x2 rhs) { return new uint4x2 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint4x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator - (uint4x2 lhs, uint rhs) { return new uint4x2 (lhs.c0 - rhs, lhs.c1 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint value and a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator - (uint lhs, uint4x2 rhs) { return new uint4x2 (lhs - rhs.c0, lhs - rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on two uint4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator / (uint4x2 lhs, uint4x2 rhs) { return new uint4x2 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1); }
/// <summary>Returns the result of a componentwise division operation on a uint4x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator / (uint4x2 lhs, uint rhs) { return new uint4x2 (lhs.c0 / rhs, lhs.c1 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a uint value and a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator / (uint lhs, uint4x2 rhs) { return new uint4x2 (lhs / rhs.c0, lhs / rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on two uint4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator % (uint4x2 lhs, uint4x2 rhs) { return new uint4x2 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1); }
/// <summary>Returns the result of a componentwise modulus operation on a uint4x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator % (uint4x2 lhs, uint rhs) { return new uint4x2 (lhs.c0 % rhs, lhs.c1 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a uint value and a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator % (uint lhs, uint4x2 rhs) { return new uint4x2 (lhs % rhs.c0, lhs % rhs.c1); }
/// <summary>Returns the result of a componentwise increment operation on a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator ++ (uint4x2 val) { return new uint4x2 (++val.c0, ++val.c1); }
/// <summary>Returns the result of a componentwise decrement operation on a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator -- (uint4x2 val) { return new uint4x2 (--val.c0, --val.c1); }
/// <summary>Returns the result of a componentwise less than operation on two uint4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator < (uint4x2 lhs, uint4x2 rhs) { return new bool4x2 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1); }
/// <summary>Returns the result of a componentwise less than operation on a uint4x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator < (uint4x2 lhs, uint rhs) { return new bool4x2 (lhs.c0 < rhs, lhs.c1 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a uint value and a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator < (uint lhs, uint4x2 rhs) { return new bool4x2 (lhs < rhs.c0, lhs < rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on two uint4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator <= (uint4x2 lhs, uint4x2 rhs) { return new bool4x2 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint4x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator <= (uint4x2 lhs, uint rhs) { return new bool4x2 (lhs.c0 <= rhs, lhs.c1 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint value and a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator <= (uint lhs, uint4x2 rhs) { return new bool4x2 (lhs <= rhs.c0, lhs <= rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on two uint4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator > (uint4x2 lhs, uint4x2 rhs) { return new bool4x2 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1); }
/// <summary>Returns the result of a componentwise greater than operation on a uint4x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator > (uint4x2 lhs, uint rhs) { return new bool4x2 (lhs.c0 > rhs, lhs.c1 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a uint value and a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator > (uint lhs, uint4x2 rhs) { return new bool4x2 (lhs > rhs.c0, lhs > rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on two uint4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator >= (uint4x2 lhs, uint4x2 rhs) { return new bool4x2 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint4x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator >= (uint4x2 lhs, uint rhs) { return new bool4x2 (lhs.c0 >= rhs, lhs.c1 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint value and a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator >= (uint lhs, uint4x2 rhs) { return new bool4x2 (lhs >= rhs.c0, lhs >= rhs.c1); }
/// <summary>Returns the result of a componentwise unary minus operation on a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator - (uint4x2 val) { return new uint4x2 (-val.c0, -val.c1); }
/// <summary>Returns the result of a componentwise unary plus operation on a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator + (uint4x2 val) { return new uint4x2 (+val.c0, +val.c1); }
/// <summary>Returns the result of a componentwise left shift operation on a uint4x2 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator << (uint4x2 x, int n) { return new uint4x2 (x.c0 << n, x.c1 << n); }
/// <summary>Returns the result of a componentwise right shift operation on a uint4x2 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator >> (uint4x2 x, int n) { return new uint4x2 (x.c0 >> n, x.c1 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two uint4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (uint4x2 lhs, uint4x2 rhs) { return new bool4x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
/// <summary>Returns the result of a componentwise equality operation on a uint4x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (uint4x2 lhs, uint rhs) { return new bool4x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a uint value and a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator == (uint lhs, uint4x2 rhs) { return new bool4x2 (lhs == rhs.c0, lhs == rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on two uint4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (uint4x2 lhs, uint4x2 rhs) { return new bool4x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
/// <summary>Returns the result of a componentwise not equal operation on a uint4x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (uint4x2 lhs, uint rhs) { return new bool4x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a uint value and a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x2 operator != (uint lhs, uint4x2 rhs) { return new bool4x2 (lhs != rhs.c0, lhs != rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise not operation on a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator ~ (uint4x2 val) { return new uint4x2 (~val.c0, ~val.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on two uint4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator & (uint4x2 lhs, uint4x2 rhs) { return new uint4x2 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint4x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator & (uint4x2 lhs, uint rhs) { return new uint4x2 (lhs.c0 & rhs, lhs.c1 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint value and a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator & (uint lhs, uint4x2 rhs) { return new uint4x2 (lhs & rhs.c0, lhs & rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on two uint4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator | (uint4x2 lhs, uint4x2 rhs) { return new uint4x2 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint4x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator | (uint4x2 lhs, uint rhs) { return new uint4x2 (lhs.c0 | rhs, lhs.c1 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint value and a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator | (uint lhs, uint4x2 rhs) { return new uint4x2 (lhs | rhs.c0, lhs | rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two uint4x2 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator ^ (uint4x2 lhs, uint4x2 rhs) { return new uint4x2 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint4x2 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator ^ (uint4x2 lhs, uint rhs) { return new uint4x2 (lhs.c0 ^ rhs, lhs.c1 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 operator ^ (uint lhs, uint4x2 rhs) { return new uint4x2 (lhs ^ rhs.c0, lhs ^ rhs.c1); }
/// <summary>Returns the uint4 element at a specified index.</summary>
unsafe public ref uint4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 2)
throw new System.ArgumentException("index must be between[0...1]");
#endif
fixed (uint4x2* array = &this) { return ref ((uint4*)array)[index]; }
}
}
/// <summary>Returns true if the uint4x2 is equal to a given uint4x2, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(uint4x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
/// <summary>Returns true if the uint4x2 is equal to a given uint4x2, false otherwise.</summary>
public override bool Equals(object o) { return Equals((uint4x2)o); }
/// <summary>Returns a hash code for the uint4x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the uint4x2.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("uint4x2({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x, c1.x, c0.y, c1.y, c0.z, c1.z, c0.w, c1.w);
}
/// <summary>Returns a string representation of the uint4x2 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("uint4x2({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider), c0.w.ToString(format, formatProvider), c1.w.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a uint4x2 matrix constructed from two uint4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 uint4x2(uint4 c0, uint4 c1) { return new uint4x2(c0, c1); }
/// <summary>Returns a uint4x2 matrix constructed from from 8 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 uint4x2(uint m00, uint m01,
uint m10, uint m11,
uint m20, uint m21,
uint m30, uint m31)
{
return new uint4x2(m00, m01,
m10, m11,
m20, m21,
m30, m31);
}
/// <summary>Returns a uint4x2 matrix constructed from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 uint4x2(uint v) { return new uint4x2(v); }
/// <summary>Returns a uint4x2 matrix constructed from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 uint4x2(bool v) { return new uint4x2(v); }
/// <summary>Return a uint4x2 matrix constructed from a bool4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 uint4x2(bool4x2 v) { return new uint4x2(v); }
/// <summary>Returns a uint4x2 matrix constructed from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 uint4x2(int v) { return new uint4x2(v); }
/// <summary>Return a uint4x2 matrix constructed from a int4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 uint4x2(int4x2 v) { return new uint4x2(v); }
/// <summary>Returns a uint4x2 matrix constructed from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 uint4x2(float v) { return new uint4x2(v); }
/// <summary>Return a uint4x2 matrix constructed from a float4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 uint4x2(float4x2 v) { return new uint4x2(v); }
/// <summary>Returns a uint4x2 matrix constructed from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 uint4x2(double v) { return new uint4x2(v); }
/// <summary>Return a uint4x2 matrix constructed from a double4x2 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x2 uint4x2(double4x2 v) { return new uint4x2(v); }
/// <summary>Return the uint2x4 transpose of a uint4x2 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint2x4 transpose(uint4x2 v)
{
return uint2x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w);
}
/// <summary>Returns a uint hash code of a uint4x2 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(uint4x2 v)
{
return csum(v.c0 * uint4(0xFA3A3285u, 0xAD55999Du, 0xDCDD5341u, 0x94DDD769u) +
v.c1 * uint4(0xA1E92D39u, 0x4583C801u, 0x9536A0F5u, 0xAF816615u)) + 0x9AF8D62Du;
}
/// <summary>
/// Returns a uint4 vector hash code of a uint4x2 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(uint4x2 v)
{
return (v.c0 * uint4(0xE3600729u, 0x5F17300Du, 0x670D6809u, 0x7AF32C49u) +
v.c1 * uint4(0xAE131389u, 0x5D1B165Bu, 0x87096CD7u, 0x4C7F6DD1u)) + 0x4822A3E9u;
}
}
}

View File

@@ -0,0 +1,512 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct uint4x3 : System.IEquatable<uint4x3>, IFormattable
{
public uint4 c0;
public uint4 c1;
public uint4 c2;
/// <summary>uint4x3 zero value.</summary>
public static readonly uint4x3 zero;
/// <summary>Constructs a uint4x3 matrix from three uint4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x3(uint4 c0, uint4 c1, uint4 c2)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
}
/// <summary>Constructs a uint4x3 matrix from 12 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x3(uint m00, uint m01, uint m02,
uint m10, uint m11, uint m12,
uint m20, uint m21, uint m22,
uint m30, uint m31, uint m32)
{
this.c0 = new uint4(m00, m10, m20, m30);
this.c1 = new uint4(m01, m11, m21, m31);
this.c2 = new uint4(m02, m12, m22, m32);
}
/// <summary>Constructs a uint4x3 matrix from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x3(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
}
/// <summary>Constructs a uint4x3 matrix from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x3(bool v)
{
this.c0 = math.select(new uint4(0u), new uint4(1u), v);
this.c1 = math.select(new uint4(0u), new uint4(1u), v);
this.c2 = math.select(new uint4(0u), new uint4(1u), v);
}
/// <summary>Constructs a uint4x3 matrix from a bool4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x3(bool4x3 v)
{
this.c0 = math.select(new uint4(0u), new uint4(1u), v.c0);
this.c1 = math.select(new uint4(0u), new uint4(1u), v.c1);
this.c2 = math.select(new uint4(0u), new uint4(1u), v.c2);
}
/// <summary>Constructs a uint4x3 matrix from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x3(int v)
{
this.c0 = (uint4)v;
this.c1 = (uint4)v;
this.c2 = (uint4)v;
}
/// <summary>Constructs a uint4x3 matrix from a int4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x3(int4x3 v)
{
this.c0 = (uint4)v.c0;
this.c1 = (uint4)v.c1;
this.c2 = (uint4)v.c2;
}
/// <summary>Constructs a uint4x3 matrix from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x3(float v)
{
this.c0 = (uint4)v;
this.c1 = (uint4)v;
this.c2 = (uint4)v;
}
/// <summary>Constructs a uint4x3 matrix from a float4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x3(float4x3 v)
{
this.c0 = (uint4)v.c0;
this.c1 = (uint4)v.c1;
this.c2 = (uint4)v.c2;
}
/// <summary>Constructs a uint4x3 matrix from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x3(double v)
{
this.c0 = (uint4)v;
this.c1 = (uint4)v;
this.c2 = (uint4)v;
}
/// <summary>Constructs a uint4x3 matrix from a double4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x3(double4x3 v)
{
this.c0 = (uint4)v.c0;
this.c1 = (uint4)v.c1;
this.c2 = (uint4)v.c2;
}
/// <summary>Implicitly converts a single uint value to a uint4x3 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator uint4x3(uint v) { return new uint4x3(v); }
/// <summary>Explicitly converts a single bool value to a uint4x3 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x3(bool v) { return new uint4x3(v); }
/// <summary>Explicitly converts a bool4x3 matrix to a uint4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x3(bool4x3 v) { return new uint4x3(v); }
/// <summary>Explicitly converts a single int value to a uint4x3 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x3(int v) { return new uint4x3(v); }
/// <summary>Explicitly converts a int4x3 matrix to a uint4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x3(int4x3 v) { return new uint4x3(v); }
/// <summary>Explicitly converts a single float value to a uint4x3 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x3(float v) { return new uint4x3(v); }
/// <summary>Explicitly converts a float4x3 matrix to a uint4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x3(float4x3 v) { return new uint4x3(v); }
/// <summary>Explicitly converts a single double value to a uint4x3 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x3(double v) { return new uint4x3(v); }
/// <summary>Explicitly converts a double4x3 matrix to a uint4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x3(double4x3 v) { return new uint4x3(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two uint4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator * (uint4x3 lhs, uint4x3 rhs) { return new uint4x3 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint4x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator * (uint4x3 lhs, uint rhs) { return new uint4x3 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint value and a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator * (uint lhs, uint4x3 rhs) { return new uint4x3 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on two uint4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator + (uint4x3 lhs, uint4x3 rhs) { return new uint4x3 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2); }
/// <summary>Returns the result of a componentwise addition operation on a uint4x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator + (uint4x3 lhs, uint rhs) { return new uint4x3 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a uint value and a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator + (uint lhs, uint4x3 rhs) { return new uint4x3 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on two uint4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator - (uint4x3 lhs, uint4x3 rhs) { return new uint4x3 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint4x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator - (uint4x3 lhs, uint rhs) { return new uint4x3 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint value and a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator - (uint lhs, uint4x3 rhs) { return new uint4x3 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on two uint4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator / (uint4x3 lhs, uint4x3 rhs) { return new uint4x3 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2); }
/// <summary>Returns the result of a componentwise division operation on a uint4x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator / (uint4x3 lhs, uint rhs) { return new uint4x3 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a uint value and a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator / (uint lhs, uint4x3 rhs) { return new uint4x3 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on two uint4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator % (uint4x3 lhs, uint4x3 rhs) { return new uint4x3 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2); }
/// <summary>Returns the result of a componentwise modulus operation on a uint4x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator % (uint4x3 lhs, uint rhs) { return new uint4x3 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a uint value and a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator % (uint lhs, uint4x3 rhs) { return new uint4x3 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2); }
/// <summary>Returns the result of a componentwise increment operation on a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator ++ (uint4x3 val) { return new uint4x3 (++val.c0, ++val.c1, ++val.c2); }
/// <summary>Returns the result of a componentwise decrement operation on a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator -- (uint4x3 val) { return new uint4x3 (--val.c0, --val.c1, --val.c2); }
/// <summary>Returns the result of a componentwise less than operation on two uint4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator < (uint4x3 lhs, uint4x3 rhs) { return new bool4x3 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2); }
/// <summary>Returns the result of a componentwise less than operation on a uint4x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator < (uint4x3 lhs, uint rhs) { return new bool4x3 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a uint value and a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator < (uint lhs, uint4x3 rhs) { return new bool4x3 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on two uint4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator <= (uint4x3 lhs, uint4x3 rhs) { return new bool4x3 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint4x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator <= (uint4x3 lhs, uint rhs) { return new bool4x3 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint value and a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator <= (uint lhs, uint4x3 rhs) { return new bool4x3 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on two uint4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator > (uint4x3 lhs, uint4x3 rhs) { return new bool4x3 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2); }
/// <summary>Returns the result of a componentwise greater than operation on a uint4x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator > (uint4x3 lhs, uint rhs) { return new bool4x3 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a uint value and a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator > (uint lhs, uint4x3 rhs) { return new bool4x3 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on two uint4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator >= (uint4x3 lhs, uint4x3 rhs) { return new bool4x3 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint4x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator >= (uint4x3 lhs, uint rhs) { return new bool4x3 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint value and a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator >= (uint lhs, uint4x3 rhs) { return new bool4x3 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2); }
/// <summary>Returns the result of a componentwise unary minus operation on a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator - (uint4x3 val) { return new uint4x3 (-val.c0, -val.c1, -val.c2); }
/// <summary>Returns the result of a componentwise unary plus operation on a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator + (uint4x3 val) { return new uint4x3 (+val.c0, +val.c1, +val.c2); }
/// <summary>Returns the result of a componentwise left shift operation on a uint4x3 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator << (uint4x3 x, int n) { return new uint4x3 (x.c0 << n, x.c1 << n, x.c2 << n); }
/// <summary>Returns the result of a componentwise right shift operation on a uint4x3 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator >> (uint4x3 x, int n) { return new uint4x3 (x.c0 >> n, x.c1 >> n, x.c2 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two uint4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (uint4x3 lhs, uint4x3 rhs) { return new bool4x3 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2); }
/// <summary>Returns the result of a componentwise equality operation on a uint4x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (uint4x3 lhs, uint rhs) { return new bool4x3 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a uint value and a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator == (uint lhs, uint4x3 rhs) { return new bool4x3 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on two uint4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (uint4x3 lhs, uint4x3 rhs) { return new bool4x3 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2); }
/// <summary>Returns the result of a componentwise not equal operation on a uint4x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (uint4x3 lhs, uint rhs) { return new bool4x3 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a uint value and a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x3 operator != (uint lhs, uint4x3 rhs) { return new bool4x3 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise not operation on a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator ~ (uint4x3 val) { return new uint4x3 (~val.c0, ~val.c1, ~val.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on two uint4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator & (uint4x3 lhs, uint4x3 rhs) { return new uint4x3 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint4x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator & (uint4x3 lhs, uint rhs) { return new uint4x3 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint value and a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator & (uint lhs, uint4x3 rhs) { return new uint4x3 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on two uint4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator | (uint4x3 lhs, uint4x3 rhs) { return new uint4x3 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint4x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator | (uint4x3 lhs, uint rhs) { return new uint4x3 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint value and a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator | (uint lhs, uint4x3 rhs) { return new uint4x3 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two uint4x3 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator ^ (uint4x3 lhs, uint4x3 rhs) { return new uint4x3 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint4x3 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator ^ (uint4x3 lhs, uint rhs) { return new uint4x3 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 operator ^ (uint lhs, uint4x3 rhs) { return new uint4x3 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2); }
/// <summary>Returns the uint4 element at a specified index.</summary>
unsafe public ref uint4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 3)
throw new System.ArgumentException("index must be between[0...2]");
#endif
fixed (uint4x3* array = &this) { return ref ((uint4*)array)[index]; }
}
}
/// <summary>Returns true if the uint4x3 is equal to a given uint4x3, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(uint4x3 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2); }
/// <summary>Returns true if the uint4x3 is equal to a given uint4x3, false otherwise.</summary>
public override bool Equals(object o) { return Equals((uint4x3)o); }
/// <summary>Returns a hash code for the uint4x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the uint4x3.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("uint4x3({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", c0.x, c1.x, c2.x, c0.y, c1.y, c2.y, c0.z, c1.z, c2.z, c0.w, c1.w, c2.w);
}
/// <summary>Returns a string representation of the uint4x3 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("uint4x3({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11})", 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), c0.w.ToString(format, formatProvider), c1.w.ToString(format, formatProvider), c2.w.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a uint4x3 matrix constructed from three uint4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 uint4x3(uint4 c0, uint4 c1, uint4 c2) { return new uint4x3(c0, c1, c2); }
/// <summary>Returns a uint4x3 matrix constructed from from 12 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 uint4x3(uint m00, uint m01, uint m02,
uint m10, uint m11, uint m12,
uint m20, uint m21, uint m22,
uint m30, uint m31, uint m32)
{
return new uint4x3(m00, m01, m02,
m10, m11, m12,
m20, m21, m22,
m30, m31, m32);
}
/// <summary>Returns a uint4x3 matrix constructed from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 uint4x3(uint v) { return new uint4x3(v); }
/// <summary>Returns a uint4x3 matrix constructed from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 uint4x3(bool v) { return new uint4x3(v); }
/// <summary>Return a uint4x3 matrix constructed from a bool4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 uint4x3(bool4x3 v) { return new uint4x3(v); }
/// <summary>Returns a uint4x3 matrix constructed from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 uint4x3(int v) { return new uint4x3(v); }
/// <summary>Return a uint4x3 matrix constructed from a int4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 uint4x3(int4x3 v) { return new uint4x3(v); }
/// <summary>Returns a uint4x3 matrix constructed from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 uint4x3(float v) { return new uint4x3(v); }
/// <summary>Return a uint4x3 matrix constructed from a float4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 uint4x3(float4x3 v) { return new uint4x3(v); }
/// <summary>Returns a uint4x3 matrix constructed from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 uint4x3(double v) { return new uint4x3(v); }
/// <summary>Return a uint4x3 matrix constructed from a double4x3 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x3 uint4x3(double4x3 v) { return new uint4x3(v); }
/// <summary>Return the uint3x4 transpose of a uint4x3 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint3x4 transpose(uint4x3 v)
{
return uint3x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w,
v.c2.x, v.c2.y, v.c2.z, v.c2.w);
}
/// <summary>Returns a uint hash code of a uint4x3 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(uint4x3 v)
{
return csum(v.c0 * uint4(0xE7579997u, 0xEF7D56C7u, 0x66F38F0Bu, 0x624256A3u) +
v.c1 * uint4(0x5292ADE1u, 0xD2E590E5u, 0xF25BE857u, 0x9BC17CE7u) +
v.c2 * uint4(0xC8B86851u, 0x64095221u, 0xADF428FFu, 0xA3977109u)) + 0x745ED837u;
}
/// <summary>
/// Returns a uint4 vector hash code of a uint4x3 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(uint4x3 v)
{
return (v.c0 * uint4(0x9CDC88F5u, 0xFA62D721u, 0x7E4DB1CFu, 0x68EEE0F5u) +
v.c1 * uint4(0xBC3B0A59u, 0x816EFB5Du, 0xA24E82B7u, 0x45A22087u) +
v.c2 * uint4(0xFC104C3Bu, 0x5FFF6B19u, 0x5E6CBF3Bu, 0xB546F2A5u)) + 0xBBCF63E7u;
}
}
}

View File

@@ -0,0 +1,530 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.CompilerServices;
#pragma warning disable 0660, 0661
namespace Unity.Mathematics
{
[System.Serializable]
public partial struct uint4x4 : System.IEquatable<uint4x4>, IFormattable
{
public uint4 c0;
public uint4 c1;
public uint4 c2;
public uint4 c3;
/// <summary>uint4x4 identity transform.</summary>
public static readonly uint4x4 identity = new uint4x4(1u, 0u, 0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 1u);
/// <summary>uint4x4 zero value.</summary>
public static readonly uint4x4 zero;
/// <summary>Constructs a uint4x4 matrix from four uint4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x4(uint4 c0, uint4 c1, uint4 c2, uint4 c3)
{
this.c0 = c0;
this.c1 = c1;
this.c2 = c2;
this.c3 = c3;
}
/// <summary>Constructs a uint4x4 matrix from 16 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x4(uint m00, uint m01, uint m02, uint m03,
uint m10, uint m11, uint m12, uint m13,
uint m20, uint m21, uint m22, uint m23,
uint m30, uint m31, uint m32, uint m33)
{
this.c0 = new uint4(m00, m10, m20, m30);
this.c1 = new uint4(m01, m11, m21, m31);
this.c2 = new uint4(m02, m12, m22, m32);
this.c3 = new uint4(m03, m13, m23, m33);
}
/// <summary>Constructs a uint4x4 matrix from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x4(uint v)
{
this.c0 = v;
this.c1 = v;
this.c2 = v;
this.c3 = v;
}
/// <summary>Constructs a uint4x4 matrix from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x4(bool v)
{
this.c0 = math.select(new uint4(0u), new uint4(1u), v);
this.c1 = math.select(new uint4(0u), new uint4(1u), v);
this.c2 = math.select(new uint4(0u), new uint4(1u), v);
this.c3 = math.select(new uint4(0u), new uint4(1u), v);
}
/// <summary>Constructs a uint4x4 matrix from a bool4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x4(bool4x4 v)
{
this.c0 = math.select(new uint4(0u), new uint4(1u), v.c0);
this.c1 = math.select(new uint4(0u), new uint4(1u), v.c1);
this.c2 = math.select(new uint4(0u), new uint4(1u), v.c2);
this.c3 = math.select(new uint4(0u), new uint4(1u), v.c3);
}
/// <summary>Constructs a uint4x4 matrix from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x4(int v)
{
this.c0 = (uint4)v;
this.c1 = (uint4)v;
this.c2 = (uint4)v;
this.c3 = (uint4)v;
}
/// <summary>Constructs a uint4x4 matrix from a int4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x4(int4x4 v)
{
this.c0 = (uint4)v.c0;
this.c1 = (uint4)v.c1;
this.c2 = (uint4)v.c2;
this.c3 = (uint4)v.c3;
}
/// <summary>Constructs a uint4x4 matrix from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x4(float v)
{
this.c0 = (uint4)v;
this.c1 = (uint4)v;
this.c2 = (uint4)v;
this.c3 = (uint4)v;
}
/// <summary>Constructs a uint4x4 matrix from a float4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x4(float4x4 v)
{
this.c0 = (uint4)v.c0;
this.c1 = (uint4)v.c1;
this.c2 = (uint4)v.c2;
this.c3 = (uint4)v.c3;
}
/// <summary>Constructs a uint4x4 matrix from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x4(double v)
{
this.c0 = (uint4)v;
this.c1 = (uint4)v;
this.c2 = (uint4)v;
this.c3 = (uint4)v;
}
/// <summary>Constructs a uint4x4 matrix from a double4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint4x4(double4x4 v)
{
this.c0 = (uint4)v.c0;
this.c1 = (uint4)v.c1;
this.c2 = (uint4)v.c2;
this.c3 = (uint4)v.c3;
}
/// <summary>Implicitly converts a single uint value to a uint4x4 matrix by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator uint4x4(uint v) { return new uint4x4(v); }
/// <summary>Explicitly converts a single bool value to a uint4x4 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x4(bool v) { return new uint4x4(v); }
/// <summary>Explicitly converts a bool4x4 matrix to a uint4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x4(bool4x4 v) { return new uint4x4(v); }
/// <summary>Explicitly converts a single int value to a uint4x4 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x4(int v) { return new uint4x4(v); }
/// <summary>Explicitly converts a int4x4 matrix to a uint4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x4(int4x4 v) { return new uint4x4(v); }
/// <summary>Explicitly converts a single float value to a uint4x4 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x4(float v) { return new uint4x4(v); }
/// <summary>Explicitly converts a float4x4 matrix to a uint4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x4(float4x4 v) { return new uint4x4(v); }
/// <summary>Explicitly converts a single double value to a uint4x4 matrix by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x4(double v) { return new uint4x4(v); }
/// <summary>Explicitly converts a double4x4 matrix to a uint4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator uint4x4(double4x4 v) { return new uint4x4(v); }
/// <summary>Returns the result of a componentwise multiplication operation on two uint4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator * (uint4x4 lhs, uint4x4 rhs) { return new uint4x4 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1, lhs.c2 * rhs.c2, lhs.c3 * rhs.c3); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint4x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator * (uint4x4 lhs, uint rhs) { return new uint4x4 (lhs.c0 * rhs, lhs.c1 * rhs, lhs.c2 * rhs, lhs.c3 * rhs); }
/// <summary>Returns the result of a componentwise multiplication operation on a uint value and a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator * (uint lhs, uint4x4 rhs) { return new uint4x4 (lhs * rhs.c0, lhs * rhs.c1, lhs * rhs.c2, lhs * rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on two uint4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator + (uint4x4 lhs, uint4x4 rhs) { return new uint4x4 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1, lhs.c2 + rhs.c2, lhs.c3 + rhs.c3); }
/// <summary>Returns the result of a componentwise addition operation on a uint4x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator + (uint4x4 lhs, uint rhs) { return new uint4x4 (lhs.c0 + rhs, lhs.c1 + rhs, lhs.c2 + rhs, lhs.c3 + rhs); }
/// <summary>Returns the result of a componentwise addition operation on a uint value and a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator + (uint lhs, uint4x4 rhs) { return new uint4x4 (lhs + rhs.c0, lhs + rhs.c1, lhs + rhs.c2, lhs + rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on two uint4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator - (uint4x4 lhs, uint4x4 rhs) { return new uint4x4 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1, lhs.c2 - rhs.c2, lhs.c3 - rhs.c3); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint4x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator - (uint4x4 lhs, uint rhs) { return new uint4x4 (lhs.c0 - rhs, lhs.c1 - rhs, lhs.c2 - rhs, lhs.c3 - rhs); }
/// <summary>Returns the result of a componentwise subtraction operation on a uint value and a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator - (uint lhs, uint4x4 rhs) { return new uint4x4 (lhs - rhs.c0, lhs - rhs.c1, lhs - rhs.c2, lhs - rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on two uint4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator / (uint4x4 lhs, uint4x4 rhs) { return new uint4x4 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1, lhs.c2 / rhs.c2, lhs.c3 / rhs.c3); }
/// <summary>Returns the result of a componentwise division operation on a uint4x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator / (uint4x4 lhs, uint rhs) { return new uint4x4 (lhs.c0 / rhs, lhs.c1 / rhs, lhs.c2 / rhs, lhs.c3 / rhs); }
/// <summary>Returns the result of a componentwise division operation on a uint value and a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator / (uint lhs, uint4x4 rhs) { return new uint4x4 (lhs / rhs.c0, lhs / rhs.c1, lhs / rhs.c2, lhs / rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on two uint4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator % (uint4x4 lhs, uint4x4 rhs) { return new uint4x4 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1, lhs.c2 % rhs.c2, lhs.c3 % rhs.c3); }
/// <summary>Returns the result of a componentwise modulus operation on a uint4x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator % (uint4x4 lhs, uint rhs) { return new uint4x4 (lhs.c0 % rhs, lhs.c1 % rhs, lhs.c2 % rhs, lhs.c3 % rhs); }
/// <summary>Returns the result of a componentwise modulus operation on a uint value and a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator % (uint lhs, uint4x4 rhs) { return new uint4x4 (lhs % rhs.c0, lhs % rhs.c1, lhs % rhs.c2, lhs % rhs.c3); }
/// <summary>Returns the result of a componentwise increment operation on a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator ++ (uint4x4 val) { return new uint4x4 (++val.c0, ++val.c1, ++val.c2, ++val.c3); }
/// <summary>Returns the result of a componentwise decrement operation on a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator -- (uint4x4 val) { return new uint4x4 (--val.c0, --val.c1, --val.c2, --val.c3); }
/// <summary>Returns the result of a componentwise less than operation on two uint4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator < (uint4x4 lhs, uint4x4 rhs) { return new bool4x4 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1, lhs.c2 < rhs.c2, lhs.c3 < rhs.c3); }
/// <summary>Returns the result of a componentwise less than operation on a uint4x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator < (uint4x4 lhs, uint rhs) { return new bool4x4 (lhs.c0 < rhs, lhs.c1 < rhs, lhs.c2 < rhs, lhs.c3 < rhs); }
/// <summary>Returns the result of a componentwise less than operation on a uint value and a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator < (uint lhs, uint4x4 rhs) { return new bool4x4 (lhs < rhs.c0, lhs < rhs.c1, lhs < rhs.c2, lhs < rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on two uint4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator <= (uint4x4 lhs, uint4x4 rhs) { return new bool4x4 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1, lhs.c2 <= rhs.c2, lhs.c3 <= rhs.c3); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint4x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator <= (uint4x4 lhs, uint rhs) { return new bool4x4 (lhs.c0 <= rhs, lhs.c1 <= rhs, lhs.c2 <= rhs, lhs.c3 <= rhs); }
/// <summary>Returns the result of a componentwise less or equal operation on a uint value and a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator <= (uint lhs, uint4x4 rhs) { return new bool4x4 (lhs <= rhs.c0, lhs <= rhs.c1, lhs <= rhs.c2, lhs <= rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on two uint4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator > (uint4x4 lhs, uint4x4 rhs) { return new bool4x4 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1, lhs.c2 > rhs.c2, lhs.c3 > rhs.c3); }
/// <summary>Returns the result of a componentwise greater than operation on a uint4x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator > (uint4x4 lhs, uint rhs) { return new bool4x4 (lhs.c0 > rhs, lhs.c1 > rhs, lhs.c2 > rhs, lhs.c3 > rhs); }
/// <summary>Returns the result of a componentwise greater than operation on a uint value and a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator > (uint lhs, uint4x4 rhs) { return new bool4x4 (lhs > rhs.c0, lhs > rhs.c1, lhs > rhs.c2, lhs > rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on two uint4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator >= (uint4x4 lhs, uint4x4 rhs) { return new bool4x4 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1, lhs.c2 >= rhs.c2, lhs.c3 >= rhs.c3); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint4x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator >= (uint4x4 lhs, uint rhs) { return new bool4x4 (lhs.c0 >= rhs, lhs.c1 >= rhs, lhs.c2 >= rhs, lhs.c3 >= rhs); }
/// <summary>Returns the result of a componentwise greater or equal operation on a uint value and a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator >= (uint lhs, uint4x4 rhs) { return new bool4x4 (lhs >= rhs.c0, lhs >= rhs.c1, lhs >= rhs.c2, lhs >= rhs.c3); }
/// <summary>Returns the result of a componentwise unary minus operation on a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator - (uint4x4 val) { return new uint4x4 (-val.c0, -val.c1, -val.c2, -val.c3); }
/// <summary>Returns the result of a componentwise unary plus operation on a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator + (uint4x4 val) { return new uint4x4 (+val.c0, +val.c1, +val.c2, +val.c3); }
/// <summary>Returns the result of a componentwise left shift operation on a uint4x4 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator << (uint4x4 x, int n) { return new uint4x4 (x.c0 << n, x.c1 << n, x.c2 << n, x.c3 << n); }
/// <summary>Returns the result of a componentwise right shift operation on a uint4x4 matrix by a number of bits specified by a single int.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator >> (uint4x4 x, int n) { return new uint4x4 (x.c0 >> n, x.c1 >> n, x.c2 >> n, x.c3 >> n); }
/// <summary>Returns the result of a componentwise equality operation on two uint4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (uint4x4 lhs, uint4x4 rhs) { return new bool4x4 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1, lhs.c2 == rhs.c2, lhs.c3 == rhs.c3); }
/// <summary>Returns the result of a componentwise equality operation on a uint4x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (uint4x4 lhs, uint rhs) { return new bool4x4 (lhs.c0 == rhs, lhs.c1 == rhs, lhs.c2 == rhs, lhs.c3 == rhs); }
/// <summary>Returns the result of a componentwise equality operation on a uint value and a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator == (uint lhs, uint4x4 rhs) { return new bool4x4 (lhs == rhs.c0, lhs == rhs.c1, lhs == rhs.c2, lhs == rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on two uint4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (uint4x4 lhs, uint4x4 rhs) { return new bool4x4 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1, lhs.c2 != rhs.c2, lhs.c3 != rhs.c3); }
/// <summary>Returns the result of a componentwise not equal operation on a uint4x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (uint4x4 lhs, uint rhs) { return new bool4x4 (lhs.c0 != rhs, lhs.c1 != rhs, lhs.c2 != rhs, lhs.c3 != rhs); }
/// <summary>Returns the result of a componentwise not equal operation on a uint value and a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4x4 operator != (uint lhs, uint4x4 rhs) { return new bool4x4 (lhs != rhs.c0, lhs != rhs.c1, lhs != rhs.c2, lhs != rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise not operation on a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator ~ (uint4x4 val) { return new uint4x4 (~val.c0, ~val.c1, ~val.c2, ~val.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on two uint4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator & (uint4x4 lhs, uint4x4 rhs) { return new uint4x4 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1, lhs.c2 & rhs.c2, lhs.c3 & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint4x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator & (uint4x4 lhs, uint rhs) { return new uint4x4 (lhs.c0 & rhs, lhs.c1 & rhs, lhs.c2 & rhs, lhs.c3 & rhs); }
/// <summary>Returns the result of a componentwise bitwise and operation on a uint value and a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator & (uint lhs, uint4x4 rhs) { return new uint4x4 (lhs & rhs.c0, lhs & rhs.c1, lhs & rhs.c2, lhs & rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on two uint4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator | (uint4x4 lhs, uint4x4 rhs) { return new uint4x4 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1, lhs.c2 | rhs.c2, lhs.c3 | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint4x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator | (uint4x4 lhs, uint rhs) { return new uint4x4 (lhs.c0 | rhs, lhs.c1 | rhs, lhs.c2 | rhs, lhs.c3 | rhs); }
/// <summary>Returns the result of a componentwise bitwise or operation on a uint value and a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator | (uint lhs, uint4x4 rhs) { return new uint4x4 (lhs | rhs.c0, lhs | rhs.c1, lhs | rhs.c2, lhs | rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on two uint4x4 matrices.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator ^ (uint4x4 lhs, uint4x4 rhs) { return new uint4x4 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1, lhs.c2 ^ rhs.c2, lhs.c3 ^ rhs.c3); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint4x4 matrix and a uint value.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator ^ (uint4x4 lhs, uint rhs) { return new uint4x4 (lhs.c0 ^ rhs, lhs.c1 ^ rhs, lhs.c2 ^ rhs, lhs.c3 ^ rhs); }
/// <summary>Returns the result of a componentwise bitwise exclusive or operation on a uint value and a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 operator ^ (uint lhs, uint4x4 rhs) { return new uint4x4 (lhs ^ rhs.c0, lhs ^ rhs.c1, lhs ^ rhs.c2, lhs ^ rhs.c3); }
/// <summary>Returns the uint4 element at a specified index.</summary>
unsafe public ref uint4 this[int index]
{
get
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
if ((uint)index >= 4)
throw new System.ArgumentException("index must be between[0...3]");
#endif
fixed (uint4x4* array = &this) { return ref ((uint4*)array)[index]; }
}
}
/// <summary>Returns true if the uint4x4 is equal to a given uint4x4, false otherwise.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(uint4x4 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1) && c2.Equals(rhs.c2) && c3.Equals(rhs.c3); }
/// <summary>Returns true if the uint4x4 is equal to a given uint4x4, false otherwise.</summary>
public override bool Equals(object o) { return Equals((uint4x4)o); }
/// <summary>Returns a hash code for the uint4x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() { return (int)math.hash(this); }
/// <summary>Returns a string representation of the uint4x4.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString()
{
return string.Format("uint4x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15})", c0.x, c1.x, c2.x, c3.x, c0.y, c1.y, c2.y, c3.y, c0.z, c1.z, c2.z, c3.z, c0.w, c1.w, c2.w, c3.w);
}
/// <summary>Returns a string representation of the uint4x4 using a specified format and culture-specific format information.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ToString(string format, IFormatProvider formatProvider)
{
return string.Format("uint4x4({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c2.x.ToString(format, formatProvider), c3.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider), c2.y.ToString(format, formatProvider), c3.y.ToString(format, formatProvider), c0.z.ToString(format, formatProvider), c1.z.ToString(format, formatProvider), c2.z.ToString(format, formatProvider), c3.z.ToString(format, formatProvider), c0.w.ToString(format, formatProvider), c1.w.ToString(format, formatProvider), c2.w.ToString(format, formatProvider), c3.w.ToString(format, formatProvider));
}
}
public static partial class math
{
/// <summary>Returns a uint4x4 matrix constructed from four uint4 vectors.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 uint4x4(uint4 c0, uint4 c1, uint4 c2, uint4 c3) { return new uint4x4(c0, c1, c2, c3); }
/// <summary>Returns a uint4x4 matrix constructed from from 16 uint values given in row-major order.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 uint4x4(uint m00, uint m01, uint m02, uint m03,
uint m10, uint m11, uint m12, uint m13,
uint m20, uint m21, uint m22, uint m23,
uint m30, uint m31, uint m32, uint m33)
{
return new uint4x4(m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23,
m30, m31, m32, m33);
}
/// <summary>Returns a uint4x4 matrix constructed from a single uint value by assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 uint4x4(uint v) { return new uint4x4(v); }
/// <summary>Returns a uint4x4 matrix constructed from a single bool value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 uint4x4(bool v) { return new uint4x4(v); }
/// <summary>Return a uint4x4 matrix constructed from a bool4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 uint4x4(bool4x4 v) { return new uint4x4(v); }
/// <summary>Returns a uint4x4 matrix constructed from a single int value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 uint4x4(int v) { return new uint4x4(v); }
/// <summary>Return a uint4x4 matrix constructed from a int4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 uint4x4(int4x4 v) { return new uint4x4(v); }
/// <summary>Returns a uint4x4 matrix constructed from a single float value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 uint4x4(float v) { return new uint4x4(v); }
/// <summary>Return a uint4x4 matrix constructed from a float4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 uint4x4(float4x4 v) { return new uint4x4(v); }
/// <summary>Returns a uint4x4 matrix constructed from a single double value by converting it to uint and assigning it to every component.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 uint4x4(double v) { return new uint4x4(v); }
/// <summary>Return a uint4x4 matrix constructed from a double4x4 matrix by componentwise conversion.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 uint4x4(double4x4 v) { return new uint4x4(v); }
/// <summary>Return the uint4x4 transpose of a uint4x4 matrix.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4x4 transpose(uint4x4 v)
{
return uint4x4(
v.c0.x, v.c0.y, v.c0.z, v.c0.w,
v.c1.x, v.c1.y, v.c1.z, v.c1.w,
v.c2.x, v.c2.y, v.c2.z, v.c2.w,
v.c3.x, v.c3.y, v.c3.z, v.c3.w);
}
/// <summary>Returns a uint hash code of a uint4x4 vector.</summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint hash(uint4x4 v)
{
return csum(v.c0 * uint4(0x9C9F0823u, 0x5A9CA13Bu, 0xAFCDD5EFu, 0xA88D187Du) +
v.c1 * uint4(0xCF6EBA1Du, 0x9D88E5A1u, 0xEADF0775u, 0x747A9D7Bu) +
v.c2 * uint4(0x4111F799u, 0xB5F05AF1u, 0xFD80290Bu, 0x8B65ADB7u) +
v.c3 * uint4(0xDFF4F563u, 0x7069770Du, 0xD1224537u, 0xE99ED6F3u)) + 0x48125549u;
}
/// <summary>
/// Returns a uint4 vector hash code of a uint4x4 vector.
/// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
/// that are only reduced to a narrow uint hash at the very end instead of at every step.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint4 hashwide(uint4x4 v)
{
return (v.c0 * uint4(0xEEE2123Bu, 0xE3AD9FE5u, 0xCE1CF8BFu, 0x7BE39F3Bu) +
v.c1 * uint4(0xFAB9913Fu, 0xB4501269u, 0xE04B89FDu, 0xDB3DE101u) +
v.c2 * uint4(0x7B6D1B4Bu, 0x58399E77u, 0x5EAC29C9u, 0xFC6014F9u) +
v.c3 * uint4(0x6BF6693Fu, 0x9D1B1D9Bu, 0xF842F5C1u, 0xA47EC335u)) + 0xA477DF57u;
}
}
}