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
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(Point)}
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 * @since 3.0
053 */
054public interface Transform<S extends Space, T extends Space> {
055
056    /** Transform a point of a space.
057     * @param point point to transform
058     * @return a new object representing the transformed point
059     */
060    Point<S> apply(Point<S> point);
061
062    /** Transform an hyperplane of a space.
063     * @param hyperplane hyperplane to transform
064     * @return a new object representing the transformed hyperplane
065     */
066    Hyperplane<S> apply(Hyperplane<S> hyperplane);
067
068    /** Transform a sub-hyperplane embedded in an hyperplane.
069     * @param sub sub-hyperplane to transform
070     * @param original hyperplane in which the sub-hyperplane is
071     * defined (this is the original hyperplane, the transform has
072     * <em>not</em> been applied to it)
073     * @param transformed hyperplane in which the sub-hyperplane is
074     * defined (this is the transformed hyperplane, the transform
075     * <em>has</em> been applied to it)
076     * @return a new object representing the transformed sub-hyperplane
077     */
078    SubHyperplane<T> apply(SubHyperplane<T> sub, Hyperplane<S> original, Hyperplane<S> transformed);
079
080}