From 94923a5a0de3fbd66acec43cf855381e33fdec8e Mon Sep 17 00:00:00 2001 From: "SND\\wo80_cp" Date: Fri, 22 Nov 2013 11:58:15 +0000 Subject: [PATCH] Added AddPoint(Vertex v) method to InputGeometry git-svn-id: https://triangle.svn.codeplex.com/svn@74076 0e2699bc-83d4-4a8f-98e7-55e24ab8c7a5 --- .../Triangle/Geometry/InputGeometry.cs | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/Triangle.NET/Triangle/Geometry/InputGeometry.cs b/Triangle.NET/Triangle/Geometry/InputGeometry.cs index 59674fc..9063cc8 100644 --- a/Triangle.NET/Triangle/Geometry/InputGeometry.cs +++ b/Triangle.NET/Triangle/Geometry/InputGeometry.cs @@ -139,7 +139,6 @@ namespace TriangleNet.Geometry public void AddPoint(double x, double y, int boundary) { points.Add(new Vertex(x, y, boundary)); - bounds.Update(x, y); } @@ -178,10 +177,34 @@ namespace TriangleNet.Geometry } points.Add(new Vertex(x, y, boundary) { attributes = attribs }); - bounds.Update(x, y); } + /// + /// Adds a vertex to the geometry. + /// + /// Vertex instance. + public void AddPoint(Vertex v) + { + var attribs = v.attributes; + + if (pointAttributes < 0) + { + pointAttributes = attribs == null ? 0 : attribs.Length; + } + else if (attribs == null && pointAttributes > 0) + { + throw new ArgumentException("Inconsitent use of point attributes."); + } + else if (attribs != null && pointAttributes != attribs.Length) + { + throw new ArgumentException("Inconsitent use of point attributes."); + } + + points.Add(v); + bounds.Update(v.x, v.y); + } + /// /// Adds a hole location to the geometry. ///