本文整理汇总了C#中System.Windows.Media.Media3D.Matrix3D.MultiplyPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix3D.MultiplyPoint方法的具体用法?C# Matrix3D.MultiplyPoint怎么用?C# Matrix3D.MultiplyPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Media3D.Matrix3D
的用法示例。
在下文中一共展示了Matrix3D.MultiplyPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Transform
public static void Transform(Matrix3D modelMatrix,
ref Point3D origin, ref Vector3D direction, out bool isRay)
{
if (modelMatrix.InvertCore())
{
Point4D o = new Point4D(origin.X,origin.Y,origin.Z,1);
Point4D d = new Point4D(direction.X,direction.Y,direction.Z,0);
modelMatrix.MultiplyPoint(ref o);
modelMatrix.MultiplyPoint(ref d);
if (o.W == 1 && d.W == 0)
{
// Affine transformation
origin = new Point3D(o.X, o.Y, o.Z);
direction = new Vector3D(d.X, d.Y, d.Z);
isRay = true;
}
else
{
// Non-affine transformation (likely projection)
// Form 4x2 matrix with two points on line in two columns.
double[,] linepoints = new double[,]{{o.X,d.X},{o.Y,d.Y},{o.Z,d.Z},{o.W,d.W}};
ColumnsToAffinePointVector(linepoints,0,1,out origin, out direction);
isRay = false;
}
}
else
{
TransformSingular(ref modelMatrix, ref origin, ref direction);
isRay = false;
}
}