本文整理汇总了C#中Vector3D.IsOrthogonalTo方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3D.IsOrthogonalTo方法的具体用法?C# Vector3D.IsOrthogonalTo怎么用?C# Vector3D.IsOrthogonalTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector3D
的用法示例。
在下文中一共展示了Vector3D.IsOrthogonalTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestIsOrthogonalTo
public void TestIsOrthogonalTo()
{
const float tolerance = 1e-5F;
Vector3D v1 = Vector3D.xUnit;
Vector3D v2 = Vector3D.yUnit;
Assert.IsTrue(v1.IsOrthogonalTo(v2, tolerance));
v2 = -Vector3D.yUnit;
Assert.IsTrue(v1.IsOrthogonalTo(v2, tolerance));
v2 = Vector3D.zUnit;
Assert.IsTrue(v1.IsOrthogonalTo(v2, tolerance));
v2 = -Vector3D.zUnit;
Assert.IsTrue(v1.IsOrthogonalTo(v2, tolerance));
v1 = Vector3D.yUnit;
v2 = Vector3D.zUnit;
Assert.IsTrue(v1.IsOrthogonalTo(v2, tolerance));
v2 = -Vector3D.zUnit;
Assert.IsTrue(v1.IsOrthogonalTo(v2, tolerance));
v1 = Vector3D.xUnit;
v2 = Vector3D.xUnit;
Assert.IsFalse(v1.IsOrthogonalTo(v2, tolerance));
v2 = -Vector3D.xUnit;
Assert.IsFalse(v1.IsOrthogonalTo(v2, tolerance));
v1 = new Vector3D(2.2F, -6.1F, 7.4F);
v2 = new Vector3D(3.8F, 3.7F, 4.1F);
Assert.IsFalse(v1.IsOrthogonalTo(v2, tolerance));
//Angle between is 75.845 degrees; "big" tolerance is 14.156
const float bigTolerance = 0.24706F;
Assert.IsTrue(v1.IsOrthogonalTo(v2, bigTolerance));
}
示例2: SetPatientOrientation
private void SetPatientOrientation(Vector3D rowDirectionPatient, Vector3D columnDirectionPatient)
{
if (!CanRotate())
return;
if (rowDirectionPatient == null || columnDirectionPatient == null || !rowDirectionPatient.IsOrthogonalTo(columnDirectionPatient, (float) (5/180d*Math.PI)))
return;
var patientPresentation = SelectedPresentationImage as IPatientPresentationProvider;
if (patientPresentation == null || !patientPresentation.PatientPresentation.IsValid)
return;
// Note the inverted column orientation vectors in both matrices - this is due to implicit Y axis inversion in the 3D transform
columnDirectionPatient = -columnDirectionPatient;
var currentRowOrientation = patientPresentation.PatientPresentation.OrientationX;
var currentColumnOrientation = -patientPresentation.PatientPresentation.OrientationY;
var currentOrientation = Matrix3D.FromRows(currentRowOrientation.Normalize(), currentColumnOrientation.Normalize(), currentRowOrientation.Cross(currentColumnOrientation).Normalize());
var requestedOrientation = Matrix3D.FromRows(rowDirectionPatient.Normalize(), columnDirectionPatient.Normalize(), rowDirectionPatient.Cross(columnDirectionPatient).Normalize());
var transform = _operation.GetOriginator(SelectedPresentationImage);
// (because we're dealing with rotation matrices (i.e. orthogonal!), the Inverse is just Transpose)
var rotation = requestedOrientation*currentOrientation.Transpose();
transform.Rotation = rotation*transform.Rotation; // this rotation is cumulative upon current rotation, since IPatientPresentationProvider is based on *current* view
SelectedPresentationImage.Draw();
}