EMAN2
Public Member Functions | Private Attributes
EMAN::FloatSize Class Reference

FloatSize is used to describe a 1D, 2D or 3D rectangular size in floating numbers. More...

#include <geometry.h>

List of all members.

Public Member Functions

 FloatSize (float xx=0, float yy=0, float zz=0)
 Construct a FloatSize object.
 FloatSize (int xx, int yy=0, int zz=0)
 Construct a FloatSize object.
 FloatSize (double xx, double yy=0, double zz=0)
 Construct a FloatSize object.
int get_ndim () const
 Get its dimension, 1D, 2D, or 3D.
float operator[] (int i) const
 Get the ith direction's size.
float & operator[] (int i)
 Get the ith direction's size.
 operator vector< float > () const

Private Attributes

float data [3]

Detailed Description

FloatSize is used to describe a 1D, 2D or 3D rectangular size in floating numbers.

Definition at line 108 of file geometry.h.


Constructor & Destructor Documentation

EMAN::FloatSize::FloatSize ( float  xx = 0,
float  yy = 0,
float  zz = 0 
) [inline, explicit]

Construct a FloatSize object.

Parameters:
xxThe x direction size. Default is 0.
yyThe y direction size. Default is 0.
zzThe z direction size. Default is 0.

Definition at line 117 of file geometry.h.

References data.

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

Construct a FloatSize object.

Parameters:
xxThe x direction size. Default is 0.
yyThe y direction size. Default is 0.
zzThe z direction size. Default is 0.

Definition at line 129 of file geometry.h.

References data.

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

Construct a FloatSize object.

Parameters:
xxThe x direction size. Default is 0.
yyThe y direction size. Default is 0.
zzThe z direction size. Default is 0.

Definition at line 141 of file geometry.h.

References data.

                {
                        data[0] = (float)xx;
                        data[1] = (float)yy;
                        data[2] = (float)zz;
                }

Member Function Documentation

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

Get its dimension, 1D, 2D, or 3D.

Returns:
The dimension.

Definition at line 151 of file geometry.h.

References data.

Referenced by EMAN::ImageIO::check_region().

                {
                        if (data[2] > 1) {
                                return 3;
                        }
                        else if (data[1] > 1) {
                                return 2;
                        }
                        else if (data[0] > 1) {
                                return 1;
                        }
                        else {
                                return 0;
                        }
                }
EMAN::FloatSize::operator vector< float > ( ) const [inline]

Definition at line 185 of file geometry.h.

References data, and t.

                                                      {
                        vector<float> t(data,data+3);
                        return t;
                }
float& EMAN::FloatSize::operator[] ( int  i) [inline]

Get the ith direction's size.

Used as a lvalue.

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

Definition at line 180 of file geometry.h.

References data.

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

Get the ith direction's size.

Used as a rvalue.

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

Definition at line 171 of file geometry.h.

References data.

                {
                        return data[i];
                }

Member Data Documentation

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

Definition at line 191 of file geometry.h.

Referenced by FloatSize(), get_ndim(), operator vector< float >(), and operator[]().


The documentation for this class was generated from the following file: