EMAN::FloatPoint Class Reference

FloatPoint defines a float-coordinate point in a 1D/2D/3D space. More...

#include <geometry.h>

List of all members.

Public Member Functions

 FloatPoint ()
 Construct a point at the origin location.
 FloatPoint (float xx)
 Construct a 1D point.
 FloatPoint (float xx, float yy)
 Construct a 2D point.
 FloatPoint (float xx, float yy, float zz)
 Construct a 3D point.
 FloatPoint (int xx)
 Construct a 1D point.
 FloatPoint (int xx, int yy)
 Construct a 2D point.
 FloatPoint (int xx, int yy, int zz)
 Construct a 3D point.
 FloatPoint (double xx)
 Construct a 1D point.
 FloatPoint (double xx, double yy)
 Construct a 2D point.
 FloatPoint (double xx, double yy, double zz)
 Construct a 3D point.
 FloatPoint (const FloatPoint &fp)
int get_ndim () const
 Get the dimension of the point, 1D/2D/3D.
float operator[] (int i) const
 Get the ith direction's coordinate.
float & operator[] (int i)
 Get the ith direction's coordinate.
 operator vector () const
 operator IntPoint () const
FloatPointoperator= (const vector< float > &v)

Private Attributes

float data [3]
int ndim


Detailed Description

FloatPoint defines a float-coordinate point in a 1D/2D/3D space.

Definition at line 282 of file geometry.h.


Constructor & Destructor Documentation

EMAN::FloatPoint::FloatPoint (  )  [inline]

Construct a point at the origin location.

Definition at line 287 of file geometry.h.

References data, and ndim.

00288                 {
00289                         data[0] = 0;
00290                         data[1] = 0;
00291                         data[2] = 0;
00292                         ndim = 0;
00293                 }

EMAN::FloatPoint::FloatPoint ( float  xx  )  [inline, explicit]

Construct a 1D point.

Parameters:
xx The x coordinate value.

Definition at line 298 of file geometry.h.

References data, and ndim.

00299                 {
00300                         data[0] = xx;
00301                         data[1] = 0;
00302                         data[2] = 0;
00303                         ndim = 1;
00304                 }

EMAN::FloatPoint::FloatPoint ( float  xx,
float  yy 
) [inline]

Construct a 2D point.

Parameters:
xx The x coordinate value.
yy The y coordinate value.

Definition at line 310 of file geometry.h.

References data, and ndim.

00311                 {
00312                         data[0] = xx;
00313                         data[1] = yy;
00314                         data[2] = 0;
00315                         ndim = 2;
00316                 }

EMAN::FloatPoint::FloatPoint ( float  xx,
float  yy,
float  zz 
) [inline]

Construct a 3D point.

Parameters:
xx The x coordinate value.
yy The y coordinate value.
zz The z coordinate value.

Definition at line 323 of file geometry.h.

References data, and ndim.

00324                 {
00325                         data[0] = xx;
00326                         data[1] = yy;
00327                         data[2] = zz;
00328                         ndim = 3;
00329                 }

EMAN::FloatPoint::FloatPoint ( int  xx  )  [inline, explicit]

Construct a 1D point.

Parameters:
xx The x coordinate value.

Definition at line 334 of file geometry.h.

References data, and ndim.

00335                 {
00336                         data[0] = (float)xx;
00337                         data[1] = 0;
00338                         data[2] = 0;
00339                         ndim = 1;
00340                 }

EMAN::FloatPoint::FloatPoint ( int  xx,
int  yy 
) [inline]

Construct a 2D point.

Parameters:
xx The x coordinate value.
yy The y coordinate value.

Definition at line 346 of file geometry.h.

References data, and ndim.

00347                 {
00348                         data[0] = (float)xx;
00349                         data[1] = (float)yy;
00350                         data[2] = 0;
00351                         ndim = 2;
00352                 }

EMAN::FloatPoint::FloatPoint ( int  xx,
int  yy,
int  zz 
) [inline]

Construct a 3D point.

Parameters:
xx The x coordinate value.
yy The y coordinate value.
zz The z coordinate value.

Definition at line 359 of file geometry.h.

References data, and ndim.

