PlaneConvexSubset.java

  1. /*
  2.  * Licensed to the Apache Software Foundation (ASF) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * The ASF licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *      http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.apache.commons.geometry.euclidean.threed;

  18. import java.util.Collections;
  19. import java.util.List;

  20. import org.apache.commons.geometry.core.Transform;
  21. import org.apache.commons.geometry.core.partitioning.Hyperplane;
  22. import org.apache.commons.geometry.core.partitioning.HyperplaneConvexSubset;
  23. import org.apache.commons.geometry.core.partitioning.Split;
  24. import org.apache.commons.geometry.euclidean.twod.ConvexArea;

  25. /** Interface representing a finite or infinite convex subset of points in a plane in Euclidean 3D
  26.  * space.
  27.  */
  28. public interface PlaneConvexSubset extends PlaneSubset, HyperplaneConvexSubset<Vector3D> {

  29.     /** {@inheritDoc} */
  30.     @Override
  31.     PlaneConvexSubset reverse();

  32.     /** {@inheritDoc} */
  33.     @Override
  34.     PlaneConvexSubset transform(Transform<Vector3D> transform);

  35.     /** {@inheritDoc} */
  36.     @Override
  37.     Split<PlaneConvexSubset> split(Hyperplane<Vector3D> splitter);

  38.     /** {@inheritDoc} */
  39.     @Override
  40.     PlaneConvexSubset.Embedded getEmbedded();

  41.     /** Get the vertices for the convex subset in a counter-clockwise order as viewed looking down the plane
  42.      * normal. Each vertex in the returned list is unique. If the boundary of the subset is closed, the start
  43.      * vertex is <em>not</em> repeated at the end of the list.
  44.      *
  45.      * <p>It is important to note that, in general, the list of vertices returned by this method
  46.      * is not sufficient to completely characterize the subset. For example, a simple triangle
  47.      * has 3 vertices, but an infinite area constructed from two parallel lines and two lines that
  48.      * intersect between them will also have 3 vertices. It is also possible for non-empty subsets to
  49.      * contain no vertices at all. For example, a subset with no boundaries (representing the full
  50.      * plane), a subset with a single boundary (ie, a half-plane), or a subset with two parallel boundaries will
  51.      * not contain any vertices.</p>
  52.      * @return the list of vertices for the plane convex subset in a counter-clockwise order as viewed looking
  53.      *      down the plane normal
  54.      */
  55.     List<Vector3D> getVertices();

  56.     /** {@inheritDoc}
  57.      *
  58.      * <p>This method simply returns a singleton list containing this object.</p>
  59.      */
  60.     @Override
  61.     default List<PlaneConvexSubset> toConvex() {
  62.         return Collections.singletonList(this);
  63.     }

  64.     /** Interface used to represent plane convex subsets as embedded 2D subspace regions.
  65.      */
  66.     interface Embedded extends PlaneSubset.Embedded {

  67.         /** {@inheritDoc} */
  68.         @Override
  69.         ConvexArea getSubspaceRegion();
  70.     }
  71. }