本文整理汇总了C#中Matrix3x3类的典型用法代码示例。如果您正苦于以下问题:C# Matrix3x3类的具体用法?C# Matrix3x3怎么用?C# Matrix3x3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Matrix3x3类属于命名空间,在下文中一共展示了Matrix3x3类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetTransformMatrix
/// <summary>
/// Set transform matrix
/// </summary>
/// <param name="transformMatrix">transform matrix</param>
public /*internal*/ virtual void SetTransformMatrix(Matrix3x3 transformMatrix)
{
if (transformMatrix != null)
{
CurrentTransformMatrix = transformMatrix;
// check if current transform is transformed
IsTransformed = transformMatrix.IsTransformed;
if (IsTransformed)
{
#region calculate inverted matrix
Matrix3x3 InvertedMatrix = transformMatrix.InvertedMatrix;
if (InvertedMatrix != null)
{
InvertedMatrixSx = InvertedMatrix.Sx;
InvertedMatrixSy = InvertedMatrix.Sy;
InvertedMatrixShy = InvertedMatrix.Shy;
InvertedMatrixShx = InvertedMatrix.Shx;
InvertedMatrixTx = InvertedMatrix.Tx;
InvertedMatrixTy = InvertedMatrix.Ty;
}
else
{
InvertedMatrixSx = 0.0;
InvertedMatrixSy = 0.0;
InvertedMatrixShy = 0.0;
InvertedMatrixShx = 0.0;
InvertedMatrixTx = 0.0;
InvertedMatrixTy = 0.0;
}
#endregion
}
}
}
开发者ID:kevincwq,项目名称:Cross.Drawing,代码行数:37,代码来源:TranformableRasterizer.cs
示例2: GetSymInverse33
public Matrix3x3 GetSymInverse33(Matrix3x3 M)
{
float det = Vector3.Dot(Column1, Vector3.Cross(Column2, Column3));
if (det != 0.0f)
{
det = 1.0f / det;
}
float a11 = Column1.X, a12 = Column2.X, a13 = Column3.X;
float a22 = Column2.Y, a23 = Column3.Y;
float a33 = Column3.Z;
M.Column1.X = det * (a22 * a33 - a23 * a23);
M.Column1.Y = det * (a13 * a23 - a12 * a33);
M.Column1.Z = det * (a12 * a23 - a13 * a22);
M.Column2.X = M.Column1.Y;
M.Column2.Y = det * (a11 * a33 - a13 * a13);
M.Column2.Z = det * (a13 * a12 - a11 * a23);
M.Column3.X = M.Column1.Z;
M.Column3.Y = M.Column2.Z;
M.Column3.Z = det * (a11 * a22 - a12 * a12);
return M;
}
开发者ID:Dani88,项目名称:SphereBed,代码行数:26,代码来源:Matrix3x3.cs
示例3: Test_Determinant
public void Test_Determinant()
{
var m = new Matrix3x3 (1, 2, 1,
1, 1, -1,
2, 1, 1);
Assert.AreEqual (-5, m.Determinant);
}
开发者ID:weimingtom,项目名称:erica,代码行数:7,代码来源:TestMatrix3x3.cs
示例4: computeEulerFromMatrixXYZ
///<summary>
/// Receive a rotation matrix of type Matrix4
/// Return a Vector3Float containing the rotation around the 3 axis
///</summary>
public static Vecto3Float computeEulerFromMatrixXYZ(Matrix3x3 m)
{
Vecto3Float sol = new Vecto3Float();
if (m.matrix[0, 2] < 1f)
{
if (m.matrix[0, 2] > -1f)
{
sol.X = (float)Math.Atan2(-m.matrix[1, 2], m.matrix[2, 2]);
sol.Y = (float)Math.Asin(-(m.matrix[0, 2]));
sol.Z = (float)Math.Atan2(-m.matrix[0, 1], m.matrix[0, 0]);
}
else
{
sol.X = -(float)Math.Atan2(m.matrix[1, 0], m.matrix[1, 1]);
sol.Y = -(float)(Math.PI) / 2;
sol.Z = 0f;
}
}
else
{
sol.X = (float)Math.Atan2(m.matrix[1, 0], m.matrix[1, 1]);
sol.Y = (float)(Math.PI) / 2;
sol.Z = 0f;
}
return sol;
}
开发者ID:TheVerga,项目名称:NAOKinect,代码行数:32,代码来源:Kinematic.cs
示例5: ConstructorValuesAreAccessibleByIndexer
public void ConstructorValuesAreAccessibleByIndexer()
{
Matrix3x3 matrix3x3;
matrix3x3 = new Matrix3x3();
for (int x = 0; x < matrix3x3.Columns; x++)
{
for (int y = 0; y < matrix3x3.Rows; y++)
{
Assert.Equal(0, matrix3x3[x, y], Epsilon);
}
}
double value = 33.33;
matrix3x3 = new Matrix3x3(value);
for (int x = 0; x < matrix3x3.Columns; x++)
{
for (int y = 0; y < matrix3x3.Rows; y++)
{
Assert.Equal(value, matrix3x3[x, y], Epsilon);
}
}
GenerateFilledMatrixWithValues(out matrix3x3);
for (int y = 0; y < matrix3x3.Rows; y++)
{
for (int x = 0; x < matrix3x3.Columns; x++)
{
Assert.Equal(y * matrix3x3.Columns + x, matrix3x3[x, y], Epsilon);
}
}
}
开发者ID:SmartCloudAI,项目名称:corefxlab,代码行数:35,代码来源:Test3x3.cs
示例6: NoRotationJointDescriptor
public NoRotationJointDescriptor(Matrix3x3 anchorOrientationALocal, Matrix3x3 anchorOrientationBLocal, IRigidBody rigidBodyA = null, IRigidBody rigidBodyB = null, object userData = null) : this()
{
AnchorOrientationALocal = anchorOrientationALocal;
AnchorOrientationBLocal = anchorOrientationBLocal;
RigidBodyA = rigidBodyA;
RigidBodyB = rigidBodyB;
UserData = userData;
}
开发者ID:sandygk,项目名称:System.Physics,代码行数:8,代码来源:NoRotationJointDescriptor.cs
示例7: ConstantValuesAreCorrect
public void ConstantValuesAreCorrect()
{
Matrix3x3 matrix3x3 = new Matrix3x3();
Assert.Equal(3, matrix3x3.Columns);
Assert.Equal(3, matrix3x3.Rows);
Assert.Equal(Matrix3x3.ColumnCount, matrix3x3.Columns);
Assert.Equal(Matrix3x3.RowCount, matrix3x3.Rows);
}
开发者ID:SmartCloudAI,项目名称:corefxlab,代码行数:9,代码来源:Test3x3.cs
示例8: ReadData
public override void ReadData(GrnBinaryReader reader, int directoryOffset)
{
reader.Seek((int)(this.Offset + directoryOffset), SeekOrigin.Begin);
this.ParentIndex = reader.ReadInt32();
this.Position = reader.ReadVector3D();
this.Rotation = reader.ReadQuaternion();
this.Scale = reader.ReadMatrix3x3();
if (this.GetReadDataLength() != this.GetWriteDataLength()) throw new Exception("bbb");
}
开发者ID:Ryder25,项目名称:Age-of-Mythology,代码行数:9,代码来源:GrnBoneNode.cs
示例9: Matrix3x3
public static Matrix3x3 operator -(Matrix3x3 m1, Matrix3x3 m2)
{
Matrix3x3 kSum = new Matrix3x3();
for (int iRow = 0; iRow < 3; iRow++) {
for (int iCol = 0; iCol < 3; iCol++) {
kSum.m[iRow,iCol] = m1.m[iRow,iCol] - m2.m[iRow,iCol];
}
}
return kSum;
}
开发者ID:kharbechteinn,项目名称:Scatterer,代码行数:10,代码来源:Matrix3x3.cs
示例10: Rotate12
static void Rotate12(ref SymmetricMatrix3x3 vtav, ref Matrix3x3 v)
{
if (vtav.m12 == 0)
{
return;
}
float c, s;
Schur2.Rot12(ref vtav, out c, out s);
Givens.Rot12_post(ref v, c, s);
}
开发者ID:smogpill,项目名称:transit,代码行数:11,代码来源:Svd.cs
示例11: GetSymmetricSvd
static void GetSymmetricSvd(SymmetricMatrix3x3 a, out SymmetricMatrix3x3 vtav, out Matrix3x3 v, float tol, int max_sweeps)
{
vtav = a;
v = Matrix3x3.identity;
float delta = tol * vtav.FNorm;
for (int i = 0; i < max_sweeps && vtav.Off > delta; ++i)
{
Rotate01(ref vtav, ref v);
Rotate02(ref vtav, ref v);
Rotate12(ref vtav, ref v);
}
}
开发者ID:smogpill,项目名称:transit,代码行数:12,代码来源:Svd.cs
示例12: transpose
public static Matrix3x3 transpose(Matrix3x3 toTra)
{
Matrix3x3 result = new Matrix3x3();
for (int i = 0; i < DIMENSION; i++)
{
for (int j = 0; j < DIMENSION; j++)
{
result.matrix[j,i] = toTra.matrix[i,j];
}
}
return result;
}
开发者ID:TheVerga,项目名称:NAOKinect,代码行数:12,代码来源:Matrix3x3.cs
示例13: Write
public void Write(Matrix3x3 m)
{
this.Write(m.A1);
this.Write(m.A2);
this.Write(m.A3);
this.Write(m.B1);
this.Write(m.B2);
this.Write(m.B3);
this.Write(m.C1);
this.Write(m.C2);
this.Write(m.C3);
}
开发者ID:Ryder25,项目名称:Age-of-Mythology,代码行数:12,代码来源:GrnBinaryWriter.cs
示例14: Write
public void Write(Matrix3x3 value)
{
Write(value.m00);
Write(value.m01);
Write(value.m02);
Write(value.m10);
Write(value.m11);
Write(value.m12);
Write(value.m20);
Write(value.m21);
Write(value.m22);
}
开发者ID:timdetering,项目名称:Physics2D.Net,代码行数:14,代码来源:MathWriter.cs
示例15: Test_Equals
public void Test_Equals()
{
var delta = 0.00001f;
var a = new Matrix3x3 (1, 1, 1,
1, 1, 1,
1, 1, 1);
var b = new Matrix3x3 (1 + delta, 1 + delta, 1 + delta,
1 + delta, 1 + delta, 1 + delta,
1 + delta, 1 + delta, 1 + delta);
Assert.IsTrue (a.Equals (b)); // 誤差許容
Assert.IsFalse (a == b); // 厳密な比較
Assert.IsFalse (a.GetHashCode () == b.GetHashCode ()); // 厳密な比較に基づくハッシュ値
}
开发者ID:weimingtom,项目名称:erica,代码行数:14,代码来源:TestMatrix3x3.cs
示例16: FromMatrix
/// <summary>
/// Erstellt aus der angegebenen Matrix eine Matrix4x4, sofern die Abmessungen stimmen.
/// </summary>
public static new Matrix3x3 FromMatrix(Matrix m)
{
if (m.ColumnCount == 3 && m.RowCount == 3)
{
var sm = new Matrix3x3();
for (int x = 0; x < sm.Size; x++)
for (int y = 0; y < sm.Size; y++)
sm[x, y] = m[x, y]; //Wert kopieren
return sm;
}
else //falsche Abmessungen
throw new ArgumentException("Die angegebene Matrix war nicht in eine Matrix3x3 konvertierbar.");
}
开发者ID:Artentus,项目名称:MathUtils,代码行数:18,代码来源:Matrix3x3.cs
示例17: GetInverse22
public Matrix3x3 GetInverse22(Matrix3x3 M)
{
float a = Column1.X, b = Column2.X, c = Column1.Y, d = Column2.Y;
float det = a * d - b * c;
if (det != 0.0f)
{
det = 1.0f / det;
}
M.Column1.X = det * d; M.Column2.X = -det * b; M.Column1.Z = 0.0f;
M.Column1.Y = -det * c; M.Column2.Y = det * a; M.Column2.Z = 0.0f;
M.Column3.X = 0.0f; M.Column3.Y = 0.0f; M.Column3.Z = 0.0f;
return M;
}
开发者ID:Dani88,项目名称:SphereBed,代码行数:15,代码来源:Matrix3x3.cs
示例18: leftMul
public Matrix3x3 leftMul(Matrix3x3 mulby)
{
Matrix3x3 result = new Matrix3x3();
for(int i=0; i<DIMENSION; i++){
for (int j = 0; j < DIMENSION; j++)
{
for (int k = 0; k < DIMENSION; k++)
{
result.matrix[i,j] = mulby.matrix[k,j] * this.matrix[i,k] ;
}
}
}
return result;
}
开发者ID:TheVerga,项目名称:NAOKinect,代码行数:16,代码来源:Matrix3x3.cs
示例19: Rot12_post
public static void Rot12_post(ref Matrix3x3 m, float c, float s)
{
float m01 = m.m01;
float m02 = m.m02;
float m11 = m.m11;
float m12 = m.m12;
float m21 = m.m21;
float m22 = m.m22;
m.m01 = c * m01 - s * m02;
m.m02 = s * m01 + c * m02;
m.m11 = c * m11 - s * m12;
m.m12 = s * m11 + c * m12;
m.m21 = c * m21 - s * m22;
m.m22 = s * m21 + c * m22;
}
开发者ID:smogpill,项目名称:transit,代码行数:16,代码来源:Givens.cs
示例20: Rot02_post
public static void Rot02_post(ref Matrix3x3 m, float c, float s)
{
float m00 = m.m00;
float m02 = m.m02;
float m10 = m.m10;
float m12 = m.m12;
float m20 = m.m20;
float m22 = m.m22;
m.m00 = c * m00 - s * m02;
m.m02 = s * m00 + c * m02;
m.m10 = c * m10 - s * m12;
m.m12 = s * m10 + c * m12;
m.m20 = c * m20 - s * m22;
m.m22 = s * m20 + c * m22;
}
开发者ID:smogpill,项目名称:transit,代码行数:16,代码来源:Givens.cs
注:本文中的Matrix3x3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论