cutFace(pt1, pt2) {
        let edge1 = this.findEdgeByPoint(pt1);
        let edge2 = this.findEdgeByPoint(pt2);
        if (edge1.face !== edge2.face)
            return [];

        // Cut face into two and create new polygon with two faces
        let edgeBefore1 = this.addVertex(pt1, edge1);
        edge2 = this.findEdgeByPoint(pt2);
        let edgeBefore2 = this.addVertex(pt2, edge2);

        let face = edgeBefore1.face;
        let newEdge1 = new Flatten.Edge(
            new Flatten.Segment(edgeBefore1.end, edgeBefore2.end)
        );
        let newEdge2 = new Flatten.Edge(
            new Flatten.Segment(edgeBefore2.end, edgeBefore1.end)
        );

        // Swap links
        edgeBefore1.next.prev = newEdge2;
        newEdge2.next = edgeBefore1.next;

        edgeBefore1.next = newEdge1;
        newEdge1.prev = edgeBefore1;

        edgeBefore2.next.prev = newEdge1;
        newEdge1.next = edgeBefore2.next;

        edgeBefore2.next = newEdge2;
        newEdge2.prev = edgeBefore2;

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

        // Add two new faces
        let face1 = this.addFace(newEdge1, edgeBefore1);
        let face2 = this.addFace(newEdge2, edgeBefore2);

        // Remove old face
        this.faces.delete(face);

        return [face1.toPolygon(), face2.toPolygon()];
    }
/**
     * Cut face of polygon with a segment between two points and create two new polygons
     * Supposed that a segments between points does not intersect any other edge
     * @param {Point} pt1
     * @param {Point} pt2
     * @returns {Polygon[]}
     */
Cut face of polygon with a segment between two points and create two new polygons
Supposed that a segments between points does not intersect any other edge
@param {Point} pt1
@param {Point} pt2
@returns {Polygon[]}
Cut face of polygon with a segment between two points and create two new polygons Supposed that a segments between points does not intersect any other edge @param { Point } pt1 @param { Point } pt2 @returns { Polygon [] }
cutFace(pt1, pt2) {
        let edge1 = this.findEdgeByPoint(pt1);
        let edge2 = this.findEdgeByPoint(pt2);
        if (edge1.face !== edge2.face)
            return [];
        let edgeBefore1 = this.addVertex(pt1, edge1);
        edge2 = this.findEdgeByPoint(pt2);
        let edgeBefore2 = this.addVertex(pt2, edge2);
        let face = edgeBefore1.face;
        let newEdge1 = new Flatten.Edge(
            new Flatten.Segment(edgeBefore1.end, edgeBefore2.end)
        );
        let newEdge2 = new Flatten.Edge(
            new Flatten.Segment(edgeBefore2.end, edgeBefore1.end)
        );
        edgeBefore1.next.prev = newEdge2;
        newEdge2.next = edgeBefore1.next;
        edgeBefore1.next = newEdge1;
        newEdge1.prev = edgeBefore1;
        edgeBefore2.next.prev = newEdge1;
        newEdge1.next = edgeBefore2.next;
        edgeBefore2.next = newEdge2;
        newEdge2.prev = edgeBefore2;
        this.edges.add(newEdge1);
        this.edges.add(newEdge2);
        let face1 = this.addFace(newEdge1, edgeBefore1);
        let face2 = this.addFace(newEdge2, edgeBefore2);
        this.faces.delete(face);
        return [face1.toPolygon(), face2.toPolygon()];
    }
cutFace ( pt1 , pt2 ) { let edge1 = this . findEdgeByPoint ( pt1 ) ; let edge2 = this . findEdgeByPoint ( pt2 ) ; if ( edge1 . face !== edge2 . face ) return [ ] ; let edgeBefore1 = this . addVertex ( pt1 , edge1 ) ; edge2 = this . findEdgeByPoint ( pt2 ) ; let edgeBefore2 = this . addVertex ( pt2 , edge2 ) ; let face = edgeBefore1 . face ; let newEdge1 = new Flatten . Edge ( new Flatten . Segment ( edgeBefore1 . end , edgeBefore2 . end ) ) ; let newEdge2 = new Flatten . Edge ( new Flatten . Segment ( edgeBefore2 . end , edgeBefore1 . end ) ) ; edgeBefore1 . next . prev = newEdge2 ; newEdge2 . next = edgeBefore1 . next ; edgeBefore1 . next = newEdge1 ; newEdge1 . prev = edgeBefore1 ; edgeBefore2 . next . prev = newEdge1 ; newEdge1 . next = edgeBefore2 . next ; edgeBefore2 . next = newEdge2 ; newEdge2 . prev = edgeBefore2 ; this . edges . add ( newEdge1 ) ; this . edges . add ( newEdge2 ) ; let face1 = this . addFace ( newEdge1 , edgeBefore1 ) ; let face2 = this . addFace ( newEdge2 , edgeBefore2 ) ; this . faces . delete ( face ) ; return [ face1 . toPolygon ( ) , face2 . toPolygon ( ) ] ; }
Cut face of polygon with a segment between two points and create two new polygons
 Supposed that a segments between points does not intersect any other edge
 @param {Point} pt1
 @param {Point} pt2
 @returns {Polygon[]}
Cut face of polygon with a segment between two points and create two new polygons Supposed that a segments between points does not intersect any other edge @param { Point } pt1 @param { Point } pt2 @returns { Polygon [] }
// Cut face into two and create new polygon with two faces // Swap links // Insert new edge to the edges container and 2d index // Add two new faces // Remove old face