Удаление избыточных методов и реорганизация библиотеки / Removing of extra methods and reorganization of the library
This commit is contained in:
parent
301cabe8de
commit
c38c5ac857
14 changed files with 969 additions and 1583 deletions
|
|
@ -103,17 +103,12 @@ namespace Geometry
|
|||
);
|
||||
}
|
||||
|
||||
public void Invert()
|
||||
public void Reverse()
|
||||
{
|
||||
this.x1 = -this.x1;
|
||||
this.x2 = -this.x2;
|
||||
}
|
||||
|
||||
public readonly DPVector2 GetInverted()
|
||||
{
|
||||
return new DPVector2(-this.x1, -this.x2);
|
||||
}
|
||||
|
||||
public readonly bool IsZero()
|
||||
{
|
||||
return this.GetSquareModule() <= DPUtility.SQUARE_EPSYLON;
|
||||
|
|
@ -137,16 +132,28 @@ namespace Geometry
|
|||
this.x2 = x2;
|
||||
}
|
||||
|
||||
public void SetValues(in DPVector2 vector)
|
||||
{
|
||||
this.x1 = vector.x1;
|
||||
this.x2 = vector.x2;
|
||||
}
|
||||
|
||||
public void SetValues(in SPVector2 vector)
|
||||
{
|
||||
this.x1 = vector.x1;
|
||||
this.x2 = vector.x2;
|
||||
}
|
||||
|
||||
public void SetValues(in DPVector2 vector)
|
||||
public void SetReverseOf(in DPVector2 vector)
|
||||
{
|
||||
this.x1 = vector.x1;
|
||||
this.x2 = vector.x2;
|
||||
this.x1 = -vector.x1;
|
||||
this.x2 = -vector.x2;
|
||||
}
|
||||
|
||||
public void SetReverseOf(in SPVector2 vector)
|
||||
{
|
||||
this.x1 = -vector.x1;
|
||||
this.x2 = -vector.x2;
|
||||
}
|
||||
|
||||
public readonly override string ToString()
|
||||
|
|
@ -160,48 +167,24 @@ namespace Geometry
|
|||
sum.x2 = vector1.x2 + vector2.x2;
|
||||
}
|
||||
|
||||
public static void Add3(
|
||||
in DPVector2 vector1,
|
||||
in DPVector2 vector2,
|
||||
in DPVector2 vector3,
|
||||
out DPVector2 sum
|
||||
)
|
||||
{
|
||||
sum.x1 = vector1.x1 + vector2.x1 + vector3.x1;
|
||||
sum.x2 = vector1.x2 + vector2.x2 + vector3.x2;
|
||||
}
|
||||
|
||||
public static void Add4(
|
||||
in DPVector2 vector1,
|
||||
in DPVector2 vector2,
|
||||
in DPVector2 vector3,
|
||||
in DPVector2 vector4,
|
||||
out DPVector2 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 DPVector2 vector1,
|
||||
in DPVector2 vector2,
|
||||
in DPVector2 vector3,
|
||||
in DPVector2 vector4,
|
||||
in DPVector2 vector5,
|
||||
out DPVector2 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 DPVector2 minuend, in DPVector2 subtrahend, out DPVector2 difference)
|
||||
{
|
||||
difference.x1 = minuend.x1 - subtrahend.x1;
|
||||
difference.x2 = minuend.x2 - subtrahend.x2;
|
||||
}
|
||||
|
||||
public static void Muliply(in DPVector2 multiplicand, double multiplier, out DPVector2 product)
|
||||
{
|
||||
product.x1 = multiplicand.x1 * multiplier;
|
||||
product.x2 = multiplicand.x2 * multiplier;
|
||||
}
|
||||
|
||||
public static void Divide(in DPVector2 dividend, double divisor, out DPVector2 quotient)
|
||||
{
|
||||
quotient.x1 = dividend.x1 / divisor;
|
||||
quotient.x2 = dividend.x2 / divisor;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum2(
|
||||
double weight1, in DPVector2 vector1,
|
||||
double weight2, in DPVector2 vector2,
|
||||
|
|
@ -228,8 +211,7 @@ namespace Geometry
|
|||
double weight2, in DPVector2 vector2,
|
||||
double weight3, in DPVector2 vector3,
|
||||
double weight4, in DPVector2 vector4,
|
||||
out DPVector2 sum
|
||||
)
|
||||
out DPVector2 sum)
|
||||
{
|
||||
sum.x1 = (vector1.x1 * weight1 + vector2.x1 * weight2) + (vector3.x1 * weight3 + vector4.x1 * weight4);
|
||||
sum.x2 = (vector1.x2 * weight1 + vector2.x2 * weight2) + (vector3.x2 * weight3 + vector4.x2 * weight4);
|
||||
|
|
@ -241,30 +223,16 @@ namespace Geometry
|
|||
double weight3, in DPVector2 vector3,
|
||||
double weight4, in DPVector2 vector4,
|
||||
double weight5, in DPVector2 vector5,
|
||||
out DPVector2 sum
|
||||
)
|
||||
out DPVector2 sum)
|
||||
{
|
||||
sum.x1 = (vector1.x1 * weight1 + vector2.x1 * weight2) + (vector3.x1 * weight3 + vector4.x1 * weight4) + vector5.x1 * weight5;
|
||||
sum.x2 = (vector1.x2 * weight1 + vector2.x2 * weight2) + (vector3.x2 * weight3 + vector4.x2 * weight4) + vector5.x2 * weight5;
|
||||
}
|
||||
|
||||
public static void Muliply(in DPVector2 multiplicand, double multiplier, out DPVector2 product)
|
||||
{
|
||||
product.x1 = multiplicand.x1 * multiplier;
|
||||
product.x2 = multiplicand.x2 * multiplier;
|
||||
}
|
||||
|
||||
public static void Divide(in DPVector2 dividend, double divisor, out DPVector2 quotient)
|
||||
{
|
||||
quotient.x1 = dividend.x1 / divisor;
|
||||
quotient.x2 = dividend.x2 / divisor;
|
||||
}
|
||||
|
||||
public static void GetMean2(
|
||||
in DPVector2 vector1,
|
||||
in DPVector2 vector2,
|
||||
out DPVector2 result
|
||||
)
|
||||
out DPVector2 result)
|
||||
{
|
||||
result.x1 = (vector1.x1 + vector2.x1) * 0.5;
|
||||
result.x2 = (vector1.x2 + vector2.x2) * 0.5;
|
||||
|
|
@ -274,8 +242,7 @@ namespace Geometry
|
|||
in DPVector2 vector1,
|
||||
in DPVector2 vector2,
|
||||
in DPVector2 vector3,
|
||||
out DPVector2 result
|
||||
)
|
||||
out DPVector2 result)
|
||||
{
|
||||
result.x1 = (vector1.x1 + vector2.x1 + vector3.x1) * DPUtility.ONE_THIRD;
|
||||
result.x2 = (vector1.x2 + vector2.x2 + vector3.x2) * DPUtility.ONE_THIRD;
|
||||
|
|
@ -286,8 +253,7 @@ namespace Geometry
|
|||
in DPVector2 vector2,
|
||||
in DPVector2 vector3,
|
||||
in DPVector2 vector4,
|
||||
out DPVector2 result
|
||||
)
|
||||
out DPVector2 result)
|
||||
{
|
||||
result.x1 = ((vector1.x1 + vector2.x1) + (vector3.x1 + vector4.x1)) * 0.25;
|
||||
result.x2 = ((vector1.x2 + vector2.x2) + (vector3.x2 + vector4.x2)) * 0.25;
|
||||
|
|
@ -299,8 +265,7 @@ namespace Geometry
|
|||
in DPVector2 vector3,
|
||||
in DPVector2 vector4,
|
||||
in DPVector2 vector5,
|
||||
out DPVector2 result
|
||||
)
|
||||
out DPVector2 result)
|
||||
{
|
||||
result.x1 = ((vector1.x1 + vector2.x1) + (vector3.x1 + vector4.x1) + vector5.x1) * 0.2;
|
||||
result.x2 = ((vector1.x2 + vector2.x2) + (vector3.x2 + vector4.x2) + vector5.x2) * 0.2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue