001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.math3.geometry.hull;
018
019import java.io.Serializable;
020
021import org.apache.commons.math3.exception.InsufficientDataException;
022import org.apache.commons.math3.geometry.Point;
023import org.apache.commons.math3.geometry.Space;
024import org.apache.commons.math3.geometry.partitioning.Region;
025
026/**
027 * This class represents a convex hull.
028 *
029 * @param <S> Space type.
030 * @param <P> Point type.
031 * @since 3.3
032 */
033public interface ConvexHull<S extends Space, P extends Point<S>> extends Serializable {
034
035    /**
036     * Get the vertices of the convex hull.
037     * @return vertices of the convex hull
038     */
039    P[] getVertices();
040
041    /**
042     * Returns a new region that is enclosed by the convex hull.
043     * @return the region enclosed by the convex hull
044     * @throws InsufficientDataException if the number of vertices is not enough to
045     * build a region in the respective space
046     */
047    Region<S> createRegion() throws InsufficientDataException;
048}