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 agents.anac.y2019.harddealer.math3.geometry.partitioning;
|
---|
18 |
|
---|
19 | import agents.anac.y2019.harddealer.math3.geometry.Point;
|
---|
20 | import agents.anac.y2019.harddealer.math3.geometry.Space;
|
---|
21 |
|
---|
22 | /** This interface represents an hyperplane of a space.
|
---|
23 |
|
---|
24 | * <p>The most prominent place where hyperplane appears in space
|
---|
25 | * partitioning is as cutters. Each partitioning node in a {@link
|
---|
26 | * BSPTree BSP tree} has a cut {@link SubHyperplane sub-hyperplane}
|
---|
27 | * which is either an hyperplane or a part of an hyperplane. In an
|
---|
28 | * n-dimensions euclidean space, an hyperplane is an (n-1)-dimensions
|
---|
29 | * hyperplane (for example a traditional plane in the 3D euclidean
|
---|
30 | * space). They can be more exotic objects in specific fields, for
|
---|
31 | * example a circle on the surface of the unit sphere.</p>
|
---|
32 |
|
---|
33 | * <p>
|
---|
34 | * Note that this interface is <em>not</em> intended to be implemented
|
---|
35 | * by Apache Commons Math users, it is only intended to be implemented
|
---|
36 | * within the library itself. New methods may be added even for minor
|
---|
37 | * versions, which breaks compatibility for external implementations.
|
---|
38 | * </p>
|
---|
39 |
|
---|
40 | * @param <S> Type of the space.
|
---|
41 |
|
---|
42 | * @since 3.0
|
---|
43 | */
|
---|
44 | public interface Hyperplane<S extends Space> {
|
---|
45 |
|
---|
46 | /** Copy the instance.
|
---|
47 | * <p>The instance created is completely independant of the original
|
---|
48 | * one. A deep copy is used, none of the underlying objects are
|
---|
49 | * shared (except for immutable objects).</p>
|
---|
50 | * @return a new hyperplane, copy of the instance
|
---|
51 | */
|
---|
52 | Hyperplane<S> copySelf();
|
---|
53 |
|
---|
54 | /** Get the offset (oriented distance) of a point.
|
---|
55 | * <p>The offset is 0 if the point is on the underlying hyperplane,
|
---|
56 | * it is positive if the point is on one particular side of the
|
---|
57 | * hyperplane, and it is negative if the point is on the other side,
|
---|
58 | * according to the hyperplane natural orientation.</p>
|
---|
59 | * @param point point to check
|
---|
60 | * @return offset of the point
|
---|
61 | */
|
---|
62 | double getOffset(Point<S> point);
|
---|
63 |
|
---|
64 | /** Project a point to the hyperplane.
|
---|
65 | * @param point point to project
|
---|
66 | * @return projected point
|
---|
67 | * @since 3.3
|
---|
68 | */
|
---|
69 | Point<S> project(Point<S> point);
|
---|
70 |
|
---|
71 | /** Get the tolerance below which points are considered to belong to the hyperplane.
|
---|
72 | * @return tolerance below which points are considered to belong to the hyperplane
|
---|
73 | * @since 3.3
|
---|
74 | */
|
---|
75 | double getTolerance();
|
---|
76 |
|
---|
77 | /** Check if the instance has the same orientation as another hyperplane.
|
---|
78 | * <p>This method is expected to be called on parallel hyperplanes. The
|
---|
79 | * method should <em>not</em> re-check for parallelism, only for
|
---|
80 | * orientation, typically by testing something like the sign of the
|
---|
81 | * dot-products of normals.</p>
|
---|
82 | * @param other other hyperplane to check against the instance
|
---|
83 | * @return true if the instance and the other hyperplane have
|
---|
84 | * the same orientation
|
---|
85 | */
|
---|
86 | boolean sameOrientationAs(Hyperplane<S> other);
|
---|
87 |
|
---|
88 | /** Build a sub-hyperplane covering the whole hyperplane.
|
---|
89 | * @return a sub-hyperplane covering the whole hyperplane
|
---|
90 | */
|
---|
91 | SubHyperplane<S> wholeHyperplane();
|
---|
92 |
|
---|
93 | /** Build a region covering the whole space.
|
---|
94 | * @return a region containing the instance
|
---|
95 | */
|
---|
96 | Region<S> wholeSpace();
|
---|
97 |
|
---|
98 | }
|
---|