• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2011 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 
17 package com.google.common.geometry;
18 
19 import javax.annotation.Nullable;
20 
21 /**
22  * The area of an interior, i.e. the region on the left side of an odd
23  * number of loops and optionally a centroid.
24  * The area is between 0 and 4*Pi. If it has a centroid, it is
25  * the true centroid of the interiord multiplied by the area of the shape.
26  * Note that the centroid may not be contained by the shape.
27  *
28  * @author dbentley@google.com (Daniel Bentley)
29  */
30 public final class S2AreaCentroid {
31 
32   private final double area;
33   private final S2Point centroid;
34 
S2AreaCentroid(double area, @Nullable S2Point centroid)35   public S2AreaCentroid(double area, @Nullable S2Point centroid) {
36     this.area = area;
37     this.centroid = centroid;
38   }
39 
getArea()40   public double getArea() {
41     return area;
42   }
43 
getCentroid()44   @Nullable public S2Point getCentroid() {
45     return centroid;
46   }
47 }
48