Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
VerdictVector.hpp File Reference
#include "moab/verdict.h"
#include <cassert>
#include <cmath>
+ Include dependency graph for VerdictVector.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  VerdictVector
 

Typedefs

typedef void(VerdictVector::* transform_function) (double gamma, double gamma2)
 

Functions

VerdictVector vectorRotate (const double angle, const VerdictVector &normalAxis, const VerdictVector &referenceAxis)
 
VerdictVector operator~ (const VerdictVector &vec)
 
VerdictVector operator+ (const VerdictVector &vector1, const VerdictVector &vector2)
 
VerdictVector operator- (const VerdictVector &vector1, const VerdictVector &vector2)
 
VerdictVector operator* (const VerdictVector &vector1, const VerdictVector &vector2)
 
VerdictVector operator* (const VerdictVector &vector1, const double scalar)
 
VerdictVector operator* (const double scalar, const VerdictVector &vector1)
 
VerdictVector operator/ (const VerdictVector &vector1, const double scalar)
 
int operator== (const VerdictVector &v1, const VerdictVector &v2)
 
int operator!= (const VerdictVector &v1, const VerdictVector &v2)
 
double operator% (const VerdictVector &vector1, const VerdictVector &vector2)
 

Typedef Documentation

◆ transform_function

typedef void( VerdictVector::* transform_function) (double gamma, double gamma2)

Definition at line 31 of file VerdictVector.hpp.

Function Documentation

◆ operator!=()

int operator!= ( const VerdictVector v1,
const VerdictVector v2 
)
inline

Definition at line 467 of file VerdictVector.hpp.

468 {
469  return ( v1.xVal != v2.xVal || v1.yVal != v2.yVal || v1.zVal != v2.zVal );
470 }

◆ operator%()

double operator% ( const VerdictVector vector1,
const VerdictVector vector2 
)
inline

Definition at line 495 of file VerdictVector.hpp.

496 {
497  return ( vector1.x() * vector2.x() + vector1.y() * vector2.y() + vector1.z() * vector2.z() );
498 }

◆ operator*() [1/3]

VerdictVector operator* ( const double  scalar,
const VerdictVector vector1 
)
inline

Definition at line 451 of file VerdictVector.hpp.

452 {
453  return VerdictVector( vector1 ) *= scalar;
454 }

◆ operator*() [2/3]

VerdictVector operator* ( const VerdictVector vector1,
const double  scalar 
)
inline

Definition at line 445 of file VerdictVector.hpp.

446 {
447  return VerdictVector( vector1 ) *= scalar;
448 }

◆ operator*() [3/3]

VerdictVector operator* ( const VerdictVector vector1,
const VerdictVector vector2 
)
inline

Definition at line 439 of file VerdictVector.hpp.

440 {
441  return VerdictVector( vector1 ) *= vector2;
442 }

◆ operator+()

VerdictVector operator+ ( const VerdictVector vector1,
const VerdictVector vector2 
)
inline

Definition at line 419 of file VerdictVector.hpp.

420 {
421  double xv = vector1.x() + vector2.x();
422  double yv = vector1.y() + vector2.y();
423  double zv = vector1.z() + vector2.z();
424  return VerdictVector( xv, yv, zv );
425  // return VerdictVector(vector1) += vector2;
426 }

◆ operator-()

VerdictVector operator- ( const VerdictVector vector1,
const VerdictVector vector2 
)
inline

Definition at line 428 of file VerdictVector.hpp.

429 {
430  double xv = vector1.x() - vector2.x();
431  double yv = vector1.y() - vector2.y();
432  double zv = vector1.z() - vector2.z();
433  return VerdictVector( xv, yv, zv );
434  // return VerdictVector(vector1) -= vector2;
435 }

◆ operator/()

VerdictVector operator/ ( const VerdictVector vector1,
const double  scalar 
)
inline

Definition at line 457 of file VerdictVector.hpp.

458 {
459  return VerdictVector( vector1 ) /= scalar;
460 }

◆ operator==()

int operator== ( const VerdictVector v1,
const VerdictVector v2 
)
inline

Definition at line 462 of file VerdictVector.hpp.

463 {
464  return ( v1.xVal == v2.xVal && v1.yVal == v2.yVal && v1.zVal == v2.zVal );
465 }

◆ operator~()

VerdictVector operator~ ( const VerdictVector vec)
inline

Definition at line 401 of file VerdictVector.hpp.

402 {
403  double mag = sqrt( vec.xVal * vec.xVal + vec.yVal * vec.yVal + vec.zVal * vec.zVal );
404 
405  VerdictVector temp = vec;
406  if( mag != 0.0 )
407  {
408  temp /= mag;
409  }
410  return temp;
411 }

◆ vectorRotate()

VerdictVector vectorRotate ( const double  angle,
const VerdictVector normalAxis,
const VerdictVector referenceAxis 
)

Definition at line 225 of file VerdictVector.cpp.

226 {
227  // A new coordinate system is created with the xy plane corresponding
228  // to the plane normal to the normal axis, and the x axis corresponding to
229  // the projection of the reference axis onto the normal plane. The normal
230  // plane is the tangent plane at the root point. A unit vector is
231  // constructed along the local x axis and then rotated by the given
232  // ccw angle to form the new point. The new point, then is a unit
233  // distance from the global origin in the tangent plane.
234 
235  double x, y;
236 
237  // project a unit distance from root along reference axis
238 
239  VerdictVector yAxis = normalAxis * referenceAxis;
240  VerdictVector xAxis = yAxis * normalAxis;
241  yAxis.normalize();
242  xAxis.normalize();
243 
244  x = cos( angle );
245  y = sin( angle );
246 
247  xAxis *= x;
248  yAxis *= y;
249  return VerdictVector( xAxis + yAxis );
250 }

References moab::angle(), and VerdictVector::normalize().