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

An encapsulation of dihedral 3D symmetry. More...

#include <symmetry.h>

Inheritance diagram for EMAN::DSym:
Inheritance graph
[legend]
Collaboration diagram for EMAN::DSym:
Collaboration graph
[legend]

Public Member Functions

 DSym ()
 
virtual ~DSym ()
 
virtual string get_name () const
 Return DSym::NAME. More...
 
virtual string get_desc () const
 Get a description. More...
 
virtual TypeDict get_param_types () const
 Get a dictionary containing the permissable parameters of this class. More...
 
virtual Dict get_delimiters (const bool inc_mirror=false) const
 Get the altitude and phi angle of the d symmetry, which depends on nysm. More...
 
virtual Transform get_sym (const int n) const
 Provides access to the complete set of rotational symmetry operations associated with this symmetry. More...
 
virtual int get_nsym () const
 Gets the total number of unique roational symmetry operations associated with this symmetry For D symmetry, this is simply 2*nsym. More...
 
virtual int get_max_csym () const
 Gets the maximum symmetry of this object. More...
 
virtual vector< Vec3fget_asym_unit_points (bool inc_mirror=false) const
 
virtual bool is_in_asym_unit (const float &altitude, const float &azimuth, const bool inc_mirror) const
 A function to be used when generating orientations over portion of the unit sphere defined by parameters returned by get_delimiters. More...
 
virtual bool is_d_sym () const
 Returns true - this is indeed a c symmetry object. More...
 
virtual vector< vector< Vec3f > > get_asym_unit_triangles (bool inc_mirror) const
 Get triangles that precisely occlude the projection area of the default asymmetric unit. More...
 
- Public Member Functions inherited from EMAN::Symmetry3D
 Symmetry3D ()
 
virtual ~Symmetry3D ()
 
virtual float get_az_alignment_offset () const
 This functionality is only relevant to platonic symmetries. More...
 
virtual bool is_platonic_sym () const
 A function that is used to determine if this is a platonic symmetry object This function is only virtually overidden by the PlatonicSym symmetry, which returns true, not false. More...
 
virtual bool is_h_sym () const
 A function that is used to determine if this is a Helical symmetry object This function is only virtually overidden by the HSym symmetry, which returns true, not false. More...
 
virtual bool is_c_sym () const
 A function that is used to determine if this is a c symmetry object This function is only virtually overidden by the CSym object, which returns true. More...
 
virtual bool is_tet_sym () const
 A function that is used to determine if this is the tetrahedral symmetry object This function is only virtually overidden by the TetSym object, which returns true. More...
 
vector< Transformgen_orientations (const string &generatorname="eman", const Dict &parms=Dict())
 Ask the Symmetry3D object to generate a set of orientations in its asymmetric unit using an OrientationGenerator constructed from the given parameters (using a Factory). More...
 
virtual Transform reduce (const Transform &t3d, int n=0) const
 A function that will reduce an orientation, as characterized by Euler anges, into a specific asymmetric unit. More...
 
virtual int in_which_asym_unit (const Transform &t3d) const
 A function that will determine in which asymmetric unit a given orientation resides The asymmetric unit 'number' will depend entirely on the order in which different symmetry operations are return by the Symmetry3D::get_sym function. More...
 
virtual int point_in_which_asym_unit (const Vec3f &v) const
 A function that will determine in which asymmetric unit a given vector resides The asymmetric unit 'number' will depend entirely on the order in which different symmetry operations are return by the Symmetry3D::get_sym function The vector is a point. More...
 
virtual vector< Transformget_touching_au_transforms (bool inc_mirror=true) const
 Gets a vector of Transform objects that define the set of asymmetric units that touch the default asymmetric unit. More...
 
virtual vector< Transformget_syms () const
 
- Public Member Functions inherited from EMAN::FactoryBase
 FactoryBase ()
 
virtual ~FactoryBase ()
 
Dict get_params () const
 get a copy of the parameters of this class More...
 
