MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Vec Class Reference

#include <Vec.h>

+ Collaboration diagram for Vec:

Public Member Functions

double a0 () const
 
double a1 () const
 
double a2 () const
 
Vec crossProduct (const Vec &other) const
 
double distance (const Vec &other) const
 
double dotProduct (const Vec &other) const
 
double length () const
 
Vec operator* (const double &other) const
 
Vec operator+ (const Vec &other) const
 
Vec operator- (const Vec &other) const
 
bool operator== (const Vec &other) const
 
void orthogonalAxes (Vec &u, Vec &v) const
 Generates vectors u and v to form a mutually orthogonal system. More...
 
Vec pointOnLine (const Vec &end, double k)
 
void unitLength ()
 Rescales vector so it has unit length. More...
 
 Vec (double a0, double a1, double a2)
 
 Vec ()
 

Private Attributes

double a0_
 
double a1_
 
double a2_
 

Detailed Description

Definition at line 13 of file Vec.h.

Constructor & Destructor Documentation

Vec::Vec ( double  a0,
double  a1,
double  a2 
)

Definition at line 14 of file Vec.cpp.

15  : a0_( a0 ), a1_( a1 ), a2_( a2 )
16 {;}
double a0() const
Definition: Vec.h:34
double a0_
Definition: Vec.h:60
double a2() const
Definition: Vec.h:40
double a2_
Definition: Vec.h:62
double a1_
Definition: Vec.h:61
double a1() const
Definition: Vec.h:37
Vec::Vec ( )
inline

Definition at line 16 of file Vec.h.

Referenced by crossProduct(), operator*(), operator+(), operator-(), orthogonalAxes(), and pointOnLine().

17  : a0_( 0.0 ), a1_( 0.0 ), a2_( 0.0 )
18  {;}
double a0_
Definition: Vec.h:60
double a2_
Definition: Vec.h:62
double a1_
Definition: Vec.h:61

+ Here is the caller graph for this function:

Member Function Documentation

double Vec::a0 ( ) const
inline

Definition at line 34 of file Vec.h.

References a0_.

Referenced by addSpine(), coordSystem(), fillPointsOnCircle(), fillPointsOnDisc(), NeuroMesh::indexToSpace(), makeCompt(), CylBase::matchCubeMeshEntries(), CylMesh::matchCubeMeshEntries(), and reorientSpine().

34  {
35  return a0_;
36  }
double a0_
Definition: Vec.h:60

+ Here is the caller graph for this function:

double Vec::a1 ( ) const
inline

Definition at line 37 of file Vec.h.

References a1_.

Referenced by coordSystem(), fillPointsOnCircle(), fillPointsOnDisc(), NeuroMesh::indexToSpace(), makeCompt(), CylBase::matchCubeMeshEntries(), CylMesh::matchCubeMeshEntries(), and reorientSpine().

37  {
38  return a1_;
39  }
double a1_
Definition: Vec.h:61

+ Here is the caller graph for this function:

double Vec::a2 ( ) const
inline

Definition at line 40 of file Vec.h.

References a2_.

Referenced by coordSystem(), fillPointsOnCircle(), fillPointsOnDisc(), NeuroMesh::indexToSpace(), makeCompt(), CylBase::matchCubeMeshEntries(), CylMesh::matchCubeMeshEntries(), and reorientSpine().

40  {
41  return a2_;
42  }
double a2_
Definition: Vec.h:62

+ Here is the caller graph for this function:

Vec Vec::crossProduct ( const Vec other) const

Definition at line 26 of file Vec.cpp.

References a0_, a1_, a2_, and Vec().

Referenced by coordSystem(), orthogonalAxes(), and testVec().

26  {
27  double c0 = a1_ * other.a2_ - a2_ * other.a1_;
28  double c1 = a2_ * other.a0_ - a0_ * other.a2_;
29  double c2 = a0_ * other.a1_ - a1_ * other.a0_;
30  return Vec( c0, c1, c2 );
31 }
double a0_
Definition: Vec.h:60
double a2_
Definition: Vec.h:62
double a1_
Definition: Vec.h:61
Vec()
Definition: Vec.h:16

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double Vec::distance ( const Vec other) const

Definition at line 81 of file Vec.cpp.

Referenced by SwcSegment::distance(), CylBase::nearest(), PsdMesh::nearest(), SpineMesh::nearest(), and SwcSegment::setGeometricalDistanceFromSoma().

82 {
83  return ( *this - other ).length();
84 }

+ Here is the caller graph for this function:

double Vec::dotProduct ( const Vec other) const

Definition at line 22 of file Vec.cpp.

References a0_, a1_, and a2_.

Referenced by testVec().

22  {
23  return a0_ * other.a0_ + a1_ * other.a1_ + a2_ * other.a2_;
24 }
double a0_
Definition: Vec.h:60
double a2_
Definition: Vec.h:62
double a1_
Definition: Vec.h:61

+ Here is the caller graph for this function:

double Vec::length ( ) const

Definition at line 18 of file Vec.cpp.

References a0_, a1_, and a2_.

Referenced by coordSystem(), orthogonalAxes(), and unitLength().

18  {
19  return sqrt( a0_*a0_ + a1_*a1_ + a2_*a2_ );
20 }
double a0_
Definition: Vec.h:60
double a2_
Definition: Vec.h:62
double a1_
Definition: Vec.h:61

+ Here is the caller graph for this function:

Vec Vec::operator* ( const double &  other) const

Definition at line 76 of file Vec.cpp.

References a0_, a1_, a2_, and Vec().

76  {
77  return Vec( a0_ * other, a1_ * other, a2_ * other );
78 }
double a0_
Definition: Vec.h:60
double a2_
Definition: Vec.h:62
double a1_
Definition: Vec.h:61
Vec()
Definition: Vec.h:16

+ Here is the call graph for this function:

Vec Vec::operator+ ( const Vec other) const

Definition at line 72 of file Vec.cpp.

References a0_, a1_, a2_, and Vec().

72  {
73  return Vec( a0_ + other.a0_, a1_ + other.a1_, a2_ + other.a2_ );
74 }
double a0_
Definition: Vec.h:60
double a2_
Definition: Vec.h:62
double a1_
Definition: Vec.h:61
Vec()
Definition: Vec.h:16

+ Here is the call graph for this function:

Vec Vec::operator- ( const Vec other) const

Definition at line 68 of file Vec.cpp.

References a0_, a1_, a2_, and Vec().

68  {
69  return Vec( a0_ - other.a0_, a1_ - other.a1_, a2_ - other.a2_ );
70 }
double a0_
Definition: Vec.h:60
double a2_
Definition: Vec.h:62
double a1_
Definition: Vec.h:61
Vec()
Definition: Vec.h:16

+ Here is the call graph for this function:

bool Vec::operator== ( const Vec other) const

Definition at line 61 of file Vec.cpp.

References a0_, a1_, a2_, and doubleEq().

61  {
62  return
63  doubleEq( a0_, other.a0_) &&
64  doubleEq( a1_, other.a1_) &&
65  doubleEq( a2_, other.a2_);
66 }
double a0_
Definition: Vec.h:60
double a2_
Definition: Vec.h:62
double a1_
Definition: Vec.h:61
bool doubleEq(double x, double y)
Definition: doubleEq.cpp:16

+ Here is the call graph for this function:

void Vec::orthogonalAxes ( Vec u,
Vec v 
) const

Generates vectors u and v to form a mutually orthogonal system.

Definition at line 41 of file Vec.cpp.

References a0_, a1_, a2_, crossProduct(), doubleApprox(), doubleEq(), length(), unitLength(), and Vec().

Referenced by CylBase::matchCubeMeshEntries(), CylMesh::matchCubeMeshEntries(), and testVec().

41  {
42  assert( !doubleEq( length(), 0 ) );
43  if ( doubleApprox( a1_, 0 ) && doubleApprox( a2_, 0 ) ) {
44  u = crossProduct( Vec( a0_, a1_, a2_ - a0_ ) );
45  } else {
46  u = crossProduct( Vec( a0_ + a1_ + a2_, a1_, a2_ ) );
47  }
48  v = crossProduct( u );
49  u.unitLength();
50  v.unitLength();
51 }
double a0_
Definition: Vec.h:60
double a2_
Definition: Vec.h:62
Vec crossProduct(const Vec &other) const
Definition: Vec.cpp:26
double a1_
Definition: Vec.h:61
bool doubleApprox(double x, double y)
Definition: doubleEq.cpp:24
bool doubleEq(double x, double y)
Definition: doubleEq.cpp:16
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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Vec Vec::pointOnLine ( const Vec end,
double  k 
)

Returns a point on the line from self to 'end', a fraction k from the 'self'. r = self + k.(end - self)

Definition at line 53 of file Vec.cpp.

References a0_, a1_, a2_, and Vec().

Referenced by NeuroMesh::indexToSpace(), and CylBase::nearest().

54 {
55  return Vec(
56  a0_ + k * ( end.a0_ - a0_ ),
57  a1_ + k * ( end.a1_ - a1_ ),
58  a2_ + k * ( end.a2_ - a2_ ) );
59 }
double a0_
Definition: Vec.h:60
double a2_
Definition: Vec.h:62
double a1_
Definition: Vec.h:61
Vec()
Definition: Vec.h:16

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Vec::unitLength ( )

Rescales vector so it has unit length.

Definition at line 33 of file Vec.cpp.

References a0_, a1_, a2_, and length().

Referenced by orthogonalAxes().

33  {
34  double len = length();
35  assert( len > 0.0 );
36  a0_ /= len;
37  a1_ /= len;
38  a2_ /= len;
39 }
double a0_
Definition: Vec.h:60
double a2_
Definition: Vec.h:62
double a1_
Definition: Vec.h:61
double length() const
Definition: Vec.cpp:18

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

double Vec::a0_
private
double Vec::a1_
private
double Vec::a2_
private

The documentation for this class was generated from the following files: