    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     */
    017    package org.apache.commons.math3.geometry.partitioning;
    018
    019    import org.apache.commons.math3.geometry.Vector;
    020    import 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     * @param <S> Type of the embedding space.
    038     * @param <T> Type of the embedded sub-space.
    039
    040     * @see Hyperplane
    041     * @version $Id: Embedding.java 1416643 2012-12-03 19:37:14Z tn $
    042     * @since 3.0
    043     */
    044    public interface Embedding<S extends Space, T extends Space> {
    045
    046        /** Transform a space point into a sub-space point.
    047         * @param point n-dimension point of the space
    048         * @return (n-1)-dimension point of the sub-space corresponding to
    049         * the specified space point
    050         * @see #toSpace
    051         */
    052        Vector<T> toSubSpace(Vector<S> point);
    053
    054        /** Transform a sub-space point into a space point.
    055         * @param point (n-1)-dimension point of the sub-space
    056         * @return n-dimension point of the space corresponding to the
    057         * specified sub-space point
    058         * @see #toSubSpace
    059         */
    060        Vector<S> toSpace(Vector<T> point);
    061
    062    }