moab
moab::CartVect Class Reference

Cartesian Vector. More...

#include <CartVect.hpp>

Inheritance diagram for moab::CartVect:
moab::BSPTreePoly::Vertex

List of all members.

Public Member Functions

 CartVect ()
 CartVect (double v)
 CartVect (double i, double j, double k)
 CartVect (const double a[3])
CartVectoperator= (const double v[3])
double & operator[] (unsigned i)
double operator[] (unsigned i) const
CartVectoperator+= (const CartVect &v)
CartVectoperator-= (const CartVect &v)
CartVectoperator*= (const CartVect &v)
CartVectoperator+= (double s)
CartVectoperator-= (double s)
CartVectoperator*= (double s)
CartVectoperator/= (double s)
bool operator== (const CartVect &v) const
double length () const
 vector length
double length_squared () const
void normalize ()
 make unit length
void flip ()
 flip direction
void scale (const CartVect &v)
double * array ()
const double * array () const
void get (double v[3]) const

Private Attributes

double d [3]

Detailed Description

Cartesian Vector.

Examples:
DeformMeshRemap.cpp, and LloydRelaxation.cpp.

Definition at line 13 of file CartVect.hpp.


Constructor & Destructor Documentation

Definition at line 20 of file CartVect.hpp.

      { }
moab::CartVect::CartVect ( double  v) [inline, explicit]

Initialze all three values to same scalar (typically zero)

Definition at line 23 of file CartVect.hpp.

      { d[0] = d[1] = d[2] = v; }
moab::CartVect::CartVect ( double  i,
double  j,
double  k 
) [inline]

Definition at line 25 of file CartVect.hpp.

      { d[0] = i; d[1] = j; d[2] = k; }
moab::CartVect::CartVect ( const double  a[3]) [inline, explicit]

Initialze from array

Definition at line 28 of file CartVect.hpp.

      { d[0] = a[0]; d[1] = a[1]; d[2] = a[2]; }

Member Function Documentation

double* moab::CartVect::array ( ) [inline]

Definition at line 69 of file CartVect.hpp.

      { return d; }
const double* moab::CartVect::array ( ) const [inline]

Definition at line 71 of file CartVect.hpp.

      { return d; }
void CartVect::flip ( ) [inline]

flip direction

Definition at line 109 of file CartVect.hpp.

  { d[0] = -d[0]; d[1] = -d[1]; d[2] = -d[2]; }
void moab::CartVect::get ( double  v[3]) const [inline]

initialize array from this

Definition at line 75 of file CartVect.hpp.

      { v[0] = d[0]; v[1] = d[1]; v[2] = d[2]; }
double CartVect::length ( ) const [inline]

vector length

Definition at line 100 of file CartVect.hpp.

  { return std::sqrt( *this % *this ); }
double CartVect::length_squared ( ) const [inline]
Examples:
DeformMeshRemap.cpp.

Definition at line 103 of file CartVect.hpp.

  { return d[0]*d[0] + d[1]*d[1] + d[2]*d[2]; }
void CartVect::normalize ( ) [inline]

make unit length

Definition at line 106 of file CartVect.hpp.

  { *this /= length(); }
CartVect & CartVect::operator*= ( const CartVect v) [inline]

Assign cross product to this

Definition at line 97 of file CartVect.hpp.

  { return *this = *this * v; }
CartVect& moab::CartVect::operator*= ( double  s) [inline]

Definition at line 49 of file CartVect.hpp.

      { d[0] *= s; d[1] *= s; d[2] *= s; return *this; }
CartVect& moab::CartVect::operator+= ( const CartVect v) [inline]

Definition at line 38 of file CartVect.hpp.

      { d[0] += v.d[0]; d[1] += v.d[1]; d[2] += v.d[2]; return *this; }
CartVect& moab::CartVect::operator+= ( double  s) [inline]

Definition at line 45 of file CartVect.hpp.

      { d[0] += s; d[1] += s; d[2] += s; return *this; }
CartVect& moab::CartVect::operator-= ( const CartVect v) [inline]

Definition at line 40 of file CartVect.hpp.

      { d[0] -= v.d[0]; d[1] -= v.d[1]; d[2] -= v.d[2]; return *this; }
CartVect& moab::CartVect::operator-= ( double  s) [inline]

Definition at line 47 of file CartVect.hpp.

      { d[0] -= s; d[1] -= s; d[2] -= s; return *this; }
CartVect& moab::CartVect::operator/= ( double  s) [inline]

Definition at line 51 of file CartVect.hpp.

      { d[0] /= s; d[1] /= s; d[2] /= s; return *this; }
CartVect& moab::CartVect::operator= ( const double  v[3]) [inline]

Definition at line 30 of file CartVect.hpp.

      { d[0]= v[0]; d[1] = v[1]; d[2] = v[2]; return *this; }
bool moab::CartVect::operator== ( const CartVect v) const [inline]

Definition at line 53 of file CartVect.hpp.

      { return d[0] == v[0] && d[1] == v[1] && d[2] == v[2]; }
double& moab::CartVect::operator[] ( unsigned  i) [inline]

Definition at line 33 of file CartVect.hpp.

      { return d[i]; }
double moab::CartVect::operator[] ( unsigned  i) const [inline]

Definition at line 35 of file CartVect.hpp.

      { return d[i]; }
void moab::CartVect::scale ( const CartVect v) [inline]

per-element scalar multiply (this[0] *= v[0], this[1] *= v[1], ...)

Definition at line 65 of file CartVect.hpp.

      { d[0] *= v.d[0]; d[1] *= v.d[1]; d[2] *= v.d[2]; }

Member Data Documentation

double moab::CartVect::d[3] [private]

Definition at line 16 of file CartVect.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines