View Javadoc

    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
    19  import java.util.Collections;
    20  import java.util.List;
    21
    22  import org.apache.commons.geometry.core.Transform;
    23  import org.apache.commons.geometry.core.partitioning.Hyperplane;
    24  import org.apache.commons.geometry.core.partitioning.HyperplaneConvexSubset;
    25  import org.apache.commons.geometry.core.partitioning.Split;
    26  import org.apache.commons.geometry.euclidean.twod.ConvexArea;
    27
    28  /** Interface representing a finite or infinite convex subset of points in a plane in Euclidean 3D
    29   * space.
    30   */
    31  public interface PlaneConvexSubset extends PlaneSubset, HyperplaneConvexSubset<Vector3D> {
    32
    33      /** {@inheritDoc} */
    34      @Override
    35      PlaneConvexSubset reverse();
    36
    37      /** {@inheritDoc} */
    38      @Override
    39      PlaneConvexSubset transform(Transform<Vector3D> transform);
    40
    41      /** {@inheritDoc} */
    42      @Override
    43      Split<PlaneConvexSubset> split(Hyperplane<Vector3D> splitter);
    44
    45      /** {@inheritDoc} */
    46      @Override
    47      PlaneConvexSubset.Embedded getEmbedded();
    48
    49      /** Get the vertices for the convex subset in a counter-clockwise order as viewed looking down the plane
    50       * normal. Each vertex in the returned list is unique. If the boundary of the subset is closed, the start
    51       * vertex is <em>not</em> repeated at the end of the list.
    52       *
    53       * <p>It is important to note that, in general, the list of vertices returned by this method
    54       * is not sufficient to completely characterize the subset. For example, a simple triangle
    55       * has 3 vertices, but an infinite area constructed from two parallel lines and two lines that
    56       * intersect between them will also have 3 vertices. It is also possible for non-empty subsets to
    57       * contain no vertices at all. For example, a subset with no boundaries (representing the full
    58       * plane), a subset with a single boundary (ie, a half-plane), or a subset with two parallel boundaries will
    59       * not contain any vertices.</p>
    60       * @return the list of vertices for the plane convex subset in a counter-clockwise order as viewed looking
    61       *      down the plane normal
    62       */
    63      List<Vector3D> getVertices();
    64
    65      /** {@inheritDoc}
    66       *
    67       * <p>This method simply returns a singleton list containing this object.</p>
    68       */
    69      @Override
    70      default List<PlaneConvexSubset> toConvex() {
    71          return Collections.singletonList(this);
    72      }
    73
    74      /** Interface used to represent plane convex subsets as embedded 2D subspace regions.
    75       */
    76      interface Embedded extends PlaneSubset.Embedded {
    77
    78          /** {@inheritDoc} */
    79          @Override
    80          ConvexArea getSubspaceRegion();
    81      }
    82  }