New rendering code check-in

git-svn-id: https://triangle.svn.codeplex.com/svn@75033 0e2699bc-83d4-4a8f-98e7-55e24ab8c7a5
This commit is contained in:
SND\wo80_cp
2014-05-31 12:12:08 +00:00
parent a9de99f651
commit 70b25002dc
42 changed files with 2648 additions and 11 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="BoundingBox.cs" company="">
// <copyright file="Rectangle.cs" company="">
// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/
// </copyright>
// -----------------------------------------------------------------------
@@ -150,7 +150,7 @@ namespace TriangleNet.Geometry
/// <returns>Return true, if bounding box contains given point.</returns>
public bool Contains(Point pt)
{
return ((pt.x >= xmin) && (pt.x <= xmax) && (pt.y >= ymin) && (pt.y <= ymax));
return ((pt.X >= xmin) && (pt.X <= xmax) && (pt.Y >= ymin) && (pt.Y <= ymax));
}
/// <summary>
+1 -1
View File
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="SimpleLog.cs" company="">
// <copyright file="Log.cs" company="">
// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/
// </copyright>
// -----------------------------------------------------------------------
@@ -42,7 +42,7 @@ namespace TriangleNet.Meshing.Algorithm
if (Log.Verbose)
{
Log.Instance.Warning("A duplicate vertex appeared and was ignored.",
"Incremental.IncrementalDelaunay()");
"Incremental.Triangulate()");
}
v.type = VertexType.UndeadVertex;
mesh.undeads++;
@@ -78,6 +78,19 @@ namespace TriangleNet.Meshing
return mesh;
}
/// <summary>
/// Generates a structured mesh with bounds (0, 0, width, height).
/// </summary>
/// <param name="width">Width of the mesh (must be > 0).</param>
/// <param name="height">Height of the mesh (must be > 0).</param>
/// <param name="nx">Number of segments in x direction.</param>
/// <param name="ny">Number of segments in y direction.</param>
/// <returns>Mesh</returns>
public IMesh StructurdMesh(double width, double height, int nx, int ny)
{
return StructurdMesh(new Rectangle(0.0, 0.0, width, height), nx, ny);
}
/// <summary>
/// Generates a structured mesh.
/// </summary>
+1
View File
@@ -15,6 +15,7 @@ namespace TriangleNet.Meshing
Rectangle Bounds { get; }
void Renumber();
void Refine(QualityOptions quality);
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="Primitives.cs">
// <copyright file="RobustPredicates.cs">
// Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html
// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/
// </copyright>
@@ -70,6 +70,11 @@ namespace TriangleNet.Tools
get { return regions; }
}
public IEnumerable<IEdge> Edges
{
get { return EnumerateEdges(); }
}
/// <summary>
/// Computes the bounded voronoi diagram.
/// </summary>
@@ -644,5 +649,41 @@ namespace TriangleNet.Tools
// Success.
return true;
}
// TODO: Voronoi enumerate edges
private IEnumerable<IEdge> EnumerateEdges()
{
// Copy edges
Point first, last;
var edges = new List<IEdge>(this.Regions.Count * 2);
foreach (var region in this.Regions)
{
first = null;
last = null;
foreach (var pt in region.Vertices)
{
if (first == null)
{
first = pt;
last = pt;
}
else
{
edges.Add(new Edge(last.ID, pt.ID));
last = pt;
}
}
if (region.Bounded && first != null)
{
edges.Add(new Edge(last.ID, first.ID));
}
}
return edges;
}
}
}
+5
View File
@@ -23,5 +23,10 @@ namespace TriangleNet.Tools
/// Gets the list of Voronoi regions.
/// </summary>
ICollection<VoronoiRegion> Regions { get; }
/// <summary>
/// Gets the list of edges.
/// </summary>
IEnumerable<IEdge> Edges { get; }
}
}
+41
View File
@@ -59,6 +59,11 @@ namespace TriangleNet.Tools
get { return regions.Values; }
}
public IEnumerable<IEdge> Edges
{
get { return EnumerateEdges(); }
}
/// <summary>
/// Gets the Voronoi diagram as raw output data.
/// </summary>
@@ -336,5 +341,41 @@ namespace TriangleNet.Tools
return true;
}
// TODO: Voronoi enumerate edges
private IEnumerable<IEdge> EnumerateEdges()
{
// Copy edges
Point first, last;
var edges = new List<IEdge>(this.Regions.Count * 2);
foreach (var region in this.Regions)
{
first = null;
last = null;
foreach (var pt in region.Vertices)
{
if (first == null)
{
first = pt;
last = pt;
}
else
{
edges.Add(new Edge(last.ID, pt.ID));
last = pt;
}
}
if (region.Bounded && first != null)
{
edges.Add(new Edge(last.ID, first.ID));
}
}
return edges;
}
}
}
+1 -3
View File
@@ -108,9 +108,7 @@
<Compile Include="Tools\VoronoiRegion.cs" />
<Compile Include="TriangleLocator.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Algorithm\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.