Fix Triangle format writer

git-svn-id: https://triangle.svn.codeplex.com/svn@75117 0e2699bc-83d4-4a8f-98e7-55e24ab8c7a5
This commit is contained in:
SND\wo80_cp
2014-07-01 19:40:48 +00:00
parent 53d5ca9505
commit 70b6ce226d
7 changed files with 42 additions and 11 deletions
+24 -5
View File
@@ -52,12 +52,29 @@ namespace TriangleNet.Geometry
get { return points.Count; }
}
/// <summary>
/// Initializes a new instance of the <see cref="Polygon" /> class.
/// </summary>
public Polygon()
: this(3)
: this(3, false)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Polygon" /> class.
/// </summary>
/// <param name="capacity">The default capacity for the points list.</param>
public Polygon(int capacity)
: this(3, false)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Polygon" /> class.
/// </summary>
/// <param name="capacity">The default capacity for the points list.</param>
/// <param name="markers">Use point and segment markers.</param>
public Polygon(int capacity, bool markers)
{
points = new List<Vertex>(capacity);
holes = new List<Point>();
@@ -65,8 +82,8 @@ namespace TriangleNet.Geometry
segments = new List<IEdge>();
HasPointMarkers = false;
HasSegmentMarkers = false;
HasPointMarkers = markers;
HasSegmentMarkers = markers;
}
/// <inherit />
@@ -236,12 +253,14 @@ namespace TriangleNet.Geometry
/// <summary>
/// Return true if the given point is inside the polygon, or false if it is not.
/// </summary>
/// <param name="point"></param>
/// <param name="poly"></param>
/// <param name="point">The point to check.</param>
/// <param name="poly">The polygon (list of contour points).</param>
/// <returns></returns>
/// <remarks>
/// WARNING: If the point is exactly on the edge of the polygon, then the function
/// may return true or false.
///
/// See http://alienryderflex.com/polygon/
/// </remarks>
private bool IsPointInPolygon(Point point, List<Vertex> poly)
{
+6 -1
View File
@@ -1,4 +1,9 @@
// -----------------------------------------------------------------------
// <copyright file="FileProcessor.cs" company="">
// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/
// </copyright>
// -----------------------------------------------------------------------
namespace TriangleNet.IO
{
using System;
+6 -1
View File
@@ -1,4 +1,9 @@
// -----------------------------------------------------------------------
// <copyright file="IFileFormat.cs" company="">
// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/
// </copyright>
// -----------------------------------------------------------------------
namespace TriangleNet.IO
{
public interface IFileFormat
+1 -1
View File
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="IGeometryFormat.cs" company="">
// <copyright file="IPolygonFormat.cs" company="">
// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/
// </copyright>
// -----------------------------------------------------------------------
+1 -1
View File
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="Triangle.cs" company="">
// <copyright file="InputTriangle.cs" company="">
// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/
// </copyright>
// -----------------------------------------------------------------------
+1 -1
View File
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="FileReader.cs" company="">
// <copyright file="TriangleReader.cs" company="">
// 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>
+3 -1
View File
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
// <copyright file="FileWriter.cs" company="">
// <copyright file="TriangleWriter.cs" company="">
// 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>
@@ -194,6 +194,8 @@ namespace TriangleNet.IO
{
// TODO: write vertex attributes
writer.WriteLine("{0} 2 0 {1}", polygon.Points.Count, polygon.HasPointMarkers ? "1" : "0");
// Write nodes to this file.
TriangleWriter.WriteNodes(writer, polygon.Points, polygon.HasPointMarkers, 0, false);