本文整理汇总了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));
}
示例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));
}
示例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));
}
示例4: VerifyIntersectPoint
private static void VerifyIntersectPoint(Ray ray, Plane plane, Vector3D expectedIntersect)
{
Assert.AreEqual(expectedIntersect, plane.Intersect(ray));
}
示例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));
}
示例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));
}
示例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);
}