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. ///