本文整理汇总了C#中Sledge.DataStructures.Geometric.Box.GetBoxLines方法的典型用法代码示例。如果您正苦于以下问题:C# Box.GetBoxLines方法的具体用法?C# Box.GetBoxLines怎么用?C# Box.GetBoxLines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sledge.DataStructures.Geometric.Box
的用法示例。
在下文中一共展示了Box.GetBoxLines方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IntersectsWithBox
/// <summary>
/// Test this face to see if the given bounding box intersects with it
/// </summary>
/// <param name="box">The box to test against</param>
/// <returns>True if the box intersects</returns>
public bool IntersectsWithBox(Box box)
{
var verts = Vertices.Select(x => x.Location).ToList();
return box.GetBoxLines().Any(x => GetIntersectionPoint(verts, x, true) != null);
}
示例2: Render
public override void Render(ViewportBase viewport)
{
if (_state == EntityState.None) return;
TextureHelper.DisableTexturing();
var high = Document.GameData.MapSizeHigh;
var low = Document.GameData.MapSizeLow;
if (viewport is Viewport3D)
{
var offset = new Coordinate(20, 20, 20);
var start = _location - offset;
var end = _location + offset;
var box = new Box(start, end);
GL.Begin(BeginMode.Lines);
GL.Color3(Color.LimeGreen);
foreach (var line in box.GetBoxLines())
{
Coord(line.Start);
Coord(line.End);
}
Coord(low, _location.DY, _location.DZ);
Coord(high, _location.DY, _location.DZ);
Coord(_location.DX, low, _location.DZ);
Coord(_location.DX, high, _location.DZ);
Coord(_location.DX, _location.DY, low);
Coord(_location.DX, _location.DY, high);
GL.End();
}
else if (viewport is Viewport2D)
{
var vp = viewport as Viewport2D;
var units = vp.PixelsToUnits(5);
var offset = new Coordinate(units, units, units);
var start = vp.Flatten(_location - offset);
var end = vp.Flatten(_location + offset);
GL.Begin(BeginMode.LineLoop);
GL.Color3(Color.LimeGreen);
Coord(start.DX, start.DY, start.DZ);
Coord(end.DX, start.DY, start.DZ);
Coord(end.DX, end.DY, start.DZ);
Coord(start.DX, end.DY, start.DZ);
GL.End();
GL.Begin(BeginMode.Lines);
var loc = vp.Flatten(_location);
Coord(low, loc.DY, 0);
Coord(high, loc.DY, 0);
Coord(loc.DX, low, 0);
Coord(loc.DX, high, 0);
GL.End();
}
TextureHelper.EnableTexturing();
}
示例3: Render3DBox
protected virtual void Render3DBox(Viewport3D viewport, Coordinate start, Coordinate end)
{
var box = new Box(start, end);
TextureHelper.Unbind();
GL.Begin(PrimitiveType.Lines);
GL.Color4(GetRenderBoxColour());
foreach (var line in box.GetBoxLines())
{
Coord(line.Start);
Coord(line.End);
}
GL.End();
}
示例4: Render
public override void Render(ViewportBase viewport)
{
if (_currentPoint != null)
{
var sub = new Coordinate(40, 40, 40);
var pointBox = new Box(_currentPoint.CurrentPosition.Location - sub, _currentPoint.CurrentPosition.Location + sub);
TextureHelper.Unbind();
GL.LineWidth(3);
GL.Begin(PrimitiveType.Lines);
GL.Color3(1f, 1, 0);
foreach (var line in pointBox.GetBoxLines())
{
GL.Vertex3(line.Start.DX, line.Start.DY, line.Start.DZ);
GL.Vertex3(line.End.DX, line.End.DY, line.End.DZ);
}
GL.End();
GL.LineWidth(1);
}
}