Исправления в матрицах 2x3 и 3x2 / Several fixes in 2x3 and 3x2 matrixes
This commit is contained in:
parent
3ba55c7524
commit
301cabe8de
22 changed files with 3805 additions and 3744 deletions
|
|
@ -28,7 +28,8 @@ namespace Geometry
|
|||
public double r2c1, r2c2;
|
||||
public double r3c1, r3c2;
|
||||
|
||||
public DPMatrix2x3() {
|
||||
public DPMatrix2x3()
|
||||
{
|
||||
this.r1c1 = 0.0;
|
||||
this.r1c2 = 0.0;
|
||||
|
||||
|
|
@ -39,7 +40,8 @@ namespace Geometry
|
|||
this.r3c2 = 0.0;
|
||||
}
|
||||
|
||||
public DPMatrix2x3(in DPMatrix2x3 matrix) {
|
||||
public DPMatrix2x3(in DPMatrix2x3 matrix)
|
||||
{
|
||||
this.r1c1 = matrix.r1c1;
|
||||
this.r1c2 = matrix.r1c2;
|
||||
|
||||
|
|
@ -50,7 +52,8 @@ namespace Geometry
|
|||
this.r3c2 = matrix.r3c2;
|
||||
}
|
||||
|
||||
public DPMatrix2x3(in SPMatrix2x3 matrix) {
|
||||
public DPMatrix2x3(in SPMatrix2x3 matrix)
|
||||
{
|
||||
this.r1c1 = matrix.r1c1;
|
||||
this.r1c2 = matrix.r1c2;
|
||||
|
||||
|
|
@ -194,7 +197,7 @@ namespace Geometry
|
|||
in DPMatrix2x3 matrix2,
|
||||
in DPMatrix2x3 matrix3,
|
||||
out DPMatrix2x3 sum
|
||||
)
|
||||
)
|
||||
{
|
||||
sum.r1c1 = matrix1.r1c1 + matrix2.r1c1 + matrix3.r1c1;
|
||||
sum.r1c2 = matrix1.r1c2 + matrix2.r1c2 + matrix3.r1c2;
|
||||
|
|
@ -212,7 +215,7 @@ namespace Geometry
|
|||
in DPMatrix2x3 matrix3,
|
||||
in DPMatrix2x3 matrix4,
|
||||
out DPMatrix2x3 sum
|
||||
)
|
||||
)
|
||||
{
|
||||
sum.r1c1 = (matrix1.r1c1 + matrix2.r1c1) + (matrix3.r1c1 + matrix4.r1c1);
|
||||
sum.r1c2 = (matrix1.r1c2 + matrix2.r1c2) + (matrix3.r1c2 + matrix4.r1c2);
|
||||
|
|
@ -231,7 +234,7 @@ namespace Geometry
|
|||
in DPMatrix2x3 matrix4,
|
||||
in DPMatrix2x3 matrix5,
|
||||
out DPMatrix2x3 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;
|
||||
|
|
@ -259,7 +262,7 @@ namespace Geometry
|
|||
double weight1, in DPMatrix2x3 matrix1,
|
||||
double weight2, in DPMatrix2x3 matrix2,
|
||||
out DPMatrix2x3 sum
|
||||
)
|
||||
)
|
||||
{
|
||||
sum.r1c1 = matrix1.r1c1 * weight1 + matrix2.r1c1 * weight2;
|
||||
sum.r1c2 = matrix1.r1c2 * weight1 + matrix2.r1c2 * weight2;
|
||||
|
|
@ -276,7 +279,7 @@ namespace Geometry
|
|||
double weight2, in DPMatrix2x3 matrix2,
|
||||
double weight3, in DPMatrix2x3 matrix3,
|
||||
out DPMatrix2x3 sum
|
||||
)
|
||||
)
|
||||
{
|
||||
sum.r1c1 = matrix1.r1c1 * weight1 + matrix2.r1c1 * weight2 + matrix3.r1c1 * weight3;
|
||||
sum.r1c2 = matrix1.r1c2 * weight1 + matrix2.r1c2 * weight2 + matrix3.r1c2 * weight3;
|
||||
|
|
@ -294,7 +297,7 @@ namespace Geometry
|
|||
double weight3, in DPMatrix2x3 matrix3,
|
||||
double weight4, in DPMatrix2x3 matrix4,
|
||||
out DPMatrix2x3 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);
|
||||
|
|
@ -313,7 +316,7 @@ namespace Geometry
|
|||
double weight4, in DPMatrix2x3 matrix4,
|
||||
double weight5, in DPMatrix2x3 matrix5,
|
||||
out DPMatrix2x3 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;
|
||||
|
|
@ -351,22 +354,15 @@ namespace Geometry
|
|||
|
||||
public static void GetRightProduct(in DPMatrix2x3 matrix, in DPVector2 vector, out DPVector3 result)
|
||||
{
|
||||
double x1 = matrix.r1c1 * vector.x1 + matrix.r1c2 * vector.x2;
|
||||
double x2 = matrix.r2c1 * vector.x1 + matrix.r2c2 * vector.x2;
|
||||
double x3 = matrix.r3c1 * vector.x1 + matrix.r3c2 * vector.x2;
|
||||
|
||||
result.x1 = x1;
|
||||
result.x2 = x2;
|
||||
result.x3 = x3;
|
||||
result.x1 = matrix.r1c1 * vector.x1 + matrix.r1c2 * vector.x2;
|
||||
result.x2 = matrix.r2c1 * vector.x1 + matrix.r2c2 * vector.x2;
|
||||
result.x3 = matrix.r3c1 * vector.x1 + matrix.r3c2 * vector.x2;
|
||||
}
|
||||
|
||||
public static void GetLeftProduct(in DPVector3 vector, in DPMatrix2x3 matrix, out DPVector2 result)
|
||||
{
|
||||
double x1 = vector.x1 * matrix.r1c1 + vector.x2 * matrix.r2c1 + vector.x3 * matrix.r3c1;
|
||||
double x2 = vector.x1 * matrix.r1c2 + vector.x2 * matrix.r2c2 + vector.x3 * matrix.r3c2;
|
||||
|
||||
result.x1 = x1;
|
||||
result.x2 = x2;
|
||||
result.x1 = vector.x1 * matrix.r1c1 + vector.x2 * matrix.r2c1 + vector.x3 * matrix.r3c1;
|
||||
result.x2 = vector.x1 * matrix.r1c2 + vector.x2 * matrix.r2c2 + vector.x3 * matrix.r3c2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue