1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-23 00:38:47 +00:00

Add ctor overloads for Cuboid

This commit is contained in:
Oliver Booth 2022-06-01 19:42:30 +01:00
parent 165cdf16d0
commit 76eb59f6c5
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634

View File

@ -19,6 +19,38 @@ public readonly struct Cuboid : IEquatable<Cuboid>
/// <value>A cube with the size (1, 1, 1).</value>
public static readonly Cuboid Cube = new(0, 0, 0, 1, 1, 1);
/// <summary>
/// Initializes a new instance of the <see cref="Cuboid" /> struct.
/// </summary>
/// <param name="centerX">The center X coordinate.</param>
/// <param name="centerY">The center Y coordinate.</param>
/// <param name="centerZ">The center Z coordinate.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="depth">The depth.</param>
public Cuboid(float centerX, float centerY, float centerZ, float width, float height, float depth)
: this(centerX, centerY, centerZ, width, height, depth, 0, 0, 0)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Cuboid" /> struct.
/// </summary>
/// <param name="centerX">The center X coordinate.</param>
/// <param name="centerY">The center Y coordinate.</param>
/// <param name="centerZ">The center Z coordinate.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="depth">The depth.</param>
/// <param name="yaw">The yaw.</param>
/// <param name="pitch">The pitch.</param>
/// <param name="roll">The roll.</param>
public Cuboid(float centerX, float centerY, float centerZ, float width, float height, float depth, float yaw, float pitch,
float roll)
: this(new Vector3(centerX, centerY, centerZ), new Vector3(width, height, depth), new Vector3(pitch, yaw, roll))
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Cuboid" /> struct.
/// </summary>
@ -37,6 +69,17 @@ public readonly struct Cuboid : IEquatable<Cuboid>
LocalFrontBottomRight = new Vector3(halfExtents.X, -halfExtents.Y, -halfExtents.Z);
}
/// <summary>
/// Initializes a new instance of the <see cref="Cuboid" /> struct.
/// </summary>
/// <param name="center">The center point.</param>
/// <param name="size">The size.</param>
/// <param name="orientation">The orientation of the cuboid.</param>
public Cuboid(in Vector3 center, in Vector3 size, in Vector3 orientation)
: this(center, size, Quaternion.CreateFromYawPitchRoll(orientation.Y, orientation.X, orientation.Z))
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Cuboid" /> struct.
/// </summary>