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


C# Plane.Intersect方法代码示例

本文整理汇总了C#中Plane.Intersect方法的典型用法代码示例。如果您正苦于以下问题:C# Plane.Intersect方法的具体用法?C# Plane.Intersect怎么用?C# Plane.Intersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Plane的用法示例。


在下文中一共展示了Plane.Intersect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RayPick

		public void RayPick()
		{
			new Grid3D(new Size(10));
			var camera = Camera.Use<LookAtCamera>();
			camera.Position = 5 * Vector3D.One;
			var cube = new Model(new ModelData(new BoxMesh(Vector3D.One, Color.Red)), Vector3D.Zero);
			var floor = new Plane(Vector3D.UnitZ, 0.0f);
			//ncrunch: no coverage start
			new Command(point =>
			{
				var ray = camera.ScreenPointToRay(point);
				Vector3D? intersect = floor.Intersect(ray);
				if (intersect != null)
					cube.Position = (Vector3D)intersect;
			}).Add(new MouseButtonTrigger(MouseButton.Left, State.Pressed));
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:16,代码来源:ModelTests.cs

示例2: RayParallelToPlaneDoesntIntersect

		public void RayParallelToPlaneDoesntIntersect()
		{
			var ray = new Ray(Vector3D.One, Vector3D.UnitZ);
			var plane = new Plane(Vector3D.UnitY, Vector3D.Zero);
			Assert.IsNull(plane.Intersect(ray));
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:6,代码来源:PlaneTests.cs

示例3: RayPointingAwayFromPlaneDoesntIntersect

		public void RayPointingAwayFromPlaneDoesntIntersect()
		{
			var ray = new Ray(3 * Vector3D.One, Vector3D.One);
			var plane = new Plane(Vector3D.UnitY, Vector3D.One);
			Assert.IsNull(plane.Intersect(ray));
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:6,代码来源:PlaneTests.cs

示例4: VerifyIntersectPoint

		private static void VerifyIntersectPoint(Ray ray, Plane plane, Vector3D expectedIntersect)
		{
			Assert.AreEqual(expectedIntersect, plane.Intersect(ray));
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:4,代码来源:PlaneTests.cs

示例5: VerifyScreenCenterIsTarget

		private static void VerifyScreenCenterIsTarget(Vector3D position, Vector3D target)
		{
			var camera = CreateLookAtCamera(position, target);
			var floor = new Plane(Vector3D.UnitY, target);
			Ray ray = camera.ScreenPointToRay(Vector2D.Half);
			Assert.IsTrue(target.IsNearlyEqual(floor.Intersect(ray).Value));
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:LookAtCameraTests.cs

示例6: CreateTowerAtClickedPosition

		public void CreateTowerAtClickedPosition()
		{
			var floor = new Plane(Vector3D.UnitY, 0.0f);
			new Command(pos =>
			{ //ncrunch: no coverage start
				var ray = Camera.Current.ScreenPointToRay(ScreenSpace.Current.ToPixelSpace(pos));
				var position = floor.Intersect(ray).Value;
				new Tower(TowerType.Water, position); //ncrunch: no coverage end
			}).Add(new MouseButtonTrigger(MouseButton.Left, State.Releasing));
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:10,代码来源:TowerTests.cs

示例7: GetIntersectionWithFloor

		public static Vector3D? GetIntersectionWithFloor(Vector2D screenPosition)
		{
			var ray = Camera.Current.ScreenPointToRay(screenPosition);
			var floor = new Plane(Vector3D.UnitZ, 0.0f);
			return floor.Intersect(ray);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:6,代码来源:Level.cs


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