MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Vec.h
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** Copyright (C) 2003-2013 Upinder S. Bhalla. and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 
10 #ifndef _VEC_H
11 #define _VEC_H
12 
13 class Vec {
14  public:
15  Vec( double a0, double a1, double a2 );
16  Vec()
17  : a0_( 0.0 ), a1_( 0.0 ), a2_( 0.0 )
18  {;}
19 
20  double length() const;
21 
22  double distance( const Vec& other ) const;
23 
24  double dotProduct( const Vec& other ) const;
25 
26  Vec crossProduct( const Vec& other ) const;
27 
29  void unitLength();
30 
32  void orthogonalAxes( Vec& u, Vec& v ) const;
33 
34  double a0() const {
35  return a0_;
36  }
37  double a1() const {
38  return a1_;
39  }
40  double a2() const {
41  return a2_;
42  }
43 
49  Vec pointOnLine( const Vec& end, double k );
50 
51  bool operator==( const Vec& other ) const;
52 
53  Vec operator-( const Vec& other ) const;
54 
55  Vec operator+( const Vec& other ) const;
56 
57  Vec operator*( const double& other ) const;
58 
59  private:
60  double a0_;
61  double a1_;
62  double a2_;
63 };
64 
65 #endif // _VEC_H
double a0() const
Definition: Vec.h:34
Vec operator*(const double &other) const
Definition: Vec.cpp:76
double a0_
Definition: Vec.h:60
double a2() const
Definition: Vec.h:40
double a2_
Definition: Vec.h:62
Vec operator+(const Vec &other) const
Definition: Vec.cpp:72
Vec crossProduct(const Vec &other) const
Definition: Vec.cpp:26
Vec operator-(const Vec &other) const
Definition: Vec.cpp:68
double a1_
Definition: Vec.h:61
bool operator==(const Vec &other) const
Definition: Vec.cpp:61
Definition: Vec.h:13
void unitLength()
Rescales vector so it has unit length.
Definition: Vec.cpp:33
double length() const
Definition: Vec.cpp:18
Vec()
Definition: Vec.h:16
double distance(const Vec &other) const
Definition: Vec.cpp:81
double dotProduct(const Vec &other) const
Definition: Vec.cpp:22
void orthogonalAxes(Vec &u, Vec &v) const
Generates vectors u and v to form a mutually orthogonal system.
Definition: Vec.cpp:41
double a1() const
Definition: Vec.h:37
Vec pointOnLine(const Vec &end, double k)
Definition: Vec.cpp:53