Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

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 () 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:
xx The x direction size. Default is 0.
yy The y direction size. Default is 0.
zz The z direction size. Default is 0.

Definition at line 117 of file geometry.h.

References data.

00118                 {
00119                         data[0] = xx;
00120                         data[1] = yy;
00121                         data[2] = zz;
00122                 }

EMAN::FloatSize::FloatSize int  xx,
int  yy = 0,
int  zz = 0
[inline]
 

Construct a FloatSize object.

Parameters:
xx The x direction size. Default is 0.
yy The y direction size. Default is 0.
zz The z direction size. Default is 0.

Definition at line 129 of file geometry.h.

References data.

00130                 {
00131                         data[0] = (float)xx;
00132                         data[1] = (float)yy;
00133                         data[2] = (float)zz;
00134                 }

EMAN::FloatSize::FloatSize double  xx,
double  yy = 0,
double  zz = 0
[inline]
 

Construct a FloatSize object.

Parameters:
xx The x direction size. Default is 0.
yy The y direction size. Default is 0.
zz The z direction size. Default is 0.

Definition at line 141 of file geometry.h.

References data.

00142                 {
00143                         data[0] = (float)xx;
00144                         data[1] = (float)yy;
00145                         data[2] = (float)zz;
00146                 }


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(), and EMAN::Region::get_ndim().

00152                 {
00153                         if (data[2] > 1) {
00154                                 return 3;
00155                         }
00156                         else if (data[1] > 1) {
00157                                 return 2;
00158                         }
00159                         else if (data[0] > 1) {
00160                                 return 1;
00161                         }
00162                         else {
00163                                 return 0;
00164                         }
00165                 }

EMAN::FloatSize::operator vector  )  const [inline]
 

Definition at line 185 of file geometry.h.

References data, and t.

00185                                                       {
00186                         vector<float> t(data,data+3);
00187                         return t;
00188                 }

float& EMAN::FloatSize::operator[] int  i  )  [inline]
 

Get the ith direction's size.

Used as a lvalue.

Parameters:
i The 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.

00181                 {
00182                         return data[i];
00183                 }

float EMAN::FloatSize::operator[] int  i  )  const [inline]
 

Get the ith direction's size.

Used as a rvalue.

Parameters:
i The 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.

00172                 {
00173                         return data[i];
00174                 }


Member Data Documentation

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

Definition at line 191 of file geometry.h.


The documentation for this class was generated from the following file:
Generated on Tue Jun 11 13:42:04 2013 for EMAN2 by  doxygen 1.3.9.1