00360                 {
00361                         data[0] = (float)xx;
00362                         data[1] = (float)yy;
00363                         data[2] = (float)zz;
00364                         ndim = 3;
00365                 }

EMAN::FloatPoint::FloatPoint ( double  xx  )  [inline, explicit]

Construct a 1D point.

Parameters:
xx The x coordinate value.

Definition at line 370 of file geometry.h.

References data, and ndim.

00371                 {
00372                         data[0] = (float)xx;
00373                         data[1] = 0;
00374                         data[2] = 0;
00375                         ndim = 1;
00376                 }

EMAN::FloatPoint::FloatPoint ( double  xx,
double  yy 
) [inline]

Construct a 2D point.

Parameters:
xx The x coordinate value.
yy The y coordinate value.

Definition at line 382 of file geometry.h.

References data, and ndim.

00383                 {
00384                         data[0] = (float)xx;
00385                         data[1] = (float)yy;
00386                         data[2] = 0;
00387                         ndim = 2;
00388                 }

EMAN::FloatPoint::FloatPoint ( double  xx,
double  yy,
double  zz 
) [inline]

Construct a 3D point.

Parameters:
xx The x coordinate value.
yy The y coordinate value.
zz The z coordinate value.

Definition at line 395 of file geometry.h.

References data, and ndim.

00396                 {
00397                         data[0] = (float)xx;
00398                         data[1] = (float)yy;
00399                         data[2] = (float)zz;
00400                         ndim = 3;
00401                 }

EMAN::FloatPoint::FloatPoint ( const FloatPoint fp  )  [inline]

Definition at line 403 of file geometry.h.

References data, and ndim.

00404                 {
00405                         data[0] = fp.data[0];
00406                         data[1] = fp.data[1];
00407                         data[2] = fp.data[2];
00408                         ndim = fp.ndim;
00409                 }


Member Function Documentation

int EMAN::FloatPoint::get_ndim (  )  const [inline]

Get the dimension of the point, 1D/2D/3D.

Returns:
The dimension of the point.

Definition at line 414 of file geometry.h.

References ndim.

Referenced by EMAN::Region::get_ndim(), EMAN::Region::get_string(), and EMAN::Region::inside_region().

00415                 {
00416                         return ndim;
00417                 }

EMAN::FloatPoint::operator IntPoint (  )  const [inline]

Definition at line 442 of file geometry.h.

References data.

00442 { return IntPoint((int)data[0],(int)data[1],(int)data[2]); }

EMAN::FloatPoint::operator vector (  )  const [inline]

Definition at line 437 of file geometry.h.

References data, and t.

00437                                                       {
00438                         vector<float> t(data,data+3);
00439                         return t;
00440                 }

FloatPoint& EMAN::FloatPoint::operator= ( const vector< float > &  v  )  [inline]

Definition at line 444 of file geometry.h.

References copy(), and data.

00444                                                                      {
00445                         copy(v.begin(),v.end(),data);
00446                         return *this;
00447                 }

float& EMAN::FloatPoint::operator[] ( int  i  )  [inline]

Get the ith direction's coordinate.

Used as a lvalue.

Parameters:
i The ith direction, with 0 is x, 1 is y, 2 is z.
Returns:
The ith direction's coordinate.

Definition at line 432 of file geometry.h.

References data.

00433                 {
00434                         return data[i];
00435                 }

float EMAN::FloatPoint::operator[] ( int  i  )  const [inline]

Get the ith direction's coordinate.

Used as a rvalue.

Parameters:
i The ith direction, with 0 is x, 1 is y, 2 is z.
Returns:
The ith direction's coordinate.

Definition at line 423 of file geometry.h.

References data.

00424                 {
00425                         return data[i];
00426                 }


Member Data Documentation

float EMAN::FloatPoint::data[3] [private]

Definition at line 450 of file geometry.h.

Referenced by FloatPoint(), operator IntPoint(), operator vector(), operator=(), and operator[]().

int EMAN::FloatPoint::ndim [private]

Definition at line 451 of file geometry.h.

Referenced by FloatPoint(), and get_ndim().


The documentation for this class was generated from the following file:
Generated on Tue Jun 11 12:43:13 2013 for EMAN2 by  doxygen 1.4.7