addVertex(pt, edge) {
        let shapes = edge.shape.split(pt);
        // if (shapes.length < 2) return;

        if (shapes[0] === null)   // point incident to edge start vertex, return previous edge
            return edge.prev;

        if (shapes[1] === null)   // point incident to edge end vertex, return edge itself
            return edge;

        let newEdge = new Flatten.Edge(shapes[0]);
        let edgeBefore = edge.prev;

        /* Insert first split edge into linked list after edgeBefore */
        edge.face.insert(newEdge, edgeBefore);

        // Remove old edge from edges container and 2d index
        this.edges.delete(edge);

        // Insert new edge to the edges container and 2d index
        this.edges.add(newEdge);

        // Update edge shape with second split edge keeping links
        edge.shape = shapes[1];

        // Add updated edge to the edges container and 2d index
        this.edges.add(edge);

        return newEdge;
    }
/**
     * Add point as a new vertex and split edge. Point supposed to belong to an edge.
     * When edge is split, new edge created from the start of the edge to the new vertex
     * and inserted before current edge.
     * Current edge is trimmed and updated.
     * Method returns new edge added. If no edge added, it returns edge before vertex
     * @param {Point} pt Point to be added as a new vertex
     * @param {Edge} edge Edge to be split with new vertex and then trimmed from start
     * @returns {Edge}
     */
Add point as a new vertex and split edge. Point supposed to belong to an edge.
When edge is split, new edge created from the start of the edge to the new vertex
and inserted before current edge.
Current edge is trimmed and updated.
Method returns new edge added. If no edge added, it returns edge before vertex
@param {Point} pt Point to be added as a new vertex
@param {Edge} edge Edge to be split with new vertex and then trimmed from start
@returns {Edge}
Add point as a new vertex and split edge . Point supposed to belong to an edge . When edge is split new edge created from the start of the edge to the new vertex and inserted before current edge . Current edge is trimmed and updated . Method returns new edge added . If no edge added it returns edge before vertex @param { Point } pt Point to be added as a new vertex @param { Edge } edge Edge to be split with new vertex and then trimmed from start @returns { Edge }
addVertex(pt, edge) {
        let shapes = edge.shape.split(pt);
        if (shapes[0] === null)   
            return edge.prev;
        if (shapes[1] === null)   
            return edge;
        let newEdge = new Flatten.Edge(shapes[0]);
        let edgeBefore = edge.prev;
        edge.face.insert(newEdge, edgeBefore);
        this.edges.delete(edge);
        this.edges.add(newEdge);
        edge.shape = shapes[1];
        this.edges.add(edge);
        return newEdge;
    }
addVertex ( pt , edge ) { let shapes = edge . shape . split ( pt ) ; if ( shapes [ 0 ] === null ) return edge . prev ; if ( shapes [ 1 ] === null ) return edge ; let newEdge = new Flatten . Edge ( shapes [ 0 ] ) ; let edgeBefore = edge . prev ; edge . face . insert ( newEdge , edgeBefore ) ; this . edges . delete ( edge ) ; this . edges . add ( newEdge ) ; edge . shape = shapes [ 1 ] ; this . edges . add ( edge ) ; return newEdge ; }
Add point as a new vertex and split edge.
Add point as a new vertex and split edge .
// if (shapes.length < 2) return; // point incident to edge start vertex, return previous edge // point incident to edge end vertex, return edge itself /* Insert first split edge into linked list after edgeBefore */ // Remove old edge from edges container and 2d index // Insert new edge to the edges container and 2d index // Update edge shape with second split edge keeping links // Add updated edge to the edges container and 2d index