blob: 3b9e0b5fbf26def7b461e71620038f84e5a4df72 [file] [log] [blame]
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.common.geometry;
import javax.annotation.Nullable;
/**
* The area of an interior, i.e. the region on the left side of an odd
* number of loops and optionally a centroid.
* The area is between 0 and 4*Pi. If it has a centroid, it is
* the true centroid of the interiord multiplied by the area of the shape.
* Note that the centroid may not be contained by the shape.
*
* @author dbentley@google.com (Daniel Bentley)
*/
public final class S2AreaCentroid {
private final double area;
private final S2Point centroid;
public S2AreaCentroid(double area, @Nullable S2Point centroid) {
this.area = area;
this.centroid = centroid;
}
public double getArea() {
return area;
}
@Nullable public S2Point getCentroid() {
return centroid;
}
}