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.partitioning;
018
019import org.apache.commons.math3.geometry.Space;
020
021/** Class holding boundary attributes.
022 * <p>This class is used for the attributes associated with the
023 * nodes of region boundary shell trees returned by the {@link
024 * Region#getTree(boolean) Region.getTree(includeBoundaryAttributes)}
025 * when the boolean {@code includeBoundaryAttributes} parameter is
026 * set to {@code true}. It contains the parts of the node cut
027 * sub-hyperplane that belong to the boundary.</p>
028 * <p>This class is a simple placeholder, it does not provide any
029 * processing methods.</p>
030 * @param <S> Type of the space.
031 * @see Region#getTree
032 * @since 3.0
033 */
034public class BoundaryAttribute<S extends Space> {
035
036    /** Part of the node cut sub-hyperplane that belongs to the
037     * boundary and has the outside of the region on the plus side of
038     * its underlying hyperplane (may be null).
039     */
040    private final SubHyperplane<S> plusOutside;
041
042    /** Part of the node cut sub-hyperplane that belongs to the
043     * boundary and has the inside of the region on the plus side of
044     * its underlying hyperplane (may be null).
045     */
046    private final SubHyperplane<S> plusInside;
047
048    /** Sub-hyperplanes that were used to split the boundary part. */
049    private final NodesSet<S> splitters;
050
051    /** Simple constructor.
052     * @param plusOutside part of the node cut sub-hyperplane that
053     * belongs to the boundary and has the outside of the region on
054     * the plus side of its underlying hyperplane (may be null)
055     * @param plusInside part of the node cut sub-hyperplane that
056     * belongs to the boundary and has the inside of the region on the
057     * plus side of its underlying hyperplane (may be null)
058     * @deprecated as of 3.4, the constructor has been replaced by a new one
059     * which is not public anymore, as it is intended to be used only by
060     * {@link BoundaryBuilder}
061     */
062    @Deprecated
063    public BoundaryAttribute(final SubHyperplane<S> plusOutside,
064                             final SubHyperplane<S> plusInside) {
065        this(plusOutside, plusInside, null);
066    }
067
068    /** Simple constructor.
069     * @param plusOutside part of the node cut sub-hyperplane that
070     * belongs to the boundary and has the outside of the region on
071     * the plus side of its underlying hyperplane (may be null)
072     * @param plusInside part of the node cut sub-hyperplane that
073     * belongs to the boundary and has the inside of the region on the
074     * plus side of its underlying hyperplane (may be null)
075     * @param splitters sub-hyperplanes that were used to
076     * split the boundary part (may be null)
077     * @since 3.4
078     */
079    BoundaryAttribute(final SubHyperplane<S> plusOutside,
080                      final SubHyperplane<S> plusInside,
081                      final NodesSet<S> splitters) {
082        this.plusOutside = plusOutside;
083        this.plusInside  = plusInside;
084        this.splitters   = splitters;
085    }
086
087    /** Get the part of the node cut sub-hyperplane that belongs to the
088     * boundary and has the outside of the region on the plus side of
089     * its underlying hyperplane.
090     * @return part of the node cut sub-hyperplane that belongs to the
091     * boundary and has the outside of the region on the plus side of
092     * its underlying hyperplane
093     */
094    public SubHyperplane<S> getPlusOutside() {
095        return plusOutside;
096    }
097
098    /** Get the part of the node cut sub-hyperplane that belongs to the
099     * boundary and has the inside of the region on the plus side of
100     * its underlying hyperplane.
101     * @return part of the node cut sub-hyperplane that belongs to the
102     * boundary and has the inside of the region on the plus side of
103     * its underlying hyperplane
104     */
105    public SubHyperplane<S> getPlusInside() {
106        return plusInside;
107    }
108
109    /** Get the sub-hyperplanes that were used to split the boundary part.
110     * @return sub-hyperplanes that were used to split the boundary part
111     */
112    public NodesSet<S> getSplitters() {
113        return splitters;
114    }
115
116}