EMAN2
Public Member Functions | Private Attributes
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< float > () 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.

                {
                        data[0] = 0;
                        data[1] = 0;
                        data[2] = 0;
                        ndim = 0;
                }
EMAN::FloatPoint::FloatPoint ( float  xx) [inline, explicit]

Construct a 1D point.

Parameters:
xxThe x coordinate value.

Definition at line 298 of file geometry.h.

References data, and ndim.

                {
                        data[0] = xx;
                        data[1] = 0;
                        data[2] = 0;
                        ndim = 1;
                }
EMAN::FloatPoint::FloatPoint ( float  xx,
float  yy 
) [inline]

Construct a 2D point.

Parameters:
xxThe x coordinate value.
yyThe y coordinate value.

Definition at line 310 of file geometry.h.

References data, and ndim.

                {
                        data[0] = xx;
                        data[1] = yy;
                        data[2] = 0;
                        ndim = 2;
                }
EMAN::FloatPoint::FloatPoint ( float  xx,
float  yy,
float  zz 
) [inline]

Construct a 3D point.

Parameters:
xxThe x coordinate value.
yyThe y coordinate value.
zzThe z coordinate value.

Definition at line 323 of file geometry.h.

References data, and ndim.

                {
                        data[0] = xx;
                        data[1] = yy;
                        data[2] = zz;
                        ndim = 3;
                }
EMAN::FloatPoint::FloatPoint ( int  xx) [inline, explicit]

Construct a 1D point.

Parameters:
xxThe x coordinate value.

Definition at line 334 of file geometry.h.

References data, and ndim.

                {
                        data[0] = (float)xx;
                        data[1] = 0;
                        data[2] = 0;
                        ndim = 1;
                }
EMAN::FloatPoint::FloatPoint ( int  xx,
int  yy 
) [inline]

Construct a 2D point.

Parameters:
xxThe x coordinate value.
yyThe y coordinate value.

Definition at line 346 of file geometry.h.

References data, and ndim.

                {
                        data[0] = (float)xx;
                        data[1] = (float)yy;
                        data[2] = 0;
                        ndim = 2;
                }
EMAN::FloatPoint::FloatPoint ( int  xx,
int  yy,
int  zz 
) [inline]

Construct a 3D point.

Parameters:
xxThe x coordinate value.
yyThe y coordinate value.
zzThe z coordinate value.

Definition at line 359 of file geometry.h.

References data, and ndim.

                {
                        data[0] = (float)xx;
                        data[1] = (float)yy;
                        data[2] = (float)zz;
                        ndim = 3;
                }
EMAN::FloatPoint::FloatPoint ( double  xx) [inline, explicit]

Construct a 1D point.

Parameters:
xxThe x coordinate value.

Definition at line 370 of file geometry.h.

References data, and ndim.

                {
                        data[0] = (float)xx;
                        data[1] = 0;
                        data[2] = 0;
                        ndim = 1;
                }
EMAN::FloatPoint::FloatPoint ( double  xx,
double  yy 
) [inline]

Construct a 2D point.

Parameters:
xxThe x coordinate value.
yyThe y coordinate value.

Definition at line 382 of file geometry.h.

References data, and ndim.

                {
                        data[0] = (float)xx;
                        data[1] = (float)yy;
                        data[2] = 0;
                        ndim = 2;
                }
EMAN::FloatPoint::FloatPoint ( double  xx,
double  yy,
double  zz 
) [inline]

Construct a 3D point.

Parameters:
xxThe x coordinate value.
yyThe y coordinate value.
zzThe z coordinate value.

Definition at line 395 of file geometry.h.

References data, and ndim.

                {
                        data[0] = (float)xx;
                        data[1] = (float)yy;
                        data[2] = (float)zz;
                        ndim = 3;
                }
EMAN::FloatPoint::FloatPoint ( const FloatPoint fp) [inline]

Definition at line 403 of file geometry.h.

References data, and ndim.

                {
                        data[0] = fp.data[0];
                        data[1] = fp.data[1];
                        data[2] = fp.data[2];
                        ndim = fp.ndim;
                }

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().

                {
                        return ndim;
                }
EMAN::FloatPoint::operator IntPoint ( ) const [inline]

Definition at line 442 of file geometry.h.

References data.

{ return IntPoint((int)data[0],(int)data[1],(int)data[2]); }
EMAN::FloatPoint::operator vector< float > ( ) const [inline]

Definition at line 437 of file geometry.h.

References data, and t.

                                                      {
                        vector<float> t(data,data+3);
                        return t;
                }
FloatPoint& EMAN::FloatPoint::operator= ( const vector< float > &  v) [inline]

Definition at line 444 of file geometry.h.

References copy(), and data.

                                                                     {
                        copy(v.begin(),v.end(),data);
                        return *this;
                }
float EMAN::FloatPoint::operator[] ( int  i) const [inline]

Get the ith direction's coordinate.

Used as a rvalue.

Parameters:
iThe 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.

                {
                        return data[i];
                }
float& EMAN::FloatPoint::operator[] ( int  i) [inline]

Get the ith direction's coordinate.

Used as a lvalue.

Parameters:
iThe 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.

                {
                        return data[i];
                }

Member Data Documentation

float EMAN::FloatPoint::data[3] [private]
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: