本文整理汇总了C#中Matrix4F.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix4F.ToArray方法的具体用法?C# Matrix4F.ToArray怎么用?C# Matrix4F.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4F
的用法示例。
在下文中一共展示了Matrix4F.ToArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Transform
/// <summary>
/// Sets box to extents of original box, transformed by the given matrix</summary>
/// <param name="M">Transformation matrix</param>
public void Transform(Matrix4F M)
{
// http://www.ics.uci.edu/~arvo/code/TransformingBoxes.c
// "Transforming Axis-Aligned Bounding Boxes",
// by Jim Arvo, in "Graphics Gems", Academic Press, 1990.
float[] oldMin = new[] { Min.X, Min.Y, Min.Z };
float[] oldMax = new[] { Max.X, Max.Y, Max.Z };
float[] newMin = new[] { M.M41, M.M42, M.M43 };
float[] newMax = new[] { newMin[0], newMin[1], newMin[2] };
float[] mArray = M.ToArray();
float a, b;
for (int i = 0; i < 3; ++i)
{
for (int j = 0; j < 3; ++j)
{
a = mArray[j * 4 + i] * oldMin[j];
b = mArray[j * 4 + i] * oldMax[j];
if (a < b)
{
newMin[i] += a;
newMax[i] += b;
}
else
{
newMin[i] += b;
newMax[i] += a;
}
}
}
Min.X = newMin[0];
Min.Y = newMin[1];
Min.Z = newMin[2];
Max.X = newMax[0];
Max.Y = newMax[1];
Max.Z = newMax[2];
m_initialized = true;
}
示例2: SetMatrix
/// <summary>
/// Sets the DomNode attribute to the given Matrix4F</summary>
/// <param name="domNode">DomNode holding attribute</param>
/// <param name="attribute">Attribute of the DomNode that contains the data</param>
/// <param name="m">Matrix4F value to be set</param>
public static void SetMatrix(DomNode domNode, AttributeInfo attribute, Matrix4F m)
{
domNode.SetAttribute(attribute, m.ToArray());
}
示例3: SetMatrix4x4
public static void SetMatrix4x4(this DomNodeAdapter node, AttributeInfo attributeInfo, Matrix4F mat)
{
node.DomNode.SetAttribute(attributeInfo, mat.ToArray());
}