Удаление избыточных методов и реорганизация библиотеки / Removing of extra methods and reorganization of the library

This commit is contained in:
Andrey Pokidov 2024-11-15 19:11:49 +07:00
parent 301cabe8de
commit c38c5ac857
14 changed files with 969 additions and 1583 deletions

View file

@ -103,17 +103,12 @@ namespace Geometry
);
}
public void Invert()
public void Reverse()
{
this.x1 = -this.x1;
this.x2 = -this.x2;
}
public readonly SPVector2 GetInverted()
{
return new SPVector2(-this.x1, -this.x2);
}
public readonly bool IsZero()
{
return this.GetSquareModule() <= SPUtility.SQUARE_EPSYLON;
@ -137,18 +132,29 @@ namespace Geometry
this.x2 = x2;
}
public void SetValues(in DPVector2 vector)
{
this.x1 = (float)vector.x1;
this.x2 = (float)vector.x2;
}
public void SetValues(in SPVector2 vector)
{
this.x1 = vector.x1;
this.x2 = vector.x2;
}
public void SetValues(in DPVector2 vector)
{
this.x1 = (float)vector.x1;
this.x2 = (float)vector.x2;
}
public void SetReverseOf(in SPVector2 vector)
{
this.x1 = -vector.x1;
this.x2 = -vector.x2;
}
public void SetReverseOf(in DPVector2 vector)
{
this.x1 = -(float)vector.x1;
this.x2 = -(float)vector.x2;
}
public readonly override string ToString()
{
return String.Format("SPVector2({0}, {1})", this.x1, this.x2);
@ -160,48 +166,24 @@ namespace Geometry
sum.x2 = vector1.x2 + vector2.x2;
}
public static void Add3(
in SPVector2 vector1,
in SPVector2 vector2,
in SPVector2 vector3,
out SPVector2 sum
)
{
sum.x1 = vector1.x1 + vector2.x1 + vector3.x1;
sum.x2 = vector1.x2 + vector2.x2 + vector3.x2;
}
public static void Add4(
in SPVector2 vector1,
in SPVector2 vector2,
in SPVector2 vector3,
in SPVector2 vector4,
out SPVector2 sum
)
{
sum.x1 = (vector1.x1 + vector2.x1) + (vector3.x1 + vector4.x1);
sum.x2 = (vector1.x2 + vector2.x2) + (vector3.x2 + vector4.x2);
}
public static void Add5(
in SPVector2 vector1,
in SPVector2 vector2,
in SPVector2 vector3,
in SPVector2 vector4,
in SPVector2 vector5,
out SPVector2 sum
)
{
sum.x1 = (vector1.x1 + vector2.x1) + (vector3.x1 + vector4.x1) + vector5.x1;
sum.x2 = (vector1.x2 + vector2.x2) + (vector3.x2 + vector4.x2) + vector5.x2;
}
public static void Subtract(in SPVector2 minuend, in SPVector2 subtrahend, out SPVector2 difference)
{
difference.x1 = minuend.x1 - subtrahend.x1;
difference.x2 = minuend.x2 - subtrahend.x2;
}
public static void Muliply(in SPVector2 multiplicand, float multiplier, out SPVector2 product)
{
product.x1 = multiplicand.x1 * multiplier;
product.x2 = multiplicand.x2 * multiplier;
}
public static void Divide(in SPVector2 dividend, float divisor, out SPVector2 quotient)
{
quotient.x1 = dividend.x1 / divisor;
quotient.x2 = dividend.x2 / divisor;
}
public static void GetWeightedSum2(
float weight1, in SPVector2 vector1,
float weight2, in SPVector2 vector2,
@ -248,18 +230,6 @@ namespace Geometry
sum.x2 = (vector1.x2 * weight1 + vector2.x2 * weight2) + (vector3.x2 * weight3 + vector4.x2 * weight4);
}
public static void Muliply(in SPVector2 multiplicand, float multiplier, out SPVector2 product)
{
product.x1 = multiplicand.x1 * multiplier;
product.x2 = multiplicand.x2 * multiplier;
}
public static void Divide(in SPVector2 dividend, float divisor, out SPVector2 quotient)
{
quotient.x1 = dividend.x1 / divisor;
quotient.x2 = dividend.x2 / divisor;
}
public static void GetMean2(
in SPVector2 vector1,
in SPVector2 vector2,