UNPKG

@jscad/modeling

Version:

Constructive Solid Geometry (CSG) Library for JSCAD

21 lines (18 loc) 564 B
const clone = require('./clone') /** * Reverses the path so that the points are in the opposite order. * This swaps the left (interior) and right (exterior) edges. * @param {path2} geometry - the path to reverse * @returns {path2} a new path * @alias module:modeling/geometries/path2.reverse * * @example * let newpath = reverse(mypath) */ const reverse = (geometry) => { // NOTE: this only updates the order of the points const cloned = clone(geometry) cloned.points = geometry.points.slice().reverse() return cloned } module.exports = reverse