summaryrefslogtreecommitdiff
path: root/CSMath/src/bezier/transforms/TDHTransform.java
blob: 3b8c52e1688c7f0d173a26306c9e72871ff703d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package bezier.transforms;

import bezier.geom.TDHPoint;

/**
 * Transformation applicable to TDHPoints.
 * 
 * @author bjculkin
 *
 */
@FunctionalInterface
public interface TDHTransform {
	/**
	 * Get the type of this transform.
	 * 
	 * Unknown transformations are assumed to be identity transforms.
	 * 
	 * @return The type of this transform.
	 */
	default TDHTransformType type() {
		return TDHTransformType.IDENTITY;
	}

	/**
	 * Get the matrix representation of the transform.
	 * 
	 * Unknown transformations are assumed to be identity transforms.
	 * 
	 * @return The matrix representation of the transform.
	 */
	default double[][] matrix() {
		return new double[][] { new double[] { 1, 0, 0 }, new double[] { 0, 1, 0 }, new double[] { 0, 0, 1 } };
	}

	/**
	 * Get the inverse of the transform.
	 * 
	 * Unknown transformations are assumed to be identity transforms.
	 * 
	 * @return The inverse the transform.
	 */
	default TDHTransform invert() {
		return new TDHIdentity();
	}

	/**
	 * Apply the transform to a point.
	 * 
	 * @param punkt
	 *            The point to transform.
	 * @return A transformed version of the point.
	 */
	TDHPoint transform(TDHPoint punkt);
}