• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2005 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.google.common.geometry;
17 
18 /**
19  * An S2Region represents a two-dimensional region over the unit sphere. It is
20  * an abstract interface with various concrete subtypes.
21  *
22  *  The main purpose of this interface is to allow complex regions to be
23  * approximated as simpler regions. So rather than having a wide variety of
24  * virtual methods that are implemented by all subtypes, the interface is
25  * restricted to methods that are useful for computing approximations.
26  *
27  *
28  */
29 public interface S2Region {
30 
31   /** Return a bounding spherical cap. */
getCapBound()32   public abstract S2Cap getCapBound();
33 
34 
35   /** Return a bounding latitude-longitude rectangle. */
getRectBound()36   public abstract S2LatLngRect getRectBound();
37 
38   /**
39    * If this method returns true, the region completely contains the given cell.
40    * Otherwise, either the region does not contain the cell or the containment
41    * relationship could not be determined.
42    */
contains(S2Cell cell)43   public abstract boolean contains(S2Cell cell);
44 
45   /**
46    * If this method returns false, the region does not intersect the given cell.
47    * Otherwise, either region intersects the cell, or the intersection
48    * relationship could not be determined.
49    */
mayIntersect(S2Cell cell)50   public abstract boolean mayIntersect(S2Cell cell);
51 }
52