void set_params (const Dict &new_params)
 Set new parameters. More...
 
void set_param (const string key, const EMObject val)
 
void insert_params (const Dict &new_params)
 Insert parameters. More...
 
Dict copy_relevant_params (const FactoryBase *const that) const
 

Static Public Member Functions

static Symmetry3DNEW ()
 Factory support function NEW. More...
 
- Static Public Member Functions inherited from EMAN::Symmetry3D
static vector< Transformget_symmetries (const string &symmetry)
 

Static Public Attributes

static const string NAME = "d"
 The name of this class - used to access it from factories etc. Should be "d". More...
 

Private Member Functions

 DSym (const DSym &)
 Disallow copy construction. More...
 
DSymoperator= (const DSym &)
 Disallow assignment. More...
 

Additional Inherited Members

- Public Types inherited from EMAN::Symmetry3D
typedef vector< vector< Vec3f > >::const_iterator cit
 
typedef vector< vector< Vec3f > >::iterator ncit
 
- Protected Member Functions inherited from EMAN::Symmetry3D
void cache_au_planes () const
 Establish the asymmetric unit planes cache. More...
 
void delete_au_planes ()
 Clear the asymmetric unit planes cache. More...
 
- Protected Attributes inherited from EMAN::Symmetry3D
float ** cached_au_planes
 The asymmetric unit planes are cached to provide a great speed up the point_in_which_asym_unit function, which is called by reduce and by in_which_asym_unit. More...
 
int cache_size
 Have to remember the cache size. More...
 
int num_triangles
 This is stores the number of triangles returned by get_asym_unit_triangles(true) More...
 
vector< vector< Vec3f > > au_sym_triangles
 This cache is of size cache_size. More...
 
- Protected Attributes inherited from EMAN::FactoryBase
Dict params
 This is the dictionary the stores the parameters of the object. More...
 

Detailed Description

An encapsulation of dihedral 3D symmetry.

Author
David Woolford (based on previous work by Phil Baldwin and Steve Ludtke)
Date
Feb 2008

Definition at line 340 of file symmetry.h.

Constructor & Destructor Documentation

◆ DSym() [1/2]

EMAN::DSym::DSym ( )
inline

Definition at line 343 of file symmetry.h.

343{};

Referenced by NEW().

◆ ~DSym()

virtual EMAN::DSym::~DSym ( )
inlinevirtual

Definition at line 344 of file symmetry.h.

344{};

◆ DSym() [2/2]

EMAN::DSym::DSym ( const DSym )
private

Disallow copy construction.

Member Function Documentation

◆ get_asym_unit_points()

vector< Vec3f > DSym::get_asym_unit_points ( bool  inc_mirror = false) const
virtual
Parameters
inc_mirrorwhether or not to include the mirror portion of the asymmetric unit
Returns
a cyclic set of points which can be connected using great arcs on the unit sphere to demarcate the asymmetric unit. The last should may be connected to the first.

Implements EMAN::Symmetry3D.

Definition at line 1527 of file symmetry.cpp.

