25 |
26 | That's it. Now a mouse left-drag will rotate the camera around the subject, a right drag will zoom in and out, and a middle-drag will pan. A double-click restores the camera to its original position.
27 |
28 | The PeasyCam is positioned on a sphere whose radius is the given distance from the look-at point. Rotations are around axes that pass through the looked-at point.
29 |
30 | h3. Constructors
31 |
32 |
camera.setActive(boolean active); // false to make this camera stop responding to mouse
38 |
39 | // By default, the camera is in "free rotation" mode, but you can
40 | // constrain it to any axis, around the look-at point:
41 | camera.setYawRotationMode(); // like spinning a globe
42 | camera.setPitchRotationMode(); // like a somersault
43 | camera.setRollRotationMode(); // like a radio knob
44 | camera.setSuppressRollRotationMode(); // Permit pitch/yaw only.
45 |
46 | // Then you can set it back to its default mode:
47 | camera.setFreeRotationMode();
48 |
49 | // reassign particular drag gestures, or set them to null
50 | camera.setLeftDragHandler(PeasyDragHandler handler);
51 | camera.setCenterDragHandler(PeasyDragHandler handler);
52 | camera.setRightDragHandler(PeasyDragHandler handler);
53 | PeasyDragHandler getPanDragHandler();
54 | PeasyDragHandler getRotateDragHandler();
55 | PeasyDragHandler getZoomDragHandler();
56 |
57 | // mouse wheel zooms by default; set null, or make your own
58 | camera.setWheelHandler(PeasyWheelHandler handler);
59 | PeasyWheelHandler getZoomWheelHandler();
60 |
61 | // change sensitivity of built-in mouse wheel zoom
62 | camera.setWheelScale(double scale); // 1.0 by default
63 | double getWheelScale();
64 |
65 | // make your own!
66 | public interface PeasyDragHandler {
67 | public void handleDrag(final double dx, final double dy);
68 | }
69 | public interface PeasyWheelHandler {
70 | public void handleWheel(final int delta);
71 | }
72 |
73 | camera.lookAt(double x, double y, double z);
74 | camera.rotateX(double angle); // rotate around the x-axis passing through the subject
75 | camera.rotateY(double angle); // rotate around the y-axis passing through the subject
76 | camera.rotateZ(double angle); // rotate around the z-axis passing through the subject
77 | camera.setDistance(double d); // distance from looked-at point
78 | camera.pan(double dx, double dy); // move the looked-at point relative to current orientation
79 |
80 | camera.reset();
81 | camera.reset(long animationTimeInMillis); // reset camera to its starting settings
82 |
83 | CameraState state = camera.getState(); // get a serializable settings object for current state
84 | camera.setState(CameraState state);
85 | camera.setState(CameraState state, long animationTimeInMillis); // set the camera to the given saved state
86 |
87 | // Utility methods to permit the use of a Heads-Up Display
88 | // Thanks, A.W. Martin
89 | camera.beginHUD();
90 | // now draw things that you want relative to the camera's position and orientation
91 | camera.endHUD(); // always!
92 |
93 | PeasyCam is impervious to gimbal lock, and has no known "singularities" or discontinuities in its behavior. It relies on the excellent "Apache Commons Math":http://commons.apache.org/math/ "geometry package":http://commons.apache.org/math/userguide/geometry.html for its rotations.
94 |
95 | h3. Contributors
96 |
97 | Thanks: "Gennaro Senatore":http://wiki.uelceca.net/msc0809/published/gennaro+senatore, "Michael Kaufmann":http://www.michael-kaufmann.ch/, "Oori Shalev":http://ooish.com/, Jeffrey Gentes, "A.W. Martin":http://imaginationfeed.com, "Yiannis Chatzikonstantinou":http://prototy.blogspot.com/, and "Donald Ephraim Curtis":http://milkbox.net/ for bug reports and feature suggestions.
98 |
--------------------------------------------------------------------------------
/resources/stylesheet.css:
--------------------------------------------------------------------------------
1 | /* Javadoc style sheet */
2 | /* Define colors, fonts and other style attributes here to override the defaults */
3 | /* processingLibs style by andreas schlegel, sojamo */
4 |
5 |
6 | body {
7 | margin : 0;
8 | padding : 0;
9 | padding-left : 10px;
10 | padding-right : 8px;
11 | background-color : #FFFFFF;
12 | font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
13 | font-size : 100%;
14 | font-size : 0.7em;
15 | font-weight : normal;
16 | line-height : normal;
17 | margin-bottom:30px;
18 | }
19 |
20 |
21 |
22 |
23 | /* Headings */
24 | h1, h2, h3, h4, h5, th {
25 | font-family :Arial, Helvetica, sans-serif;
26 | font-size:1.2em;
27 | }
28 |
29 |
30 | p {
31 | font-size : 1em;
32 | width:80%;
33 | }
34 |
35 | pre, code {
36 | font-family : "Courier New", Courier, monospace;
37 | font-size : 12px;
38 | line-height : normal;
39 | }
40 |
41 |
42 |
43 | table {
44 | border:0;
45 | margin-bottom:10px;
46 | margin-top:10px;
47 | }
48 |
49 |
50 | tr, td {
51 | border-top: 0px solid;
52 | border-left: 0px solid;
53 | padding-top:8px;
54 | padding-bottom:8px;
55 | }
56 |
57 |
58 |
59 | hr {
60 | border:0;
61 | height:1px;
62 | padding:0;
63 | margin:0;
64 | margin-bottom:4px;
65 |
66 | }
67 |
68 |
69 |
70 | dd, th, td, font {
71 | font-size:1.0em;
72 | line-height:1.0em;
73 | }
74 |
75 |
76 |
77 | dt {
78 | margin-bottom:0px;
79 | }
80 |
81 |
82 |
83 | dd {
84 | margin-top:2px;
85 | margin-bottom:4px;
86 | }
87 |
88 |
89 |
90 | a {
91 | text-decoration: underline;
92 | font-weight: normal;
93 | }
94 |
95 | a:hover,
96 | a:active {
97 | text-decoration: underline;
98 | font-weight: normal;
99 | }
100 |
101 | a:visited,
102 | a:link:visited {
103 | text-decoration: underline;
104 | font-weight: normal;
105 | }
106 |
107 |
108 | img {
109 | border: 0px solid #000000;
110 | }
111 |
112 |
113 |
114 | /* Navigation bar fonts */
115 | .NavBarCell1 {
116 | border:0;
117 | }
118 |
119 | .NavBarCell1Rev {
120 | border:0;
121 | }
122 |
123 | .NavBarFont1 {
124 | font-family: Arial, Helvetica, sans-serif;
125 | font-size:1.1em;
126 | }
127 |
128 |
129 | .NavBarFont1 b {
130 | font-weight:normal;
131 | }
132 |
133 |
134 |
135 | .NavBarFont1:after, .NavBarFont1Rev:after {
136 | font-weight:normal;
137 | content: " \\";
138 | }
139 |
140 |
141 | .NavBarFont1Rev {
142 | font-family: Arial, Helvetica, sans-serif;
143 | font-size:1.1em;
144 | }
145 |
146 | .NavBarFont1Rev b {
147 | font-family: Arial, Helvetica, sans-serif;
148 | font-size:1.1em;
149 | font-weight:normal;
150 | }
151 |
152 | .NavBarCell2 {
153 | font-family: Arial, Helvetica, sans-serif;
154 | }
155 |
156 | .NavBarCell3 {
157 | font-family: Arial, Helvetica, sans-serif;
158 | }
159 |
160 |
161 |
162 | font.FrameItemFont {
163 | font-family: Helvetica, Arial, sans-serif;
164 | font-size:1.1em;
165 | line-height:1.1em;
166 | }
167 |
168 | font.FrameHeadingFont {
169 | font-family: Helvetica, Arial, sans-serif;
170 | line-height:32px;
171 | }
172 |
173 | /* Font used in left-hand frame lists */
174 | .FrameTitleFont {
175 | font-family: Helvetica, Arial, sans-serif
176 | }
177 |
178 |
179 | .toggleList {
180 | padding:0;
181 | margin:0;
182 | margin-top:12px;
183 | }
184 |
185 | .toggleList dt {
186 | font-weight:bold;
187 | font-size:12px;
188 | font-family:arial,sans-serif;
189 | padding:0px;
190 | margin:10px 0px 10px 0px;
191 | }
192 |
193 | .toggleList dt span {
194 | font-family: monospace;
195 | padding:0;
196 | margin:0;
197 | }
198 |
199 |
200 | .toggleList dd {
201 | margin:0;
202 | padding:0;
203 | }
204 |
205 | html.isjs .toggleList dd {
206 | display: none;
207 | }
208 |
209 | .toggleList pre {
210 | padding: 4px 4px 4px 4px;
211 | }
212 |
213 |
214 |
215 |
216 |
217 | /* COLORS */
218 |
219 | pre, code {
220 | color: #000000;
221 | }
222 |
223 |
224 | body {
225 | color : #333333;
226 | background-color :#FFFFFF;
227 | }
228 |
229 |
230 | h1, h2, h3, h4, h5, h6 {
231 | color:#555;
232 | }
233 |
234 | a,
235 | .toggleList dt {
236 | color: #1a7eb0;
237 | }
238 |
239 | a:hover,
240 | a:active {
241 | color: #1a7eb0;
242 | }
243 |
244 | a:visited,
245 | a:link:visited {
246 | color: #1a7eb0;
247 | }
248 |
249 | td,tr {
250 | border-color: #999999;
251 | }
252 |
253 | hr {
254 | color:#999999;
255 | background:#999999;
256 | }
257 |
258 |
259 | .TableHeadingColor {
260 | background: #dcdcdc;
261 | color: #555;
262 | }
263 |
264 |
265 | .TableSubHeadingColor {
266 | background: #EEEEFF
267 | }
268 |
269 | .TableRowColor {
270 | background: #FFFFFF
271 | }
272 |
273 |
274 | .NavBarCell1 {
275 | background-color:#dcdcdc;
276 | color:#000;
277 | }
278 |
279 | .NavBarCell1 a {
280 | color:#333;
281 | }
282 |
283 |
284 | .NavBarCell1Rev {
285 | background-color:transparent;
286 | }
287 |
288 | .NavBarFont1 {
289 | color:#333;
290 | }
291 |
292 |
293 | .NavBarFont1Rev {
294 | color:#fff;
295 | }
296 |
297 | .NavBarCell2 {
298 | background-color:#999;
299 | }
300 |
301 | .NavBarCell2 a {
302 | color:#fff;
303 | }
304 |
305 |
306 |
307 | .NavBarCell3 {
308 | background-color:#dcdcdc;
309 | }
310 |
311 |
--------------------------------------------------------------------------------
/src/peasy/org/apache/commons/math/geometry/RotationOrder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package peasy.org.apache.commons.math.geometry;
19 |
20 | /**
21 | * This class is a utility representing a rotation order specification for
22 | * Cardan or Euler angles specification.
23 | *
24 | * This class cannot be instanciated by the user. He can only use one of the
25 | * twelve predefined supported orders as an argument to either the
26 | * {@link Rotation#Rotation(RotationOrder,double,double,double)} constructor or
27 | * the {@link Rotation#getAngles} method.
28 | *
29 | * @version $Revision: 620312 $ $Date: 2008-02-10 12:28:59 -0700 (Sun, 10 Feb
30 | * 2008) $
31 | * @since 1.2
32 | */
33 | public final class RotationOrder {
34 |
35 | /**
36 | * Private constructor. This is a utility class that cannot be instantiated
37 | * by the user, so its only constructor is private.
38 | *
39 | * @param name
40 | * name of the rotation order
41 | * @param a1
42 | * axis of the first rotation
43 | * @param a2
44 | * axis of the second rotation
45 | * @param a3
46 | * axis of the third rotation
47 | */
48 | private RotationOrder(final String name, final Vector3D a1, final Vector3D a2,
49 | final Vector3D a3) {
50 | this.name = name;
51 | this.a1 = a1;
52 | this.a2 = a2;
53 | this.a3 = a3;
54 | }
55 |
56 | /**
57 | * Get a string representation of the instance.
58 | *
59 | * @return a string representation of the instance (in fact, its name)
60 | */
61 | public String toString() {
62 | return name;
63 | }
64 |
65 | /**
66 | * Get the axis of the first rotation.
67 | *
68 | * @return axis of the first rotation
69 | */
70 | public Vector3D getA1() {
71 | return a1;
72 | }
73 |
74 | /**
75 | * Get the axis of the second rotation.
76 | *
77 | * @return axis of the second rotation
78 | */
79 | public Vector3D getA2() {
80 | return a2;
81 | }
82 |
83 | /**
84 | * Get the axis of the second rotation.
85 | *
86 | * @return axis of the second rotation
87 | */
88 | public Vector3D getA3() {
89 | return a3;
90 | }
91 |
92 | /**
93 | * Set of Cardan angles. this ordered set of rotations is around X, then
94 | * around Y, then around Z
95 | */
96 | public static final RotationOrder XYZ = new RotationOrder("XYZ", Vector3D.plusI,
97 | Vector3D.plusJ, Vector3D.plusK);
98 |
99 | /**
100 | * Set of Cardan angles. this ordered set of rotations is around X, then
101 | * around Z, then around Y
102 | */
103 | public static final RotationOrder XZY = new RotationOrder("XZY", Vector3D.plusI,
104 | Vector3D.plusK, Vector3D.plusJ);
105 |
106 | /**
107 | * Set of Cardan angles. this ordered set of rotations is around Y, then
108 | * around X, then around Z
109 | */
110 | public static final RotationOrder YXZ = new RotationOrder("YXZ", Vector3D.plusJ,
111 | Vector3D.plusI, Vector3D.plusK);
112 |
113 | /**
114 | * Set of Cardan angles. this ordered set of rotations is around Y, then
115 | * around Z, then around X
116 | */
117 | public static final RotationOrder YZX = new RotationOrder("YZX", Vector3D.plusJ,
118 | Vector3D.plusK, Vector3D.plusI);
119 |
120 | /**
121 | * Set of Cardan angles. this ordered set of rotations is around Z, then
122 | * around X, then around Y
123 | */
124 | public static final RotationOrder ZXY = new RotationOrder("ZXY", Vector3D.plusK,
125 | Vector3D.plusI, Vector3D.plusJ);
126 |
127 | /**
128 | * Set of Cardan angles. this ordered set of rotations is around Z, then
129 | * around Y, then around X
130 | */
131 | public static final RotationOrder ZYX = new RotationOrder("ZYX", Vector3D.plusK,
132 | Vector3D.plusJ, Vector3D.plusI);
133 |
134 | /**
135 | * Set of Euler angles. this ordered set of rotations is around X, then
136 | * around Y, then around X
137 | */
138 | public static final RotationOrder XYX = new RotationOrder("XYX", Vector3D.plusI,
139 | Vector3D.plusJ, Vector3D.plusI);
140 |
141 | /**
142 | * Set of Euler angles. this ordered set of rotations is around X, then
143 | * around Z, then around X
144 | */
145 | public static final RotationOrder XZX = new RotationOrder("XZX", Vector3D.plusI,
146 | Vector3D.plusK, Vector3D.plusI);
147 |
148 | /**
149 | * Set of Euler angles. this ordered set of rotations is around Y, then
150 | * around X, then around Y
151 | */
152 | public static final RotationOrder YXY = new RotationOrder("YXY", Vector3D.plusJ,
153 | Vector3D.plusI, Vector3D.plusJ);
154 |
155 | /**
156 | * Set of Euler angles. this ordered set of rotations is around Y, then
157 | * around Z, then around Y
158 | */
159 | public static final RotationOrder YZY = new RotationOrder("YZY", Vector3D.plusJ,
160 | Vector3D.plusK, Vector3D.plusJ);
161 |
162 | /**
163 | * Set of Euler angles. this ordered set of rotations is around Z, then
164 | * around X, then around Z
165 | */
166 | public static final RotationOrder ZXZ = new RotationOrder("ZXZ", Vector3D.plusK,
167 | Vector3D.plusI, Vector3D.plusK);
168 |
169 | /**
170 | * Set of Euler angles. this ordered set of rotations is around Z, then
171 | * around Y, then around Z
172 | */
173 | public static final RotationOrder ZYZ = new RotationOrder("ZYZ", Vector3D.plusK,
174 | Vector3D.plusJ, Vector3D.plusK);
175 |
176 | /** Name of the rotations order. */
177 | private final String name;
178 |
179 | /** Axis of the first rotation. */
180 | private final Vector3D a1;
181 |
182 | /** Axis of the second rotation. */
183 | private final Vector3D a2;
184 |
185 | /** Axis of the third rotation. */
186 | private final Vector3D a3;
187 |
188 | }
189 |
--------------------------------------------------------------------------------
/commons-math-1.2/RELEASE-NOTES.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache Commons Math Version 1.2
3 | RELEASE NOTES
4 |
5 |
6 | This release combines bug fixes and new features. Most notable among the new
7 | features are the estimation, optimization, geometry and ode packages added
8 | from the Mantissa library. Implementations of fast Fourier transform, QR
9 | decomposition and several numerical integration algorithms have also been
10 | added, along with enhancements and extensions to packages included in Commons
11 | Math 1.1. This release is source and binary compatible with earlier versions
12 | of Commons Math.
13 |
14 | For more information on Apache Commons Math, see
15 | http://commons.apache.org/math/
16 |
17 |
18 | SUMMARY OF CHANGES
19 |
20 | ADDITIONS
21 |
22 | * Added the estimation, optimization, geometry and ode packages from the
23 | Mantissa library.
24 |
25 | * MATH-120. Added Pascal distribution implementation. Thanks to Todd C.
26 | Parnell.
27 |
28 | * MATH-148. Added QR Decomposition. Thanks to Joni Salonen.
29 |
30 | * MATH-140. Added Fast Fourier Transform implementation. Thanks to Xiaogang
31 | Zhang.
32 |
33 | * MATH-173. Added one-way ANOVA implementation. Thanks to Bob MacCallum.
34 |
35 | * Added an angle normalization method in MathUtils to force angles in some
36 | user-defined interval
37 |
38 | * Added vectorial covariance computation (either sample or population
39 | covariance)
40 |
41 | * Added multivariate summary statistics.
42 |
43 |
44 | BUG FIXES
45 |
46 | * Fixed numerous warnings in test code.
47 |
48 | * MATH-156. Use the initial guess provided by the user in
49 | BrentSolver.solve(), thus improving speed. Thanks to Tyler Ward.
50 |
51 | * MATH-18. Made ComplexFormat format double values with a provided
52 | NumberFormat instance instead of using the real part format for all values.
53 | Thanks to Phil Steitz.
54 |
55 | * MATH-60. Modified ProperFractionFormat to reject embedded minus signs.
56 | Thanks to Nhung Nnguyen.
57 |
58 | * MATH-151. Added a nextAfter method in MathUtils to return the next
59 | machine-representable number in a specified direction from a given floating
60 | point number. Used this to ensure that MathUtils.round does not return
61 | incorrect results for numbers with bad IEEE754 representations. Thanks to
62 | Luc Maisonobe.
63 |
64 | * MATH-85. Modified getSumSquaredErrors method in SimpleRegression to always
65 | return a non-negative result. Thanks to Mark Osborn, Luc Maisonobe.
66 |
67 | * MATH-153. Corrected nextInt and nextLong to handle wide value ranges.
68 | Thanks to Remi Arntzen.
69 |
70 | * MATH-166. Increased default precision of Gamma and Beta functions. Thanks
71 | to Lukas Theussl.
72 |
73 | * MATH-167. Modified NormalDistributionImpl.cumulativeProbablity to catch
74 | MaxIterationsExceededException and return 0 or 1, resp. if the argument is
75 | more than 20 standard deviations from the mean.
76 |
77 | * MATH-174. Changed Mean.evaluate() to use a two-pass algorithm, improving
78 | accuracy by exploiting the the fact that this method has access to the full
79 | array of data values.
80 |
81 | * MATH-175. Added check and rescaling of expected counts to sum to sum of
82 | expected counts if necessary in ChiSquare test. Thanks to Carl Anderson.
83 |
84 | * MATH-164. Handle multiplication of Complex numbers with infinite parts
85 | specially.
86 |
87 | * MATH-182. Add integer overflow checks in Fraction constructor using double
88 | parameter.
89 |
90 | * MATH-185. Throw EOFException when using empty files with ValueServer in
91 | replay and digest modes.
92 |
93 | * MATH-184. Fixed AbstractIntegerDistribution cumulativeProbablility(-,-) to
94 | correctly handle double arguments. Thanks to Yegor Bryukhov.
95 |
96 |
97 | UPDATES
98 |
99 | * MATH-158. Added log function to MathUtils. Thanks to Hasan Diwan.
100 |
101 | * MATH-160. Added two sample (binned comparison) ChiSquare test. Thanks to
102 | Matthias Hummel.
103 |
104 | * MATH-170. Added SynchronizedDescriptiveStatistics class. Thanks to David J.
105 | M. Karlsen.
106 |
107 | * MATH-154. Added addAndCheck, mulAndCheck, and subAndCheck MathUtils methods
108 | for long integer arguments. Thanks to Remi Arntzen.
109 |
110 | * MATH-171. Merged most functions from ComplexUtils into Complex class, added
111 | static factory method to Complex. Thanks to Niall Pemberton.
112 |
113 | * Deprecated abstract factory methods and made DescriptiveStatistics and and
114 | SummaryStatistics concrete classes. Pushed implementations up from
115 | DescriptiveStatisticsImpl, SummaryStatisticsImpl. Made implementations of
116 | statistics configurable via setters.
117 |
118 | * MATH-176. Add errors guessing to least-squares estimators. Thanks to
119 | Kazuhiro Koshino.
120 |
121 | * MATH-179. Add tests for Fraction constructor using double parameter. Thanks
122 | to Niall Pemberton.
123 |
124 | * MATH-181. Add Fraction constructor using max denominator value. Thanks to
125 | Niall Pemberton.
126 |
127 | * Added a equals and hash methods in MathUtils to check for double arrays
128 |
129 | * MATH-191. Added getSumOfLogs method to SummaryStatistics and made SumOfLogs
130 | instance used by GeometricMean configurable.
131 |
132 | * MATH-188. Made numerator and denominator final in Fraction and deprecated
133 | protected real and imaginary parts fields in Complex, making Fraction
134 | immutable and preparing Complex to become fully immutable in 2.0. Thanks to
135 | Sebastian Bazley.
136 |
137 | DEPRECATIONS SUMMARY
138 |
139 | * The abstract factory pattern used to enable pluggable implementations in the
140 | statistics, analysis and distributions packages has been deprecated and
141 | replaced by setter injection.
142 |
143 | * Non-localized exception messages and associated constructors have been
144 | deprecated and replaced by localized versions.
145 |
146 | * Most methods from the ComplexUtils class have been deprecated, with
147 | implementations moved to the Complex class.
148 |
149 | See "clirr-report.html" included in the docs directory of the binary
150 | distribution for a detailed list of API changes. The "errors" reported at the
151 | top of the report are due to protected fields being moved to superclasses.
152 | These fields are still available, so there is no backward compatibility issue.
153 |
154 | BUILDING COMMONS MATH
155 |
156 | Commons math can be built from the source distribution using Maven 1, Maven 2,
157 | or Ant, launching any one of these from the top-level directory of the unpacked
158 | zip or tarball. For detailed build instructions and information about how to
159 | contribute to Commons Math, see "developers.html" in the docs directory of the
160 | binary distribution.
161 |
162 |
--------------------------------------------------------------------------------
/resources/code/ExampleTaglet.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or
5 | * without modification, are permitted provided that the following
6 | * conditions are met:
7 | *
8 | * -Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | *
11 | * -Redistribution in binary form must reproduce the above copyright
12 | * notice, this list of conditions and the following disclaimer in
13 | * the documentation and/or other materials provided with the
14 | * distribution.
15 | *
16 | * Neither the name of Sun Microsystems, Inc. or the names of
17 | * contributors may be used to endorse or promote products derived
18 | * from this software without specific prior written permission.
19 | *
20 | * This software is provided "AS IS," without a warranty of any
21 | * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
22 | * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
23 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
24 | * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY
25 | * DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT OF OR
26 | * RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR
27 | * ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE
28 | * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT,
29 | * SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
30 | * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF
31 | * THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN
32 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
33 | *
34 | * You acknowledge that Software is not designed, licensed or
35 | * intended for use in the design, construction, operation or
36 | * maintenance of any nuclear facility.
37 | */
38 |
39 | import com.sun.tools.doclets.Taglet;
40 | import com.sun.javadoc.*;
41 | import java.util.Map;
42 | import java.io.*;
43 | /**
44 | * A sample Taglet representing @example. This tag can be used in any kind of
45 | * {@link com.sun.javadoc.Doc}. It is not an inline tag. The text is displayed
46 | * in yellow to remind the developer to perform a task. For
47 | * example, "@example Hello" would be shown as:
48 | *
49 | *
50 | * To Do:
51 | *
Fix this!
52 | *
53 | *
54 | *
55 | * @author Jamie Ho
56 | * @since 1.4
57 | */
58 |
59 | public class ExampleTaglet implements Taglet {
60 |
61 | private static final String NAME = "example";
62 | private static final String HEADER = "example To Do:";
63 |
64 | /**
65 | * Return the name of this custom tag.
66 | */
67 | public String getName() {
68 | return NAME;
69 | }
70 |
71 | /**
72 | * Will return true since @example
73 | * can be used in field documentation.
74 | * @return true since @example
75 | * can be used in field documentation and false
76 | * otherwise.
77 | */
78 | public boolean inField() {
79 | return true;
80 | }
81 |
82 | /**
83 | * Will return true since @example
84 | * can be used in constructor documentation.
85 | * @return true since @example
86 | * can be used in constructor documentation and false
87 | * otherwise.
88 | */
89 | public boolean inConstructor() {
90 | return true;
91 | }
92 |
93 | /**
94 | * Will return true since @example
95 | * can be used in method documentation.
96 | * @return true since @example
97 | * can be used in method documentation and false
98 | * otherwise.
99 | */
100 | public boolean inMethod() {
101 | return true;
102 | }
103 |
104 | /**
105 | * Will return true since @example
106 | * can be used in method documentation.
107 | * @return true since @example
108 | * can be used in overview documentation and false
109 | * otherwise.
110 | */
111 | public boolean inOverview() {
112 | return true;
113 | }
114 |
115 | /**
116 | * Will return true since @example
117 | * can be used in package documentation.
118 | * @return true since @example
119 | * can be used in package documentation and false
120 | * otherwise.
121 | */
122 | public boolean inPackage() {
123 | return true;
124 | }
125 |
126 | /**
127 | * Will return true since @example
128 | * can be used in type documentation (classes or interfaces).
129 | * @return true since @example
130 | * can be used in type documentation and false
131 | * otherwise.
132 | */
133 | public boolean inType() {
134 | return true;
135 | }
136 |
137 | /**
138 | * Will return false since @example
139 | * is not an inline tag.
140 | * @return false since @example
141 | * is not an inline tag.
142 | */
143 |
144 | public boolean isInlineTag() {
145 | return false;
146 | }
147 |
148 | /**
149 | * Register this Taglet.
150 | * @param tagletMap the map to register this tag to.
151 | */
152 | public static void register(Map tagletMap) {
153 | ExampleTaglet tag = new ExampleTaglet();
154 | Taglet t = (Taglet) tagletMap.get(tag.getName());
155 | if (t != null) {
156 | tagletMap.remove(tag.getName());
157 | }
158 | tagletMap.put(tag.getName(), tag);
159 | }
160 |
161 | /**
162 | * Given the Tag representation of this custom
163 | * tag, return its string representation.
164 | * @param tag the Tag representation of this custom tag.
165 | */
166 | public String toString(Tag tag) {
167 | return createHTML(readFile(tag.text()));
168 | }
169 |
170 |
171 | /**
172 | * Given an array of Tags representing this custom
173 | * tag, return its string representation.
174 | * @param tags the array of Tags representing of this custom tag.
175 | */
176 | public String toString(Tag[] tags) {
177 | if (tags.length == 0) {
178 | return null;
179 | }
180 | return createHTML(readFile(tags[0].text()));
181 | }
182 |
183 |
184 |
185 | String createHTML(String theString) {
186 | if(theString!=null) {
187 | String dd = "";
193 |
194 | return dd+"\n
" +
195 | "
+Example
" +
196 | "
"+theString+"
" +
197 | "
";
198 | }
199 | return "";
200 | }
201 |
202 |
203 | /**
204 | * check if the examples directory exists and return the example as given in the tag.
205 | * @param theExample the name of the example
206 | */
207 | String readFile(String theExample) {
208 | String record = "";
209 | String myResult = "";
210 | int recCount = 0;
211 | String myDir = "../examples";
212 | File file=new File(myDir);
213 | if(file.exists()==false) {
214 | myDir = "./examples";
215 | }
216 | try {
217 | FileReader fr = new FileReader(myDir+"/"+theExample+"/"+theExample+".pde");
218 | BufferedReader br = new BufferedReader(fr);
219 | record = new String();
220 | while ((record = br.readLine()) != null) {
221 | myResult += record+"\n";
222 | }
223 | } catch (IOException e) {
224 | System.out.println(e);
225 | return null;
226 | }
227 | return myResult;
228 | }
229 | }
230 |
231 |
232 |
--------------------------------------------------------------------------------
/src/peasy/org/apache/commons/math/MathException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package peasy.org.apache.commons.math;
18 |
19 | import java.io.PrintStream;
20 | import java.io.PrintWriter;
21 | import java.text.MessageFormat;
22 | import java.util.Locale;
23 | import java.util.MissingResourceException;
24 | import java.util.ResourceBundle;
25 |
26 | /**
27 | * Base class for commons-math checked exceptions.
28 | *
91 | That's it. Now a mouse left-drag will rotate the camera around the subject,
92 | a right drag will zoom in and out, and a middle-drag (command-left-drag on mac) will pan. A
93 | double-click restores the camera to its original position. The shift key constrains rotation
94 | and panning to one axis or the other.
95 |
96 |
97 | The PeasyCam is positioned on a sphere whose radius is the given
98 | distance from the look-at point. Rotations are around axes that
99 | pass through the looked-at point.
100 |
101 |
102 |
103 | PeasyCam is impervious to gimbal lock, and has no known "singularities" or
104 | discontinuities in its behavior. It relies on the excellent
105 | Apache Commons Math
106 | geometry package
107 | for its rotations.
108 |
109 |
110 |
Thanks
111 |
Useful bug reports and feature suggestions were provided by:
camera.setActive(boolean active); // false to make this camera stop responding to mouse
145 |
146 | // By default, the camera is in "free rotation" mode, but you can
147 | // constrain it to any axis, around the look-at point:
148 | camera.setYawRotationMode(); // like spinning a globe
149 | camera.setPitchRotationMode(); // like a somersault
150 | camera.setRollRotationMode(); // like a radio knob
151 | camera.setSuppressRollRotationMode(); // Permit pitch/yaw only.
152 |
153 | // Then you can set it back to its default mode:
154 | camera.setFreeRotationMode();
155 |
156 | // reassign particular drag gestures, or set them to null
157 | camera.setLeftDragHandler(PeasyDragHandler handler);
158 | camera.setCenterDragHandler(PeasyDragHandler handler);
159 | camera.setRightDragHandler(PeasyDragHandler handler);
160 | PeasyDragHandler getPanDragHandler();
161 | PeasyDragHandler getRotateDragHandler();
162 | PeasyDragHandler getZoomDragHandler();
163 |
164 | // mouse wheel zooms by default; set null, or make your own
165 | camera.setWheelHandler(PeasyWheelHandler handler);
166 | PeasyWheelHandler getZoomWheelHandler();
167 |
168 | // change sensitivity of built-in mouse wheel zoom
169 | camera.setWheelScale(double scale); // 1.0 by default
170 | double getWheelScale();
171 |
172 | // make your own!
173 | public interface PeasyDragHandler {
174 | public void handleDrag(final double dx, final double dy);
175 | }
176 | public interface PeasyWheelHandler {
177 | public void handleWheel(final int delta);
178 | }
179 | camera.setResetOnDoubleClick(boolean resetOnDoubleClick); // default true
180 |
181 | camera.lookAt(double x, double y, double z);
182 | camera.lookAt(double x, double y, double z, long animationTimeInMillis);
183 | camera.lookAt(double x, double y, double z, double distance);
184 | camera.lookAt(double x, double y, double z, double distance, long animationTimeInMillis);
185 |
186 | camera.rotateX(double angle); // rotate around the x-axis passing through the subject
187 | camera.rotateY(double angle); // rotate around the y-axis passing through the subject
188 | camera.rotateZ(double angle); // rotate around the z-axis passing through the subject
189 | camera.setDistance(double d); // distance from looked-at point
190 | camera.pan(double dx, double dy); // move the looked-at point relative to current orientation
191 |
192 | double camera.getDistance(); // current distance
193 | float[] camera.getLookAt(); // float[] { x, y, z }, looked-at point
194 |
195 | camera.setMinimumDistance(double minimumDistance);
196 | camera.setMaximumDistance(double maximumDistance); // clamp zooming
197 |
198 | camera.reset();
199 | camera.reset(long animationTimeInMillis); // reset camera to its starting settings
200 |
201 | CameraState state = camera.getState(); // get a serializable settings object for current state
202 | camera.setState(CameraState state);
203 | camera.setState(CameraState state, long animationTimeInMillis); // set the camera to the given saved state
204 |
205 | float[] rotations = camera.getRotations(); // x, y, and z rotations required to face camera in model space
206 | camera.setRotations(double pitch, double yaw, double roll); // rotations are applied in that order
207 | float[] position = camera.getPosition(); // x, y, and z coordinates of camera in model space
208 |
209 | // Utility methods to permit the use of a Heads-Up Display
210 | // Thanks, A.W. Martin
211 | camera.beginHUD();
212 | // now draw things that you want relative to the camera's position and orientation
213 | camera.endHUD(); // always!
214 |
215 |
216 |
217 |
Keywords ##keywords##
218 |
Reference. Have a look at the javadoc reference here. a copy of the reference is included in the .zip as well.
219 |
Source. The source code of ##yourLibrary##
220 | is available at ##source:host##,
221 | and its repository can be browsed
222 | here. Fork it and fix it!
272 |
273 |
274 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/commons-math-1.2/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/src/peasy/org/apache/commons/math/geometry/Vector3D.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package peasy.org.apache.commons.math.geometry;
19 |
20 | import java.io.Serializable;
21 |
22 | /**
23 | * This class implements vectors in a three-dimensional space.
24 | *
25 | * Instance of this class are guaranteed to be immutable.
26 | *
27 | *
28 | * @version $Revision: 627998 $ $Date: 2008-02-15 03:24:50 -0700 (Fri, 15 Feb
29 | * 2008) $
30 | * @since 1.2
31 | */
32 |
33 | public class Vector3D implements Serializable {
34 |
35 | /** First canonical vector (coordinates: 1, 0, 0). */
36 | public static final Vector3D plusI = new Vector3D(1, 0, 0);
37 |
38 | /** Opposite of the first canonical vector (coordinates: -1, 0, 0). */
39 | public static final Vector3D minusI = new Vector3D(-1, 0, 0);
40 |
41 | /** Second canonical vector (coordinates: 0, 1, 0). */
42 | public static final Vector3D plusJ = new Vector3D(0, 1, 0);
43 |
44 | /** Opposite of the second canonical vector (coordinates: 0, -1, 0). */
45 | public static final Vector3D minusJ = new Vector3D(0, -1, 0);
46 |
47 | /** Third canonical vector (coordinates: 0, 0, 1). */
48 | public static final Vector3D plusK = new Vector3D(0, 0, 1);
49 |
50 | /** Opposite of the third canonical vector (coordinates: 0, 0, -1). */
51 | public static final Vector3D minusK = new Vector3D(0, 0, -1);
52 |
53 | /** Null vector (coordinates: 0, 0, 0). */
54 | public static final Vector3D zero = new Vector3D(0, 0, 0);
55 |
56 | /**
57 | * Simple constructor. Build a null vector.
58 | */
59 | public Vector3D() {
60 | x = 0;
61 | y = 0;
62 | z = 0;
63 | }
64 |
65 | /**
66 | * Simple constructor. Build a vector from its coordinates
67 | *
68 | * @param x
69 | * abscissa
70 | * @param y
71 | * ordinate
72 | * @param z
73 | * height
74 | * @see #getX()
75 | * @see #getY()
76 | * @see #getZ()
77 | */
78 | public Vector3D(final double x, final double y, final double z) {
79 | this.x = x;
80 | this.y = y;
81 | this.z = z;
82 | }
83 |
84 | /**
85 | * Simple constructor. Build a vector from its azimuthal coordinates
86 | *
87 | * @param alpha
88 | * azimuth (α) around Z (0 is +X, π/2 is +Y, π is -X
89 | * and 3π/2 is -Y)
90 | * @param delta
91 | * elevation (δ) above (XY) plane, from -π/2 to +π/2
92 | * @see #getAlpha()
93 | * @see #getDelta()
94 | */
95 | public Vector3D(final double alpha, final double delta) {
96 | final double cosDelta = Math.cos(delta);
97 | this.x = Math.cos(alpha) * cosDelta;
98 | this.y = Math.sin(alpha) * cosDelta;
99 | this.z = Math.sin(delta);
100 | }
101 |
102 | /**
103 | * Multiplicative constructor Build a vector from another one and a scale
104 | * factor. The vector built will be a * u
105 | *
106 | * @param a
107 | * scale factor
108 | * @param u
109 | * base (unscaled) vector
110 | */
111 | public Vector3D(final double a, final Vector3D u) {
112 | this.x = a * u.x;
113 | this.y = a * u.y;
114 | this.z = a * u.z;
115 | }
116 |
117 | /**
118 | * Linear constructor Build a vector from two other ones and corresponding
119 | * scale factors. The vector built will be a1 * u1 + a2 * u2
120 | *
121 | * @param a1
122 | * first scale factor
123 | * @param u1
124 | * first base (unscaled) vector
125 | * @param a2
126 | * second scale factor
127 | * @param u2
128 | * second base (unscaled) vector
129 | */
130 | public Vector3D(final double a1, final Vector3D u1, final double a2, final Vector3D u2) {
131 | this.x = a1 * u1.x + a2 * u2.x;
132 | this.y = a1 * u1.y + a2 * u2.y;
133 | this.z = a1 * u1.z + a2 * u2.z;
134 | }
135 |
136 | /**
137 | * Linear constructor Build a vector from three other ones and corresponding
138 | * scale factors. The vector built will be a1 * u1 + a2 * u2 + a3 * u3
139 | *
140 | * @param a1
141 | * first scale factor
142 | * @param u1
143 | * first base (unscaled) vector
144 | * @param a2
145 | * second scale factor
146 | * @param u2
147 | * second base (unscaled) vector
148 | * @param a3
149 | * third scale factor
150 | * @param u3
151 | * third base (unscaled) vector
152 | */
153 | public Vector3D(final double a1, final Vector3D u1, final double a2,
154 | final Vector3D u2, final double a3, final Vector3D u3) {
155 | this.x = a1 * u1.x + a2 * u2.x + a3 * u3.x;
156 | this.y = a1 * u1.y + a2 * u2.y + a3 * u3.y;
157 | this.z = a1 * u1.z + a2 * u2.z + a3 * u3.z;
158 | }
159 |
160 | /**
161 | * Linear constructor Build a vector from four other ones and corresponding
162 | * scale factors. The vector built will be a1 * u1 + a2 * u2 + a3 * u3 + a4
163 | * * u4
164 | *
165 | * @param a1
166 | * first scale factor
167 | * @param u1
168 | * first base (unscaled) vector
169 | * @param a2
170 | * second scale factor
171 | * @param u2
172 | * second base (unscaled) vector
173 | * @param a3
174 | * third scale factor
175 | * @param u3
176 | * third base (unscaled) vector
177 | * @param a4
178 | * fourth scale factor
179 | * @param u4
180 | * fourth base (unscaled) vector
181 | */
182 | public Vector3D(final double a1, final Vector3D u1, final double a2,
183 | final Vector3D u2, final double a3, final Vector3D u3, final double a4,
184 | final Vector3D u4) {
185 | this.x = a1 * u1.x + a2 * u2.x + a3 * u3.x + a4 * u4.x;
186 | this.y = a1 * u1.y + a2 * u2.y + a3 * u3.y + a4 * u4.y;
187 | this.z = a1 * u1.z + a2 * u2.z + a3 * u3.z + a4 * u4.z;
188 | }
189 |
190 | /**
191 | * Get the abscissa of the vector.
192 | *
193 | * @return abscissa of the vector
194 | * @see #Vector3D(double, double, double)
195 | */
196 | public double getX() {
197 | return x;
198 | }
199 |
200 | /**
201 | * Get the ordinate of the vector.
202 | *
203 | * @return ordinate of the vector
204 | * @see #Vector3D(double, double, double)
205 | */
206 | public double getY() {
207 | return y;
208 | }
209 |
210 | /**
211 | * Get the height of the vector.
212 | *
213 | * @return height of the vector
214 | * @see #Vector3D(double, double, double)
215 | */
216 | public double getZ() {
217 | return z;
218 | }
219 |
220 | /**
221 | * Get the norm for the vector.
222 | *
223 | * @return euclidian norm for the vector
224 | */
225 | public double getNorm() {
226 | return Math.sqrt(x * x + y * y + z * z);
227 | }
228 |
229 | /**
230 | * Get the azimuth of the vector.
231 | *
232 | * @return azimuth (α) of the vector, between -π and +π
233 | * @see #Vector3D(double, double)
234 | */
235 | public double getAlpha() {
236 | return Math.atan2(y, x);
237 | }
238 |
239 | /**
240 | * Get the elevation of the vector.
241 | *
242 | * @return elevation (δ) of the vector, between -π/2 and +π/2
243 | * @see #Vector3D(double, double)
244 | */
245 | public double getDelta() {
246 | return Math.asin(z / getNorm());
247 | }
248 |
249 | /**
250 | * Add a vector to the instance.
251 | *
252 | * @param v
253 | * vector to add
254 | * @return a new vector
255 | */
256 | public Vector3D add(final Vector3D v) {
257 | return new Vector3D(x + v.x, y + v.y, z + v.z);
258 | }
259 |
260 | /**
261 | * Add a scaled vector to the instance.
262 | *
263 | * @param factor
264 | * scale factor to apply to v before adding it
265 | * @param v
266 | * vector to add
267 | * @return a new vector
268 | */
269 | public Vector3D add(final double factor, final Vector3D v) {
270 | return new Vector3D(x + factor * v.x, y + factor * v.y, z + factor * v.z);
271 | }
272 |
273 | /**
274 | * Subtract a vector from the instance.
275 | *
276 | * @param v
277 | * vector to subtract
278 | * @return a new vector
279 | */
280 | public Vector3D subtract(final Vector3D v) {
281 | return new Vector3D(x - v.x, y - v.y, z - v.z);
282 | }
283 |
284 | /**
285 | * Subtract a scaled vector from the instance.
286 | *
287 | * @param factor
288 | * scale factor to apply to v before subtracting it
289 | * @param v
290 | * vector to subtract
291 | * @return a new vector
292 | */
293 | public Vector3D subtract(final double factor, final Vector3D v) {
294 | return new Vector3D(x - factor * v.x, y - factor * v.y, z - factor * v.z);
295 | }
296 |
297 | /**
298 | * Get a normalized vector aligned with the instance.
299 | *
300 | * @return a new normalized vector
301 | * @exception ArithmeticException
302 | * if the norm is zero
303 | */
304 | public Vector3D normalize() {
305 | final double s = getNorm();
306 | if (s == 0) {
307 | throw new ArithmeticException("cannot normalize a zero norm vector");
308 | }
309 | return scalarMultiply(1 / s);
310 | }
311 |
312 | /**
313 | * Get a vector orthogonal to the instance.
314 | *
315 | * There are an infinite number of normalized vectors orthogonal to the
316 | * instance. This method picks up one of them almost arbitrarily. It is
317 | * useful when one needs to compute a reference frame with one of the axes
318 | * in a predefined direction. The following example shows how to build a
319 | * frame having the k axis aligned with the known vector u :
320 | *
321 | *
330 | *
331 | * @return a new normalized vector orthogonal to the instance
332 | * @exception ArithmeticException
333 | * if the norm of the instance is null
334 | */
335 | public Vector3D orthogonal() {
336 |
337 | final double threshold = 0.6 * getNorm();
338 | if (threshold == 0) {
339 | throw new ArithmeticException("null norm");
340 | }
341 |
342 | if ((x >= -threshold) && (x <= threshold)) {
343 | final double inverse = 1 / Math.sqrt(y * y + z * z);
344 | return new Vector3D(0, inverse * z, -inverse * y);
345 | } else if ((y >= -threshold) && (y <= threshold)) {
346 | final double inverse = 1 / Math.sqrt(x * x + z * z);
347 | return new Vector3D(-inverse * z, 0, inverse * x);
348 | }
349 | final double inverse = 1 / Math.sqrt(x * x + y * y);
350 | return new Vector3D(inverse * y, -inverse * x, 0);
351 |
352 | }
353 |
354 | /**
355 | * Compute the angular separation between two vectors.
356 | *
357 | * This method computes the angular separation between two vectors using the
358 | * dot product for well separated vectors and the cross product for almost
359 | * aligned vectors. This allow to have a good accuracy in all cases, even
360 | * for vectors very close to each other.
361 | *
362 | *
363 | * @param v1
364 | * first vector
365 | * @param v2
366 | * second vector
367 | * @return angular separation between v1 and v2
368 | * @exception ArithmeticException
369 | * if either vector has a null norm
370 | */
371 | public static double angle(final Vector3D v1, final Vector3D v2) {
372 |
373 | final double normProduct = v1.getNorm() * v2.getNorm();
374 | if (normProduct == 0) {
375 | throw new ArithmeticException("null norm");
376 | }
377 |
378 | final double dot = dotProduct(v1, v2);
379 | final double threshold = normProduct * 0.9999;
380 | if ((dot < -threshold) || (dot > threshold)) {
381 | // the vectors are almost aligned, compute using the sine
382 | final Vector3D v3 = crossProduct(v1, v2);
383 | if (dot >= 0) {
384 | return Math.asin(v3.getNorm() / normProduct);
385 | }
386 | return Math.PI - Math.asin(v3.getNorm() / normProduct);
387 | }
388 |
389 | // the vectors are sufficiently separated to use the cosine
390 | return Math.acos(dot / normProduct);
391 |
392 | }
393 |
394 | /**
395 | * Get the opposite of the instance.
396 | *
397 | * @return a new vector which is opposite to the instance
398 | */
399 | public Vector3D negate() {
400 | return new Vector3D(-x, -y, -z);
401 | }
402 |
403 | /**
404 | * Multiply the instance by a scalar
405 | *
406 | * @param a
407 | * scalar
408 | * @return a new vector
409 | */
410 | public Vector3D scalarMultiply(final double a) {
411 | return new Vector3D(a * x, a * y, a * z);
412 | }
413 |
414 | /**
415 | * Compute the dot-product of two vectors.
416 | *
417 | * @param v1
418 | * first vector
419 | * @param v2
420 | * second vector
421 | * @return the dot product v1.v2
422 | */
423 | public static double dotProduct(final Vector3D v1, final Vector3D v2) {
424 | return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;
425 | }
426 |
427 | /**
428 | * Compute the cross-product of two vectors.
429 | *
430 | * @param v1
431 | * first vector
432 | * @param v2
433 | * second vector
434 | * @return the cross product v1 ^ v2 as a new Vector
435 | */
436 | public static Vector3D crossProduct(final Vector3D v1, final Vector3D v2) {
437 | return new Vector3D(v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x
438 | * v2.y - v1.y * v2.x);
439 | }
440 |
441 | /** Abscissa. */
442 | private final double x;
443 |
444 | /** Ordinate. */
445 | private final double y;
446 |
447 | /** Height. */
448 | private final double z;
449 |
450 | /** Serializable version identifier */
451 | private static final long serialVersionUID = -5721105387745193385L;
452 |
453 | }
454 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | #Thu Apr 22 18:55:46 EDT 2010
2 | eclipse.preferences.version=1
3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6 | org.eclipse.jdt.core.compiler.compliance=1.5
7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.source=1.5
13 | org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
14 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
15 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
16 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
17 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
18 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
19 | org.eclipse.jdt.core.formatter.alignment_for_assignment=0
20 | org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
21 | org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
22 | org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
23 | org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
24 | org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
25 | org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
26 | org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
27 | org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
28 | org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
29 | org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
30 | org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
31 | org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
32 | org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
33 | org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
34 | org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
35 | org.eclipse.jdt.core.formatter.blank_lines_after_package=1
36 | org.eclipse.jdt.core.formatter.blank_lines_before_field=0
37 | org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
38 | org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
39 | org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
40 | org.eclipse.jdt.core.formatter.blank_lines_before_method=1
41 | org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
42 | org.eclipse.jdt.core.formatter.blank_lines_before_package=0
43 | org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
44 | org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
45 | org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
46 | org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
47 | org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
48 | org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
49 | org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
50 | org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
51 | org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
52 | org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
53 | org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
54 | org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
55 | org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
56 | org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
57 | org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
58 | org.eclipse.jdt.core.formatter.comment.format_block_comments=false
59 | org.eclipse.jdt.core.formatter.comment.format_header=false
60 | org.eclipse.jdt.core.formatter.comment.format_html=true
61 | org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
62 | org.eclipse.jdt.core.formatter.comment.format_line_comments=false
63 | org.eclipse.jdt.core.formatter.comment.format_source_code=true
64 | org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
65 | org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
66 | org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
67 | org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
68 | org.eclipse.jdt.core.formatter.comment.line_length=80
69 | org.eclipse.jdt.core.formatter.compact_else_if=true
70 | org.eclipse.jdt.core.formatter.continuation_indentation=2
71 | org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
72 | org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
73 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
74 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
75 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
76 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
77 | org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
78 | org.eclipse.jdt.core.formatter.indent_empty_lines=false
79 | org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
80 | org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
81 | org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
82 | org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
83 | org.eclipse.jdt.core.formatter.indentation.size=4
84 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
85 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
86 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
87 | org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
88 | org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
89 | org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
90 | org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
91 | org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
92 | org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
93 | org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
94 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
95 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
96 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
97 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
98 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
99 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
100 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
101 | org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
102 | org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
103 | org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
104 | org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
105 | org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
106 | org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
107 | org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
108 | org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
109 | org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=do not insert
110 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
111 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
112 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
113 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
114 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
115 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
116 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
117 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
118 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
119 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
120 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
121 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
122 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
123 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
124 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
125 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
126 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
127 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
128 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
129 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
130 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
131 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
132 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
133 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
134 | org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
135 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
136 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
137 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
138 | org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
139 | org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
140 | org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
141 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
142 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
143 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
144 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
145 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
146 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
147 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
148 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
149 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
150 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
151 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
152 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
153 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
154 | org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
155 | org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
156 | org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
157 | org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
158 | org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
159 | org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
160 | org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
161 | org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
162 | org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
163 | org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
164 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
165 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
166 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
167 | org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
168 | org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
169 | org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
170 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
171 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
172 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
173 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
174 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
175 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
176 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
177 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
178 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
179 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
180 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
181 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
182 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
183 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
184 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
185 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
186 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
187 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
188 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
189 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
190 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
191 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
192 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
193 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
194 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
195 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
196 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
197 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
198 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
199 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
200 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
201 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
202 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
203 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
204 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
205 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
206 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
207 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
208 | org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
209 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
210 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
211 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
212 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
213 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
214 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
215 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
216 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
217 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
218 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
219 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
220 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
221 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
222 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
223 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
224 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
225 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
226 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
227 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
228 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
229 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
230 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
231 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
232 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
233 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
234 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
235 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
236 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
237 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
238 | org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
239 | org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
240 | org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
241 | org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
242 | org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
243 | org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
244 | org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
245 | org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
246 | org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
247 | org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
248 | org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
249 | org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
250 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
251 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
252 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
253 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
254 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
255 | org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
256 | org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
257 | org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
258 | org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
259 | org.eclipse.jdt.core.formatter.lineSplit=90
260 | org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
261 | org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
262 | org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
263 | org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
264 | org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
265 | org.eclipse.jdt.core.formatter.tabulation.char=tab
266 | org.eclipse.jdt.core.formatter.tabulation.size=4
267 | org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
268 | org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
269 |
--------------------------------------------------------------------------------
/src/peasy/PeasyCam.java:
--------------------------------------------------------------------------------
1 | /*
2 | The PeasyCam Processing library, which provides an easy-peasy
3 | camera for 3D sketching.
4 |
5 | Copyright 2008 Jonathan Feinberg
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 | */
19 | package peasy;
20 |
21 | import peasy.org.apache.commons.math.geometry.CardanEulerSingularityException;
22 | import peasy.org.apache.commons.math.geometry.Rotation;
23 | import peasy.org.apache.commons.math.geometry.RotationOrder;
24 | import peasy.org.apache.commons.math.geometry.Vector3D;
25 | import processing.core.PApplet;
26 | import processing.core.PConstants;
27 | import processing.core.PGraphics;
28 | import processing.event.KeyEvent;
29 | import processing.event.MouseEvent;
30 | import processing.opengl.PGraphicsOpenGL;
31 |
32 | /**
33 | *
34 | * @author Jonathan Feinberg
35 | * @author Thomas Diewald
36 | *
37 | */
38 | public class PeasyCam {
39 |
40 | public final String VERSION = "301";
41 |
42 | private static final Vector3D LOOK = Vector3D.plusK;
43 | private static final Vector3D UP = Vector3D.plusJ;
44 | private static final double SMALLEST_MINIMUM_DISTANCE = 0.01;
45 |
46 | private static enum Constraint {
47 | YAW, PITCH, ROLL, SUPPRESS_ROLL
48 | }
49 |
50 | private final PGraphics g;
51 | private final PApplet p;
52 |
53 | private final double startDistance;
54 | private final Vector3D startCenter;
55 |
56 | private boolean resetOnDoubleClick = true;
57 | private double minimumDistance = 1;
58 | private double maximumDistance = Double.MAX_VALUE;
59 |
60 | private final DampedAction rotateX, rotateY, rotateZ, dampedZoom, dampedPanX,
61 | dampedPanY;
62 |
63 | private double distance;
64 | private Vector3D center;
65 | private Rotation rotation;
66 |
67 | // viewport for the mouse-pointer [x,y,w,h]
68 | private int[] viewport = new int[4];
69 |
70 | private Constraint dragConstraint = null;
71 | private Constraint permaConstraint = null;
72 |
73 | private final InterpolationManager rotationInterps = new InterpolationManager();
74 | private final InterpolationManager centerInterps = new InterpolationManager();
75 | private final InterpolationManager distanceInterps = new InterpolationManager();
76 |
77 | private final PeasyDragHandler panHandler /* ha ha ha */ = new PeasyDragHandler() {
78 | public void handleDrag(final double dx, final double dy) {
79 | dampedPanX.impulse(dx / 8.);
80 | dampedPanY.impulse(dy / 8.);
81 | }
82 | };
83 | private PeasyDragHandler centerDragHandler = panHandler;
84 |
85 | private final PeasyDragHandler rotateHandler = new PeasyDragHandler() {
86 | public void handleDrag(final double dx, final double dy) {
87 | mouseRotate(dx, dy);
88 | }
89 | };
90 | private PeasyDragHandler leftDragHandler = rotateHandler;
91 |
92 | private final PeasyDragHandler zoomHandler = new PeasyDragHandler() {
93 | public void handleDrag(final double dx, final double dy) {
94 | dampedZoom.impulse(dy / 10.0);
95 | }
96 | };
97 | private PeasyDragHandler rightDraghandler = zoomHandler;
98 |
99 | private final PeasyWheelHandler zoomWheelHandler = new PeasyWheelHandler() {
100 | public void handleWheel(final int delta) {
101 | dampedZoom.impulse(wheelScale * delta);
102 | }
103 | };
104 | private PeasyWheelHandler wheelHandler = zoomWheelHandler;
105 | private double wheelScale = 1.0;
106 |
107 | private final PeasyEventListener peasyEventListener = new PeasyEventListener();
108 | private boolean isActive = false;
109 |
110 |
111 |
112 | public PeasyCam(final PApplet parent, final double distance) {
113 | this(parent, parent.g, 0, 0, 0, distance);
114 | }
115 |
116 | public PeasyCam(final PApplet parent, final double lookAtX, final double lookAtY,
117 | final double lookAtZ, final double distance) {
118 | this(parent, parent.g, lookAtX, lookAtY, lookAtZ, distance);
119 | }
120 |
121 | public PeasyCam(final PApplet parent, final PGraphics pg, final double distance) {
122 | this(parent, pg, 0, 0, 0, distance);
123 | }
124 |
125 | public PeasyCam(final PApplet parent, PGraphics pg, final double lookAtX,
126 | final double lookAtY, final double lookAtZ, final double distance) {
127 | this.p = parent;
128 | this.g = pg;
129 | this.startCenter = this.center = new Vector3D(lookAtX, lookAtY, lookAtZ);
130 | this.startDistance = this.distance = Math.max(distance,
131 | SMALLEST_MINIMUM_DISTANCE);
132 | this.rotation = new Rotation();
133 |
134 | viewport[0] = 0;
135 | viewport[1] = 0;
136 | viewport[2] = pg.width;
137 | viewport[3] = pg.height;
138 |
139 | feed();
140 |
141 | rotateX = new DampedAction(this) {
142 | @Override
143 | protected void behave(final double velocity) {
144 | rotation = rotation.applyTo(new Rotation(Vector3D.plusI, velocity));
145 | }
146 | };
147 |
148 | rotateY = new DampedAction(this) {
149 | @Override
150 | protected void behave(final double velocity) {
151 | rotation = rotation.applyTo(new Rotation(Vector3D.plusJ, velocity));
152 | }
153 | };
154 |
155 | rotateZ = new DampedAction(this) {
156 | @Override
157 | protected void behave(final double velocity) {
158 | rotation = rotation.applyTo(new Rotation(Vector3D.plusK, velocity));
159 | }
160 | };
161 |
162 | dampedZoom = new DampedAction(this) {
163 | @Override
164 | protected void behave(final double velocity) {
165 | mouseZoom(velocity);
166 | }
167 | };
168 |
169 | dampedPanX = new DampedAction(this) {
170 | @Override
171 | protected void behave(final double velocity) {
172 | mousePan(velocity, 0);
173 | }
174 | };
175 |
176 | dampedPanY = new DampedAction(this) {
177 | @Override
178 | protected void behave(final double velocity) {
179 | mousePan(0, velocity);
180 | }
181 | };
182 |
183 | setActive(true);
184 | }
185 |
186 | public void setActive(final boolean active) {
187 | if (active == isActive) {
188 | return;
189 | }
190 | isActive = active;
191 | if (isActive) {
192 | p.registerMethod("mouseEvent", peasyEventListener);
193 | p.registerMethod("keyEvent", peasyEventListener);
194 | } else {
195 | p.unregisterMethod("mouseEvent", peasyEventListener);
196 | p.unregisterMethod("keyEvent", peasyEventListener);
197 | }
198 | }
199 |
200 | public boolean isActive() {
201 | return isActive;
202 | }
203 |
204 | /**
205 | *
206 | * Turn on or off default mouse-handling behavior:
207 | *
208 | *