diff --git a/src/Triangle/Geometry/RegionPointer.cs b/src/Triangle/Geometry/RegionPointer.cs index 6eb93b3..7ecb6ad 100644 --- a/src/Triangle/Geometry/RegionPointer.cs +++ b/src/Triangle/Geometry/RegionPointer.cs @@ -6,42 +6,35 @@ namespace TriangleNet.Geometry { - using System; - /// /// Pointer to a region in the mesh geometry. A region is a well-defined /// subset of the geometry (enclosed by subsegments). /// public class RegionPointer { - internal Point point; - internal int id; - internal double area; + /// + /// Gets the x and y coordinates of the region pointer. + /// + public Point Point { get; private set; } /// - /// Gets or sets a region area constraint. + /// Gets the label of the region. /// - public double Area - { - get { return area; } - set - { - if (value < 0.0) - { - throw new ArgumentException("Area constraints must not be negative."); - } - area = value; - } - } + public int Label { get; private set; } + + /// + /// Gets the area constraint of the region. + /// + public double Area { get; private set; } /// /// Initializes a new instance of the class. /// /// X coordinate of the region. /// Y coordinate of the region. - /// Region id. - public RegionPointer(double x, double y, int id) - : this(x, y, id, 0.0) + /// Region label. + public RegionPointer(double x, double y, int label) + : this(x, y, label, 0.0) { } @@ -50,13 +43,13 @@ public RegionPointer(double x, double y, int id) /// /// X coordinate of the region. /// Y coordinate of the region. - /// Region id. + /// Region label. /// Area constraint. - public RegionPointer(double x, double y, int id, double area) + public RegionPointer(double x, double y, int label, double area) { - this.point = new Point(x, y); - this.id = id; - this.area = area; + Point = new Point(x, y); + Label = label; + Area = area; } } } diff --git a/src/Triangle/IO/TriangleWriter.cs b/src/Triangle/IO/TriangleWriter.cs index 7a2168d..695eba9 100644 --- a/src/Triangle/IO/TriangleWriter.cs +++ b/src/Triangle/IO/TriangleWriter.cs @@ -237,8 +237,8 @@ public void WritePoly(IPolygon polygon, string filename) writer.WriteLine("{0}", polygon.Regions.Count); foreach (var region in polygon.Regions) { - writer.WriteLine("{0} {1} {2} {3}", j, region.point.X.ToString(nfi), - region.point.Y.ToString(nfi), region.id); + writer.WriteLine("{0} {1} {2} {3}", j, region.Point.X.ToString(nfi), + region.Point.Y.ToString(nfi), region.Label); j++; } @@ -328,8 +328,8 @@ public void WritePoly(Mesh mesh, string filename, bool writeNodes) writer.WriteLine("{0}", mesh.regions.Count); foreach (var region in mesh.regions) { - writer.WriteLine("{0} {1} {2} {3}", j, region.point.X.ToString(nfi), - region.point.Y.ToString(nfi), region.id); + writer.WriteLine("{0} {1} {2} {3}", j, region.Point.X.ToString(nfi), + region.Point.Y.ToString(nfi), region.Label); j++; } diff --git a/src/Triangle/Meshing/ConstraintMesher.cs b/src/Triangle/Meshing/ConstraintMesher.cs index 51e28b3..2073a1c 100644 --- a/src/Triangle/Meshing/ConstraintMesher.cs +++ b/src/Triangle/Meshing/ConstraintMesher.cs @@ -162,7 +162,7 @@ private void CarveHoles() { regionTris[i] = dummytri; // Ignore region points that aren't within the bounds of the mesh. - if (mesh.bounds.Contains(region.point)) + if (mesh.bounds.Contains(region.Point)) { // Start searching from some triangle on the outer boundary. searchtri.tri = dummytri; @@ -173,17 +173,17 @@ private void CarveHoles() // region point falls within the starting triangle. searchorg = searchtri.Org(); searchdest = searchtri.Dest(); - if (predicates.CounterClockwise(searchorg, searchdest, region.point) > 0.0) + if (predicates.CounterClockwise(searchorg, searchdest, region.Point) > 0.0) { // Find a triangle that contains the region point. - intersect = mesh.locator.Locate(region.point, ref searchtri); + intersect = mesh.locator.Locate(region.Point, ref searchtri); if ((intersect != LocateResult.Outside) && (!searchtri.IsInfected())) { // Record the triangle for processing after the // holes have been carved. regionTris[i] = searchtri.tri; - regionTris[i].label = region.id; - regionTris[i].area = region.area; + regionTris[i].label = region.Label; + regionTris[i].area = region.Area; } } }