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.Point;
020import org.apache.commons.math3.geometry.Space;
021
022/** This interface defines mappers between a space and one of its sub-spaces.
023
024 * <p>Sub-spaces are the lower dimensions subsets of a n-dimensions
025 * space. The (n-1)-dimension sub-spaces are specific sub-spaces known
026 * as {@link Hyperplane hyperplanes}. This interface can be used regardless
027 * of the dimensions differences. As an example, {@link
028 * org.apache.commons.math3.geometry.euclidean.threed.Line Line} in 3D
029 * implements Embedding<{@link
030 * org.apache.commons.math3.geometry.euclidean.threed.Vector3D Vector3D}, {link
031 * org.apache.commons.math3.geometry.euclidean.oned.Vector1D Vector1D>, i.e. it
032 * maps directly dimensions 3 and 1.</p>
033
034 * <p>In the 3D euclidean space, hyperplanes are 2D planes, and the 1D
035 * sub-spaces are lines.</p>
036
037 * <p>
038 * Note that this interface is <em>not</em> intended to be implemented
039 * by Apache Commons Math users, it is only intended to be implemented
040 * within the library itself. New methods may be added even for minor
041 * versions, which breaks compatibility for external implementations.
042 * </p>
043
044 * @param <S> Type of the embedding space.
045 * @param <T> Type of the embedded sub-space.
046
047 * @see Hyperplane
048 * @since 3.0
049 */
050public interface Embedding<S extends Space, T extends Space> {
051
052    /** Transform a space point into a sub-space point.
053     * @param point n-dimension point of the space
054     * @return (n-1)-dimension point of the sub-space corresponding to
055     * the specified space point
056     * @see #toSpace
057     */
058    Point<T> toSubSpace(Point<S> point);
059
060    /** Transform a sub-space point into a space point.
061     * @param point (n-1)-dimension point of the sub-space
062     * @return n-dimension point of the space corresponding to the
063     * specified sub-space point
064     * @see #toSubSpace
065     */
066    Point<S> toSpace(Point<T> point);
067
068}