Files
rk35xx-android14/external/s2-geometry-library-java/src/com/google/common/geometry/S2AreaCentroid.java
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

48 lines
1.4 KiB
Java

/*
* 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;
}
}