UNPKG

poly2tri

Version:

A 2D constrained Delaunay triangulation library

53 lines (46 loc) 1.2 kB
/* * Poly2Tri Copyright (c) 2009-2014, Poly2Tri Contributors * http://code.google.com/p/poly2tri/ * * poly2tri.js (JavaScript port) (c) 2009-2014, Poly2Tri Contributors * https://github.com/r3mi/poly2tri.js * * All rights reserved. * * Distributed under the 3-clause BSD License, see LICENSE.txt */ "use strict"; /* * Class added in the JavaScript version (was not present in the c++ version) */ var xy = require('./xy'); /** * Custom exception class to indicate invalid Point values * @constructor * @public * @extends Error * @struct * @param {string=} message - error message * @param {Array.<XY>=} points - invalid points */ var PointError = function(message, points) { this.name = "PointError"; /** * Invalid points * @public * @type {Array.<XY>} */ this.points = points = points || []; /** * Error message * @public * @type {string} */ this.message = message || "Invalid Points!"; for (var i = 0; i < points.length; i++) { this.message += " " + xy.toString(points[i]); } }; PointError.prototype = new Error(); PointError.prototype.constructor = PointError; module.exports = PointError;