main/src/georegression/geometry/UtilPolygons2D_F64.java
public static boolean isEquivalent( Polygon2D_F64 a , Polygon2D_F64 b , double tol ) {
		if( a.size() != b.size())
			return false;

		double tol2 = tol*tol;

		// first find two vertexes which are the same
		Point2D_F64 a0 = a.get(0);
		int match = -1;
		for (int i = 0; i < b.size(); i++) {
			if( a0.distance2(b.get(i)) <= tol2 ) {
				match = i;
				break;
			}
		}

		if( match < 0 )
			return false;

		// now go in a circle and see if they all line up
		for (int i = 1; i < b.size(); i++) {
			Point2D_F64 ai = a.get(i);
			Point2D_F64 bi = b.get((match+i)%b.size());

			if( ai.distance2(bi) > tol2 ) {
				return false;
			}
		}
		return true;
	}
public static boolean isEquivalent( Polygon2D_F64 a , Polygon2D_F64 b , double tol ) {
		if( a.size() != b.size())
			return false;

		double tol2 = tol*tol;

		// first find two vertexes which are the same
		Point2D_F64 a0 = a.get(0);
		int match = -1;
		for (int i = 0; i < b.size(); i++) {
			if( a0.distance2(b.get(i)) <= tol2 ) {
				match = i;
				break;
			}
		}

		if( match < 0 )
			return false;

		// now go in a circle and see if they all line up
		for (int i = 1; i < b.size(); i++) {
			Point2D_F64 ai = a.get(i);
			Point2D_F64 bi = b.get((match+i)%b.size());

			if( ai.distance2(bi) > tol2 ) {
				return false;
			}
		}
		return true;
	}
public static boolean isEquivalent ( Polygon2D_F64 a , Polygon2D_F64 b , double tol ) { if ( a . size ( ) != b . size ( ) ) return false ; double tol2 = tol * tol ; // first find two vertexes which are the same Point2D_F64 a0 = a . get ( 0 ) ; int match = - 1 ; for ( int i = 0 ; i < b . size ( ) ; i ++ ) { if ( a0 . distance2 ( b . get ( i ) ) <= tol2 ) { match = i ; break ; } } if ( match < 0 ) return false ; // now go in a circle and see if they all line up for ( int i = 1 ; i < b . size ( ) ; i ++ ) { Point2D_F64 ai = a . get ( i ) ; Point2D_F64 bi = b . get ( ( match + i ) % b . size ( ) ) ; if ( ai . distance2 ( bi ) > tol2 ) { return false ; } } return true ; }
Checks to see if the vertexes of the two polygon's are the same up to the specified tolerance and allows
for a shift in their order

@param a Polygon
@param b Polygon
@param tol tolerance
@return true if identical up to tolerance or false if not
Checks to see if the vertexes of the two polygon s are the same up to the specified tolerance and allows for a shift in their order