Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 @see GenVector
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 */
71 constexpr DisplacementVector3D ( ) : fCoordinates() { }
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>
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>
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 constexpr 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 constexpr 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>
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>
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 */
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 \note Alternatively, you may use structured bindings: `auto const [a, b, c] = v`.
213 */
214 void GetCoordinates( Scalar& a, Scalar& b, Scalar& c ) const
215 { fCoordinates.GetCoordinates(a, b, c); }
216
217 /**
218 get internal data into a C-style array of 3 Scalar numbers
219 */
220 void GetCoordinates( Scalar dest[] ) const
221 { fCoordinates.GetCoordinates(dest); }
222
223 /**
224 get internal data into 3 Scalars at *begin to *end (3 past begin)
225 */
226 template <class IT>
227 void GetCoordinates( IT begin, IT end ) const
228 { IT a = begin; IT b = ++begin; IT c = ++begin;
229 (void)end;
230 assert (++begin==end);
231 GetCoordinates (*a,*b,*c);
232 }
233 /**
234 get internal data into 3 Scalars starting at *begin
235 */
236 template <class IT>
237 void GetCoordinates( IT begin) const {
238 Scalar a = Scalar(0);
239 Scalar b = Scalar(0);
240 Scalar c = Scalar(0);
241 GetCoordinates(a, b, c);
242 *begin++ = a;
243 *begin++ = b;
244 *begin = c;
245 }
246
247 /**
248 set the values of the vector from the cartesian components (x,y,z)
249 (if the vector is held in polar or cylindrical eta coordinates,
250 then (x, y, z) are converted to that form)
251 */
253 fCoordinates.SetXYZ(a, b, c);
254 return *this;
255 }
256
257 // ------------------- Equality -----------------
258
259 /**
260 Exact equality
261 */
262 bool operator==(const DisplacementVector3D & rhs) const {
263 return fCoordinates==rhs.fCoordinates;
264 }
266 return !(operator==(rhs));
267 }
268
269 // ------ Individual element access, in various coordinate systems ------
270
271 /**
272 Dimension
273 */
274 unsigned int Dimension() const
275 {
276 return fDimension;
277 };
278
279 /**
280 Cartesian X, converting if necessary from internal coordinate system.
281 */
282 Scalar X() const { return fCoordinates.X(); }
283
284 /**
285 Cartesian Y, converting if necessary from internal coordinate system.
286 */
287 Scalar Y() const { return fCoordinates.Y(); }
288
289 /**
290 Cartesian Z, converting if necessary from internal coordinate system.
291 */
292 Scalar Z() const { return fCoordinates.Z(); }
293
294 /**
295 Polar R, converting if necessary from internal coordinate system.
296 */
297 Scalar R() const { return fCoordinates.R(); }
298
299 /**
300 Polar theta, converting if necessary from internal coordinate system.
301 */
302 Scalar Theta() const { return fCoordinates.Theta(); }
303
304 /**
305 Polar phi, converting if necessary from internal coordinate system.
306 */
307 Scalar Phi() const { return fCoordinates.Phi(); }
308
309 /**
310 Polar eta, converting if necessary from internal coordinate system.
311 */
312 Scalar Eta() const { return fCoordinates.Eta(); }
313
314 /**
315 Cylindrical transverse component rho
316 */
317 Scalar Rho() const { return fCoordinates.Rho(); }
318
319 // ----- Other fundamental properties -----
320
321 /**
322 Magnitute squared ( r^2 in spherical coordinate)
323 */
324 Scalar Mag2() const { return fCoordinates.Mag2();}
325
326 /**
327 Transverse component squared (rho^2 in cylindrical coordinates.
328 */
329 Scalar Perp2() const { return fCoordinates.Perp2();}
330
331 /**
332 return unit vector parallel to this (scalar)
333 */
336 {
337 const auto tot = R();
338 return tot == 0 ? *this : DisplacementVector3D(*this) / tot;
339 }
340
341 /**
342 return unit vector parallel to this (vector)
343 */
346 {
347 SCALAR tot = R();
348 tot(tot == SCALAR(0)) = SCALAR(1);
349 return DisplacementVector3D(*this) / tot;
350 }
351
352 // ------ Setting of individual elements present in coordinate system ------
353
354 /**
355 Change X - Cartesian3D coordinates only
356 */
358
359 /**
360 Change Y - Cartesian3D coordinates only
361 */
363
364 /**
365 Change Z - Cartesian3D coordinates only
366 */
368
369 /**
370 Change R - Polar3D coordinates only
371 */
373
374 /**
375 Change Theta - Polar3D coordinates only
376 */
378
379 /**
380 Change Phi - Polar3D or CylindricalEta3D coordinates
381 */
383
384 /**
385 Change Rho - CylindricalEta3D coordinates only
386 */
388
389 /**
390 Change Eta - CylindricalEta3D coordinates only
391 */
393
394
395 // ------ Operations combining two vectors ------
396 // -- need to have the specialized version in order to avoid
397
398 /**
399 Return the scalar (dot) product of two displacement vectors.
400 It is possible to perform the product for any type of vector coordinates,
401 but they must have the same coordinate system tag
402 */
403 template< class OtherCoords >
405 return X()*v.X() + Y()*v.Y() + Z()*v.Z();
406 }
407 /**
408 Return the scalar (dot) product of two vectors.
409 It is possible to perform the product for any classes
410 implementing x(), y() and z() member functions
411 */
412 template< class OtherVector >
413 Scalar Dot( const OtherVector & v) const {
414 return X()*v.x() + Y()*v.y() + Z()*v.z();
415 }
416
417 /**
418 Return vector (cross) product of two displacement vectors,
419 as a vector in the coordinate system of this class.
420 It is possible to perform the product for any type of vector coordinates,
421 but they must have the same coordinate system tag
422 */
423 template <class OtherCoords>
426 result.SetXYZ ( Y()*v.Z() - v.Y()*Z(),
427 Z()*v.X() - v.Z()*X(),
428 X()*v.Y() - v.X()*Y() );
429 return result;
430 }
431 /**
432 Return vector (cross) product of two vectors,
433 as a vector in the coordinate system of this class.
434 It is possible to perform the product for any classes
435 implementing X(), Y() and Z() member functions
436 */
437 template <class OtherVector>
440 result.SetXYZ ( Y()*v.z() - v.y()*Z(),
441 Z()*v.x() - v.z()*X(),
442 X()*v.y() - v.x()*Y() );
443 return result;
444 }
445
446
447
448 /**
449 Self Addition with a displacement vector.
450 */
451 template <class OtherCoords>
454 SetXYZ( X() + v.X(), Y() + v.Y(), Z() + v.Z() );
455 return *this;
456 }
457
458 /**
459 Self Difference with a displacement vector.
460 */
461 template <class OtherCoords>
464 SetXYZ( x() - v.x(), y() - v.y(), z() - v.z() );
465 return *this;
466 }
467
468
469 /**
470 multiply this vector by a scalar quantity
471 */
473 fCoordinates.Scale(a);
474 return *this;
475 }
476
477 /**
478 divide this vector by a scalar quantity
479 */
481 fCoordinates.Scale(1/a);
482 return *this;
483 }
484
485 // The following methods (v*a and v/a) could instead be free functions.
486 // They were moved into the class to solve a problem on AIX.
487
488 /**
489 Multiply a vector by a real number
490 */
492 DisplacementVector3D tmp(*this);
493 tmp *= a;
494 return tmp;
495 }
496
497 /**
498 Negative of the vector
499 */
501 return operator*( Scalar(-1) );
502 }
503
504 /**
505 Positive of the vector, return itself
506 */
507 DisplacementVector3D operator + ( ) const {return *this;}
508
509 /**
510 Division of a vector with a real number
511 */
513 DisplacementVector3D tmp(*this);
514 tmp /= a;
515 return tmp;
516 }
517
518
519 // Methods providing limited backward name compatibility with CLHEP
520
521 Scalar x() const { return fCoordinates.X(); }
522 Scalar y() const { return fCoordinates.Y(); }
523 Scalar z() const { return fCoordinates.Z(); }
524 Scalar r() const { return fCoordinates.R(); }
525 Scalar theta() const { return fCoordinates.Theta(); }
526 Scalar phi() const { return fCoordinates.Phi(); }
527 Scalar eta() const { return fCoordinates.Eta(); }
528 Scalar rho() const { return fCoordinates.Rho(); }
529 Scalar mag2() const { return fCoordinates.Mag2(); }
530 Scalar perp2() const { return fCoordinates.Perp2(); }
531 DisplacementVector3D unit() const {return Unit();}
532
533
534 private:
535
536 CoordSystem fCoordinates; // internal coordinate system
537 static constexpr unsigned int fDimension = CoordinateType::Dimension;
538
539#ifdef NOT_SURE_THIS_SHOULD_BE_FORBIDDEN
540 /**
541 Cross product involving a position vector is inappropriate
542 */
543 template <class T2>
545#endif
546
547 // the following methods should not compile
548
549 // this should not compile (if from a vector or points with different tag
550 template <class OtherCoords, class OtherTag>
552
553 template <class OtherCoords, class OtherTag>
555
556 template <class OtherCoords, class OtherTag>
558
559
560 template <class OtherCoords, class OtherTag>
562
563 template <class OtherCoords, class OtherTag>
565
566 template <class OtherCoords, class OtherTag>
568
569 template<class OtherCoords, class OtherTag >
571
572 template<class OtherCoords, class OtherTag >
574
575
576 };
577
578// ---------- DisplacementVector3D class template ends here ------------
579// ---------------------------------------------------------------------
580
581
582
583 /**
584 Addition of DisplacementVector3D vectors.
585 The (coordinate system) type of the returned vector is defined to
586 be identical to that of the first vector, which is passed by value
587 */
588 template <class CoordSystem1, class CoordSystem2, class U>
589 inline
595
596 /**
597 Difference between two DisplacementVector3D vectors.
598 The (coordinate system) type of the returned vector is defined to
599 be identical to that of the first vector.
600 */
601 template <class CoordSystem1, class CoordSystem2, class U>
602 inline
608
609 /**
610 Multiplication of a displacement vector by real number a*v
611 */
612 template <class CoordSystem, class U>
613 inline
617 return v *= a;
618 // Note - passing v by value and using operator *= may save one
619 // copy relative to passing v by const ref and creating a temporary.
620 }
621
622
623 // v1*v2 notation for Cross product of two vectors is omitted,
624 // since it is always confusing as to whether dot product is meant.
625
626
627
628 // ------------- I/O to/from streams -------------
629
630 template <class char_t, class traits_t, class T, class U,
631 typename std::enable_if<std::is_arithmetic<typename DisplacementVector3D<T, U>::Scalar>::value>::type * =
632 nullptr>
633 std::basic_ostream<char_t, traits_t> &operator<<(std::basic_ostream<char_t, traits_t> &os,
635 {
636 if (os) {
637
638 typename T::Scalar a, b, c;
639 v.GetCoordinates(a, b, c);
640
643 typedef GenVector_detail::BitReproducible BR;
644 BR::Output(os, a);
645 BR::Output(os, b);
646 BR::Output(os, c);
647 } else {
650 }
651 }
652 return os;
653 } // op<< <>()
654
655 template <class char_t, class traits_t, class T, class U,
656 typename std::enable_if<!std::is_arithmetic<typename DisplacementVector3D<T, U>::Scalar>::value>::type * =
657 nullptr>
658 std::basic_ostream<char_t, traits_t> &operator<<(std::basic_ostream<char_t, traits_t> &os,
660 {
661 if (os) {
662 os << "{ ";
663 for (std::size_t i = 0; i < PositionVector3D<T, U>::Scalar::Size; ++i) {
664 os << "(" << v.x()[i] << "," << v.y()[i] << "," << v.z()[i] << ") ";
665 }
666 os << "}";
667 }
668 return os;
669 } // op<< <>()
670
671 template< class char_t, class traits_t, class T, class U >
672 inline
673 std::basic_istream<char_t,traits_t> &
674 operator >> ( std::basic_istream<char_t,traits_t> & is
676 )
677 {
678 if( !is ) return is;
679
680 typename T::Scalar a, b, c;
681
685 BR::Input(is, a);
686 BR::Input(is, b);
687 BR::Input(is, c);
688 }
689 else {
694 }
695
696 if( is )
697 v.SetCoordinates(a, b, c);
698 return is;
699
700 } // op>> <>()
701
702 // Structured bindings
703 template <std::size_t I, class CoordSystem, class Tag>
704 typename CoordSystem::Scalar get(DisplacementVector3D<CoordSystem, Tag> const& p)
705 {
706 static_assert(I < 3);
707 if constexpr (I == 0) {
708 return p.x();
709 } else if constexpr (I == 1) {
710 return p.y();
711 } else {
712 return p.z();
713 }
714 }
715
716 } // namespace Math
717
718} // namespace ROOT
719
720// Structured bindings
721#include <tuple>
722namespace std {
723 template <class CoordSystem, class Tag>
724 struct tuple_size<ROOT::Math::DisplacementVector3D<CoordSystem, Tag>> : integral_constant<size_t, 3> {};
725 template <size_t I, class CoordSystem, class Tag>
726 struct tuple_element<I, ROOT::Math::DisplacementVector3D<CoordSystem, Tag>> {
727 static_assert(I < 3);
728 using type = typename CoordSystem::Scalar;
729 };
730}
731
732#endif /* ROOT_Math_GenVector_DisplacementVector3D */
733
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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 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.
constexpr DisplacementVector3D(const DisplacementVector3D< OtherCoords, OtherTag > &)
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.
constexpr DisplacementVector3D(Scalar a, Scalar b, Scalar c)
Construct from three values of type Scalar.
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.
constexpr DisplacementVector3D(const PositionVector3D< OtherCoords, Tag > &p)
Construct from a position vector expressed in different coordinates but with the same coordinate syst...
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.
constexpr DisplacementVector3D(const PositionVector3D< OtherCoords, OtherTag > &)
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.
constexpr DisplacementVector3D(const ForeignVector &v)
Construct from a foreign 3D vector type, for example, Hep3Vector Precondition: v must implement metho...
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
static constexpr unsigned int fDimension
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.
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.
constexpr DisplacementVector3D(const DisplacementVector3D< OtherCoords, Tag > &v)
Construct from a displacement vector expressed in different coordinates, or using a different Scalar ...
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< CoordSystem, Tag > & SetCoordinates(const Scalar src[])
Set internal data based on a C-style array of 3 Scalar numbers.
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.
unsigned int Dimension() const
Dimension.
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.
constexpr DisplacementVector3D()
Default constructor.
Scalar Z() const
Cartesian Z, converting if necessary from internal coordinate system.
void GetCoordinates(IT begin, IT end) const
get internal data into 3 Scalars at *begin to *end (3 past begin)
Scalar Dot(const DisplacementVector3D< OtherCoords, Tag > &v) const
Return the scalar (dot) product of two displacement vectors.
DisplacementVector3D & operator=(const DisplacementVector3D< OtherCoords, OtherTag > &)
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
#define I(x, y, z)
Namespace for new Math classes and functions.
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)
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)
CoordSystem::Scalar get(DisplacementVector2D< CoordSystem, Tag > const &p)
DisplacementVector2D< CoordSystem1, U > operator+(DisplacementVector2D< CoordSystem1, U > v1, const DisplacementVector2D< CoordSystem2, U > &v2)
Addition of DisplacementVector2D vectors.
DisplacementVector2D< CoordSystem1, U > operator-(DisplacementVector2D< CoordSystem1, U > v1, DisplacementVector2D< CoordSystem2, U > const &v2)
Difference between two DisplacementVector2D vectors.
AxisAngle operator*(RotationX const &r1, AxisAngle const &r2)
Multiplication of an axial rotation by an AxisAngle.