1
2 package hep.wired.heprep.services;
3
4 import java.util.*;
5
6 import org.freehep.xml.io.XMLIO;
7
8 import hep.wired.services.Feature;
9 import hep.wired.services.ViewPort;
10 import hep.wired.util.WiredRegistry;
11 import hep.wired.util.XYZindices;
12 import hep.wired.util.UVWindices;
13
14 /***
15 * Transforms coordinates in one system (X, Y, Z) into
16 * coordinates of another system (X', Y', Z'). Projections can be
17 * cascaded (sequenced).
18 *
19 * @author Mark Donszelmann
20 * @version $Id: Projection.java 2085 2005-07-20 17:55:45Z duns $
21 */
22
23 public interface Projection extends Feature, WiredRegistry.ID, XYZindices, UVWindices, XMLIO {
24
25 /***
26 * Returns the name of the projection.
27 */
28 public String getName();
29
30 /***
31 * Returns the formula in text readable form
32 */
33 public String getFormula();
34
35 /***
36 * Return true if this (composite) projection implements this featureClass.
37 */
38 public boolean supports(Class featureClass);
39
40 /***
41 * Return Feature if implemented, otherwise null.
42 */
43 public Feature getFeature(Class featureClass);
44
45 /***
46 * Sets the associated viewport.
47 */
48 public void setViewPort(ViewPort viewPort);
49
50 /***
51 * Returns the associated viewport.
52 */
53 public ViewPort getViewPort();
54
55 /***
56 * Returns an array of length 3: uvw = viewPort(projection(xyz)).
57 * The returned array may have a lifetime up to the next call to this method
58 * on this object.
59 * CoordinateProjection may be null.
60 */
61 public double[] transform(ViewPort viewPort, double[] xyz);
62
63 /***
64 * Returns an array of length 3: uvw = projection(xyz).
65 * The returned array may have a lifetime up to the next call to this method
66 * on this object.
67 */
68 public double[] transform(double[] xyz);
69
70 /***
71 * Returns an array of length 3*n: uvw[][n] = viewPort(projection(xyz[][n])).
72 * The returned array may have a lifetime up to the next call to this method
73 * on this object. The number of "valid" coordinates is given by n.
74 * CoordinateProjection may be null.
75 */
76 public double[][] transform(ViewPort viewPort, double[][] xyz, int n);
77
78 /***
79 * Returns an array of length 3*n: uvw[][n] = projection(xyz[][n]).
80 * The returned array may have a lifetime up to the next call to this method
81 * on this object. The number of "valid" coordinates is given by n.
82 */
83 public double[][] transform(double[][] xyz, int n);
84
85 /***
86 * Returns an array of length 3: uvw = delta projection(xyz).
87 * The returned array may have a lifetime up to the next call to this method
88 * on this object.
89 */
90 public double[] deltaTransform(double[] xyz);
91
92 /***
93 * Returns an array of length 3: xyz = inverse projection(uvw).
94 * The returned array may have a lifetime up to the next call to this method
95 * on this object.
96 * UnsupportedOperation is thrown in no inverse projection is possible.
97 */
98 public double[] inverseTransform(double[] uvw) throws UnsupportedOperationException;
99
100 /***
101 * Returns an array of length 3: xyz = inverse delta projection(uvw).
102 * The returned array may have a lifetime up to the next call to this method
103 * on this object.
104 * UnsupportedOperation is thrown in no inverse delta projection is possible.
105 */
106 public double[] inverseDeltaTransform(double[] uvw) throws UnsupportedOperationException;
107
108 /***
109 * Returns a deep copy of the projection.
110 */
111 public Projection copy();
112 }