本文整理汇总了C#中Rotation.ReverseRotation方法的典型用法代码示例。如果您正苦于以下问题:C# Rotation.ReverseRotation方法的具体用法?C# Rotation.ReverseRotation怎么用?C# Rotation.ReverseRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rotation
的用法示例。
在下文中一共展示了Rotation.ReverseRotation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: T_Viewport
public T_Viewport(SizeF sourceSize, Vector2D sourceUnits,
SizeF targetSize, Vector2D targetUnits,
Rotation targetRotation)
{
this.sourceSize = sourceSize;
this.sourceUnits = sourceUnits;
this.targetSize = targetSize;
this.targetUnits = targetUnits;
this.targetRotation = targetRotation;
// create 2D scaling & rotation & axis reflection
var normalizedTargetSize = Matrix2x2.RotationMatrix(targetRotation.ReverseRotation()) * targetSize;
float mx = normalizedTargetSize.Width / sourceSize.Width;
float my = normalizedTargetSize.Height / sourceSize.Height;
var reflection = Matrix2x2.Unit();
if (targetUnits.x * sourceUnits.x < 0)
reflection.x1y1 = -1;
if (targetUnits.y * sourceUnits.y < 0)
reflection.x2y2 = -1;
Matrix2x2 scaleRotateReflect = new Matrix2x2(mx, 0, 0, my) * Matrix2x2.RotationMatrix(targetRotation) * reflection;
// combine with translation into a 3D matrix
m = new Matrix3x3(scaleRotateReflect);
if (m.x1y1 < 0)
m.x3y1 = normalizedTargetSize.Width;
if (m.x1y2 < 0)
m.x3y2 = normalizedTargetSize.Width;
if (m.x2y1 < 0)
m.x3y1 = normalizedTargetSize.Height;
if (m.x2y2 < 0)
m.x3y2 = normalizedTargetSize.Height;
}
示例2: ReverseRotationMatrix
public static Matrix2x2 ReverseRotationMatrix(Rotation rotation, float unit = 1f)
{
return RotationMatrix(rotation.ReverseRotation(), unit);
}