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    
023    /** This interface represents an inversible affine transform in a space.
024     * <p>Inversible affine transform include for example scalings,
025     * translations, rotations.</p>
026    
027     * <p>Transforms are dimension-specific. The consistency rules between
028     * the three {@code apply} methods are the following ones for a
029     * transformed defined for dimension D:</p>
030     * <ul>
031     *   <li>
032     *     the transform can be applied to a point in the
033     *     D-dimension space using its {@link #apply(Vector)}
034     *     method
035     *   </li>
036     *   <li>
037     *     the transform can be applied to a (D-1)-dimension
038     *     hyperplane in the D-dimension space using its
039     *     {@link #apply(Hyperplane)} method
040     *   </li>
041     *   <li>
042     *     the transform can be applied to a (D-2)-dimension
043     *     sub-hyperplane in a (D-1)-dimension hyperplane using
044     *     its {@link #apply(SubHyperplane, Hyperplane, Hyperplane)}
045     *     method
046     *   </li>
047     * </ul>
048    
049     * @param <S> Type of the embedding space.
050     * @param <T> Type of the embedded sub-space.
051    
052     * @version $Id: Transform.java 1416643 2012-12-03 19:37:14Z tn $
053     * @since 3.0
054     */
055    public interface Transform<S extends Space, T extends Space> {
056    
057        /** Transform a point of a space.
058         * @param point point to transform
059         * @return a new object representing the transformed point
060         */
061        Vector<S> apply(Vector<S> point);
062    
063        /** Transform an hyperplane of a space.
064         * @param hyperplane hyperplane to transform
065         * @return a new object representing the transformed hyperplane
066         */
067        Hyperplane<S> apply(Hyperplane<S> hyperplane);
068    
069        /** Transform a sub-hyperplane embedded in an hyperplane.
070         * @param sub sub-hyperplane to transform
071         * @param original hyperplane in which the sub-hyperplane is
072         * defined (this is the original hyperplane, the transform has
073         * <em>not</em> been applied to it)
074         * @param transformed hyperplane in which the sub-hyperplane is
075         * defined (this is the transformed hyperplane, the transform
076         * <em>has</em> been applied to it)
077         * @return a new object representing the transformed sub-hyperplane
078         */
079        SubHyperplane<T> apply(SubHyperplane<T> sub, Hyperplane<S> original, Hyperplane<S> transformed);
080    
081    }