Interface SimilarityMeasure

 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.algorithm.match;
14  
15 import org.locationtech.jts.geom.Geometry;
16  
17 /**
18  * An interface for classes which measures the degree of similarity between two {@link Geometry}s.
19  * The computed measure lies in the range [0, 1].
20  * Higher measures indicate a great degree of similarity.
21  * A measure of 1.0 indicates that the input geometries are identical
22  * A measure of 0.0 indicates that the geometries
23  * have essentially no similarity.
24  * The precise definition of "identical" and "no similarity" may depend on the 
25  * exact algorithm being used.
26  * 
27  * @author mbdavis
28  *
29  */
30 public interface SimilarityMeasure
31 {
32     /**
33      * Computes the similarity measure between two geometries
34      * @param g1 a geometry
35      * @param g2 a geometry
36      * @return the value of the similarity measure, in [0.0, 1.0]
37      */
38     double measure(Geometry g1, Geometry g2);
39 }
40