cgma
CubitVector.hpp File Reference
#include "CubitDefines.h"
#include "CubitVectorStruct.h"
#include "CGMUtilConfigure.h"

Go to the source code of this file.

Classes

class  CubitVector

Typedefs

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

Functions

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

Typedef Documentation

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

Definition at line 20 of file CubitVector.hpp.


Function Documentation

CubitVector interpolate ( const double  param,
const CubitVector v1,
const CubitVector v2 
) [inline]

Definition at line 634 of file CubitVector.hpp.

{
  CubitVector temp = (1.0 - param) * v1;
  temp += param * v2;
  return temp;
}
int operator!= ( const CubitVector v1,
const CubitVector v2 
) [inline]

Definition at line 595 of file CubitVector.hpp.

{
  return (v1.xVal != v2.xVal || v1.yVal != v2.yVal || v1.zVal != v2.zVal);
}
double operator% ( const CubitVector vector1,
const CubitVector vector2 
) [inline]

Definition at line 624 of file CubitVector.hpp.

{
  return( vector1.xVal * vector2.xVal +
          vector1.yVal * vector2.yVal +
          vector1.zVal * vector2.zVal );
}
CubitVector operator* ( const CubitVector vector1,
const CubitVector vector2 
) [inline]

Definition at line 563 of file CubitVector.hpp.

{
  return CubitVector(vector1) *= vector2;
}
CubitVector operator* ( const CubitVector vector1,
const double  scalar 
) [inline]

Definition at line 570 of file CubitVector.hpp.

{
  return CubitVector(vector1) *= scalar;
}
CubitVector operator* ( const double  scalar,
const CubitVector vector1 
) [inline]

Definition at line 577 of file CubitVector.hpp.

{
  return CubitVector(vector1) *= scalar;
}
CubitVector operator+ ( const CubitVector vector1,
const CubitVector vector2 
) [inline]

Definition at line 541 of file CubitVector.hpp.

{
  double xv = vector1.xVal + vector2.xVal;
  double yv = vector1.yVal + vector2.yVal;
  double zv = vector1.zVal + vector2.zVal;
  return CubitVector(xv,yv,zv);
//  return CubitVector(vector1) += vector2;
}
CubitVector operator- ( const CubitVector vector1,
const CubitVector vector2 
) [inline]

Definition at line 551 of file CubitVector.hpp.

{
  double xv = vector1.xVal - vector2.xVal;
  double yv = vector1.yVal - vector2.yVal;
  double zv = vector1.zVal - vector2.zVal;
  return CubitVector(xv,yv,zv);
//  return CubitVector(vector1) -= vector2;
}
CubitVector operator/ ( const CubitVector vector1,
const double  scalar 
) [inline]

Definition at line 584 of file CubitVector.hpp.

{
  return CubitVector(vector1) /= scalar;
}
int operator== ( const CubitVector v1,
const CubitVector v2 
) [inline]

Definition at line 590 of file CubitVector.hpp.

{
  return (v1.xVal == v2.xVal && v1.yVal == v2.yVal && v1.zVal == v2.zVal);
}
CubitVector operator~ ( const CubitVector vec) [inline]

Definition at line 511 of file CubitVector.hpp.

{
  double mag = sqrt(vec.xVal*vec.xVal +
                    vec.yVal*vec.yVal +
                    vec.zVal*vec.zVal);
  
  CubitVector temp = vec;
  if (mag != 0.0)
  {
    temp /= mag;
  }
  return temp;
}
CUBIT_UTIL_EXPORT CubitVector vectorRotate ( const double  angle,
const CubitVector normalAxis,
const CubitVector referenceAxis 
)

Definition at line 265 of file CubitVector.cpp.

{
    // A new coordinate system is created with the xy plane corresponding
    // to the plane normal to the normal axis, and the x axis corresponding to
    // the projection of the reference axis onto the normal plane.  The normal
    // plane is the tangent plane at the root point.  A unit vector is
    // constructed along the local x axis and then rotated by the given
    // ccw angle to form the new point.  The new point, then is a unit
    // distance from the global origin in the tangent plane.
  
  double x, y;
  
    // project a unit distance from root along reference axis
  
  CubitVector yAxis = normalAxis * referenceAxis;
  CubitVector xAxis = yAxis * normalAxis;
  yAxis.normalize();
  xAxis.normalize();
  
  x = cos(angle);
  y = sin(angle);
  
  xAxis *= x;
  yAxis *= y;
  return CubitVector(xAxis + yAxis);
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines