docs: improved documentation no Shape2D
This commit is contained in:
parent
7f93d95f6b
commit
4b856420f9
@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Syntriax.Engine.Core.Abstract;
|
||||
|
||||
namespace Syntriax.Engine.Core;
|
||||
@ -9,7 +10,7 @@ namespace Syntriax.Engine.Core;
|
||||
/// </summary>
|
||||
/// <param name="vertices">The vertices of the shape.</param>
|
||||
/// <remarks>
|
||||
/// Initializes a new instance of the <see cref="Shape2D"/> struct with the specified vertices.
|
||||
/// Initializes a new instance of a <see cref="Shape2D"/> struct with the specified vertices.
|
||||
/// </remarks>
|
||||
[System.Diagnostics.DebuggerDisplay("Vertices Count: {Vertices.Count}")]
|
||||
public readonly struct Shape2D(List<Vector2D> vertices) : IEnumerable<Vector2D>
|
||||
@ -22,7 +23,7 @@ public readonly struct Shape2D(List<Vector2D> vertices) : IEnumerable<Vector2D>
|
||||
private readonly List<Vector2D> _verticesList = vertices;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the vertices of the shape.
|
||||
/// Gets the vertices of the <see cref="Shape2D"/>.
|
||||
/// </summary>
|
||||
public IReadOnlyList<Vector2D> Vertices => _verticesList;
|
||||
|
||||
@ -34,10 +35,10 @@ public readonly struct Shape2D(List<Vector2D> vertices) : IEnumerable<Vector2D>
|
||||
public Vector2D this[System.Index index] => Vertices[index];
|
||||
|
||||
/// <summary>
|
||||
/// Returns a copy of the current shape.
|
||||
/// Returns a copy of the current <see cref="Shape2D"/>.
|
||||
/// </summary>
|
||||
/// <param name="shape">The shape to copy.</param>
|
||||
/// <returns>A copy of the input shape.</returns>
|
||||
/// <param name="shape">The <see cref="Shape2D"/> to copy.</param>
|
||||
/// <returns>A copy of the input <see cref="Shape2D"/>.</returns>
|
||||
public static Shape2D CreateCopy(Shape2D shape) => new(new List<Vector2D>(shape.Vertices));
|
||||
|
||||
/// <summary>
|
||||
@ -69,10 +70,10 @@ public readonly struct Shape2D(List<Vector2D> vertices) : IEnumerable<Vector2D>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the super triangle that encloses the given shape.
|
||||
/// Gets the super triangle that encloses the given <see cref="Shape2D"/>.
|
||||
/// </summary>
|
||||
/// <param name="shape">The shape to enclose.</param>
|
||||
/// <returns>The super triangle that encloses the given shape.</returns>
|
||||
/// <param name="shape">The <see cref="Shape2D"/> to enclose.</param>
|
||||
/// <returns>The super triangle that encloses the given <see cref="Shape2D"/>.</returns>
|
||||
public static Triangle GetSuperTriangle(Shape2D shape)
|
||||
{
|
||||
float minX = float.MaxValue, minY = float.MaxValue;
|
||||
@ -100,9 +101,9 @@ public readonly struct Shape2D(List<Vector2D> vertices) : IEnumerable<Vector2D>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triangulates the given convex shape.
|
||||
/// Triangulates the given convex <see cref="Shape2D"/>.
|
||||
/// </summary>
|
||||
/// <param name="shape">The shape to triangulate.</param>
|
||||
/// <param name="shape">The <see cref="Shape2D"/> to triangulate.</param>
|
||||
/// <param name="triangles">The list to populate with triangles.</param>
|
||||
public static void TriangulateConvex(Shape2D shape, IList<Triangle> triangles)
|
||||
{
|
||||
@ -113,9 +114,9 @@ public readonly struct Shape2D(List<Vector2D> vertices) : IEnumerable<Vector2D>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triangulates the given convex shape.
|
||||
/// Triangulates the given convex <see cref="Shape2D"/>.
|
||||
/// </summary>
|
||||
/// <param name="shape">The shape to triangulate.</param>
|
||||
/// <param name="shape">The <see cref="Shape2D"/> to triangulate.</param>
|
||||
/// <returns>A list of <see cref="Triangle"/>s that makes up the given convex <see cref="Shape2D"/>.</returns>
|
||||
public static List<Triangle> TriangulateConvex(Shape2D shape)
|
||||
{
|
||||
@ -125,10 +126,10 @@ public readonly struct Shape2D(List<Vector2D> vertices) : IEnumerable<Vector2D>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the lines that form the edges of the shape.
|
||||
/// Gets the <see cref="Line2D"/>s that form the edges of the <see cref="Shape2D"/>.
|
||||
/// </summary>
|
||||
/// <param name="shape">The shape to get lines from.</param>
|
||||
/// <param name="lines">The list to populate with lines.</param>
|
||||
/// <param name="shape">The <see cref="Shape2D"/> to get <see cref="Line2D"/>s from.</param>
|
||||
/// <param name="lines">The list to populate with <see cref="Line2D"/>.</sparam>
|
||||
public static void GetLines(Shape2D shape, IList<Line2D> lines)
|
||||
{
|
||||
lines.Clear();
|
||||
@ -138,10 +139,10 @@ public readonly struct Shape2D(List<Vector2D> vertices) : IEnumerable<Vector2D>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of lines that form the edges of the shape.
|
||||
/// Gets a list of <see cref="Line2D"/>s that form the edges of the <see cref="Shape2D"/>.
|
||||
/// </summary>
|
||||
/// <param name="shape">The shape to get lines from.</param>
|
||||
/// <returns>A list of lines that form the edges of the shape.</returns>
|
||||
/// <param name="shape">The shape to get <see cref="Line2D"/>s from.</param>
|
||||
/// <returns>A list of <see cref="Line2D"/>s that form the edges of the <see cref="Shape2D"/>.</returns>
|
||||
public static List<Line2D> GetLines(Shape2D shape)
|
||||
{
|
||||
List<Line2D> lines = new(shape.Vertices.Count - 1);
|
||||
@ -150,7 +151,7 @@ public readonly struct Shape2D(List<Vector2D> vertices) : IEnumerable<Vector2D>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Projects the shape onto a vector.
|
||||
/// Projects the <see cref="Shape2D"/> onto a 1D plane.
|
||||
/// </summary>
|
||||
/// <param name="shape">The shape to project.</param>
|
||||
/// <param name="projectionVector">The vector to project onto.</param>
|
||||
@ -165,11 +166,11 @@ public readonly struct Shape2D(List<Vector2D> vertices) : IEnumerable<Vector2D>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Projects the shape onto a vector.
|
||||
/// Projects the <see cref="Shape2D"/> onto a vector.
|
||||
/// </summary>
|
||||
/// <param name="shape">The shape to project.</param>
|
||||
/// <param name="shape">The <see cref="Shape2D"/> to project.</param>
|
||||
/// <param name="projectionVector">The vector to project onto.</param>
|
||||
/// <returns>The projection of the shape onto the vector.</returns>
|
||||
/// <returns>The projection of the <see cref="Shape2D"/> onto the vector.</returns>
|
||||
public static Projection1D Project(Shape2D shape, Vector2D projectionVector)
|
||||
{
|
||||
float min = float.MaxValue;
|
||||
@ -186,11 +187,11 @@ public readonly struct Shape2D(List<Vector2D> vertices) : IEnumerable<Vector2D>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transforms the shape using the specified transform.
|
||||
/// Transforms the <see cref="Shape2D"/> using the specified <see cref="ITransform2D"/>.
|
||||
/// </summary>
|
||||
/// <param name="shape">The shape to transform.</param>
|
||||
/// <param name="transform">The transform to apply.</param>
|
||||
/// <returns>The transformed shape.</returns>
|
||||
/// <param name="shape">The <see cref="Shape2D"/> to transform.</param>
|
||||
/// <param name="transform">The <see cref="ITransform2D"/> to apply.</param>
|
||||
/// <returns>The transformed <see cref="Shape2D"/>.</returns>
|
||||
public static Shape2D TransformShape(Shape2D shape, ITransform2D transform)
|
||||
{
|
||||
List<Vector2D> vertices = new(shape.Vertices.Count);
|
||||
@ -203,11 +204,11 @@ public readonly struct Shape2D(List<Vector2D> vertices) : IEnumerable<Vector2D>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transforms the shape using the specified transform.
|
||||
/// Transforms the <see cref="Shape2D"/> using the specified <see cref="ITransform2D"/>.
|
||||
/// </summary>
|
||||
/// <param name="from">The shape to transform.</param>
|
||||
/// <param name="transform">The transform to apply.</param>
|
||||
/// <param name="to">The transformed shape.</param>
|
||||
/// <param name="from">The <see cref="Shape2D"/> to transform.</param>
|
||||
/// <param name="transform">The <see cref="ITransform2D"/> to apply.</param>
|
||||
/// <param name="to">The transformed <see cref="Shape2D"/>.</param>
|
||||
public static void TransformShape(Shape2D from, ITransform2D transform, ref Shape2D to)
|
||||
{
|
||||
to._verticesList.Clear();
|
||||
@ -218,12 +219,12 @@ public readonly struct Shape2D(List<Vector2D> vertices) : IEnumerable<Vector2D>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether two shapes are approximately equal.
|
||||
/// Determines whether two <see cref="Shape2D"/>s are approximately equal.
|
||||
/// </summary>
|
||||
/// <param name="left">The first shape to compare.</param>
|
||||
/// <param name="right">The second shape to compare.</param>
|
||||
/// <param name="left">The first <see cref="Shape2D"/> to compare.</param>
|
||||
/// <param name="right">The second <see cref="Shape2D"/> to compare.</param>
|
||||
/// <param name="epsilon">The epsilon range.</param>
|
||||
/// <returns><c>true</c> if the shapes are approximately equal; otherwise, <c>false</c>.</returns>
|
||||
/// <returns><c>true</c> if the <see cref="Shape2D"/>s are approximately equal; otherwise, <c>false</c>.</returns>
|
||||
public static bool ApproximatelyEquals(Shape2D left, Shape2D right, float epsilon = float.Epsilon)
|
||||
{
|
||||
if (left.Vertices.Count != right.Vertices.Count)
|
||||
|
Loading…
x
Reference in New Issue
Block a user