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

IntPoint defines an integer-coordinate point in a 1D/2D/3D space. More...

#include <geometry.h>

Public Member Functions

 IntPoint ()
 Construct a point at the origin location. More...
 
 IntPoint (int xx)
 Construct a 1D point. More...
 
 IntPoint (int xx, int yy)
 Construct a 2D point. More...
 
 IntPoint (int xx, int yy, int zz)
 Construct a 3D point. More...
 
int get_ndim () const
 Get the dimension of the point, 1D/2D/3D. More...
 
int operator[] (int i) const
 Get the ith direction's coordinate. More...
 
int & operator[] (int i)
 Get the ith direction's coordinate. More...
 

Private Attributes

int data [3]
 
int ndim
 

Detailed Description

IntPoint defines an integer-coordinate point in a 1D/2D/3D space.

Definition at line 192 of file geometry.h.

Constructor & Destructor Documentation

◆ IntPoint() [1/4]

EMAN::IntPoint::IntPoint ( )
inline

Construct a point at the origin location.

Definition at line 196 of file geometry.h.

197 {
198 data[0] = 0;
199 data[1] = 0;
200 data[2] = 0;
201 ndim = 0;
202 }
int data[3]
Definition: geometry.h:267

References data, and ndim.

◆ IntPoint() [2/4]

EMAN::IntPoint::IntPoint ( int  xx)
inlineexplicit

Construct a 1D point.

Parameters
xxThe x coordinate value.

Definition at line 207 of file geometry.h.

208 {
209 data[0] = xx;
210 data[1] = 0;
211 data[2] = 0;
212 ndim = 1;
213 }

References data, and ndim.

◆ IntPoint() [3/4]

EMAN::IntPoint::IntPoint ( int  xx,
int  yy 
)
inline

Construct a 2D point.

Parameters
xxThe x coordinate value.
yyThe y coordinate value.

Definition at line 219 of file geometry.h.

220 {
221 data[0] = xx;
222 data[1] = yy;
223 data[2] = 0;
224 ndim = 2;
225 }

References data, and ndim.

◆ IntPoint() [4/4]

EMAN::IntPoint::IntPoint ( 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 232 of file geometry.h.

233 {
234 data[0] = xx;
235 data[1] = yy;
236 data[2] = zz;
237 ndim = 3;
238 }

References data, and ndim.

Member Function Documentation

◆ get_ndim()

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

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

Returns
The dimension of the point.

Definition at line 243 of file geometry.h.

244 {
245 return ndim;
246 }

References ndim.

◆ operator[]() [1/2]

int & EMAN::IntPoint::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 261 of file geometry.h.

262 {
263 return data[i];
264 }

References data.

◆ operator[]() [2/2]

int EMAN::IntPoint::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 252 of file geometry.h.

253 {
254 return data[i];
255 }

References data.

Member Data Documentation

◆ data

int EMAN::IntPoint::data[3]
private

Definition at line 267 of file geometry.h.

Referenced by IntPoint(), and operator[]().

◆ ndim

int EMAN::IntPoint::ndim
private

Definition at line 268 of file geometry.h.

Referenced by get_ndim(), and IntPoint().


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