Public Member Functions | Protected Attributes

MeshLib::CPoint Class Reference

CPoint class, three dimensional point. More...

#include <Point.h>

Collaboration diagram for MeshLib::CPoint:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CPoint (double x, double y, double z)
 CPoint ()
 ~CPoint ()
double & operator[] (int i)
double operator() (int i) const
double operator[] (int i) const
double norm () const
CPointoperator+= (const CPoint &p)
CPointoperator-= (const CPoint &p)
CPointoperator*= (const double s)
CPointoperator/= (const double s)
double operator* (const CPoint &p) const
CPoint operator+ (const CPoint &p) const
CPoint operator- (const CPoint &p) const
CPoint operator* (const double s) const
CPoint operator/ (const double s) const
CPoint operator^ (const CPoint &p2) const
CPoint operator- () const

Protected Attributes

double v [3]

Detailed Description

CPoint class, three dimensional point.

Three dimensional point or vector $(x,y,z)$, inner product, cross product, scale multiplication etc.

Definition at line 25 of file Point.h.


Constructor & Destructor Documentation

MeshLib::CPoint::CPoint ( double  x,
double  y,
double  z 
) [inline]

CPoint constructor, specifying $(x,y,z)$

Definition at line 31 of file Point.h.

{ v[0] = x; v[1] = y; v[2] = z;};

MeshLib::CPoint::CPoint (  )  [inline]

CPoint default constructor, initialized as (0,0,0)

Definition at line 35 of file Point.h.

{ v[0] = v[1] = v[2] = 0; };

MeshLib::CPoint::~CPoint (  )  [inline]

CPoint destructor

Definition at line 39 of file Point.h.

{};


Member Function Documentation

double MeshLib::CPoint::norm (  )  const [inline]

norm of the CPoint $\sqrt{x^2+y^2+z^2}$

Definition at line 64 of file Point.h.

{ return sqrt( fabs( v[0] * v[0] + v[1] * v[1] + v[2] * v[2] ) ); };

Here is the caller graph for this function:

double MeshLib::CPoint::operator() ( int  i  )  const [inline]

constant (x,y,z) value

Parameters:
i index
Returns:
CPoint[i]

Definition at line 52 of file Point.h.

{ assert( 0<=i && i<3 ); return v[i]; };

double MeshLib::CPoint::operator* ( const CPoint p  )  const [inline]

dot product

Parameters:
p another point
Returns:
dot product of current point with p.

Definition at line 98 of file Point.h.

        {
                return v[0] * p[0] + v[1] * p[1] + v[2] * p[2]; 
        };

CPoint MeshLib::CPoint::operator* ( const double  s  )  const [inline]

Multiply by a scalar

Parameters:
s scalar
Returns:
current point is multipolied by s.

Definition at line 128 of file Point.h.

        {
                CPoint r( v[0] * s, v[1] * s, v[2] * s );
                return r;
        };

CPoint& MeshLib::CPoint::operator*= ( const double  s  )  [inline]

Multiply by a scalar

Parameters:
s scalar
Returns:
current point is multipolied by s.

Definition at line 84 of file Point.h.

{ v[0] *= s   ; v[1] *=    s; v[2] *=    s; return *this; };

CPoint MeshLib::CPoint::operator+ ( const CPoint p  )  const [inline]

Add another point to the current point

Parameters:
p 
Returns:
cuccrent point is added by p.

Definition at line 108 of file Point.h.

        {
                CPoint r( v[0] + p[0], v[1] + p[1], v[2] + p[2] );
                return r;
        };

CPoint& MeshLib::CPoint::operator+= ( const CPoint p  )  [inline]

Add another point to the current point

Parameters:
p 
Returns:
cuccrent point is added by p.

Definition at line 71 of file Point.h.

{ v[0] += p(0); v[1] += p(1); v[2] += p(2); return *this; }; 

CPoint MeshLib::CPoint::operator- ( const CPoint p  )  const [inline]

Substract another point to the current point

Parameters:
p 
Returns:
cuccrent point is substracted by p.

Definition at line 118 of file Point.h.

        {
                CPoint r( v[0] - p[0], v[1] - p[1], v[2] - p[2] );
                return r;
        };

CPoint MeshLib::CPoint::operator- (  )  const [inline]

negate the point

Returns:
the negative of the current point

Definition at line 170 of file Point.h.

        {
                CPoint p(-v[0],-v[1],-v[2]);
                return p;
        };

CPoint& MeshLib::CPoint::operator-= ( const CPoint p  )  [inline]

Substract another point to the current point

Parameters:
p 
Returns:
cuccrent point is substracted by p.

Definition at line 77 of file Point.h.

{ v[0] -= p(0); v[1] -= p(1); v[2] -= p(2); return *this; };

CPoint MeshLib::CPoint::operator/ ( const double  s  )  const [inline]

Divide by a scalar

Parameters:
s scalar
Returns:
current point is divided by s.

Definition at line 138 of file Point.h.

        {
                CPoint r( v[0] / s, v[1] / s, v[2] / s );
                return r;
        };

CPoint& MeshLib::CPoint::operator/= ( const double  s  )  [inline]

Divide by a scalar

Parameters:
s scalar
Returns:
current point is divided by s.

Definition at line 90 of file Point.h.

{ v[0] /= s   ; v[1] /=    s; v[2] /=    s; return *this; };

double MeshLib::CPoint::operator[] ( int  i  )  const [inline]

constant $(x,y,z)$ value

Parameters:
i index
Returns:
CPoint[i]

Definition at line 59 of file Point.h.

{ assert( 0<=i && i<3 ); return v[i]; };

double& MeshLib::CPoint::operator[] ( int  i  )  [inline]

reference to $(x,y,z)$ value

Parameters:
i index
Returns:
CPoint[i]

Definition at line 46 of file Point.h.

{ assert( 0<=i && i<3 ); return v[i]; };

CPoint MeshLib::CPoint::operator^ ( const CPoint p2  )  const [inline]

Cross product

Parameters:
p2 another point
Returns:
cross product of the current point with p2.

\[ \left| \begin{array}{ccc} x_1& y_1 & z_1\\ x_2 &y_2 & z_2\\ \mathbf{e}_1 & \mathbf{e}_2 & \mathbf{e}_3\\ \end{array} \right| \]

Definition at line 158 of file Point.h.

        {
                CPoint r( v[1] * p2[2] - v[2] * p2[1],
                              v[2] * p2[0] - v[0] * p2[2],
                           v[0] * p2[1] - v[1] * p2[0]);
                return r;
        };


Member Data Documentation

double MeshLib::CPoint::v[3] [protected]

$(x,y,z)$ value

Definition at line 174 of file Point.h.


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