EMAN2
Public Member Functions | Private Attributes | List of all members
EMAN::FloatSize Class Reference

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

#include <geometry.h>

Public Member Functions

 FloatSize (float xx=0, float yy=0, float zz=0)
 Construct a FloatSize object. More...
 
 FloatSize (int xx, int yy=0, int zz=0)
 Construct a FloatSize object. More...
 
 FloatSize (double xx, double yy=0, double zz=0)
 Construct a FloatSize object. More...
 
int get_ndim () const
 Get its dimension, 1D, 2D, or 3D. More...
 
float operator[] (int i) const
 Get the ith direction's size. More...
 
float & operator[] (int i)
 Get the ith direction's size. More...
 
 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 104 of file geometry.h.

Constructor & Destructor Documentation

◆ FloatSize() [1/3]

EMAN::FloatSize::FloatSize ( float  xx = 0,
float  yy = 0,
float  zz = 0 
)
inlineexplicit

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 113 of file geometry.h.

114 {
115 data[0] = xx;
116 data[1] = yy;
117 data[2] = zz;
118 }
float data[3]
Definition: geometry.h:187

References data.

◆ FloatSize() [2/3]

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 125 of file geometry.h.

126 {
127 data[0] = (float)xx;
128 data[1] = (float)yy;
129 data[2] = (float)zz;
130 }

References data.

◆ FloatSize() [3/3]

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 137 of file geometry.h.

138 {
139 data[0] = (float)xx;
140 data[1] = (float)yy;
141 data[2] = (float)zz;
142 }

References data.

Member Function Documentation

◆ get_ndim()

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

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

Returns
The dimension.

Definition at line 147 of file geometry.h.

148 {
149 if (data[2] > 1) {
150 return 3;
151 }
152 else if (data[1] > 1) {
153 return 2;
154 }
155 else if (data[0] > 1) {
156 return 1;
157 }
158 else {
159 return 0;
160 }
161 }

References data.

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

◆ operator vector< float >()

EMAN::FloatSize::operator vector< float > ( ) const
inline

Definition at line 181 of file geometry.h.

181 {
182 vector<float> t(data,data+3);
183 return t;
184 }

References data.

◆ operator[]() [1/2]

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 176 of file geometry.h.

177 {
178 return data[i];
179 }

References data.

◆ operator[]() [2/2]

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 167 of file geometry.h.

168 {
169 return data[i];
170 }

References data.

Member Data Documentation

◆ data

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

Definition at line 187 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: