ROOT   Reference Guide
DisplacementVector3D.h
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 MathLib Team and *
7 * FNAL LCG ROOT MathLib Team *
8 * *
9 * *
10 **********************************************************************/
11
12// Header source file for class DisplacementVector3D
13//
14// Created by: Lorenzo Moneta at Mon May 30 12:21:43 2005
15// Major rewrite: M. FIschler at Wed Jun 8 2005
16//
17// Last update: $Id$
18//
19
20#ifndef ROOT_Math_GenVector_DisplacementVector3D
21#define ROOT_Math_GenVector_DisplacementVector3D 1
22
24
26
28
30
32
33#include <cassert>
34
35
36namespace ROOT {
37
38 namespace Math {
39
40
41//__________________________________________________________________________________________
42 /**
43 Class describing a generic displacement vector in 3 dimensions.
44 This class is templated on the type of Coordinate system.
45 One example is the XYZVector which is a vector based on
46 double precision x,y,z data members by using the
47 ROOT::Math::Cartesian3D<double> Coordinate system.
48 The class is having also an extra template parameter, the coordinate system tag,
49 to be able to identify (tag) vector described in different reference coordinate system,
50 like global or local coordinate systems.
51
52 @ingroup GenVector
53
54 @sa Overview of the @ref GenVector "physics vector library"
55 */
56
57 template <class CoordSystem, class Tag = DefaultCoordinateSystemTag >
59
60 public:
61
62 typedef typename CoordSystem::Scalar Scalar;
63 typedef CoordSystem CoordinateType;
65
66 // ------ ctors ------
67
68 /**
69 Default constructor. Construct an empty object with zero values
70 */
72
73
74 /**
75 Construct from three values of type <em>Scalar</em>.
76 In the case of a XYZVector the values are x,y,z
77 In the case of a polar vector they are r,theta, phi
78 */
80 fCoordinates ( a , b, c ) { }
81
82 /**
83 Construct from a displacement vector expressed in different
84 coordinates, or using a different Scalar type, but with same coordinate system tag
85 */
86 template <class OtherCoords>
88 fCoordinates ( v.Coordinates() ) { }
89
90
91 /**
92 Construct from a position vector expressed in different coordinates
93 but with the same coordinate system tag
94 */
95 template <class OtherCoords>
97 fCoordinates ( p.Coordinates() ) { }
98
99
100 /**
101 Construct from a foreign 3D vector type, for example, Hep3Vector
102 Precondition: v must implement methods x(), y() and z()
103 */
104 template <class ForeignVector>
105 explicit DisplacementVector3D( const ForeignVector & v) :
106 fCoordinates ( Cartesian3D<Scalar>( v.x(), v.y(), v.z() ) ) { }
107
108
109#ifdef LATER
110 /**
111 construct from a generic linear algebra vector of at least size 3
112 implementing operator [].
113 \par v LAVector
114 \par index0 index where coordinates starts (typically zero)
115 It works for all Coordinates types,
116 ( x= v[index0] for Cartesian and r=v[index0] for Polar )
117 */
118 template <class LAVector>
119 DisplacementVector3D(const LAVector & v, size_t index0 ) {
120 fCoordinates = CoordSystem ( v[index0], v[index0+1], v[index0+2] );
121 }
122#endif
123
124 // compiler-generated copy ctor and dtor are fine.
125
126 // ------ assignment ------
127
128 /**
129 Assignment operator from a displacement vector of arbitrary type
130 */
131 template <class OtherCoords>
134 fCoordinates = v.Coordinates();
135 return *this;
136 }
137
138 /**
139 Assignment operator from a position vector
140 (not necessarily efficient unless one or the other is Cartesian)
141 */
142 template <class OtherCoords>
144 ( const PositionVector3D<OtherCoords,Tag> & rhs) {
145 SetXYZ(rhs.x(), rhs.y(), rhs.z());
146 return *this;
147 }
148
149
150 /**
151 Assignment from a foreign 3D vector type, for example, Hep3Vector
152 Precondition: v must implement methods x(), y() and z()
153 */
154 template <class ForeignVector>
155 DisplacementVector3D & operator= ( const ForeignVector & v) {
156 SetXYZ( v.x(), v.y(), v.z() );
157 return *this;
158 }
159
160
161#ifdef LATER
162 /**
163 assign from a generic linear algebra vector of at least size 3
164 implementing operator []. This could be also a C array
165 \par v LAVector
166 \par index0 index where coordinates starts (typically zero)
167 It works for all Coordinates types,
168 ( x= v[index0] for Cartesian and r=v[index0] for Polar )
169 */
170 template <class LAVector>
171 DisplacementVector3D & assignFrom(const LAVector & v, size_t index0 = 0) {
172 fCoordinates = CoordSystem ( v[index0], v[index0+1], v[index0+2] );
173 return *this;
174 }
175#endif
176
177 // ------ Set, Get, and access coordinate data ------
178
179 /**
180 Retrieve a copy of the coordinates object
181 */
182 CoordSystem Coordinates() const {
183 return fCoordinates;
184 }
185
186 /**
187 Set internal data based on a C-style array of 3 Scalar numbers
188 */
190 { fCoordinates.SetCoordinates(src); return *this; }
191
192 /**
193 Set internal data based on 3 Scalar numbers
194 */
196 { fCoordinates.SetCoordinates(a, b, c); return *this; }
197
198 /**
199 Set internal data based on 3 Scalars at *begin to *end
200 */
201 template <class IT>
203 { IT a = begin; IT b = ++begin; IT c = ++begin;
204 (void)end;
205 assert (++begin==end);
206 SetCoordinates (*a,*b,*c);
207 return *this;
208 }
209
210 /**
211 get internal data into 3 Scalar numbers
212 */
213 void GetCoordinates( Scalar& a, Scalar& b, Scalar& c ) const
214 { fCoordinates.GetCoordinates(a, b, c); }
215
216 /**
217 get internal data into a C-style array of 3 Scalar numbers
218 */
219 void GetCoordinates( Scalar dest[] ) const
220 { fCoordinates.GetCoordinates(dest); }
221
222 /**
223 get internal data into 3 Scalars at *begin to *end (3 past begin)
224 */
225 template <class IT>
226 void GetCoordinates( IT begin, IT end ) const
227 { IT a = begin; IT b = ++begin; IT c = ++begin;
228 (void)end;
229 assert (++begin==end);
230 GetCoordinates (*a,*b,*c);
231 }
232 /**
233 get internal data into 3 Scalars starting at *begin
234 */
235 template <class IT>
236 void GetCoordinates( IT begin) const {
237 Scalar a = Scalar(0);
238 Scalar b = Scalar(0);
239 Scalar c = Scalar(0);
240 GetCoordinates(a, b, c);
241 *begin++ = a;
242 *begin++ = b;
243 *begin = c;
244 }
245
246 /**
247 set the values of the vector from the cartesian components (x,y,z)
248 (if the vector is held in polar or cylindrical eta coordinates,
249 then (x, y, z) are converted to that form)
250 */
252 fCoordinates.SetXYZ(a, b, c);
253 return *this;
254 }
255
256 // ------------------- Equality -----------------
257
258 /**
259 Exact equality
260 */
261 bool operator==(const DisplacementVector3D & rhs) const {
262 return fCoordinates==rhs.fCoordinates;
263 }
264 bool operator!= (const DisplacementVector3D & rhs) const {
265 return !(operator==(rhs));
266 }
267
268 // ------ Individual element access, in various coordinate systems ------
269
270 /**
271 Cartesian X, converting if necessary from internal coordinate system.
272 */
273 Scalar X() const { return fCoordinates.X(); }
274
275 /**
276 Cartesian Y, converting if necessary from internal coordinate system.
277 */
278 Scalar Y() const { return fCoordinates.Y(); }
279
280 /**
281 Cartesian Z, converting if necessary from internal coordinate system.
282 */
283 Scalar Z() const { return fCoordinates.Z(); }
284
285 /**
286 Polar R, converting if necessary from internal coordinate system.
287 */
288 Scalar R() const { return fCoordinates.R(); }
289
290 /**
291 Polar theta, converting if necessary from internal coordinate system.
292 */
293 Scalar Theta() const { return fCoordinates.Theta(); }
294
295 /**
296 Polar phi, converting if necessary from internal coordinate system.
297 */
298 Scalar Phi() const { return fCoordinates.Phi(); }
299
300 /**
301 Polar eta, converting if necessary from internal coordinate system.
302 */
303 Scalar Eta() const { return fCoordinates.Eta(); }
304
305 /**
306 Cylindrical transverse component rho
307 */
308 Scalar Rho() const { return fCoordinates.Rho(); }
309
310 // ----- Other fundamental properties -----
311
312 /**
313 Magnitute squared ( r^2 in spherical coordinate)
314 */
315 Scalar Mag2() const { return fCoordinates.Mag2();}
316
317 /**
318 Transverse component squared (rho^2 in cylindrical coordinates.
319 */
320 Scalar Perp2() const { return fCoordinates.Perp2();}
321
322 /**
323 return unit vector parallel to this (scalar)
324 */
327 {
328 const auto tot = R();
330 }
331
332 /**
333 return unit vector parallel to this (vector)
334 */
337 {
338 SCALAR tot = R();
339 tot(tot == SCALAR(0)) = SCALAR(1);
340 return DisplacementVector3D(*this) / tot;
341 }
342
343 // ------ Setting of individual elements present in coordinate system ------
344
345 /**
346 Change X - Cartesian3D coordinates only
347 */
349
350 /**
351 Change Y - Cartesian3D coordinates only
352 */
354
355 /**
356 Change Z - Cartesian3D coordinates only
357 */
359
360 /**
361 Change R - Polar3D coordinates only
362 */
364
365 /**
366 Change Theta - Polar3D coordinates only
367 */
369
370 /**
371 Change Phi - Polar3D or CylindricalEta3D coordinates
372 */
374
375 /**
376 Change Rho - CylindricalEta3D coordinates only
377 */
379
380 /**
381 Change Eta - CylindricalEta3D coordinates only
382 */
383 DisplacementVector3D<CoordSystem, Tag>& SetEta (Scalar etaval) { fCoordinates.SetEta(etaval); return *this;}
384
385
386 // ------ Operations combining two vectors ------
387 // -- need to have the specialized version in order to avoid
388
389 /**
390 Return the scalar (dot) product of two displacement vectors.
391 It is possible to perform the product for any type of vector coordinates,
392 but they must have the same coordinate system tag
393 */
394 template< class OtherCoords >
396 return X()*v.X() + Y()*v.Y() + Z()*v.Z();
397 }
398 /**
399 Return the scalar (dot) product of two vectors.
400 It is possible to perform the product for any classes
401 implementing x(), y() and z() member functions
402 */
403 template< class OtherVector >
404 Scalar Dot( const OtherVector & v) const {
405 return X()*v.x() + Y()*v.y() + Z()*v.z();
406 }
407
408 /**
409 Return vector (cross) product of two displacement vectors,
410 as a vector in the coordinate system of this class.
411 It is possible to perform the product for any type of vector coordinates,
412 but they must have the same coordinate system tag
413 */
414 template <class OtherCoords>
417 result.SetXYZ ( Y()*v.Z() - v.Y()*Z(),
418 Z()*v.X() - v.Z()*X(),
419 X()*v.Y() - v.X()*Y() );
420 return result;
421 }
422 /**
423 Return vector (cross) product of two vectors,
424 as a vector in the coordinate system of this class.
425 It is possible to perform the product for any classes
426 implementing X(), Y() and Z() member functions
427 */
428 template <class OtherVector>
429 DisplacementVector3D Cross( const OtherVector & v) const {
431 result.SetXYZ ( Y()*v.z() - v.y()*Z(),
432 Z()*v.x() - v.z()*X(),
433 X()*v.y() - v.x()*Y() );
434 return result;
435 }
436
437
438
439 /**
440 Self Addition with a displacement vector.
441 */
442 template <class OtherCoords>
445 SetXYZ( X() + v.X(), Y() + v.Y(), Z() + v.Z() );
446 return *this;
447 }
448
449 /**
450 Self Difference with a displacement vector.
451 */
452 template <class OtherCoords>
455 SetXYZ( x() - v.x(), y() - v.y(), z() - v.z() );
456 return *this;
457 }
458
459
460 /**
461 multiply this vector by a scalar quantity
462 */
464 fCoordinates.Scale(a);
465 return *this;
466 }
467
468 /**
469 divide this vector by a scalar quantity
470 */
472 fCoordinates.Scale(1/a);
473 return *this;
474 }
475
476 // The following methods (v*a and v/a) could instead be free functions.
477 // They were moved into the class to solve a problem on AIX.
478
479 /**
480 Multiply a vector by a real number
481 */
483 DisplacementVector3D tmp(*this);
484 tmp *= a;
485 return tmp;
486 }
487
488 /**
489 Negative of the vector
490 */
492 return operator*( Scalar(-1) );
493 }
494
495 /**
496 Positive of the vector, return itself
497 */
498 DisplacementVector3D operator + ( ) const {return *this;}
499
500 /**
501 Division of a vector with a real number
502 */
504 DisplacementVector3D tmp(*this);
505 tmp /= a;
506 return tmp;
507 }
508
509
510 // Methods providing limited backward name compatibility with CLHEP
511
512 Scalar x() const { return fCoordinates.X(); }
513 Scalar y() const { return fCoordinates.Y(); }
514 Scalar z() const { return fCoordinates.Z(); }
515 Scalar r() const { return fCoordinates.R(); }
516 Scalar theta() const { return fCoordinates.Theta(); }
517 Scalar phi() const { return fCoordinates.Phi(); }
518 Scalar eta() const { return fCoordinates.Eta(); }
519 Scalar rho() const { return fCoordinates.Rho(); }
520 Scalar mag2() const { return fCoordinates.Mag2(); }
521 Scalar perp2() const { return fCoordinates.Perp2(); }
522 DisplacementVector3D unit() const {return Unit();}
523
524
525 private:
526
527 CoordSystem fCoordinates; // internal coordinate system
528
529#ifdef NOT_SURE_THIS_SHOULD_BE_FORBIDDEN
530 /**
531 Cross product involving a position vector is inappropriate
532 */
533 template <class T2>
535#endif
536
537 // the following methods should not compile
538
539 // this should not compile (if from a vector or points with different tag
540 template <class OtherCoords, class OtherTag>
542
543 template <class OtherCoords, class OtherTag>
545
546 template <class OtherCoords, class OtherTag>
548
549
550 template <class OtherCoords, class OtherTag>
552
553 template <class OtherCoords, class OtherTag>
555
556 template <class OtherCoords, class OtherTag>
558
559 template<class OtherCoords, class OtherTag >
561
562 template<class OtherCoords, class OtherTag >
564
565
566 };
567
568// ---------- DisplacementVector3D class template ends here ------------
569// ---------------------------------------------------------------------
570
571
572
573 /**
575 The (coordinate system) type of the returned vector is defined to
576 be identical to that of the first vector, which is passed by value
577 */
578 template <class CoordSystem1, class CoordSystem2, class U>
579 inline
583 return v1 += v2;
584 }
585
586 /**
587 Difference between two DisplacementVector3D vectors.
588 The (coordinate system) type of the returned vector is defined to
589 be identical to that of the first vector.
590 */
591 template <class CoordSystem1, class CoordSystem2, class U>
592 inline
593 DisplacementVector3D<CoordSystem1,U>
596 return v1 -= v2;
597 }
598
599 //#endif // not __CINT__
600
601 /**
602 Multiplication of a displacement vector by real number a*v
603 */
604 template <class CoordSystem, class U>
605 inline
606 DisplacementVector3D<CoordSystem,U>
609 return v *= a;
610 // Note - passing v by value and using operator *= may save one
611 // copy relative to passing v by const ref and creating a temporary.
612 }
613
614
615 // v1*v2 notation for Cross product of two vectors is omitted,
616 // since it is always confusing as to whether dot product is meant.
617
618
619
620 // ------------- I/O to/from streams -------------
621
622 template <class char_t, class traits_t, class T, class U,
624 nullptr>
625 std::basic_ostream<char_t, traits_t> &operator<<(std::basic_ostream<char_t, traits_t> &os,
626 DisplacementVector3D<T, U> const &v)
627 {
628 if (os) {
629
630 typename T::Scalar a, b, c;
631 v.GetCoordinates(a, b, c);
632
635 typedef GenVector_detail::BitReproducible BR;
636 BR::Output(os, a);
637 BR::Output(os, b);
638 BR::Output(os, c);
639 } else {
642 }
643 }
644 return os;
645 } // op<< <>()
646
647 template <class char_t, class traits_t, class T, class U,
649 nullptr>
650 std::basic_ostream<char_t, traits_t> &operator<<(std::basic_ostream<char_t, traits_t> &os,
651 DisplacementVector3D<T, U> const &v)
652 {
653 if (os) {
654 os << "{ ";
655 for (std::size_t i = 0; i < PositionVector3D<T, U>::Scalar::Size; ++i) {
656 os << "(" << v.x()[i] << "," << v.y()[i] << "," << v.z()[i] << ") ";
657 }
658 os << "}";
659 }
660 return os;
661 } // op<< <>()
662
663 template< class char_t, class traits_t, class T, class U >
664 inline
665 std::basic_istream<char_t,traits_t> &
666 operator >> ( std::basic_istream<char_t,traits_t> & is
668 )
669 {
670 if( !is ) return is;
671
672 typename T::Scalar a, b, c;
673
677 BR::Input(is, a);
678 BR::Input(is, b);
679 BR::Input(is, c);
680 }
681 else {
683 detail::require_delim( is, detail::sep ); is >> b;
684 detail::require_delim( is, detail::sep ); is >> c;
686 }
687
688 if( is )
689 v.SetCoordinates(a, b, c);
690 return is;
691
692 } // op>> <>()
693
694
695
696 } // namespace Math
697
698} // namespace ROOT
699
700
701#endif /* ROOT_Math_GenVector_DisplacementVector3D */
702
#define c(i)
Definition: RSha256.hxx:101
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Class describing a 3D cartesian coordinate system (x, y, z coordinates)
Definition: Cartesian3D.h:46
Class describing a generic displacement vector in 3 dimensions.
DisplacementVector3D< CoordSystem, Tag > & SetCoordinates(IT begin, IT end)
Set internal data based on 3 Scalars at *begin to *end.
Scalar Theta() const
Polar theta, converting if necessary from internal coordinate system.
DisplacementVector3D & operator-=(const DisplacementVector3D< OtherCoords, OtherTag > &)
CoordSystem Coordinates() const
Retrieve a copy of the coordinates object.
DisplacementVector3D< CoordSystem, Tag > & SetRho(Scalar rr)
Change Rho - CylindricalEta3D coordinates only.
DisplacementVector3D & operator=(const DisplacementVector3D< OtherCoords, Tag > &v)
Assignment operator from a displacement vector of arbitrary type.
DisplacementVector3D & operator+=(const DisplacementVector3D< OtherCoords, OtherTag > &)
DisplacementVector3D< CoordSystem, Tag > & SetEta(Scalar etaval)
Change Eta - CylindricalEta3D coordinates only.
Scalar R() const
Polar R, converting if necessary from internal coordinate system.
DisplacementVector3D & operator/=(Scalar a)
divide this vector by a scalar quantity
DisplacementVector3D< CoordSystem, Tag > & SetPhi(Scalar ang)
Change Phi - Polar3D or CylindricalEta3D coordinates.
DisplacementVector3D< CoordSystem, Tag > & SetR(Scalar rr)
Change R - Polar3D coordinates only.
DisplacementVector3D Cross(const OtherVector &v) const
Return vector (cross) product of two vectors, as a vector in the coordinate system of this class.
DisplacementVector3D Unit() const
return unit vector parallel to this (scalar)
DisplacementVector3D operator+() const
Positive of the vector, return itself.
DisplacementVector3D operator-() const
Negative of the vector.
DisplacementVector3D< CoordSystem, Tag > & SetCoordinates(Scalar a, Scalar b, Scalar c)
Set internal data based on 3 Scalar numbers.
DisplacementVector3D< CoordSystem, Tag > & SetY(Scalar yy)
Change Y - Cartesian3D coordinates only.
Scalar X() const
Cartesian X, converting if necessary from internal coordinate system.
DisplacementVector3D< CoordSystem, Tag > & SetZ(Scalar zz)
Change Z - Cartesian3D coordinates only.
void GetCoordinates(Scalar dest[]) const
get internal data into a C-style array of 3 Scalar numbers
DisplacementVector3D(const PositionVector3D< OtherCoords, OtherTag > &)
void GetCoordinates(Scalar &a, Scalar &b, Scalar &c) const
get internal data into 3 Scalar numbers
void GetCoordinates(IT begin) const
get internal data into 3 Scalars starting at *begin
Scalar Y() const
Cartesian Y, converting if necessary from internal coordinate system.
DisplacementVector3D(const PositionVector3D< OtherCoords, Tag > &p)
Construct from a position vector expressed in different coordinates but with the same coordinate syst...
Scalar Dot(const OtherVector &v) const
Return the scalar (dot) product of two vectors.
DisplacementVector3D Cross(const DisplacementVector3D< OtherCoords, Tag > &v) const
Return vector (cross) product of two displacement vectors, as a vector in the coordinate system of th...
DisplacementVector3D< CoordSystem, Tag > & SetTheta(Scalar ang)
Change Theta - Polar3D coordinates only.
DisplacementVector3D operator*(Scalar a) const
Multiply a vector by a real number.
bool operator==(const DisplacementVector3D &rhs) const
Exact equality.
Scalar Rho() const
Cylindrical transverse component rho.
DisplacementVector3D Cross(const DisplacementVector3D< OtherCoords, OtherTag > &) const
bool operator!=(const DisplacementVector3D &rhs) const
DisplacementVector3D unit() const
DisplacementVector3D()
Default constructor.
DisplacementVector3D< CoordSystem, Tag > & SetCoordinates(const Scalar src[])
Set internal data based on a C-style array of 3 Scalar numbers.
DisplacementVector3D(Scalar a, Scalar b, Scalar c)
Construct from three values of type Scalar.
DisplacementVector3D(const ForeignVector &v)
Construct from a foreign 3D vector type, for example, Hep3Vector Precondition: v must implement metho...
DisplacementVector3D & operator=(const PositionVector3D< OtherCoords, OtherTag > &)
Scalar Dot(const DisplacementVector3D< OtherCoords, OtherTag > &) const
Scalar Phi() const
Polar phi, converting if necessary from internal coordinate system.
DisplacementVector3D< CoordSystem, Tag > & SetX(Scalar xx)
Change X - Cartesian3D coordinates only.
Scalar Mag2() const
Magnitute squared ( r^2 in spherical coordinate)
DisplacementVector3D< CoordSystem, Tag > & SetXYZ(Scalar a, Scalar b, Scalar c)
set the values of the vector from the cartesian components (x,y,z) (if the vector is held in polar or...
Scalar Perp2() const
Transverse component squared (rho^2 in cylindrical coordinates.
DisplacementVector3D & operator*=(Scalar a)
multiply this vector by a scalar quantity
DisplacementVector3D operator/(Scalar a) const
Division of a vector with a real number.
Scalar Eta() const
Polar eta, converting if necessary from internal coordinate system.
Scalar Z() const
Cartesian Z, converting if necessary from internal coordinate system.
DisplacementVector3D(const DisplacementVector3D< OtherCoords, Tag > &v)
Construct from a displacement vector expressed in different coordinates, or using a different Scalar ...
void GetCoordinates(IT begin, IT end) const
get internal data into 3 Scalars at *begin to *end (3 past begin)
DisplacementVector3D(const DisplacementVector3D< OtherCoords, OtherTag > &)
Scalar Dot(const DisplacementVector3D< OtherCoords, Tag > &v) const
Return the scalar (dot) product of two displacement vectors.
DisplacementVector3D & operator=(const DisplacementVector3D< OtherCoords, OtherTag > &)
Class describing a generic position vector (point) in 3 dimensions.
Namespace for new Math classes and functions.
void(off) SmallVectorTemplateBase< T
double T(double x)
Definition: ChebyshevPol.h:34
char_t get_manip(std::basic_ios< char_t, traits_t > &ios, manip_t m)
Definition: GenVectorIO.h:54
std::basic_istream< char_t, traits_t > & require_delim(std::basic_istream< char_t, traits_t > &is, manip_t m)
Definition: GenVectorIO.h:113
void set_manip(std::basic_ios< char_t, traits_t > &ios, manip_t m, char_t ch)
Definition: GenVectorIO.h:74
std::ostream & operator<<(std::ostream &os, const AxisAngle &a)
Stream Output and Input.
Definition: AxisAngle.cxx:91
std::basic_istream< char_t, traits_t > & operator>>(std::basic_istream< char_t, traits_t > &is, DisplacementVector2D< T, U > &v)
DisplacementVector2D< CoordSystem1, U > operator+(DisplacementVector2D< CoordSystem1, U > v1, const DisplacementVector2D< CoordSystem2, U > &v2)