poly2tri
Version:
A 2D constrained Delaunay triangulation library
117 lines (108 loc) • 3.76 kB
JavaScript
/*
* 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.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of Poly2Tri nor the names of its contributors may be
* used to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
;
/**
* Public API for poly2tri.js
* @module poly2tri
*/
/**
* If you are not using a module system (e.g. CommonJS, RequireJS), you can access this library
* as a global variable <code>poly2tri</code> i.e. <code>window.poly2tri</code> in a browser.
* @name poly2tri
* @global
* @public
* @type {module:poly2tri}
*/
var previousPoly2tri = global.poly2tri;
/**
* For Browser + <script> :
* reverts the {@linkcode poly2tri} global object to its previous value,
* and returns a reference to the instance called.
*
* @example
* var p = poly2tri.noConflict();
* @public
* @return {module:poly2tri} instance called
*/
// (this feature is not automatically provided by browserify).
exports.noConflict = function() {
global.poly2tri = previousPoly2tri;
return exports;
};
/**
* poly2tri library version
* @public
* @const {string}
*/
exports.VERSION = require('../dist/version.json').version;
/**
* Exports the {@linkcode PointError} class.
* @public
* @typedef {PointError} module:poly2tri.PointError
* @function
*/
exports.PointError = require('./pointerror');
/**
* Exports the {@linkcode Point} class.
* @public
* @typedef {Point} module:poly2tri.Point
* @function
*/
exports.Point = require('./point');
/**
* Exports the {@linkcode Triangle} class.
* @public
* @typedef {Triangle} module:poly2tri.Triangle
* @function
*/
exports.Triangle = require('./triangle');
/**
* Exports the {@linkcode SweepContext} class.
* @public
* @typedef {SweepContext} module:poly2tri.SweepContext
* @function
*/
exports.SweepContext = require('./sweepcontext');
// Backward compatibility
var sweep = require('./sweep');
/**
* @function
* @deprecated use {@linkcode SweepContext#triangulate} instead
*/
exports.triangulate = sweep.triangulate;
/**
* @deprecated use {@linkcode SweepContext#triangulate} instead
* @property {function} Triangulate - use {@linkcode SweepContext#triangulate} instead
*/
exports.sweep = {Triangulate: sweep.triangulate};