From 95ddba02308e3e62d10d952ee1be480b39a327e3 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Fri, 21 Mar 2025 23:01:47 +0300 Subject: [PATCH] docs: updated extension methods to inherit the original method's documentation --- Engine.Core/Primitives/AABB.cs | 8 +- Engine.Core/Primitives/Circle.cs | 25 ++-- Engine.Core/Primitives/Line2D.cs | 31 ++--- Engine.Core/Primitives/Line2DEquation.cs | 8 +- Engine.Core/Primitives/Projection1D.cs | 15 +-- Engine.Core/Primitives/Quaternion.cs | 105 +++------------ Engine.Core/Primitives/Shape2D.cs | 54 ++------ Engine.Core/Primitives/Triangle.cs | 8 ++ Engine.Core/Primitives/Vector2D.cs | 165 ++++------------------- Engine.Core/Primitives/Vector3D.cs | 160 +++------------------- 10 files changed, 108 insertions(+), 471 deletions(-) diff --git a/Engine.Core/Primitives/AABB.cs b/Engine.Core/Primitives/AABB.cs index 7e6e3c8..fad4569 100644 --- a/Engine.Core/Primitives/AABB.cs +++ b/Engine.Core/Primitives/AABB.cs @@ -74,6 +74,7 @@ public readonly struct AABB(Vector2D lowerBoundary, Vector2D upperBoundary) /// /// The first . /// The second . + /// The epsilon range. /// if the s are approximately equal; otherwise, . public static bool ApproximatelyEquals(AABB left, AABB right, float epsilon = float.Epsilon) => left.LowerBoundary.ApproximatelyEquals(right.LowerBoundary, epsilon) && left.UpperBoundary.ApproximatelyEquals(right.UpperBoundary, epsilon); @@ -84,12 +85,9 @@ public readonly struct AABB(Vector2D lowerBoundary, Vector2D upperBoundary) /// public static class AABBExtensions { - /// - /// Converts a collection of s to an . - /// - /// The collection of s. - /// An that bounds all the s. + /// public static AABB ToAABB(this IEnumerable vectors) => AABB.FromVectors(vectors); + /// public static bool ApproximatelyEquals(this AABB left, AABB right, float epsilon = float.Epsilon) => AABB.ApproximatelyEquals(left, right, epsilon); } diff --git a/Engine.Core/Primitives/Circle.cs b/Engine.Core/Primitives/Circle.cs index 780fd64..acb4ace 100644 --- a/Engine.Core/Primitives/Circle.cs +++ b/Engine.Core/Primitives/Circle.cs @@ -72,6 +72,10 @@ public readonly struct Circle(Vector2D center, float radius) /// /// Checks if two s are approximately equal. /// + /// The first . + /// The second . + /// The epsilon range. + /// if the s are approximately equal; otherwise, . public static bool ApproximatelyEquals(Circle left, Circle right, float epsilon = float.Epsilon) => left.Center.ApproximatelyEquals(right.Center, epsilon) && left.Radius.ApproximatelyEquals(right.Radius, epsilon); } @@ -81,30 +85,21 @@ public readonly struct Circle(Vector2D center, float radius) /// public static class CircleExtensions { - /// - /// Sets the center of the . - /// + /// public static Circle SetCenter(this Circle circle, Vector2D center) => Circle.SetCenter(circle, center); - /// - /// Sets the radius of the . - /// + /// public static Circle SetRadius(this Circle circle, float radius) => Circle.SetRadius(circle, radius); - /// - /// Moves the by the specified . - /// + /// public static Circle Displace(this Circle circle, Vector2D displaceVector) => Circle.Displace(circle, displaceVector); - /// - /// Projects the onto the specified . - /// + /// public static Projection1D ToProjection(this Circle circle, Vector2D projectionVector) => Circle.Project(circle, projectionVector); - /// - /// Transforms the by the specified . - /// + /// public static Circle TransformCircle(this ITransform transform, Circle circle) => Circle.TransformCircle(transform, circle); + /// public static bool ApproximatelyEquals(this Circle left, Circle right, float epsilon = float.Epsilon) => Circle.ApproximatelyEquals(left, right, epsilon); } diff --git a/Engine.Core/Primitives/Line2D.cs b/Engine.Core/Primitives/Line2D.cs index d2b776c..83b6f8c 100644 --- a/Engine.Core/Primitives/Line2D.cs +++ b/Engine.Core/Primitives/Line2D.cs @@ -184,44 +184,37 @@ public readonly struct Line2D(Vector2D from, Vector2D to) /// /// Checks if two segments are approximately equal. /// + /// The first . + /// The second . + /// The epsilon range. + /// if the s are approximately equal; otherwise, . public static bool ApproximatelyEquals(Line2D left, Line2D right, float epsilon = float.Epsilon) => left.From.ApproximatelyEquals(right.From, epsilon) && left.To.ApproximatelyEquals(right.To, epsilon); } /// -/// Provides extension methods for the Line struct. +/// Provides extension methods for the struct. /// public static class Line2DExtensions { - /// - /// Linearly interpolates between the two endpoints of the segment using parameter 't'. - /// + /// public static Vector2D Lerp(this Line2D line, float t) => Line2D.Lerp(line, t); - /// - /// The equation of the defined by this segment. - /// + /// public static Line2DEquation ToLineEquation(this Line2D line) => Line2D.GetLineEquation(line); - /// - /// Determines whether the specified lies on the . - /// + /// public static bool Intersects(this Line2D line, Vector2D point) => Line2D.Intersects(line, point); - /// - /// Calculates the parameter 't' representing the point's position on the segment. - /// + /// public static float GetT(this Line2D line, Vector2D point) => Line2D.GetT(line, point); - /// - /// Checks if the segment intersects with another segment. - /// + /// public static bool Intersects(this Line2D left, Line2D right) => Line2D.Intersects(left, right); - /// - /// Determines whether two segments intersect. - /// + /// public static bool Intersects(this Line2D left, Line2D right, [NotNullWhen(returnValue: true)] out Vector2D? point) => Line2D.Intersects(left, right, out point); + /// public static bool ApproximatelyEquals(this Line2D left, Line2D right, float epsilon = float.Epsilon) => Line2D.ApproximatelyEquals(left, right, epsilon); } diff --git a/Engine.Core/Primitives/Line2DEquation.cs b/Engine.Core/Primitives/Line2DEquation.cs index 24479e3..d76c20d 100644 --- a/Engine.Core/Primitives/Line2DEquation.cs +++ b/Engine.Core/Primitives/Line2DEquation.cs @@ -45,13 +45,9 @@ public readonly struct Line2DEquation(float slope, float offsetY) /// public static class Line2DEquationExtensions { - /// - /// Resolves the y-coordinate for a given x-coordinate using the line equation. - /// - /// The line equation to resolve. - /// The x-coordinate for which to resolve the y-coordinate. - /// The y-coordinate resolved using the line equation. + /// public static float Resolve(this Line2DEquation lineEquation, float x) => Line2DEquation.Resolve(lineEquation, x); + /// public static bool ApproximatelyEquals(this Line2DEquation left, Line2DEquation right, float epsilon = float.Epsilon) => Line2DEquation.ApproximatelyEquals(left, right, epsilon); } diff --git a/Engine.Core/Primitives/Projection1D.cs b/Engine.Core/Primitives/Projection1D.cs index 9c72fdd..8a78413 100644 --- a/Engine.Core/Primitives/Projection1D.cs +++ b/Engine.Core/Primitives/Projection1D.cs @@ -77,20 +77,9 @@ public readonly struct Projection1D(float min, float max) /// public static class Projection1DExtensions { - /// - /// Checks if two projections overlap. - /// - /// The first projection to check. - /// The second projection to check. - /// if the projections overlap; otherwise, . + /// public static bool Overlaps(this Projection1D left, Projection1D right) => Projection1D.Overlaps(left, right); - /// - /// Checks if two projections overlap and calculates the depth of the overlap. - /// - /// The first projection to check. - /// The second projection to check. - /// The depth of the overlap, if any. - /// if the projections overlap; otherwise, . + /// public static bool Overlaps(this Projection1D left, Projection1D right, out float depth) => Projection1D.Overlaps(left, right, out depth); } diff --git a/Engine.Core/Primitives/Quaternion.cs b/Engine.Core/Primitives/Quaternion.cs index 383a6bf..4593ee3 100644 --- a/Engine.Core/Primitives/Quaternion.cs +++ b/Engine.Core/Primitives/Quaternion.cs @@ -252,121 +252,48 @@ public readonly struct Quaternion(float x, float y, float z, float w) /// public static class QuaternionExtensions { - /// - /// Calculates the length of the . - /// - /// The . - /// The length of the . + /// public static float Length(this Quaternion quaternion) => Quaternion.Length(quaternion); - /// - /// Calculates the squared length of the . - /// - /// The . - /// The squared length of the . + /// public static float LengthSquared(this Quaternion quaternion) => Quaternion.LengthSquared(quaternion); - /// - /// Adds two s. - /// - /// The first . - /// The second . - /// The sum of the two s. + /// public static Quaternion Add(this Quaternion left, Quaternion right) => Quaternion.Add(left, right); - /// - /// Subtracts one from another. - /// - /// The to subtract from. - /// The to subtract. - /// The result of subtracting the second from the first. + /// public static Quaternion Subtract(this Quaternion left, Quaternion right) => Quaternion.Subtract(left, right); - /// - /// Multiplies a by a scalar value. - /// - /// The . - /// The scalar value. - /// The result of multiplying the by the scalar value. + /// public static Quaternion Multiply(this Quaternion quaternion, float value) => Quaternion.Multiply(quaternion, value); - /// - /// Divides a by a scalar value. - /// - /// The . - /// The scalar value. - /// The result of dividing the by the scalar value. + /// public static Quaternion Divide(this Quaternion quaternion, float value) => Quaternion.Divide(quaternion, value); - /// - /// Normalizes the (creates a unit with the same direction). - /// - /// The to normalize. - /// The normalized . + /// public static Quaternion Normalize(this Quaternion quaternion) => Quaternion.Normalize(quaternion); - /// - /// Inverts the direction of the . - /// - /// The . - /// The inverted . + /// public static Quaternion Invert(this Quaternion quaternion) => Quaternion.Invert(quaternion); - /// - /// Conjugate of the . - /// - /// The . - /// The inverted . + /// public static Quaternion Conjugate(this Quaternion quaternion) => Quaternion.Conjugate(quaternion); - /// - /// Rotates a by applying the provided . - /// - /// The to be rotated. - /// The to used for applying rotation. - /// The rotated . + /// public static Vector3D RotateVector(this Vector3D vector, Quaternion quaternion) => Quaternion.RotateVector(vector, quaternion); - /// - /// Performs spherical linear interpolation between two s. - /// - /// The starting (t = 0). - /// The target (t = 1). - /// The interpolation parameter. - /// The interpolated . + /// public static Quaternion SLerp(this Quaternion from, Quaternion to, float t) => Quaternion.SLerp(from, to, t); - /// - /// Performs linear interpolation between two s. - /// - /// The starting (t = 0). - /// The target (t = 1). - /// The interpolation parameter. - /// The interpolated . + /// public static Quaternion Lerp(this Quaternion from, Quaternion to, float t) => Quaternion.Lerp(from, to, t); - /// - /// Calculates the dot product of two s. - /// - /// The first . - /// The second . - /// The dot product of the two s. + /// public static float Dot(this Quaternion left, Quaternion right) => Quaternion.Dot(left, right); - /// - /// Calculates the from given axis and angle. - /// - /// The axis of the rotation in . - /// The angle in radians. - /// The rotation calculated by the given parameters. - public static Quaternion CreateRotationFromAxis(this Vector3D axis, float angle) => Quaternion.FromAxisAngle(axis, angle); + /// + public static Quaternion CreateRotation(this Vector3D axis, float angle) => Quaternion.FromAxisAngle(axis, angle); - /// - /// Checks if two s are approximately equal within a specified epsilon range. - /// - /// The first . - /// The second . - /// The epsilon range. - /// if the s are approximately equal; otherwise, . + /// public static bool ApproximatelyEquals(this Quaternion left, Quaternion right, float epsilon = float.Epsilon) => Quaternion.ApproximatelyEquals(left, right, epsilon); } diff --git a/Engine.Core/Primitives/Shape2D.cs b/Engine.Core/Primitives/Shape2D.cs index a2c5433..8e8b5fe 100644 --- a/Engine.Core/Primitives/Shape2D.cs +++ b/Engine.Core/Primitives/Shape2D.cs @@ -197,6 +197,7 @@ public readonly struct Shape2D(List vertices) : IEnumerable /// /// The first shape to compare. /// The second shape to compare. + /// The epsilon range. /// true if the shapes are approximately equal; otherwise, false. public static bool ApproximatelyEquals(Shape2D left, Shape2D right, float epsilon = float.Epsilon) { @@ -222,65 +223,30 @@ public readonly struct Shape2D(List vertices) : IEnumerable /// public static class Shape2DExtensions { - /// - /// Creates a copy of the shape. - /// - /// The shape to copy. - /// A copy of the input shape. + /// public static Shape2D CreateCopy(this Shape2D shape) => Shape2D.CreateCopy(shape); - /// - /// Gets the super triangle that encloses the shape. - /// - /// The shape to enclose. - /// The super triangle that encloses the shape. + /// public static Triangle ToSuperTriangle(this Shape2D shape) => Shape2D.GetSuperTriangle(shape); - /// - /// Gets the lines that form the edges of the shape. - /// - /// The shape to get lines from. - /// The list to populate with lines. + /// public static void ToLines(this Shape2D shape, IList lines) => Shape2D.GetLines(shape, lines); - /// - /// Gets a list of lines that form the edges of the shape. - /// - /// The shape to get lines from. - /// A list of lines that form the edges of the shape. + /// public static List ToLines(this Shape2D shape) => Shape2D.GetLines(shape); - /// - /// Projects the shape onto a vector. - /// - /// The shape to project. - /// The vector to project onto. - /// The list to populate with projected values. + /// public static void ToProjection(this Shape2D shape, Vector2D projectionVector, IList list) => Shape2D.Project(shape, projectionVector, list); - /// - /// Projects the shape onto a vector. - /// - /// The shape to project. - /// The vector to project onto. - /// The projection of the shape onto the vector. + /// public static Projection1D ToProjection(this Shape2D shape, Vector2D projectionVector) => Shape2D.Project(shape, projectionVector); - /// - /// Transforms the shape using the specified transform. - /// - /// The transform to apply. - /// The shape to transform. - /// The transformed shape. + /// public static Shape2D TransformShape(this ITransform transform, Shape2D shape) => Shape2D.TransformShape(shape, transform); - /// - /// Transforms the shape using the specified transform. - /// - /// The transform to apply. - /// The shape to transform. - /// The transformed shape. + /// public static void TransformShape(this ITransform transform, Shape2D from, ref Shape2D to) => Shape2D.TransformShape(from, transform, ref to); + /// public static bool ApproximatelyEquals(this Shape2D left, Shape2D right, float epsilon = float.Epsilon) => Shape2D.ApproximatelyEquals(left, right, epsilon); } diff --git a/Engine.Core/Primitives/Triangle.cs b/Engine.Core/Primitives/Triangle.cs index 1dfbf2f..e36ac03 100644 --- a/Engine.Core/Primitives/Triangle.cs +++ b/Engine.Core/Primitives/Triangle.cs @@ -37,11 +37,19 @@ public readonly struct Triangle(Vector2D A, Vector2D B, Vector2D C) return new(center, Vector2D.Distance(center, triangle.A)); } + /// + /// Determines whether two s are approximately equal. + /// + /// The first to compare. + /// The second to compare. + /// The epsilon range. + /// true if the s are approximately equal; otherwise, false. public static bool ApproximatelyEquals(Triangle left, Triangle right, float epsilon = float.Epsilon) => left.A.ApproximatelyEquals(right.A, epsilon) && left.B.ApproximatelyEquals(right.B, epsilon) && left.C.ApproximatelyEquals(right.C, epsilon); } public static class TriangleExtensions { + /// public static bool ApproximatelyEquals(this Triangle left, Triangle right, float epsilon = float.Epsilon) => Triangle.ApproximatelyEquals(left, right, epsilon); } diff --git a/Engine.Core/Primitives/Vector2D.cs b/Engine.Core/Primitives/Vector2D.cs index 074f472..e005e24 100644 --- a/Engine.Core/Primitives/Vector2D.cs +++ b/Engine.Core/Primitives/Vector2D.cs @@ -313,191 +313,72 @@ public readonly struct Vector2D(float x, float y) /// public static class Vector2DExtensions { - /// - /// Returns the representation of the . - /// - /// The input . - /// The representation of the provided . - public static Vector3D As3D(this Vector2D vector) => new(vector.X, vector.Y, 0f); - - /// - /// Calculates the length of the . - /// - /// The input . - /// The length of the . + /// public static float Length(this Vector2D vector) => Vector2D.Length(vector); - /// - /// Calculates the squared length of the . - /// - /// The input . - /// The squared length of the . + /// s. - /// - /// The starting . - /// The ending . - /// The distance between the two s. + /// public static float Distance(this Vector2D from, Vector2D to) => Vector2D.Distance(from, to); - /// - /// Returns the with its components inverted. - /// - /// The input . - /// The inverted . + /// s component-wise. - /// - /// The first . - /// The vector to be added. - /// The result of the addition. + /// public static Vector2D Add(this Vector2D vector, Vector2D vectorToAdd) => Vector2D.Add(vector, vectorToAdd); - /// - /// Subtracts one from another component-wise. - /// - /// The first . - /// The to be subtracted. - /// The result of the subtraction. + /// public static Vector2D Subtract(this Vector2D vector, Vector2D vectorToSubtract) => Vector2D.Subtract(vector, vectorToSubtract); - /// - /// Multiplies a by a scalar value. - /// - /// The to multiply. - /// The scalar value to multiply with. - /// The result of the multiplication. + /// public static Vector2D Multiply(this Vector2D vector, float value) => Vector2D.Multiply(vector, value); - /// - /// Divides a by a scalar value. - /// - /// The to divide. - /// The scalar value to divide with. - /// The result of the division. + /// public static Vector2D Divide(this Vector2D vector, float value) => Vector2D.Divide(vector, value); - /// - /// Returns a with the absolute values of each component. - /// - /// The input . - /// The with absolute values. + /// public static Vector2D Abs(this Vector2D vector) => Vector2D.Abs(vector); - /// - /// Reflects a off a surface with the specified normal. - /// - /// The to reflect. - /// The normal of the reflecting surface. - /// The reflected . + /// public static Vector2D Reflect(this Vector2D vector, Vector2D normal) => Vector2D.Reflect(vector, normal); - /// - /// Normalizes the (creates a with the same direction but with a length of 1). - /// - /// The input . - /// The normalized . + /// public static Vector2D Normalize(this Vector2D vector) => Vector2D.Normalize(vector); - /// - /// Creates a pointing from one point to another. - /// - /// The starting point. - /// The ending point. - /// The pointing from to . + /// public static Vector2D FromTo(this Vector2D from, Vector2D to) => Vector2D.FromTo(from, to); - /// - /// Scales a by another component-wise. - /// - /// The to scale. - /// The containing the scaling factors for each component. - /// The scaled . + /// public static Vector2D Scale(this Vector2D vector, Vector2D scale) => Vector2D.Scale(vector, scale); - /// - /// Calculates the perpendicular to the given . - /// - /// The input . - /// A perpendicular to the input . + /// public static Vector2D Perpendicular(this Vector2D vector) => Vector2D.Perpendicular(vector); - /// - /// Rotates a by the specified angle (in radians). - /// - /// The to rotate. - /// The angle to rotate by, in radians. - /// The rotated . + /// public static Vector2D Rotate(this Vector2D vector, float angleInRadian) => Vector2D.Rotate(vector, angleInRadian); - /// - /// Returns the component-wise minimum of two s. - /// - /// The first . - /// The second . - /// The containing the minimum components from both input s. + /// public static Vector2D Min(this Vector2D left, Vector2D right) => Vector2D.Min(left, right); - /// - /// Returns the component-wise maximum of two s. - /// - /// The first . - /// The second . - /// The containing the maximum components from both input s. + /// public static Vector2D Max(this Vector2D left, Vector2D right) => Vector2D.Max(left, right); - /// - /// Clamps each component of a between the corresponding component of two other s. - /// - /// The to clamp. - /// The representing the minimum values for each component. - /// The representing the maximum values for each component. - /// The clamped . + /// public static Vector2D Clamp(this Vector2D vector, Vector2D min, Vector2D max) => Vector2D.Clamp(vector, min, max); - /// - /// Linearly interpolates between two s. - /// - /// The start . - /// The end . - /// The interpolation parameter (between 0 and 1). - /// The interpolated . + /// public static Vector2D Lerp(this Vector2D from, Vector2D to, float t) => Vector2D.Lerp(from, to, t); - /// - /// Calculates the cross product of two s. - /// - /// The first . - /// The second . - /// The cross product of the two s. + /// public static float Cross(this Vector2D left, Vector2D right) => Vector2D.Cross(left, right); - /// - /// Calculates the angle in radians between two s. - /// - /// The first . - /// The second . - /// The angle between the two s in radians. + /// public static float AngleBetween(this Vector2D left, Vector2D right) => Vector2D.Angle(left, right); - /// - /// Calculates the dot product of two s. - /// - /// The first . - /// The second . - /// The dot product of the two s. + /// public static float Dot(this Vector2D left, Vector2D right) => Vector2D.Dot(left, right); - /// - /// Checks whether two s are approximately equal within a certain epsilon range. - /// - /// The first . - /// The second . - /// The maximum difference allowed between components. - /// True if the s are approximately equal, false otherwise. + /// public static bool ApproximatelyEquals(this Vector2D left, Vector2D right, float epsilon = float.Epsilon) => Vector2D.ApproximatelyEquals(left, right, epsilon); } diff --git a/Engine.Core/Primitives/Vector3D.cs b/Engine.Core/Primitives/Vector3D.cs index aeef7ac..1c869e1 100644 --- a/Engine.Core/Primitives/Vector3D.cs +++ b/Engine.Core/Primitives/Vector3D.cs @@ -298,185 +298,69 @@ public readonly struct Vector3D(float x, float y, float z) /// public static class Vector3DExtensions { - /// - /// Returns the representation of the . - /// - /// The input . - /// The representation of the provided . - public static Vector2D As2D(this Vector3D vector) => new(vector.X, vector.Y); - - /// - /// Calculates the length of the . - /// - /// The input . - /// The length of the . + /// public static float Length(this Vector3D vector) => Vector3D.Length(vector); - /// - /// Calculates the squared length of the . - /// - /// The input . - /// The squared length of the . + /// public static float LengthSquared(this Vector3D vector) => Vector3D.LengthSquared(vector); - /// - /// Calculates the distance between two s. - /// - /// The starting . - /// The ending . - /// The distance between the two s. + /// public static float Distance(this Vector3D from, Vector3D to) => Vector3D.Distance(from, to); - /// - /// Returns the with its components inverted. - /// - /// The input . - /// The inverted . + /// public static Vector3D Invert(this Vector3D vector) => Vector3D.Invert(vector); - /// - /// Adds two s component-wise. - /// - /// The first . - /// The vector to be added. - /// The result of the addition. + /// public static Vector3D Add(this Vector3D vector, Vector3D vectorToAdd) => Vector3D.Add(vector, vectorToAdd); - /// - /// Subtracts one from another component-wise. - /// - /// The first . - /// The to be subtracted. - /// The result of the subtraction. + /// public static Vector3D Subtract(this Vector3D vector, Vector3D vectorToSubtract) => Vector3D.Subtract(vector, vectorToSubtract); - /// - /// Multiplies a by a scalar value. - /// - /// The to multiply. - /// The scalar value to multiply with. - /// The result of the multiplication. + /// public static Vector3D Multiply(this Vector3D vector, float value) => Vector3D.Multiply(vector, value); - /// - /// Divides a by a scalar value. - /// - /// The to divide. - /// The scalar value to divide with. - /// The result of the division. + /// public static Vector3D Divide(this Vector3D vector, float value) => Vector3D.Divide(vector, value); - /// - /// Returns a with the absolute values of each component. - /// - /// The input . - /// The with absolute values. + /// public static Vector3D Abs(this Vector3D vector) => Vector3D.Abs(vector); - /// - /// Reflects a off a surface with the specified normal. - /// - /// The to reflect. - /// The normal of the reflecting surface. - /// The reflected . + /// public static Vector3D Reflect(this Vector3D vector, Vector3D normal) => Vector3D.Reflect(vector, normal); - /// - /// Normalizes the (creates a with the same direction but with a length of 1). - /// - /// The input . - /// The normalized . + /// public static Vector3D Normalize(this Vector3D vector) => Vector3D.Normalize(vector); - /// - /// Creates a pointing from one point to another. - /// - /// The starting point. - /// The ending point. - /// The pointing from to . + /// public static Vector3D FromTo(this Vector3D from, Vector3D to) => Vector3D.FromTo(from, to); - /// - /// Scales a by another component-wise. - /// - /// The to scale. - /// The containing the scaling factors for each component. - /// The scaled . + /// public static Vector3D Scale(this Vector3D vector, Vector3D scale) => Vector3D.Scale(vector, scale); - /// - /// Rotates a by the specified angle (in radians). - /// - /// The to rotate. - /// The to rotate around. - /// The angle to rotate by, in radians. - /// The rotated . + /// public static Vector3D Rotate(this Vector3D vector, Vector3D normal, float angleInRadian) => Vector3D.Rotate(vector, normal, angleInRadian); - /// - /// Returns the component-wise minimum of two s. - /// - /// The first . - /// The second . - /// The containing the minimum components from both input s. + /// public static Vector3D Min(this Vector3D left, Vector3D right) => Vector3D.Min(left, right); - /// - /// Returns the component-wise maximum of two s. - /// - /// The first . - /// The second . - /// The containing the maximum components from both input s. + /// public static Vector3D Max(this Vector3D left, Vector3D right) => Vector3D.Max(left, right); - /// - /// Clamps each component of a between the corresponding component of two other s. - /// - /// The to clamp. - /// The representing the minimum values for each component. - /// The representing the maximum values for each component. - /// The clamped . + /// public static Vector3D Clamp(this Vector3D vector, Vector3D min, Vector3D max) => Vector3D.Clamp(vector, min, max); - /// - /// Linearly interpolates between two s. - /// - /// The start . - /// The end . - /// The interpolation parameter (between 0 and 1). - /// The interpolated . + /// public static Vector3D Lerp(this Vector3D from, Vector3D to, float t) => Vector3D.Lerp(from, to, t); - /// - /// Calculates the cross product of two s. - /// - /// The first . - /// The second . - /// The cross product of the two s. + /// public static Vector3D Cross(this Vector3D left, Vector3D right) => Vector3D.Cross(left, right); - /// - /// Calculates the angle in radians between two s. - /// - /// The first . - /// The second . - /// The angle between the two s in radians. + /// public static float AngleBetween(this Vector3D left, Vector3D right) => Vector3D.Angle(left, right); - /// - /// Calculates the dot product of two s. - /// - /// The first . - /// The second . - /// The dot product of the two s. + /// public static float Dot(this Vector3D left, Vector3D right) => Vector3D.Dot(left, right); - /// - /// Checks whether two s are approximately equal within a certain epsilon range. - /// - /// The first . - /// The second . - /// The maximum difference allowed between components. - /// True if the s are approximately equal, false otherwise. + /// public static bool ApproximatelyEquals(this Vector3D left, Vector3D right, float epsilon = float.Epsilon) => Vector3D.ApproximatelyEquals(left, right, epsilon); }