Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

vecmath.h File Reference

#include <iostream>
#include <cmath>
#include <cstring>
#include "emassert.h"

Include dependency graph for vecmath.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Namespaces

namespace  EMAN

Classes

class  EMAN::ScreenVector
class  EMAN::ScreenPoint
class  EMAN::Vector3
class  EMAN::Point3
class  EMAN::Matrix3
class  EMAN::Vector4
class  EMAN::Matrix4

Functions

bool isZero (double in_d, double in_dEps=1e-16)
ScreenVector operator * (const double s, const ScreenVector &v)
std::ostream & operator<< (std::ostream &os, const ScreenVector &v)
std::ostream & operator<< (std::ostream &os, const ScreenPoint &p)
Vector3 operator * (const double s, const Vector3 &v)
double dot (const Vector3 &w, const Vector3 &v)
Vector3 cross (const Vector3 &w, const Vector3 &v)
double length (const Vector3 &v)
Vector3 unit (const Vector3 &v)
std::ostream & operator<< (std::ostream &os, const Vector3 &v)
Point3 lerp (const Point3 &p0, const Point3 &p1, double dT)
std::ostream & operator<< (std::ostream &os, const Point3 &p)
Vector3 operator * (const Vector3 &v, const Matrix3 &m)
Point3 operator * (const Point3 &p, const Matrix3 &m)
std::ostream & operator<< (std::ostream &os, const Matrix3 &m)
Vector4 operator * (const double s, const Vector4 &v)
double length (const Vector4 &v)
Vector4 unit (const Vector4 &v)
std::ostream & operator<< (std::ostream &os, const Vector4 &v)
std::ostream & operator<< (std::ostream &os, const Matrix4 &m)


Function Documentation

Vector3 cross const Vector3 &  w,
const Vector3 &  v
[inline]
 

Definition at line 313 of file vecmath.h.

00313                                                                    {
00314             return w ^ v;
00315         }

double dot const Vector3 &  w,
const Vector3 &  v
[inline]
 

Definition at line 309 of file vecmath.h.

00309                                                                 {
00310             return w * v;
00311         }

bool isZero double  in_d,
double  in_dEps = 1e-16
[inline]
 

Definition at line 48 of file vecmath.h.

Referenced by EMAN::Matrix4::approxEqual(), EMAN::Vector4::approxEqual(), EMAN::Matrix3::approxEqual(), EMAN::Point3::approxEqual(), EMAN::Vector3::approxEqual(), EMAN::Matrix4::inverse(), EMAN::Matrix3::inverse(), and EMAN::Matrix4::operator *().

00049         { 
00050             return (in_d < in_dEps && in_d > -in_dEps)? true : false; 
00051         }

double length const Vector4 &  v  )  [inline]
 

Definition at line 688 of file vecmath.h.

References EMAN::Vector4::length(), and v.

Referenced by EMAN::Vector4::normalize(), EMAN::Vec2< Type >::normalize(), EMAN::Vec3< int >::normalize(), and EMAN::Vec4< Type >::normalize().

00688 { return v.length(); }

double length const Vector3 &  v  )  [inline]
 

Definition at line 317 of file vecmath.h.

References EMAN::Vector3::length(), and v.

Referenced by EMAN::TestImageFourierNoiseProfile::process_inplace(), EMAN::CTFSNRWeightProcessor::process_inplace(), and EMAN::TestImageFourierNoiseGaussian::process_inplace().

00317 { return v.length(); }

Point3 lerp const Point3 &  p0,
const Point3 &  p1,
double  dT
[inline]
 

Definition at line 406 of file vecmath.h.

00407         {
00408             const double dTMinus = 1.0 - dT;
00409             return Point3( dTMinus * p0[0] + dT * p1[0], dTMinus * p0[1] + dT * p1[1], dTMinus * p0[2] + dT * p1[2] ); 
00410         }

Vector4 operator * const double  s,
const Vector4 &  v
[inline]
 

Definition at line 684 of file vecmath.h.

References v.

00684                                                                      {
00685             return Vector4( v[0] * s, v[1] * s, v[2] * s, v[3] * s );
00686         }

Point3 operator * const Point3 &  p,
const Matrix3 &  m
[inline]
 

Definition at line 578 of file vecmath.h.

00578                                                                    {
00579             return Point3(m(0,0) * p[0] + m(1,0) * p[1] + m(2,0) * p[2],
00580                           m(0,1) * p[0] + m(1,1) * p[1] + m(2,1) * p[2],
00581                           m(0,2) * p[0] + m(1,2) * p[1] + m(2,2) * p[2]);
00582         }

Vector3 operator * const Vector3 &  v,
const Matrix3 &  m
[inline]
 

Definition at line 571 of file vecmath.h.

References v.

00571                                                                      {
00572             return Vector3(m(0,0) * v[0] + m(1,0) * v[1] + m(2,0) * v[2],
00573                            m(0,1) * v[0] + m(1,1) * v[1] + m(2,1) * v[2],
00574                            m(0,2) * v[0] + m(1,2) * v[1] + m(2,2) * v[2]);
00575         }

Vector3 operator * const double  s,
const Vector3 &  v
[inline]
 

Definition at line 305 of file vecmath.h.

References v.

00305                                                                      {
00306             return Vector3( v[0] * s, v[1] * s, v[2] * s );
00307         }

ScreenVector operator * const double  s,
const ScreenVector &  v
[inline]
 

Definition at line 133 of file vecmath.h.

References v.

00133                                                                                {
00134             return ScreenVector( (int)(v[0] * s), (int)(v[1] * s) );
00135         }

std::ostream& operator<< std::ostream &  os,
const Matrix4 &  m
[inline]
 

Definition at line 952 of file vecmath.h.

References EMAN::Matrix4::row().

00952                                                                         {
00953             os << m.row(0) << std::endl;
00954             os << m.row(1) << std::endl;
00955             os << m.row(2) << std::endl;
00956             os << m.row(3) << std::endl;
00957             return os;
00958         }

std::ostream& operator<< std::ostream &  os,
const Vector4 &  v
[inline]
 

Definition at line 690 of file vecmath.h.

References v.

00690                                                                         {
00691             os << "(" << v[0] << ", " << v[1] << ", " << v[2] << ", " << v[3] << ")";
00692             return os;
00693         }

std::ostream& operator<< std::ostream &  os,
const Matrix3 &  m
[inline]
 

Definition at line 584 of file vecmath.h.

References EMAN::Matrix3::row().

00584                                                                         {
00585             os << m.row(0) << std::endl;
00586             os << m.row(1) << std::endl;
00587             os << m.row(2) << std::endl;
00588             return os;
00589         }

std::ostream& operator<< std::ostream &  os,
const Point3 &  p
[inline]
 

Definition at line 412 of file vecmath.h.

00412                                                                        {
00413             os << "(" << p[0] << ", " << p[1] << ", " << p[2] << ")";
00414             return os;
00415         }

std::ostream& operator<< std::ostream &  os,
const Vector3 &  v
[inline]
 

Definition at line 320 of file vecmath.h.

References v.

00320                                                                         {
00321             os << "(" << v[0] << ", " << v[1] << ", " << v[2] << ")";
00322             return os;
00323         }

std::ostream& operator<< std::ostream &  os,
const ScreenPoint &  p
[inline]
 

Definition at line 200 of file vecmath.h.

00200                                                                             {
00201             os << "(" << p[0] << ", " << p[1] << ")";
00202             return os;
00203         }

std::ostream& operator<< std::ostream &  os,
const ScreenVector &  v
[inline]
 

Definition at line 137 of file vecmath.h.

References v.

00137                                                                              {
00138             os << "(" << v[0] << ", " << v[1] << ")";
00139             return os;
00140         }

Vector4 unit const Vector4 &  v  )  [inline]
 

Definition at line 689 of file vecmath.h.

References EMAN::Vector4::length(), and v.

00689 { const double len = v.length(); return v / len; }

Vector3 unit const Vector3 &  v  )  [inline]
 

Definition at line 318 of file vecmath.h.

References EMAN::Vector3::length(), and v.

00318 { const double len = v.length(); return v / len; }


Generated on Tue Jun 11 13:41:41 2013 for EMAN2 by  doxygen 1.3.9.1