CPoint class, three dimensional point.
More...
#include <Point.h>
List of all members.
Detailed Description
CPoint class, three dimensional point.
Three dimensional point or vector
, 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
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] |
Member Function Documentation
double MeshLib::CPoint::norm |
( |
|
) |
const [inline] |
norm of the CPoint
Definition at line 64 of file Point.h.
{ return sqrt( fabs( v[0] * v[0] + v[1] * v[1] + v[2] * v[2] ) ); };
double MeshLib::CPoint::operator() |
( |
int |
i |
) |
const [inline] |
constant (x,y,z) value
- Parameters:
-
- 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:
-
- 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:
-
- 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:
-
- 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:
-
- 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:
-
- 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:
-
- 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& MeshLib::CPoint::operator-= |
( |
const CPoint & |
p |
) |
[inline] |
Substract another point to the current point
- Parameters:
-
- 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:
-
- 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:
-
- 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
value
- Parameters:
-
- 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
value
- Parameters:
-
- 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:
-
- Returns:
- cross product of the current point with p2.
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
The documentation for this class was generated from the following file: