Задача 0000002: замена методов getWeightedSum на appendScaled для векторов / Task 0000002: replacement of getWeightedSum methods on appendScaled for vectors
This commit is contained in:
parent
f9bf5ef92e
commit
c3dc0b2ecd
4 changed files with 35 additions and 417 deletions
|
|
@ -81,28 +81,6 @@ namespace BGC
|
|||
return 1;
|
||||
}
|
||||
|
||||
public readonly F32Vector2 GetNormalized()
|
||||
{
|
||||
float squareModule = this.GetSquareModule();
|
||||
|
||||
if (1.0f - F32Utility.TWO_EPSYLON <= squareModule && squareModule <= 1.0f + F32Utility.TWO_EPSYLON)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
if (squareModule <= F32Utility.SQUARE_EPSYLON)
|
||||
{
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
float module = MathF.Sqrt(squareModule);
|
||||
|
||||
return new F32Vector2(
|
||||
this.x1 / module,
|
||||
this.x2 / module
|
||||
);
|
||||
}
|
||||
|
||||
public void Reverse()
|
||||
{
|
||||
this.x1 = -this.x1;
|
||||
|
|
@ -155,6 +133,13 @@ namespace BGC
|
|||
this.x1 = -(float)vector.x1;
|
||||
this.x2 = -(float)vector.x2;
|
||||
}
|
||||
|
||||
public void AppendScaled(F32Vector2 scalableSummand, float scale)
|
||||
{
|
||||
this.x1 += scalableSummand.x1 * scale;
|
||||
this.x2 += scalableSummand.x2 * scale;
|
||||
}
|
||||
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return String.Format("SPVector2({0}, {1})", this.x1, this.x2);
|
||||
|
|
@ -184,98 +169,18 @@ namespace BGC
|
|||
quotient.x2 = dividend.x2 / divisor;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum2(
|
||||
float weight1, in F32Vector2 vector1,
|
||||
float weight2, in F32Vector2 vector2,
|
||||
out F32Vector2 sum
|
||||
)
|
||||
{
|
||||
sum.x1 = vector1.x1 * weight1 + vector2.x1 * weight2;
|
||||
sum.x2 = vector1.x2 * weight1 + vector2.x2 * weight2;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum3(
|
||||
float weight1, in F32Vector2 vector1,
|
||||
float weight2, in F32Vector2 vector2,
|
||||
float weight3, in F32Vector2 vector3,
|
||||
out F32Vector2 sum
|
||||
)
|
||||
{
|
||||
sum.x1 = vector1.x1 * weight1 + vector2.x1 * weight2 + vector3.x1 * weight3;
|
||||
sum.x2 = vector1.x2 * weight1 + vector2.x2 * weight2 + vector3.x2 * weight3;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum4(
|
||||
float weight1, in F32Vector2 vector1,
|
||||
float weight2, in F32Vector2 vector2,
|
||||
float weight3, in F32Vector2 vector3,
|
||||
float weight4, in F32Vector2 vector4,
|
||||
out F32Vector2 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);
|
||||
}
|
||||
|
||||
public static void GetWeightedSum5(
|
||||
float weight1, in F32Vector2 vector1,
|
||||
float weight2, in F32Vector2 vector2,
|
||||
float weight3, in F32Vector2 vector3,
|
||||
float weight4, in F32Vector2 vector4,
|
||||
float weight5, in F32Vector2 vector5,
|
||||
out F32Vector2 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);
|
||||
}
|
||||
|
||||
public static void GetMean2(
|
||||
in F32Vector2 vector1,
|
||||
in F32Vector2 vector2,
|
||||
out F32Vector2 result
|
||||
)
|
||||
public static void GetMean2(in F32Vector2 vector1, in F32Vector2 vector2, out F32Vector2 result)
|
||||
{
|
||||
result.x1 = (vector1.x1 + vector2.x1) * 0.5f;
|
||||
result.x2 = (vector1.x2 + vector2.x2) * 0.5f;
|
||||
}
|
||||
|
||||
public static void GetMean3(
|
||||
in F32Vector2 vector1,
|
||||
in F32Vector2 vector2,
|
||||
in F32Vector2 vector3,
|
||||
out F32Vector2 result
|
||||
)
|
||||
public static void GetMean3(in F32Vector2 vector1, in F32Vector2 vector2, in F32Vector2 vector3, out F32Vector2 result)
|
||||
{
|
||||
result.x1 = (vector1.x1 + vector2.x1 + vector3.x1) * F32Utility.ONE_THIRD;
|
||||
result.x2 = (vector1.x2 + vector2.x2 + vector3.x2) * F32Utility.ONE_THIRD;
|
||||
}
|
||||
|
||||
public static void GetMean4(
|
||||
in F32Vector2 vector1,
|
||||
in F32Vector2 vector2,
|
||||
in F32Vector2 vector3,
|
||||
in F32Vector2 vector4,
|
||||
out F32Vector2 result
|
||||
)
|
||||
{
|
||||
result.x1 = ((vector1.x1 + vector2.x1) + (vector3.x1 + vector4.x1)) * 0.25f;
|
||||
result.x2 = ((vector1.x2 + vector2.x2) + (vector3.x2 + vector4.x2)) * 0.25f;
|
||||
}
|
||||
|
||||
public static void GetMean5(
|
||||
in F32Vector2 vector1,
|
||||
in F32Vector2 vector2,
|
||||
in F32Vector2 vector3,
|
||||
in F32Vector2 vector4,
|
||||
in F32Vector2 vector5,
|
||||
out F32Vector2 result
|
||||
)
|
||||
{
|
||||
result.x1 = ((vector1.x1 + vector2.x1) + (vector3.x1 + vector4.x1) + vector5.x1) * 0.2f;
|
||||
result.x2 = ((vector1.x2 + vector2.x2) + (vector3.x2 + vector4.x2) + vector5.x2) * 0.2f;
|
||||
}
|
||||
|
||||
public static float GetScalarProduct(in F32Vector2 vector1, in F32Vector2 vector2)
|
||||
{
|
||||
return vector1.x1 * vector2.x1 + vector1.x2 * vector2.x2;
|
||||
|
|
|
|||
|
|
@ -86,29 +86,6 @@ namespace BGC
|
|||
return 1;
|
||||
}
|
||||
|
||||
public readonly F32Vector3 GetNormalized()
|
||||
{
|
||||
float squareModule = this.GetSquareModule();
|
||||
|
||||
if (1.0f - F32Utility.TWO_EPSYLON <= squareModule && squareModule <= 1.0f + F32Utility.TWO_EPSYLON)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
if (squareModule <= F32Utility.SQUARE_EPSYLON)
|
||||
{
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
float module = MathF.Sqrt(squareModule);
|
||||
|
||||
return new F32Vector3(
|
||||
this.x1 / module,
|
||||
this.x2 / module,
|
||||
this.x3 / module
|
||||
);
|
||||
}
|
||||
|
||||
public void Reverse()
|
||||
{
|
||||
this.x1 = -this.x1;
|
||||
|
|
@ -169,6 +146,13 @@ namespace BGC
|
|||
this.x3 = -(float)vector.x3;
|
||||
}
|
||||
|
||||
public void AppendScaled(F32Vector3 scalableSummand, float scale)
|
||||
{
|
||||
this.x1 += scalableSummand.x1 * scale;
|
||||
this.x2 += scalableSummand.x2 * scale;
|
||||
this.x3 += scalableSummand.x3 * scale;
|
||||
}
|
||||
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return String.Format("SPVector3({0}, {1}, {2})", this.x1, this.x2, this.x3);
|
||||
|
|
@ -202,106 +186,20 @@ namespace BGC
|
|||
quotient.x3 = dividend.x3 / divisor;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum2(
|
||||
float weight1, in F32Vector3 vector1,
|
||||
float weight2, in F32Vector3 vector2,
|
||||
out F32Vector3 sum
|
||||
)
|
||||
{
|
||||
sum.x1 = vector1.x1 * weight1 + vector2.x1 * weight2;
|
||||
sum.x2 = vector1.x2 * weight1 + vector2.x2 * weight2;
|
||||
sum.x3 = vector1.x3 * weight1 + vector2.x3 * weight2;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum3(
|
||||
float weight1, in F32Vector3 vector1,
|
||||
float weight2, in F32Vector3 vector2,
|
||||
float weight3, in F32Vector3 vector3,
|
||||
out F32Vector3 sum
|
||||
)
|
||||
{
|
||||
sum.x1 = vector1.x1 * weight1 + vector2.x1 * weight2 + vector3.x1 * weight3;
|
||||
sum.x2 = vector1.x2 * weight1 + vector2.x2 * weight2 + vector3.x2 * weight3;
|
||||
sum.x3 = vector1.x3 * weight1 + vector2.x3 * weight2 + vector3.x3 * weight3;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum4(
|
||||
float weight1, in F32Vector3 vector1,
|
||||
float weight2, in F32Vector3 vector2,
|
||||
float weight3, in F32Vector3 vector3,
|
||||
float weight4, in F32Vector3 vector4,
|
||||
out F32Vector3 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);
|
||||
sum.x3 = (vector1.x3 * weight1 + vector2.x3 * weight2) + (vector3.x3 * weight3 + vector4.x3 * weight4);
|
||||
}
|
||||
|
||||
public static void GetWeightedSum5(
|
||||
float weight1, in F32Vector3 vector1,
|
||||
float weight2, in F32Vector3 vector2,
|
||||
float weight3, in F32Vector3 vector3,
|
||||
float weight4, in F32Vector3 vector4,
|
||||
float weight5, in F32Vector3 vector5,
|
||||
out F32Vector3 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;
|
||||
sum.x3 = (vector1.x3 * weight1 + vector2.x3 * weight2) + (vector3.x3 * weight3 + vector4.x3 * weight4) + vector5.x3 * weight5;
|
||||
}
|
||||
|
||||
public static void GetMean2(
|
||||
in F32Vector3 vector1,
|
||||
in F32Vector3 vector2,
|
||||
out F32Vector3 result
|
||||
)
|
||||
public static void GetMean2(in F32Vector3 vector1, in F32Vector3 vector2, out F32Vector3 result)
|
||||
{
|
||||
result.x1 = (vector1.x1 + vector2.x1) * 0.5f;
|
||||
result.x2 = (vector1.x2 + vector2.x2) * 0.5f;
|
||||
result.x3 = (vector1.x3 + vector2.x3) * 0.5f;
|
||||
}
|
||||
|
||||
public static void GetMean3(
|
||||
in F32Vector3 vector1,
|
||||
in F32Vector3 vector2,
|
||||
in F32Vector3 vector3,
|
||||
out F32Vector3 result
|
||||
)
|
||||
public static void GetMean3(in F32Vector3 vector1, in F32Vector3 vector2, in F32Vector3 vector3, out F32Vector3 result)
|
||||
{
|
||||
result.x1 = (vector1.x1 + vector2.x1 + vector3.x1) * F32Utility.ONE_THIRD;
|
||||
result.x2 = (vector1.x2 + vector2.x2 + vector3.x2) * F32Utility.ONE_THIRD;
|
||||
result.x3 = (vector1.x3 + vector2.x3 + vector3.x3) * F32Utility.ONE_THIRD;
|
||||
}
|
||||
|
||||
public static void GetMean4(
|
||||
in F32Vector3 vector1,
|
||||
in F32Vector3 vector2,
|
||||
in F32Vector3 vector3,
|
||||
in F32Vector3 vector4,
|
||||
out F32Vector3 result
|
||||
)
|
||||
{
|
||||
result.x1 = ((vector1.x1 + vector2.x1) + (vector3.x1 + vector4.x1)) * 0.25f;
|
||||
result.x2 = ((vector1.x2 + vector2.x2) + (vector3.x2 + vector4.x2)) * 0.25f;
|
||||
result.x3 = ((vector1.x3 + vector2.x3) + (vector3.x3 + vector4.x3)) * 0.25f;
|
||||
}
|
||||
|
||||
public static void GetMean5(
|
||||
in F32Vector3 vector1,
|
||||
in F32Vector3 vector2,
|
||||
in F32Vector3 vector3,
|
||||
in F32Vector3 vector4,
|
||||
in F32Vector3 vector5,
|
||||
out F32Vector3 result
|
||||
)
|
||||
{
|
||||
result.x1 = ((vector1.x1 + vector2.x1) + (vector3.x1 + vector4.x1) + vector5.x1) * 0.2f;
|
||||
result.x2 = ((vector1.x2 + vector2.x2) + (vector3.x2 + vector4.x2) + vector5.x2) * 0.2f;
|
||||
result.x3 = ((vector1.x3 + vector2.x3) + (vector3.x3 + vector4.x3) + vector5.x3) * 0.2f;
|
||||
}
|
||||
|
||||
public static float GetScalarProduct(in F32Vector3 vector1, in F32Vector3 vector2)
|
||||
{
|
||||
return vector1.x1 * vector2.x1 + vector1.x2 * vector2.x2 + vector1.x3 * vector2.x3;
|
||||
|
|
|
|||
|
|
@ -81,28 +81,6 @@ namespace BGC
|
|||
return 1;
|
||||
}
|
||||
|
||||
public readonly F64Vector2 GetNormalized()
|
||||
{
|
||||
double squareModule = this.GetSquareModule();
|
||||
|
||||
if (1.0 - F64Utility.TWO_EPSYLON <= squareModule && squareModule <= 1.0 + F64Utility.TWO_EPSYLON)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
if (squareModule <= F64Utility.SQUARE_EPSYLON)
|
||||
{
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
double module = Math.Sqrt(squareModule);
|
||||
|
||||
return new F64Vector2(
|
||||
this.x1 / module,
|
||||
this.x2 / module
|
||||
);
|
||||
}
|
||||
|
||||
public void Reverse()
|
||||
{
|
||||
this.x1 = -this.x1;
|
||||
|
|
@ -156,6 +134,12 @@ namespace BGC
|
|||
this.x2 = -vector.x2;
|
||||
}
|
||||
|
||||
public void AppendScaled(F64Vector2 scalableSummand, double scale)
|
||||
{
|
||||
this.x1 += scalableSummand.x1 * scale;
|
||||
this.x2 += scalableSummand.x2 * scale;
|
||||
}
|
||||
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return String.Format("DPVector2({0}, {1})", this.x1, this.x2);
|
||||
|
|
@ -185,92 +169,18 @@ namespace BGC
|
|||
quotient.x2 = dividend.x2 / divisor;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum2(
|
||||
double weight1, in F64Vector2 vector1,
|
||||
double weight2, in F64Vector2 vector2,
|
||||
out F64Vector2 sum
|
||||
)
|
||||
{
|
||||
sum.x1 = vector1.x1 * weight1 + vector2.x1 * weight2;
|
||||
sum.x2 = vector1.x2 * weight1 + vector2.x2 * weight2;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum3(
|
||||
double weight1, in F64Vector2 vector1,
|
||||
double weight2, in F64Vector2 vector2,
|
||||
double weight3, in F64Vector2 vector3,
|
||||
out F64Vector2 sum
|
||||
)
|
||||
{
|
||||
sum.x1 = vector1.x1 * weight1 + vector2.x1 * weight2 + vector3.x1 * weight3;
|
||||
sum.x2 = vector1.x2 * weight1 + vector2.x2 * weight2 + vector3.x2 * weight3;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum4(
|
||||
double weight1, in F64Vector2 vector1,
|
||||
double weight2, in F64Vector2 vector2,
|
||||
double weight3, in F64Vector2 vector3,
|
||||
double weight4, in F64Vector2 vector4,
|
||||
out F64Vector2 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);
|
||||
}
|
||||
|
||||
public static void GetWeightedSum5(
|
||||
double weight1, in F64Vector2 vector1,
|
||||
double weight2, in F64Vector2 vector2,
|
||||
double weight3, in F64Vector2 vector3,
|
||||
double weight4, in F64Vector2 vector4,
|
||||
double weight5, in F64Vector2 vector5,
|
||||
out F64Vector2 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 GetMean2(
|
||||
in F64Vector2 vector1,
|
||||
in F64Vector2 vector2,
|
||||
out F64Vector2 result)
|
||||
public static void GetMean2(in F64Vector2 vector1, in F64Vector2 vector2, out F64Vector2 result)
|
||||
{
|
||||
result.x1 = (vector1.x1 + vector2.x1) * 0.5;
|
||||
result.x2 = (vector1.x2 + vector2.x2) * 0.5;
|
||||
}
|
||||
|
||||
public static void GetMean3(
|
||||
in F64Vector2 vector1,
|
||||
in F64Vector2 vector2,
|
||||
in F64Vector2 vector3,
|
||||
out F64Vector2 result)
|
||||
public static void GetMean3(in F64Vector2 vector1, in F64Vector2 vector2, in F64Vector2 vector3, out F64Vector2 result)
|
||||
{
|
||||
result.x1 = (vector1.x1 + vector2.x1 + vector3.x1) * F64Utility.ONE_THIRD;
|
||||
result.x2 = (vector1.x2 + vector2.x2 + vector3.x2) * F64Utility.ONE_THIRD;
|
||||
}
|
||||
|
||||
public static void GetMean4(
|
||||
in F64Vector2 vector1,
|
||||
in F64Vector2 vector2,
|
||||
in F64Vector2 vector3,
|
||||
in F64Vector2 vector4,
|
||||
out F64Vector2 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;
|
||||
}
|
||||
|
||||
public static void GetMean5(
|
||||
in F64Vector2 vector1,
|
||||
in F64Vector2 vector2,
|
||||
in F64Vector2 vector3,
|
||||
in F64Vector2 vector4,
|
||||
in F64Vector2 vector5,
|
||||
out F64Vector2 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;
|
||||
}
|
||||
|
||||
public static double GetScalarProduct(in F64Vector2 vector1, in F64Vector2 vector2)
|
||||
{
|
||||
return vector1.x1 * vector2.x1 + vector1.x2 * vector2.x2;
|
||||
|
|
|
|||
|
|
@ -86,29 +86,6 @@ namespace BGC
|
|||
return 1;
|
||||
}
|
||||
|
||||
public readonly F64Vector3 GetNormalized()
|
||||
{
|
||||
double squareModule = this.GetSquareModule();
|
||||
|
||||
if (1.0 - F64Utility.TWO_EPSYLON <= squareModule && squareModule <= 1.0 + F64Utility.TWO_EPSYLON)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
if (squareModule <= F64Utility.SQUARE_EPSYLON)
|
||||
{
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
double module = Math.Sqrt(squareModule);
|
||||
|
||||
return new F64Vector3(
|
||||
this.x1 / module,
|
||||
this.x2 / module,
|
||||
this.x3 / module
|
||||
);
|
||||
}
|
||||
|
||||
public void Reverse()
|
||||
{
|
||||
this.x1 = -this.x1;
|
||||
|
|
@ -169,6 +146,13 @@ namespace BGC
|
|||
this.x3 = -vector.x3;
|
||||
}
|
||||
|
||||
public void AppendScaled(F64Vector3 scalableSummand, double scale)
|
||||
{
|
||||
this.x1 += scalableSummand.x1 * scale;
|
||||
this.x2 += scalableSummand.x2 * scale;
|
||||
this.x3 += scalableSummand.x3 * scale;
|
||||
}
|
||||
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return String.Format("DPVector3({0}, {1}, {2})", this.x1, this.x2, this.x3);
|
||||
|
|
@ -202,98 +186,20 @@ namespace BGC
|
|||
quotient.x3 = dividend.x3 / divisor;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum2(
|
||||
double weight1, in F64Vector3 vector1,
|
||||
double weight2, in F64Vector3 vector2,
|
||||
out F64Vector3 sum)
|
||||
{
|
||||
sum.x1 = vector1.x1 * weight1 + vector2.x1 * weight2;
|
||||
sum.x2 = vector1.x2 * weight1 + vector2.x2 * weight2;
|
||||
sum.x3 = vector1.x3 * weight1 + vector2.x3 * weight2;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum3(
|
||||
double weight1, in F64Vector3 vector1,
|
||||
double weight2, in F64Vector3 vector2,
|
||||
double weight3, in F64Vector3 vector3,
|
||||
out F64Vector3 sum)
|
||||
{
|
||||
sum.x1 = vector1.x1 * weight1 + vector2.x1 * weight2 + vector3.x1 * weight3;
|
||||
sum.x2 = vector1.x2 * weight1 + vector2.x2 * weight2 + vector3.x2 * weight3;
|
||||
sum.x3 = vector1.x3 * weight1 + vector2.x3 * weight2 + vector3.x3 * weight3;
|
||||
}
|
||||
|
||||
public static void GetWeightedSum4(
|
||||
double weight1, in F64Vector3 vector1,
|
||||
double weight2, in F64Vector3 vector2,
|
||||
double weight3, in F64Vector3 vector3,
|
||||
double weight4, in F64Vector3 vector4,
|
||||
out F64Vector3 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);
|
||||
sum.x3 = (vector1.x3 * weight1 + vector2.x3 * weight2) + (vector3.x3 * weight3 + vector4.x3 * weight4);
|
||||
}
|
||||
|
||||
public static void GetWeightedSum5(
|
||||
double weight1, in F64Vector3 vector1,
|
||||
double weight2, in F64Vector3 vector2,
|
||||
double weight3, in F64Vector3 vector3,
|
||||
double weight4, in F64Vector3 vector4,
|
||||
double weight5, in F64Vector3 vector5,
|
||||
out F64Vector3 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;
|
||||
sum.x3 = (vector1.x3 * weight1 + vector2.x3 * weight2) + (vector3.x3 * weight3 + vector4.x3 * weight4) + vector5.x3 * weight5;
|
||||
}
|
||||
|
||||
public static void GetMean2(
|
||||
in F64Vector3 vector1,
|
||||
in F64Vector3 vector2,
|
||||
out F64Vector3 result)
|
||||
public static void GetMean2(in F64Vector3 vector1, in F64Vector3 vector2, out F64Vector3 result)
|
||||
{
|
||||
result.x1 = (vector1.x1 + vector2.x1) * 0.5;
|
||||
result.x2 = (vector1.x2 + vector2.x2) * 0.5;
|
||||
result.x3 = (vector1.x3 + vector2.x3) * 0.5;
|
||||
}
|
||||
|
||||
public static void GetMean3(
|
||||
in F64Vector3 vector1,
|
||||
in F64Vector3 vector2,
|
||||
in F64Vector3 vector3,
|
||||
out F64Vector3 result)
|
||||
public static void GetMean3(in F64Vector3 vector1, in F64Vector3 vector2, in F64Vector3 vector3, out F64Vector3 result)
|
||||
{
|
||||
result.x1 = (vector1.x1 + vector2.x1 + vector3.x1) * F64Utility.ONE_THIRD;
|
||||
result.x2 = (vector1.x2 + vector2.x2 + vector3.x2) * F64Utility.ONE_THIRD;
|
||||
result.x3 = (vector1.x3 + vector2.x3 + vector3.x3) * F64Utility.ONE_THIRD;
|
||||
}
|
||||
|
||||
public static void GetMean4(
|
||||
in F64Vector3 vector1,
|
||||
in F64Vector3 vector2,
|
||||
in F64Vector3 vector3,
|
||||
in F64Vector3 vector4,
|
||||
out F64Vector3 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;
|
||||
result.x3 = ((vector1.x3 + vector2.x3) + (vector3.x3 + vector4.x3)) * 0.25;
|
||||
}
|
||||
|
||||
public static void GetMean5(
|
||||
in F64Vector3 vector1,
|
||||
in F64Vector3 vector2,
|
||||
in F64Vector3 vector3,
|
||||
in F64Vector3 vector4,
|
||||
in F64Vector3 vector5,
|
||||
out F64Vector3 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;
|
||||
result.x3 = ((vector1.x3 + vector2.x3) + (vector3.x3 + vector4.x3) + vector5.x3) * 0.2;
|
||||
}
|
||||
|
||||
public static double GetScalarProduct(in F64Vector3 vector1, in F64Vector3 vector2)
|
||||
{
|
||||
return vector1.x1 * vector2.x1 + vector1.x2 * vector2.x2 + vector1.x3 * vector2.x3;
|
||||
|
|
@ -394,4 +300,3 @@ namespace BGC
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue