removeIfNonNeighbor method

void removeIfNonNeighbor(
  1. Vertex? n
)

Implementation

void removeIfNonNeighbor(Vertex? n){
    if(n == null) return;
	final neighbors = this.neighbors;
	final faces = this.faces;
	final offset = neighbors.indexOf(n);

	if (offset == - 1 ) return;

	for (int i = 0; i < faces.length; i ++ ) {
		if(faces[i] != null && faces[i]!.hasVertex(n)) return;
	}

	neighbors.splice(offset, 1);
}