Interface TraversalVisitor

 1 /*
 2  * Copyright (c) 2016 Vivid Solutions.
 3  *
 4  * All rights reserved. This program and the accompanying materials
 5  * are made available under the terms of the Eclipse Public License 2.0
 6  * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
 7  * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v20.html
 8  * and the Eclipse Distribution License is available at
 9  *
10  * http://www.eclipse.org/org/documents/edl-v10.php.
11  */
12  
13 package org.locationtech.jts.triangulate.quadedge;
14  
15 /**
16  * Interface for classes which process triangles visited during traversals of a
17  * {@link QuadEdgeSubdivision}
18  * 
19  * @author Martin Davis
20  */
21 public interface TraversalVisitor {
22     /**
23      * Visits a triangle during a traversal of a {@link QuadEdgeSubdivision}. An implementation of
24      * this method may perform processing on the current triangle. It must also decide whether a
25      * neighbouring triangle should be added to the queue so its neighbours are visited. Often it
26      * will perform processing on the neighbour triangle as well, in order to mark it as processed
27      * (visited) and/or to determine if it should be visited. Note that choosing <b>not</b> to
28      * visit the neighbouring triangle is the terminating condition for many traversal algorithms.
29      * In particular, if the neighbour triangle has already been visited, it should not be visited
30      * again.
31      * 
32      * @param currTri the current triangle being processed
33      * @param edgeIndex the index of the edge in the current triangle being traversed
34      * @param neighbTri a neighbouring triangle next in line to visit
35      * @return true if the neighbour triangle should be visited
36      */
37     boolean visit(QuadEdgeTriangle currTri, int edgeIndex, QuadEdgeTriangle neighbTri);
38 }
39