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.math3.geometry.partitioning;
18 
19 import org.apache.commons.math3.geometry.Space;
20 
21 /** Class holding boundary attributes.
22  * <p>This class is used for the attributes associated with the
23  * nodes of region boundary shell trees returned by the {@link
24  * Region#getTree(boolean) Region.getTree(includeBoundaryAttributes)}
25  * when the boolean {@code includeBoundaryAttributes} parameter is
26  * set to {@code true}. It contains the parts of the node cut
27  * sub-hyperplane that belong to the boundary.</p>
28  * <p>This class is a simple placeholder, it does not provide any
29  * processing methods.</p>
30  * @param <S> Type of the space.
31  * @see Region#getTree
32  * @since 3.0
33  */
34 public class BoundaryAttribute<S extends Space> {
35 
36     /** Part of the node cut sub-hyperplane that belongs to the
37      * boundary and has the outside of the region on the plus side of
38      * its underlying hyperplane (may be null).
39      */
40     private final SubHyperplane<S> plusOutside;
41 
42     /** Part of the node cut sub-hyperplane that belongs to the
43      * boundary and has the inside of the region on the plus side of
44      * its underlying hyperplane (may be null).
45      */
46     private final SubHyperplane<S> plusInside;
47 
48     /** Sub-hyperplanes that were used to split the boundary part. */
49     private final NodesSet<S> splitters;
50 
51     /** Simple constructor.
52      * @param plusOutside part of the node cut sub-hyperplane that
53      * belongs to the boundary and has the outside of the region on
54      * the plus side of its underlying hyperplane (may be null)
55      * @param plusInside part of the node cut sub-hyperplane that
56      * belongs to the boundary and has the inside of the region on the
57      * plus side of its underlying hyperplane (may be null)
58      * @deprecated as of 3.4, the constructor has been replaced by a new one
59      * which is not public anymore, as it is intended to be used only by
60      * {@link BoundaryBuilder}
61      */
62     @Deprecated
BoundaryAttribute(final SubHyperplane<S> plusOutside, final SubHyperplane<S> plusInside)63     public BoundaryAttribute(final SubHyperplane<S> plusOutside,
64                              final SubHyperplane<S> plusInside) {
65         this(plusOutside, plusInside, null);
66     }
67 
68     /** Simple constructor.
69      * @param plusOutside part of the node cut sub-hyperplane that
70      * belongs to the boundary and has the outside of the region on
71      * the plus side of its underlying hyperplane (may be null)
72      * @param plusInside part of the node cut sub-hyperplane that
73      * belongs to the boundary and has the inside of the region on the
74      * plus side of its underlying hyperplane (may be null)
75      * @param splitters sub-hyperplanes that were used to
76      * split the boundary part (may be null)
77      * @since 3.4
78      */
BoundaryAttribute(final SubHyperplane<S> plusOutside, final SubHyperplane<S> plusInside, final NodesSet<S> splitters)79     BoundaryAttribute(final SubHyperplane<S> plusOutside,
80                       final SubHyperplane<S> plusInside,
81                       final NodesSet<S> splitters) {
82         this.plusOutside = plusOutside;
83         this.plusInside  = plusInside;
84         this.splitters   = splitters;
85     }
86 
87     /** Get the part of the node cut sub-hyperplane that belongs to the
88      * boundary and has the outside of the region on the plus side of
89      * its underlying hyperplane.
90      * @return part of the node cut sub-hyperplane that belongs to the
91      * boundary and has the outside of the region on the plus side of
92      * its underlying hyperplane
93      */
getPlusOutside()94     public SubHyperplane<S> getPlusOutside() {
95         return plusOutside;
96     }
97 
98     /** Get the part of the node cut sub-hyperplane that belongs to the
99      * 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      */
getPlusInside()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      */
getSplitters()112     public NodesSet<S> getSplitters() {
113         return splitters;
114     }
115 
116 }
117