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

FloatPoint defines a float-coordinate point in a 1D/2D/3D space. More...

#include <geometry.h>

Public Member Functions

 FloatPoint ()
 Construct a point at the origin location. More...
 
 FloatPoint (float xx)
 Construct a 1D point. More...
 
 FloatPoint (float xx, float yy)
 Construct a 2D point. More...
 
 FloatPoint (float xx, float yy, float zz)
 Construct a 3D point. More...
 
 FloatPoint (int xx)
 Construct a 1D point. More...
 
 FloatPoint (int xx, int yy)
 Construct a 2D point. More...
 
 FloatPoint (int xx, int yy, int zz)
 Construct a 3D point. More...
 
 FloatPoint (double xx)
 Construct a 1D point. More...
 
 FloatPoint (double xx, double yy)
 Construct a 2D point. More...
 
 FloatPoint (double xx, double yy, double zz)
 Construct a 3D point. More...
 
 FloatPoint (const FloatPoint &fp)
 
int get_ndim () const
 Get the dimension of the point, 1D/2D/3D. More...
 
float operator[] (int i) const
 Get the ith direction's coordinate. More...
 
float & operator[] (int i)
 Get the ith direction's coordinate. More...
 
 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 278 of file geometry.h.

Constructor & Destructor Documentation

◆ FloatPoint() [1/11]

EMAN::FloatPoint::FloatPoint ( )
inline

Construct a point at the origin location.

Definition at line 283 of file geometry.h.

284 {
285 data[0] = 0;
286 data[1] = 0;
287 data[2] = 0;
288 ndim = 0;
289 }
float data[3]
Definition: geometry.h:446

References data, and ndim.

◆ FloatPoint() [2/11]

EMAN::FloatPoint::FloatPoint ( float  xx)
inlineexplicit

Construct a 1D point.

Parameters
xxThe x coordinate value.

Definition at line 294 of file geometry.h.

295 {
296 data[0] = xx;
297 data[1] = 0;
298 data[2] = 0;
299 ndim = 1;
300 }

References data, and ndim.

◆ FloatPoint() [3/11]

EMAN::FloatPoint::FloatPoint ( float  xx,
float  yy 
)
inline

Construct a 2D point.

Parameters
xxThe x coordinate value.
yyThe y coordinate value.

Definition at line 306 of file geometry.h.

307 {
308 data[0] = xx;
309 data[1] = yy;
310 data[2] = 0;
311 ndim = 2;
312 }

References data, and ndim.

◆ FloatPoint() [4/11]

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

320 {
321 data[0] = xx;
322 data[1] = yy;
323 data[2] = zz;
324 ndim = 3;
325 }

References data, and ndim.

◆ FloatPoint() [5/11]

EMAN::FloatPoint::FloatPoint ( int  xx)
inlineexplicit

Construct a 1D point.

Parameters
xxThe x coordinate value.

Definition at line 330 of file geometry.h.

331 {
332 data[0] = (float)xx;
333 data[1] = 0;
334 data[2] = 0;
335 ndim = 1;
336 }

References data, and ndim.

◆ FloatPoint() [6/11]

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

Construct a 2D point.

Parameters
xxThe x coordinate value.
yyThe y coordinate value.

Definition at line 342 of file geometry.h.

343 {
344 data[0] = (float)xx;
345 data[1] = (float)yy;
346 data[2] = 0;
347 ndim = 2;
348 }

References data, and ndim.

◆ FloatPoint() [7/11]

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

356 {
357 data[0] = (float)xx;
358 data[1] = (float)yy;
359 data[2] = (float)zz;
360 ndim = 3;
361 }

References data, and ndim.

◆ FloatPoint() [8/11]

EMAN::FloatPoint::FloatPoint ( double  xx)
inlineexplicit

Construct a 1D point.

Parameters
xxThe x coordinate value.

Definition at line 366 of file geometry.h.

367 {
368 data[0] = (float)xx;
369 data[1] = 0;
370 data[2] = 0;
371 ndim = 1;
372 }

References data, and ndim.

◆ FloatPoint() [9/11]

EMAN::FloatPoint::FloatPoint ( double  xx,
double  yy 
)
inline

Construct a 2D point.

Parameters
xxThe x coordinate value.
yyThe y coordinate value.

Definition at line 378 of file geometry.h.

379 {
380 data[0] = (float)xx;
381 data[1] = (float)yy;
382 data[2] = 0;
383 ndim = 2;
384 }

References data, and ndim.

◆ FloatPoint() [10/11]

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

392 {
393 data[0] = (float)xx;
394 data[1] = (float)yy;
395 data[2] = (float)zz;
396 ndim = 3;
397 }

References data, and ndim.

◆ FloatPoint() [11/11]

EMAN::FloatPoint::FloatPoint ( const FloatPoint fp)
inline

Definition at line 399 of file geometry.h.

400 {
401 data[0] = fp.data[0];
402 data[1] = fp.data[1];
403 data[2] = fp.data[2];
404 ndim = fp.ndim;
405 }

References data, and ndim.

Member Function Documentation

◆ get_ndim()

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

411 {
412 return ndim;
413 }

References ndim.

Referenced by EMAN::Region::get_ndim(), EMAN::Region::get_string(), and EMAN::Region::inside_region().

◆ operator IntPoint()

EMAN::FloatPoint::operator IntPoint ( ) const
inline

Definition at line 438 of file geometry.h.

438{ return IntPoint((int)data[0],(int)data[1],(int)data[2]); }

References data.

◆ operator vector< float >()

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

Definition at line 433 of file geometry.h.

433 {
434 vector<float> t(data,data+3);
435 return t;
436 }

References data.

◆ operator=()

FloatPoint & EMAN::FloatPoint::operator= ( const vector< float > &  v)
inline

Definition at line 440 of file geometry.h.

440 {
441 copy(v.begin(),v.end(),data);
442 return *this;
443 }
EMData * copy() const
This file is a part of "emdata.h", to use functions in this file, you should "#include "emdata....

References copy(), and data.

◆ operator[]() [1/2]

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

429 {
430 return data[i];
431 }

References data.

◆ operator[]() [2/2]

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

420 {
421 return data[i];
422 }

References data.

Member Data Documentation

◆ data

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

◆ ndim

int EMAN::FloatPoint::ndim
private

Definition at line 447 of file geometry.h.

Referenced by FloatPoint(), and get_ndim().


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