Удаление избыточных методов и реорганизация библиотеки / 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
|
|
@ -76,33 +76,6 @@ namespace Geometry
|
|||
return -DPUtility.EPSYLON <= determinant && determinant <= DPUtility.EPSYLON;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
this.r1c1 = 0.0;
|
||||
this.r1c2 = 0.0;
|
||||
|
||||
this.r2c1 = 0.0;
|
||||
this.r2c2 = 0.0;
|
||||
}
|
||||
|
||||
public void MakeIdentity()
|
||||
{
|
||||
this.r1c1 = 1.0;
|
||||
this.r1c2 = 0.0;
|
||||
|
||||
this.r2c1 = 0.0;
|
||||
this.r2c2 = 1.0;
|
||||
}
|
||||
|
||||
public void MakeDiagonal(double d1, double d2)
|
||||
{
|
||||
this.r1c1 = d1;
|
||||
this.r1c2 = 0.0;
|
||||
|
||||
this.r2c1 = 0.0;
|
||||
this.r2c2 = d2;
|
||||
}
|
||||
|
||||
public void Transpose()
|
||||
{
|
||||
(this.r1c2, this.r2c1) = (this.r2c1, this.r1c2);
|
||||
|
|
@ -132,14 +105,59 @@ namespace Geometry
|
|||
return true;
|
||||
}
|
||||
|
||||
public void MakeTransposedOf(in DPMatrix2x2 matrix)
|
||||
public void Reset()
|
||||
{
|
||||
this.r1c1 = 0.0;
|
||||
this.r1c2 = 0.0;
|
||||
|
||||
this.r2c1 = 0.0;
|
||||
this.r2c2 = 0.0;
|
||||
}
|
||||
|
||||
public void SetToIdentity()
|
||||
{
|
||||
this.r1c1 = 1.0;
|
||||
this.r1c2 = 0.0;
|
||||
|
||||
this.r2c1 = 0.0;
|
||||
this.r2c2 = 1.0;
|
||||
}
|
||||
|
||||
public void SetToDiagonal(double d1, double d2)
|
||||
{
|
||||
this.r1c1 = d1;
|
||||
this.r1c2 = 0.0;
|
||||
|
||||
this.r2c1 = 0.0;
|
||||
this.r2c2 = d2;
|
||||
}
|
||||
|
||||
public void SetValues(in DPMatrix2x2 matrix)
|
||||
{
|
||||
this.r1c1 = matrix.r1c1;
|
||||
this.r1c2 = matrix.r1c2;
|
||||
|
||||
this.r2c1 = matrix.r2c1;
|
||||
this.r2c2 = matrix.r2c2;
|
||||
}
|
||||
|
||||
public void SetValues(in SPMatrix2x2 matrix)
|
||||
{
|
||||
this.r1c1 = matrix.r1c1;
|
||||
this.r1c2 = matrix.r1c2;
|
||||
|
||||
this.r2c1 = matrix.r2c1;
|
||||
this.r2c2 = matrix.r2c2;
|
||||
}
|
||||
|
||||
public void SetTransposedOf(in DPMatrix2x2 matrix)
|
||||
{
|
||||
this.r1c1 = matrix.r1c1;
|
||||
this.r2c2 = matrix.r2c2;
|
||||
(this.r1c2, this.r2c1) = (matrix.r2c1, matrix.r1c2);
|
||||
}
|
||||
|
||||
public void MakeTransposedOf(in SPMatrix2x2 matrix)
|
||||
public void SetTransposedOf(in SPMatrix2x2 matrix)
|
||||
{
|
||||
this.r1c1 = matrix.r1c1;
|
||||
this.r1c2 = matrix.r2c1;
|
||||
|
|
@ -148,7 +166,7 @@ namespace Geometry
|
|||
this.r2c2 = matrix.r2c2;
|
||||
}
|
||||
|
||||
public bool MakeInvertedOf(in DPMatrix2x2 matrix)
|
||||
public bool SetInvertedOf(in DPMatrix2x2 matrix)
|
||||
{
|
||||
double determinant = matrix.GetDeterminant();
|
||||
|
||||
|
|
@ -172,30 +190,6 @@ namespace Geometry
|
|||
return true;
|
||||
}
|
||||
|
||||
public void SetValues(in DPMatrix2x2 matrix)
|
||||
{
|
||||
this.r1c1 = matrix.r1c1;
|
||||
this.r1c2 = matrix.r1c2;
|
||||
|
||||
this.r2c1 = matrix.r2c1;
|
||||
this.r2c2 = matrix.r2c2;
|
||||
}
|
||||
|
||||
public void SetValues(in SPMatrix2x2 matrix)
|
||||
{
|
||||
this.r1c1 = matrix.r1c1;
|
||||
this.r1c2 = matrix.r1c2;
|
||||
|
||||
this.r2c1 = matrix.r2c1;
|
||||
this.r2c2 = matrix.r2c2;
|
||||
}
|
||||
|
||||
public void SetMainDiagonal(double d1, double d2)
|
||||
{
|
||||
this.r1c1 = d1;
|
||||
this.r2c2 = d2;
|
||||
}
|
||||
|
||||
public void SetRow1(double c1, double c2)
|
||||
{
|
||||
this.r1c1 = c1;
|
||||
|
|
@ -229,51 +223,6 @@ namespace Geometry
|
|||
sum.r2c2 = matrix1.r2c2 + matrix2.r2c2;
|
||||
}
|
||||
|
||||
public static void Add3(
|
||||
in DPMatrix2x2 matrix1,
|
||||
in DPMatrix2x2 matrix2,
|
||||
in DPMatrix2x2 matrix3,
|
||||
out DPMatrix2x2 sum
|
||||
)
|
||||
{
|
||||
sum.r1c1 = matrix1.r1c1 + matrix2.r1c1 + matrix3.r1c1;
|
||||
sum.r1c2 = matrix1.r1c2 + matrix2.r1c2 + matrix3.r1c2;
|
||||
|
||||
sum.r2c1 = matrix1.r2c1 + matrix2.r2c1 + matrix3.r2c1;
|
||||
sum.r2c2 = matrix1.r2c2 + matrix2.r2c2 + matrix3.r2c2;
|
||||
}
|
||||
|
||||
public static void Add4(
|
||||
in DPMatrix2x2 matrix1,
|
||||
in DPMatrix2x2 matrix2,
|
||||
in DPMatrix2x2 matrix3,
|
||||
in DPMatrix2x2 matrix4,
|
||||
out DPMatrix2x2 sum
|
||||
)
|
||||
{
|
||||
sum.r1c1 = (matrix1.r1c1 + matrix2.r1c1) + (matrix3.r1c1 + matrix4.r1c1);
|
||||
sum.r1c2 = (matrix1.r1c2 + matrix2.r1c2) + (matrix3.r1c2 + matrix4.r1c2);
|
||||
|
||||
sum.r2c1 = (matrix1.r2c1 + matrix2.r2c1) + (matrix3.r2c1 + matrix4.r2c1);
|
||||
sum.r2c2 = (matrix1.r2c2 + matrix2.r2c2) + (matrix3.r2c2 + matrix4.r2c2);
|
||||
}
|
||||
|
||||
public static void Add5(
|
||||
in DPMatrix2x2 matrix1,
|
||||
in DPMatrix2x2 matrix2,
|
||||
in DPMatrix2x2 matrix3,
|
||||
in DPMatrix2x2 matrix4,
|
||||
in DPMatrix2x2 matrix5,
|
||||
out DPMatrix2x2 sum
|
||||
)
|
||||
{
|
||||
sum.r1c1 = (matrix1.r1c1 + matrix2.r1c1) + (matrix3.r1c1 + matrix4.r1c1) + matrix5.r1c1;
|
||||
sum.r1c2 = (matrix1.r1c2 + matrix2.r1c2) + (matrix3.r1c2 + matrix4.r1c2) + matrix5.r1c2;
|
||||
|
||||
sum.r2c1 = (matrix1.r2c1 + matrix2.r2c1) + (matrix3.r2c1 + matrix4.r2c1) + matrix5.r2c1;
|
||||
sum.r2c2 = (matrix1.r2c2 + matrix2.r2c2) + (matrix3.r2c2 + matrix4.r2c2) + matrix5.r2c2;
|
||||
}
|
||||
|
||||
public static void Subtract(in DPMatrix2x2 minuend, in DPMatrix2x2 subtrahend, out DPMatrix2x2 difference)
|
||||
{
|
||||
difference.r1c1 = minuend.r1c1 - subtrahend.r1c1;
|
||||
|
|
@ -283,64 +232,6 @@ namespace Geometry
|
|||
difference.r2c2 = minuend.r2c2 - subtrahend.r2c2;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum2(
|
||||
double weight1, in DPMatrix2x2 matrix1,
|
||||
double weight2, in DPMatrix2x2 matrix2,
|
||||
out DPMatrix2x2 sum
|
||||
)
|
||||
{
|
||||
sum.r1c1 = matrix1.r1c1 * weight1 + matrix2.r1c1 * weight2;
|
||||
sum.r1c2 = matrix1.r1c2 * weight1 + matrix2.r1c2 * weight2;
|
||||
|
||||
sum.r2c1 = matrix1.r2c1 * weight1 + matrix2.r2c1 * weight2;
|
||||
sum.r2c2 = matrix1.r2c2 * weight1 + matrix2.r2c2 * weight2;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum3(
|
||||
float weight1, in SPMatrix2x2 matrix1,
|
||||
float weight2, in SPMatrix2x2 matrix2,
|
||||
float weight3, in SPMatrix2x2 matrix3,
|
||||
out DPMatrix2x2 sum
|
||||
)
|
||||
{
|
||||
sum.r1c1 = matrix1.r1c1 * weight1 + matrix2.r1c1 * weight2 + matrix3.r1c1 * weight3;
|
||||
sum.r1c2 = matrix1.r1c2 * weight1 + matrix2.r1c2 * weight2 + matrix3.r1c2 * weight3;
|
||||
|
||||
sum.r2c1 = matrix1.r2c1 * weight1 + matrix2.r2c1 * weight2 + matrix3.r2c1 * weight3;
|
||||
sum.r2c2 = matrix1.r2c2 * weight1 + matrix2.r2c2 * weight2 + matrix3.r2c2 * weight3;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum4(
|
||||
float weight1, in SPMatrix2x2 matrix1,
|
||||
float weight2, in SPMatrix2x2 matrix2,
|
||||
float weight3, in SPMatrix2x2 matrix3,
|
||||
float weight4, in SPMatrix2x2 matrix4,
|
||||
out DPMatrix2x2 sum
|
||||
)
|
||||
{
|
||||
sum.r1c1 = (matrix1.r1c1 * weight1 + matrix2.r1c1 * weight2) + (matrix3.r1c1 * weight3 + matrix4.r1c1 * weight4);
|
||||
sum.r1c2 = (matrix1.r1c2 * weight1 + matrix2.r1c2 * weight2) + (matrix3.r1c2 * weight3 + matrix4.r1c2 * weight4);
|
||||
|
||||
sum.r2c1 = (matrix1.r2c1 * weight1 + matrix2.r2c1 * weight2) + (matrix3.r2c1 * weight3 + matrix4.r2c1 * weight4);
|
||||
sum.r2c2 = (matrix1.r2c2 * weight1 + matrix2.r2c2 * weight2) + (matrix3.r2c2 * weight3 + matrix4.r2c2 * weight4);
|
||||
}
|
||||
|
||||
public static void GetWeightedSum5(
|
||||
double weight1, in DPMatrix2x2 matrix1,
|
||||
double weight2, in DPMatrix2x2 matrix2,
|
||||
double weight3, in DPMatrix2x2 matrix3,
|
||||
double weight4, in DPMatrix2x2 matrix4,
|
||||
double weight5, in DPMatrix2x2 matrix5,
|
||||
out DPMatrix2x2 sum
|
||||
)
|
||||
{
|
||||
sum.r1c1 = (matrix1.r1c1 * weight1 + matrix2.r1c1 * weight2) + (matrix3.r1c1 * weight3 + matrix4.r1c1 * weight4) + matrix5.r1c1 * weight5;
|
||||
sum.r1c2 = (matrix1.r1c2 * weight1 + matrix2.r1c2 * weight2) + (matrix3.r1c2 * weight3 + matrix4.r1c2 * weight4) + matrix5.r1c2 * weight5;
|
||||
|
||||
sum.r2c1 = (matrix1.r2c1 * weight1 + matrix2.r2c1 * weight2) + (matrix3.r2c1 * weight3 + matrix4.r2c1 * weight4) + matrix5.r2c1 * weight5;
|
||||
sum.r2c2 = (matrix1.r2c2 * weight1 + matrix2.r2c2 * weight2) + (matrix3.r2c2 * weight3 + matrix4.r2c2 * weight4) + matrix5.r2c2 * weight5;
|
||||
}
|
||||
|
||||
public static void Multiply(in DPMatrix2x2 multiplicand, double multiplier, out DPMatrix2x2 product)
|
||||
{
|
||||
product.r1c1 = multiplicand.r1c1 * multiplier;
|
||||
|
|
@ -359,6 +250,60 @@ namespace Geometry
|
|||
quotient.r2c2 = dividend.r2c2 / divisor;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum2(
|
||||
double weight1, in DPMatrix2x2 matrix1,
|
||||
double weight2, in DPMatrix2x2 matrix2,
|
||||
out DPMatrix2x2 sum)
|
||||
{
|
||||
sum.r1c1 = matrix1.r1c1 * weight1 + matrix2.r1c1 * weight2;
|
||||
sum.r1c2 = matrix1.r1c2 * weight1 + matrix2.r1c2 * weight2;
|
||||
|
||||
sum.r2c1 = matrix1.r2c1 * weight1 + matrix2.r2c1 * weight2;
|
||||
sum.r2c2 = matrix1.r2c2 * weight1 + matrix2.r2c2 * weight2;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum3(
|
||||
float weight1, in SPMatrix2x2 matrix1,
|
||||
float weight2, in SPMatrix2x2 matrix2,
|
||||
float weight3, in SPMatrix2x2 matrix3,
|
||||
out DPMatrix2x2 sum)
|
||||
{
|
||||
sum.r1c1 = matrix1.r1c1 * weight1 + matrix2.r1c1 * weight2 + matrix3.r1c1 * weight3;
|
||||
sum.r1c2 = matrix1.r1c2 * weight1 + matrix2.r1c2 * weight2 + matrix3.r1c2 * weight3;
|
||||
|
||||
sum.r2c1 = matrix1.r2c1 * weight1 + matrix2.r2c1 * weight2 + matrix3.r2c1 * weight3;
|
||||
sum.r2c2 = matrix1.r2c2 * weight1 + matrix2.r2c2 * weight2 + matrix3.r2c2 * weight3;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum4(
|
||||
float weight1, in SPMatrix2x2 matrix1,
|
||||
float weight2, in SPMatrix2x2 matrix2,
|
||||
float weight3, in SPMatrix2x2 matrix3,
|
||||
float weight4, in SPMatrix2x2 matrix4,
|
||||
out DPMatrix2x2 sum)
|
||||
{
|
||||
sum.r1c1 = (matrix1.r1c1 * weight1 + matrix2.r1c1 * weight2) + (matrix3.r1c1 * weight3 + matrix4.r1c1 * weight4);
|
||||
sum.r1c2 = (matrix1.r1c2 * weight1 + matrix2.r1c2 * weight2) + (matrix3.r1c2 * weight3 + matrix4.r1c2 * weight4);
|
||||
|
||||
sum.r2c1 = (matrix1.r2c1 * weight1 + matrix2.r2c1 * weight2) + (matrix3.r2c1 * weight3 + matrix4.r2c1 * weight4);
|
||||
sum.r2c2 = (matrix1.r2c2 * weight1 + matrix2.r2c2 * weight2) + (matrix3.r2c2 * weight3 + matrix4.r2c2 * weight4);
|
||||
}
|
||||
|
||||
public static void GetWeightedSum5(
|
||||
double weight1, in DPMatrix2x2 matrix1,
|
||||
double weight2, in DPMatrix2x2 matrix2,
|
||||
double weight3, in DPMatrix2x2 matrix3,
|
||||
double weight4, in DPMatrix2x2 matrix4,
|
||||
double weight5, in DPMatrix2x2 matrix5,
|
||||
out DPMatrix2x2 sum)
|
||||
{
|
||||
sum.r1c1 = (matrix1.r1c1 * weight1 + matrix2.r1c1 * weight2) + (matrix3.r1c1 * weight3 + matrix4.r1c1 * weight4) + matrix5.r1c1 * weight5;
|
||||
sum.r1c2 = (matrix1.r1c2 * weight1 + matrix2.r1c2 * weight2) + (matrix3.r1c2 * weight3 + matrix4.r1c2 * weight4) + matrix5.r1c2 * weight5;
|
||||
|
||||
sum.r2c1 = (matrix1.r2c1 * weight1 + matrix2.r2c1 * weight2) + (matrix3.r2c1 * weight3 + matrix4.r2c1 * weight4) + matrix5.r2c1 * weight5;
|
||||
sum.r2c2 = (matrix1.r2c2 * weight1 + matrix2.r2c2 * weight2) + (matrix3.r2c2 * weight3 + matrix4.r2c2 * weight4) + matrix5.r2c2 * weight5;
|
||||
}
|
||||
|
||||
public static void GetRightProduct(in DPMatrix2x2 matrix, in DPVector2 vector, out DPVector2 result)
|
||||
{
|
||||
double x1 = matrix.r1c1 * vector.x1 + matrix.r1c2 * vector.x2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue