/// <summary>
        /// Computes the distance from the base geometry to the given geometry.
        /// </summary>
        /// <param name="g">The geometry to compute the distance to.</param>
        /// <returns>The computed distance</returns>
        public double Distance(Geometry g)
        {
            var tree2 = FacetSequenceTreeBuilder.BuildSTRtree(g);
            var obj   = _cachedTree.NearestNeighbour(tree2, new FacetSequenceDistance());
            var fs1   = obj[0];
            var fs2   = obj[1];

            return(fs1.Distance(fs2));
        }
 /// <summary>
 /// Creates a new distance-finding instance for a given target <see cref="Geometry"/>.
 /// </summary>
 /// <remarks>
 /// <para>
 /// Distances will be computed to all facets of the input geometry.
 /// The facets of the geometry are the discrete segments and points
 /// contained in its components.  </para>
 /// <para>
 /// In the case of <see cref="ILineal"/> and <see cref="IPuntal"/> inputs,
 /// this is equivalent to computing the conventional distance.
 /// </para><para>
 /// In the case of <see cref="IPolygonal"/> inputs, this is equivalent
 /// to computing the distance to the polygon boundaries.
 /// </para>
 /// </remarks>
 /// <param name="g1">A Geometry, which may be of any type.</param>
 public IndexedFacetDistance(Geometry g1)
 {
     _cachedTree = FacetSequenceTreeBuilder.BuildSTRtree(g1);
 }