1528{
1529 Dict delim = get_delimiters(inc_mirror);
1530
1531 vector<Vec3f> ret;
1532 int nsym = params.set_default("nsym",0);
1533 if ( nsym == 1 ) {
1534 if (inc_mirror == false ) {
1535 ret.push_back(Vec3f(0,0,1));
1536 ret.push_back(Vec3f(0,-1,0));
1537 ret.push_back(Vec3f(1,0,0));
1538 ret.push_back(Vec3f(0,1,0));
1539 }
1540 else {
1541 ret.push_back(Vec3f(0,-1,0));
1542 ret.push_back(Vec3f(1,0,0));
1543 ret.push_back(Vec3f(0,1,0));
1544 ret.push_back(Vec3f(-1,0,0));
1545 }
1546 }
1547 else if ( nsym == 2 && inc_mirror ) {
1548 ret.push_back(Vec3f(0,0,1));
1549 ret.push_back(Vec3f(0,-1,0));
1550 ret.push_back(Vec3f(1,0,0));
1551 ret.push_back(Vec3f(0,1,0));
1552 }
1553 else {
1554 float angle = (float)(EMConsts::deg2rad*float(delim["az_max"]));
1555 ret.push_back(Vec3f(0,0,1));
1556 ret.push_back(Vec3f(0,-1,0));
1557 float y = -cos(angle);
1558 float x = sin(angle);
1559 ret.push_back(Vec3f(x,y,0));
1560 }
1561
1562 return ret;
1563
1564}
virtual Dict get_delimiters(const bool inc_mirror=false) const
Get the altitude and phi angle of the d symmetry, which depends on nysm.
Definition: symmetry.cpp:1420
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
type set_default(const string &key, type val)
Default setting behavior This can be achieved using a template - d.woolford Jan 2008 (before there wa...
Definition: emobject.h:569
static const double deg2rad
Definition: emobject.h:78
Dict params
This is the dictionary the stores the parameters of the object.
Definition: emobject.h:953
Vec3< float > Vec3f
Definition: vec3.h:693
#define y(i, j)
Definition: projector.cpp:1516
#define x(i)
Definition: projector.cpp:1517

References EMAN::EMConsts::deg2rad, get_delimiters(), EMAN::FactoryBase::params, EMAN::Dict::set_default(), x, and y.

Referenced by get_asym_unit_triangles().

◆ get_asym_unit_triangles()

vector< vector< Vec3f > > DSym::get_asym_unit_triangles ( bool  inc_mirror) const
virtual

Get triangles that precisely occlude the projection area of the default asymmetric unit.

This is used for collision detection in Symmetry3D::reduce

Parameters
inc_mirrorwhether to include the mirror portion of the asymmetric unit

Implements EMAN::Symmetry3D.

Definition at line 1472 of file symmetry.cpp.

1472 {
1473 vector<Vec3f> v = get_asym_unit_points(inc_mirror);
1474 int nsym = params.set_default("nsym",0);
1475 vector<vector<Vec3f> > ret;
1476 if ( (nsym == 1 && inc_mirror == false) || (nsym == 2 && inc_mirror)) {
1477 vector<Vec3f> tmp;
1478 tmp.push_back(v[0]);
1479 tmp.push_back(v[2]);
1480 tmp.push_back(v[1]);
1481 ret.push_back(tmp);
1482
1483 vector<Vec3f> tmp2;
1484 tmp2.push_back(v[2]);
1485 tmp2.push_back(v[0]);
1486 tmp2.push_back(v[3]);
1487 ret.push_back(tmp2);
1488 }
1489 else if (nsym == 1) {
1490 Vec3f z(0,0,1);
1491 vector<Vec3f> tmp;
1492 tmp.push_back(z);
1493 tmp.push_back(v[1]);
1494 tmp.push_back(v[0]);
1495 ret.push_back(tmp);
1496
1497 vector<Vec3f> tmp2;
1498 tmp2.push_back(z);
1499 tmp2.push_back(v[2]);
1500 tmp2.push_back(v[1]);
1501 ret.push_back(tmp2);
1502
1503 vector<Vec3f> tmp3;
1504 tmp3.push_back(z);
1505 tmp3.push_back(v[3]);
1506 tmp3.push_back(v[2]);
1507 ret.push_back(tmp3);
1508
1509 vector<Vec3f> tmp4;
1510 tmp4.push_back(z);
1511 tmp4.push_back(v[0]);
1512 tmp4.push_back(v[3]);
1513 ret.push_back(tmp4);
1514 }
1515 else {
1516// if v.size() == 3
1517 vector<Vec3f> tmp;
1518 tmp.push_back(v[0]);
1519 tmp.push_back(v[2]);
1520 tmp.push_back(v[1]);
1521 ret.push_back(tmp);
1522 }
1523
1524 return ret;
1525}
virtual vector< Vec3f > get_asym_unit_points(bool inc_mirror=false) const
Definition: symmetry.cpp:1527

References get_asym_unit_points(), EMAN::FactoryBase::params, and EMAN::Dict::set_default().

◆ get_delimiters()

Dict DSym::get_delimiters ( const bool  inc_mirror = false) const
virtual

Get the altitude and phi angle of the d symmetry, which depends on nysm.

The "alt_max" is always 90 degrees The "az_max" is 360/nsym degrees of 180/nsym, depending the inc_mirror argument

Parameters
inc_mirrorwhether or not to include the part of the asymmetric unit which contains the mirror projections of the other half
Returns
a dictionary containing the keys "alt_max" and "az_max"
Exceptions
InvalidValueExceptionif nsym is less than or equal to zero

Implements EMAN::Symmetry3D.

Definition at line 1420 of file symmetry.cpp.

1420 {
1421 Dict returnDict;
1422
1423 // Get the parameters of interest
1424 int nsym = params.set_default("nsym",0);
1425 if ( nsym <= 0 ) throw InvalidValueException(nsym,"Error, you must specify a positive non zero nsym");
1426
1427 returnDict["alt_max"] = 90.0f;
1428
1429 if ( inc_mirror ) returnDict["az_max"] = 360.0f/(float)nsym;
1430 else returnDict["az_max"] = 180.0f/(float)nsym;
1431
1432 return returnDict;
1433}
#define InvalidValueException(val, desc)
Definition: exception.h:285

References InvalidValueException, EMAN::FactoryBase::params, and EMAN::Dict::set_default().

Referenced by get_asym_unit_points(), and is_in_asym_unit().

◆ get_desc()

virtual string EMAN::DSym::get_desc ( ) const
inlinevirtual

Get a description.

Returns
a clear desciption of this class

Implements EMAN::FactoryBase.

Definition at line 362 of file symmetry.h.

362{ return "D symmetry support"; }

◆ get_max_csym()

virtual int EMAN::DSym::get_max_csym ( ) const
inlinevirtual

Gets the maximum symmetry of this object.

This is used by OrientationGenerators, and is probably not something a general user would utilize.

Returns
nsym - this is the maximum symmetry about a given any axis for D symmetry

Implements EMAN::Symmetry3D.

Definition at line 404 of file symmetry.h.

404{ return params["nsym"]; }

References EMAN::FactoryBase::params.

◆ get_name()

virtual string EMAN::DSym::get_name ( ) const
inlinevirtual

Return DSym::NAME.

Returns
the unique name of this class

Implements EMAN::FactoryBase.

Definition at line 357 of file symmetry.h.

357{ return NAME; }
static const string NAME
The name of this class - used to access it from factories etc. Should be "d".
Definition: symmetry.h:423

References NAME.

◆ get_nsym()

virtual int EMAN::DSym::get_nsym ( ) const
inlinevirtual

Gets the total number of unique roational symmetry operations associated with this symmetry For D symmetry, this is simply 2*nsym.

Returns
two times nsym

Implements EMAN::Symmetry3D.

Definition at line 397 of file symmetry.h.

397{ return 2*(int)params["nsym"]; };

References EMAN::FactoryBase::params.

◆ get_param_types()

virtual TypeDict EMAN::DSym::get_param_types ( ) const
inlinevirtual

Get a dictionary containing the permissable parameters of this class.

Returns
a dictionary containing the permissable parameters of this class

Implements EMAN::FactoryBase.

Definition at line 367 of file symmetry.h.

368 {
369 TypeDict d;
370 d.put("nsym", EMObject::INT, "The symmetry number");
371 return d;
372 }

References EMAN::EMObject::INT, and EMAN::TypeDict::put().

◆ get_sym()

Transform DSym::get_sym ( const int  n) const
virtual

Provides access to the complete set of rotational symmetry operations associated with this symmetry.

The first half symmetry operations returned by this function are all about the z axis (i.e. only azimuth is non zero. The second half of the symmetry operations are replicas of the first half, except that they have an additional 180 degree rotation about x (in EMAN terms, the altitude angle is 180).

Parameters
nthe rotational symmetry operation number. If n is greater than nsym we take n modulo nsym
Returns
a transform containing the correct rotational symmetric operation.
Exceptions
InvalidValueExceptionif nsym is less than or equal to zero

Implements EMAN::Symmetry3D.

Definition at line 1452 of file symmetry.cpp.

1453{
1454 int nsym = 2*params.set_default("nsym",0);
1455 if ( nsym <= 0 ) throw InvalidValueException(n,"Error, you must specify a positive non zero nsym");
1456
1457 Dict d("type","eman");
1458 // courtesy of Phil Baldwin
1459 if (n >= nsym / 2) {
1460 d["az"] = ( (n%nsym) - nsym/2) * 360.0f / (nsym / 2);
1461 d["alt"] = 180.0f;
1462 d["phi"] = 0.0f;
1463 }
1464 else {
1465 d["az"] = (n%nsym) * 360.0f / (nsym / 2);
1466 d["alt"] = 0.0f;
1467 d["phi"] = 0.0f;
1468 }
1469 return Transform(d);
1470}
A Transform object is a somewhat specialized object designed specifically for EMAN2/Sparx storage of ...
Definition: transform.h:75

References InvalidValueException, EMAN::FactoryBase::params, and EMAN::Dict::set_default().

◆ is_d_sym()

virtual bool EMAN::DSym::is_d_sym ( ) const
inlinevirtual

Returns true - this is indeed a c symmetry object.

Returns
true - indicating that this is a c symmetry object

Reimplemented from EMAN::Symmetry3D.

Definition at line 428 of file symmetry.h.

428{ return true; }

◆ is_in_asym_unit()

bool DSym::is_in_asym_unit ( const float &  altitude,
const float &  azimuth,
const bool  inc_mirror = false 
) const
virtual

A function to be used when generating orientations over portion of the unit sphere defined by parameters returned by get_delimiters.

In platonic symmetry altitude and azimuth alone are not enough to correctly demarcate the asymmetric unit. See the get_delimiters comments.

Parameters
altitudethe EMAN style altitude of the 3D orientation in degrees
azimuththe EMAN style azimuth of the 3D orientation in degrees
inc_mirrorwhether or not to include orientations if they are in the mirror portion of the asymmetric unit
Returns
true or false, depending on whether or not the orientation is within the asymmetric unit

Implements EMAN::Symmetry3D.

Definition at line 1435 of file symmetry.cpp.

1436{
1437 Dict d = get_delimiters(inc_mirror);
1438 float alt_max = d["alt_max"];
1439 float az_max = d["az_max"];
1440
1441 int nsym = params.set_default("nsym",0);
1442
1443 if ( nsym == 1 && inc_mirror ) {
1444 if (altitude >= 0 && altitude <= alt_max && azimuth < az_max ) return true;
1445 }
1446 else {
1447 if ( altitude >= 0 && altitude <= alt_max && azimuth < az_max && azimuth >= 0 ) return true;
1448 }
1449 return false;
1450}

References get_delimiters(), EMAN::FactoryBase::params, and EMAN::Dict::set_default().

◆ NEW()

static Symmetry3D * EMAN::DSym::NEW ( )
inlinestatic

Factory support function NEW.

Returns
a newly instantiated class of this type

Definition at line 349 of file symmetry.h.

350 {
351 return new DSym();
352 }

References DSym().

◆ operator=()

DSym & EMAN::DSym::operator= ( const DSym )
private

Disallow assignment.

Member Data Documentation

◆ NAME

const string DSym::NAME = "d"
static

The name of this class - used to access it from factories etc. Should be "d".

Definition at line 423 of file symmetry.h.

Referenced by get_name().


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