Logo ROOT   master
Reference Guide
3DDistances.cxx
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Authors: W. Brown, M. Fischler, L. Moneta 2005
3 
4  /**********************************************************************
5  * *
6  * Copyright (c) 2005, LCG ROOT FNAL MathLib Team *
7  * *
8  * *
9  **********************************************************************/
10 
11 // Source file for something else
12 //
13 // Created by: Mark Fischler Thurs July 7, 2005
14 //
15 // Last update: Wed Thurs July 7, 2005
16 //
17 
18 
20 
29 
30 #include <cmath>
31 
32 
33 namespace ROOT {
34 namespace Math {
35 namespace gv_detail {
36 
37 
39 { kXX = 0, kXY = 1, kXZ = 2
40 , kYX = 3, kYY = 4, kYZ = 5
41 , kZX = 6, kZY = 7, kZZ = 8
42 };
43 
44 
45 // ----------------------------------------------------------------------
46 // distance from Rotation3D
47 
48 double dist( Rotation3D const & from, Rotation3D const & to)
49 { /*TODO better */
50  return Quaternion(from).Distance(Quaternion(to));
51 }
52 
53 double dist( Rotation3D const & from, AxisAngle const & to)
54 { return Quaternion(from).Distance(Quaternion(to));}
55 
56 double dist( Rotation3D const & from, EulerAngles const & to)
57 { return Quaternion(from).Distance(Quaternion(to)); }
58 
59 double dist( Rotation3D const & from, Quaternion const & to)
60 { return Quaternion(from).Distance(to); }
61 
62 double dist( Rotation3D const & from, RotationZYX const & to)
63 { /*TODO better */
64  return Quaternion(from).Distance(Quaternion(to));
65 }
66 double dist( Rotation3D const & from, RotationX const & to)
67 { /*TODO better */
68  return Quaternion(from).Distance(Quaternion(to));
69 }
70 
71 double dist( Rotation3D const & from, RotationY const & to)
72 { /*TODO*/
73  return Quaternion(from).Distance(Quaternion(to));
74 }
75 
76 double dist( Rotation3D const & from, RotationZ const & to)
77 { /*TODO*/
78  return Quaternion(from).Distance(Quaternion(to));
79 }
80 
81 
82 
83 // ----------------------------------------------------------------------
84 // distance from AxisAngle
85 
86 double dist( AxisAngle const & from, Rotation3D const & to)
87 { return Quaternion(from).Distance(Quaternion(to)); }
88 
89 double dist( AxisAngle const & from, AxisAngle const & to)
90 { /*TODO*/
91  return Quaternion(from).Distance(Quaternion(to));
92 }
93 
94 double dist( AxisAngle const & from, EulerAngles const & to)
95 { return Quaternion(from).Distance(Quaternion(to)); }
96 
97 double dist( AxisAngle const & from, Quaternion const & to)
98 { return Quaternion(from).Distance(to); }
99 
100 double dist( AxisAngle const & from, RotationZYX const & to)
101 { /*TODO better */
102  return Quaternion(from).Distance(Quaternion(to));
103 }
104 
105 double dist( AxisAngle const & from, RotationX const & to)
106 { /*TODO*/
107  return Quaternion(from).Distance(Quaternion(to));
108 }
109 
110 double dist( AxisAngle const & from, RotationY const & to)
111 { /*TODO*/
112  return Quaternion(from).Distance(Quaternion(to));
113 }
114 
115 double dist( AxisAngle const & from, RotationZ const & to)
116 { /*TODO*/
117  return Quaternion(from).Distance(Quaternion(to));
118 }
119 
120 
121 
122 // ----------------------------------------------------------------------
123 // distance from EulerAngles
124 
125 double dist( EulerAngles const & from, Rotation3D const & to)
126 { return Quaternion(from).Distance(Quaternion(to)); }
127 
128 double dist( EulerAngles const & from, AxisAngle const & to)
129 { return Quaternion(from).Distance(Quaternion(to)); }
130 
131 double dist( EulerAngles const & from, EulerAngles const & to)
132 { /*TODO*/
133  return Quaternion(from).Distance(Quaternion(to));
134 }
135 
136 double dist( EulerAngles const & from, Quaternion const & to)
137 { return Quaternion(from).Distance(to); }
138 
139 double dist( EulerAngles const & from, RotationZYX const & to)
140 { /*TODO better */
141  return Quaternion(from).Distance(Quaternion(to));
142 }
143 
144 double dist( EulerAngles const & from, RotationX const & to)
145 { /*TODO*/
146  return Quaternion(from).Distance(Quaternion(to));
147 }
148 
149 double dist( EulerAngles const & from, RotationY const & to)
150 { /*TODO*/
151  return Quaternion(from).Distance(Quaternion(to));
152 }
153 
154 double dist( EulerAngles const & from, RotationZ const & to)
155 { /*TODO*/
156  return Quaternion(from).Distance(Quaternion(to));
157 }
158 
159 
160 
161 // ----------------------------------------------------------------------
162 // distance from Quaternion
163 
164 double dist( Quaternion const & from, Rotation3D const & to)
165 { return from.Distance(Quaternion(to)); }
166 
167 double dist( Quaternion const & from, AxisAngle const & to)
168 { return from.Distance(Quaternion(to)); }
169 
170 double dist( Quaternion const & from, EulerAngles const & to)
171 { return from.Distance(Quaternion(to)); }
172 
173 double dist( Quaternion const & from, Quaternion const & to)
174 { return from.Distance(to); }
175 
176 double dist( Quaternion const & from, RotationZYX const & to)
177 { return from.Distance(Quaternion(to)); }
178 
179 double dist( Quaternion const & from, RotationX const & to)
180 { /*TODO*/
181  return from.Distance(Quaternion(to));
182 }
183 
184 double dist( Quaternion const & from, RotationY const & to)
185 { /*TODO*/
186  return from.Distance(Quaternion(to));
187 }
188 
189 double dist( Quaternion const & from, RotationZ const & to)
190 { /*TODO*/
191  return from.Distance(Quaternion(to));
192 }
193 
194 // ----------------------------------------------------------------------
195 // distance from RotationZYX
196 
197 double dist( RotationZYX const & from, Rotation3D const & to)
198 { return Quaternion(from).Distance(Quaternion(to)); }
199 
200 double dist( RotationZYX const & from, AxisAngle const & to)
201 { return Quaternion(from).Distance(Quaternion(to)); }
202 
203 double dist( RotationZYX const & from, EulerAngles const & to)
204 { return Quaternion(from).Distance(Quaternion(to)); }
205 
206 double dist( RotationZYX const & from, Quaternion const & to)
207 { return Quaternion(from).Distance(to); }
208 
209 double dist( RotationZYX const & from, RotationZYX const & to)
210 { /*TODO better */
211  return Quaternion(from).Distance(Quaternion(to));
212 }
213 
214 double dist( RotationZYX const & from, RotationX const & to)
215 { /*TODO*/
216  return Quaternion(from).Distance(Quaternion(to));
217 }
218 
219 double dist( RotationZYX const & from, RotationY const & to)
220 { /*TODO*/
221  return Quaternion(from).Distance(Quaternion(to));
222 }
223 
224 double dist( RotationZYX const & from, RotationZ const & to)
225 { /*TODO*/
226  return Quaternion(from).Distance(Quaternion(to));
227 }
228 
229 
230 
231 // ----------------------------------------------------------------------
232 // distance from RotationX
233 
234 double dist( RotationX const & from, Rotation3D const & to)
235 { return Quaternion(from).Distance(Quaternion(to)); }
236 
237 double dist( RotationX const & from, AxisAngle const & to)
238 { return Quaternion(from).Distance(Quaternion(to)); }
239 
240 double dist( RotationX const & from, EulerAngles const & to)
241 { return Quaternion(from).Distance(Quaternion(to)); }
242 
243 double dist( RotationX const & from, Quaternion const & to)
244 { return Quaternion(from).Distance(to); }
245 
246 double dist( RotationX const & from, RotationZYX const & to)
247 { /*TODO better */
248  return Quaternion(from).Distance(Quaternion(to));
249 }
250 
251 double dist( RotationX const & from, RotationX const & to)
252 { /*TODO*/
253  return Quaternion(from).Distance(Quaternion(to));
254 }
255 
256 double dist( RotationX const & from, RotationY const & to)
257 { /*TODO*/
258  return Quaternion(from).Distance(Quaternion(to));
259 }
260 
261 double dist( RotationX const & from, RotationZ const & to)
262 { /*TODO*/
263  return Quaternion(from).Distance(Quaternion(to));
264 }
265 
266 
267 
268 // ----------------------------------------------------------------------
269 // distance from RotationY
270 
271 double dist( RotationY const & from, Rotation3D const & to)
272 { return Quaternion(from).Distance(Quaternion(to)); }
273 
274 double dist( RotationY const & from, AxisAngle const & to)
275 { return Quaternion(from).Distance(Quaternion(to)); }
276 
277 double dist( RotationY const & from, EulerAngles const & to)
278 { return Quaternion(from).Distance(Quaternion(to)); }
279 
280 double dist( RotationY const & from, Quaternion const & to)
281 { return Quaternion(from).Distance(to); }
282 
283 double dist( RotationY const & from, RotationZYX const & to)
284 { /*TODO better */
285  return Quaternion(from).Distance(Quaternion(to));
286 }
287 
288 double dist( RotationY const & from, RotationX const & to)
289 { /*TODO*/
290  return Quaternion(from).Distance(Quaternion(to));
291 }
292 
293 double dist( RotationY const & from, RotationY const & to)
294 { /*TODO*/
295  return Quaternion(from).Distance(Quaternion(to));
296 }
297 
298 double dist( RotationY const & from, RotationZ const & to)
299 { /*TODO*/
300  return Quaternion(from).Distance(Quaternion(to));
301 }
302 
303 
304 
305 // ----------------------------------------------------------------------
306 // distance from RotationZ
307 
308 double dist( RotationZ const & from, Rotation3D const & to)
309 { return Quaternion(from).Distance(Quaternion(to)); }
310 
311 double dist( RotationZ const & from, AxisAngle const & to)
312 { return Quaternion(from).Distance(Quaternion(to)); }
313 
314 double dist( RotationZ const & from, EulerAngles const & to)
315 { return Quaternion(from).Distance(Quaternion(to)); }
316 
317 double dist( RotationZ const & from, Quaternion const & to)
318 { return Quaternion(from).Distance(to); }
319 
320 double dist( RotationZ const & from, RotationZYX const & to)
321 { /*TODO better */
322  return Quaternion(from).Distance(Quaternion(to));
323 }
324 
325 double dist( RotationZ const & from, RotationX const & to)
326 { /*TODO*/
327  return Quaternion(from).Distance(Quaternion(to));
328 }
329 
330 double dist( RotationZ const & from, RotationY const & to)
331 { /*TODO*/
332  return Quaternion(from).Distance(Quaternion(to));
333 }
334 
335 double dist( RotationZ const & from, RotationZ const & to)
336 { /*TODO*/
337  return Quaternion(from).Distance(Quaternion(to));
338 }
339 
340 
341 } //namespace gv_detail
342 } //namespace Math
343 } //namespace ROOT
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48
Returns the available number of logical cores.
Definition: StringConv.hxx:21
Rotation class representing a 3D rotation about the Z axis by the angle of rotation.
Definition: RotationZ.h:43
Rotation class with the (3D) rotation represented by angles describing first a rotation of an angle p...
Definition: RotationZYX.h:61
Rotation class with the (3D) rotation represented by a unit quaternion (u, i, j, k).
Definition: Quaternion.h:47
AxisAngle class describing rotation represented with direction axis (3D Vector) and an angle of rotat...
Definition: AxisAngle.h:41
Rotation class representing a 3D rotation about the Y axis by the angle of rotation.
Definition: RotationY.h:43
Rotation class representing a 3D rotation about the X axis by the angle of rotation.
Definition: RotationX.h:43
Rotation class with the (3D) rotation represented by a 3x3 orthogonal matrix.
Definition: Rotation3D.h:65
EulerAngles class describing rotation as three angles (Euler Angles).
Definition: EulerAngles.h:43
Namespace for new Math classes and functions.
Scalar Distance(const Quaternion &q) const
Distance between two rotations in Quaternion form Note: The rotation group is isomorphic to a 3-spher...
Definition: Quaternion.cxx:92