当前位置: 首页>>代码示例>>C#>>正文


C# Vector3D.IsOrthogonalTo方法代码示例

本文整理汇总了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));
		}
开发者ID:nhannd,项目名称:Xian,代码行数:35,代码来源:Vector3DTests.cs

示例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();
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:28,代码来源:Rotate3DTool.cs


注:本文中的Vector3D.IsOrthogonalTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。