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

A base (or parent) class for the Platonic symmetries. More...

#include <symmetry.h>

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

Public Member Functions

 PlatonicSym ()
 
virtual ~PlatonicSym ()
 
virtual TypeDict get_param_types () const
 Get a dictionary containing the permissable parameters of this class Platonic symmetries actually have no parameters. More...
 
virtual Dict get_delimiters (const bool inc_mirror=false) const
 Returns the range of altitude and azimuth angles which encompass the asymmetric unit of the Platonic symmetry (and more). More...
 
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_platonic_sym () const
 Determines whether or not this Symmetry3D is the platonic type - returns true. More...
 
- Public Member Functions inherited from EMAN::Symmetry3D
 Symmetry3D ()
 
virtual ~Symmetry3D ()
 
virtual Transform get_sym (const int n) const =0
 Every Symmetry3D object must provide access to the full set of its symmetry operators via this function. More...
 
virtual int get_nsym () const =0
 The total number of unique symmetry operations that will be return by this object when a calling program access Symmetry3D::get_sym. More...
 
virtual float get_az_alignment_offset () const
 This functionality is only relevant to platonic symmetries. 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_d_sym () const
 A function that is used to determine if this is a d symmetry object This function is only virtually overidden by the DSym 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...
 
virtual int get_max_csym () const =0
 The Symmetry3D object must return the maximum degree of symmetry it exhibits about any one axis. 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 ()
 
virtual string get_name () const =0
 Get the unique name of this class (especially for factory based instantiation access) More...
 
virtual string get_desc () const =0
 Get a clear, concise description of this class. More...
 
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
 

Protected Member Functions

void init ()
 Init - Called to initialize platonic_params, should be called in the constructor of all Platonic solids that derive from this. More...
 
float platonic_alt_lower_bound (const float &azimuth, const float &alpha) const
 Returns the lower bound of the asymmetric unit, as dependent on azimuth, and on alpha - alpha is alt_max for icos and oct, but may be alt_max/2.0 for tet depending on mirror symmetry etc. More...
 
virtual vector< Vec3fget_asym_unit_points (bool inc_mirror=false) const
 
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...
 
- 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

Dict platonic_params
 A dictionary that stores important angles, in radians. 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...
 

Private Member Functions

 PlatonicSym (const PlatonicSym &)
 Disallow copy construction. More...
 
PlatonicSymoperator= (const PlatonicSym &)
 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
 
- Static Public Member Functions inherited from EMAN::Symmetry3D
static vector< Transformget_symmetries (const string &symmetry)
 

Detailed Description

A base (or parent) class for the Platonic symmetries.

It cannot be instantieted on its own. Doctor Phil says: "see www.math.utah.edu/~alfeld/math/polyhedra/polyhedra.html for pictures of platonic solids" Also, see http://blake.bcm.edu/emanwiki/EMAN2/Symmetry for a good pictorial description of what's going on here This class has a fundamental role to play in terms of the Platonic symmetries that derive from it. It is based heavily on the manuscript Baldwin and Penczek, 2007. The Transform Class in SPARX and EMAN2. JSB 157(250-261), where the important angles of the asymmetric units in Platonic solids are described. The MOST IMPORTANT THING TO NOTE is anything that derives from this class must call init() in its constructor. However, because it is unlikey that any class will inherit from this one seeing as the set of Platonic symmetries is finite.

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

Definition at line 581 of file symmetry.h.

Constructor & Destructor Documentation

◆ PlatonicSym() [1/2]

EMAN::PlatonicSym::PlatonicSym ( )
inline

Definition at line 584 of file symmetry.h.

584{};

◆ ~PlatonicSym()

virtual EMAN::PlatonicSym::~PlatonicSym ( )
inlinevirtual

Definition at line 585 of file symmetry.h.

585{};

◆ PlatonicSym() [2/2]

EMAN::PlatonicSym::PlatonicSym ( const PlatonicSym )
private

Disallow copy construction.

Member Function Documentation

◆ get_asym_unit_points()

vector< Vec3f > PlatonicSym::get_asym_unit_points ( bool  inc_mirror = false) const
protectedvirtual
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.

Reimplemented in EMAN::TetrahedralSym.

Definition at line 1777 of file symmetry.cpp.

1778{
1779 vector<Vec3f> ret;
1780
1781 Vec3f b = Vec3f(0,0,1);
1782 ret.push_back(b);
1783 float theta_c_on_two = (float)platonic_params["theta_c_on_two"]; // already in radians
1784 float theta_c = 2*theta_c_on_two;
1785
1786 Vec3f c_on_two = Vec3f(0,-sin(theta_c_on_two),cos(theta_c_on_two));
1787 Vec3f c = Vec3f(0,-sin(theta_c),cos(theta_c));
1788 ret.push_back(c_on_two);
1789
1790 float cap_sig = platonic_params["az_max"];
1791 Vec3f a = Vec3f(sin(theta_c)*sin(cap_sig),-sin(theta_c)*cos(cap_sig),cos(theta_c));
1792
1793 Vec3f f = a+b+c;
1794 f.normalize();
1795
1796 ret.push_back(f);
1797
1798 if ( inc_mirror ) {
1799 Vec3f a_on_two = Vec3f(sin(theta_c_on_two)*sin(cap_sig),-sin(theta_c_on_two)*cos(cap_sig),cos(theta_c_on_two));
1800 ret.push_back(a_on_two);
1801 }
1802
1803 if ( get_az_alignment_offset() != 0 ) {
1804 Dict d("type","eman");
1805 d["az"] = get_az_alignment_offset();
1806 d["phi"] = 0.0f;
1807 d["alt"] = 0.0f;
1808 Transform t(d);
1809 for (vector<Vec3f>::iterator it = ret.begin(); it != ret.end(); ++it )
1810 {
1811 *it = (*it)*t;
1812 }
1813 }
1814 //
1815 return ret;
1816
1817}
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
Dict platonic_params
A dictionary that stores important angles, in radians.
Definition: symmetry.h:631
virtual float get_az_alignment_offset() const
This functionality is only relevant to platonic symmetries.
Definition: symmetry.h:86
A Transform object is a somewhat specialized object designed specifically for EMAN2/Sparx storage of ...
Definition: transform.h:75
float normalize()
Normalize the vector and return its length before the normalization.
Definition: vec3.h:332
Vec3< float > Vec3f
Definition: vec3.h:693

References EMAN::Symmetry3D::get_az_alignment_offset(), EMAN::Vec3< Type >::normalize(), and platonic_params.

Referenced by get_asym_unit_triangles().

◆ get_asym_unit_triangles()

vector< vector< Vec3f > > PlatonicSym::get_asym_unit_triangles ( bool  inc_mirror) const
protectedvirtual

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 1750 of file symmetry.cpp.

1750 {
1751 vector<Vec3f> v = get_asym_unit_points(inc_mirror);
1752 vector<vector<Vec3f> > ret;
1753 if (v.size() == 3) {
1754 vector<Vec3f> tmp;
1755 tmp.push_back(v[0]);
1756 tmp.push_back(v[2]);
1757 tmp.push_back(v[1]);
1758 ret.push_back(tmp);
1759 }
1760 else /* v.size() == 4*/ {
1761 vector<Vec3f> tmp;
1762 tmp.push_back(v[0]);
1763 tmp.push_back(v[2]);
1764 tmp.push_back(v[1]);
1765 ret.push_back(tmp);
1766
1767 vector<Vec3f> tmp2;
1768 tmp2.push_back(v[0]);
1769 tmp2.push_back(v[3]);
1770 tmp2.push_back(v[2]);
1771 ret.push_back(tmp2);
1772 }
1773
1774 return ret;
1775}
virtual vector< Vec3f > get_asym_unit_points(bool inc_mirror=false) const
Definition: symmetry.cpp:1777

References get_asym_unit_points().

◆ get_delimiters()

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

Returns the range of altitude and azimuth angles which encompass the asymmetric unit of the Platonic symmetry (and more).

As a general rule you may generate your orientations evenly over the range altitude range as accessed by "alt_max" key in the return dictionary, and over the azimuth range as accessed by the "az_max", but your must call the function is_in_asym_unit as you do it, to accomodate for orientations in the range that are actually beyond the asymmetric unit. See http://blake.bcm.edu/emanwiki/EMAN2/Symmetry for pictures and descriptions. If the inc_mirror is true, the return "az_max" key is twice as large as if not, but only if the platonic symmetry is Icos or Oct. If the symmetry is Tet, the mirror considerations are taken into account in is_in_asym_unit. This is a bit of a design flaw, but it works.

Parameters
inc_mirrorwhether or not to consider the mirror portion of the asymmetric unit (only changes the return values if the symmetry is Icos or Oct)
Returns
a dictionary containing the "az_max" and "alt_max" keys which define angles, in degrees

Implements EMAN::Symmetry3D.

Definition at line 1694 of file symmetry.cpp.

1695{
1696 Dict ret;
1697 ret["az_max"] = EMConsts::rad2deg * (float) platonic_params["az_max"];
1698 // For icos and oct symmetries, excluding the mirror means halving az_maz
1699 if ( inc_mirror == false )
1701 ret["az_max"] = 0.5f*EMConsts::rad2deg * (float) platonic_params["az_max"];
1702 //else
1703 //the alt_max variable should probably be altered if the symmetry is tet, but
1704 //this is taken care of in TetSym::is_in_asym_unit
1705
1706 ret["alt_max"] = (float)(EMConsts::rad2deg * (float) platonic_params["alt_max"]);
1707 return ret;
1708}
static const double rad2deg
Definition: emobject.h:77
virtual string get_name() const =0
Get the unique name of this class (especially for factory based instantiation access)
static const string NAME
The name of this class - used to access it from factories etc. Should be "icos".
Definition: symmetry.h:910
static const string NAME
The name of this class - used to access it from factories etc. Should be "oct".
Definition: symmetry.h:834

References EMAN::FactoryBase::get_name(), EMAN::OctahedralSym::NAME, EMAN::IcosahedralSym::NAME, platonic_params, and EMAN::EMConsts::rad2deg.

Referenced by is_in_asym_unit(), and EMAN::TetrahedralSym::is_in_asym_unit().

◆ get_param_types()

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

Get a dictionary containing the permissable parameters of this class Platonic symmetries actually have no parameters.

Returns
a dictionary containing the permissable parameters of this class ( which is none)

Implements EMAN::FactoryBase.

Definition at line 591 of file symmetry.h.

592 {
593 TypeDict d;
594 return d;
595 }

◆ init()

void PlatonicSym::init ( )
protected

Init - Called to initialize platonic_params, should be called in the constructor of all Platonic solids that derive from this.

This function generates the important angles of the platonic symmetries which is dependent only on the function get_max_csym ( which must be defined in all classes that inherit from this class)

Definition at line 1673 of file symmetry.cpp.

1674{
1675 //See the manuscript "The Transform Class in Sparx and EMAN2", Baldwin & Penczek 2007. J. Struct. Biol. 157 (250-261)
1676 //In particular see pages 257-259
1677 //cap_sig is capital sigma in the Baldwin paper
1678 float cap_sig = 2.0f*M_PI/ get_max_csym();
1679 //In EMAN2 projection cap_sig is really az_max
1680 platonic_params["az_max"] = cap_sig;
1681
1682 // Alpha is the angle between (immediately) neighborhing 3 fold axes of symmetry
1683 // This follows the conventions in the Baldwin paper
1684 float alpha = acos(1.0f/(sqrtf(3.0f)*tan(cap_sig/2.0f)));
1685 // In EMAN2 projection alpha is really al_maz
1686 platonic_params["alt_max"] = alpha;
1687
1688 // This is half of "theta_c" as in the conventions of the Balwin paper. See also http://blake.bcm.edu/emanwiki/EMAN2/Symmetry.
1689 platonic_params["theta_c_on_two"] = 1.0f/2.0f*acos( cos(cap_sig)/(1.0f-cos(cap_sig)));
1690
1691}
virtual int get_max_csym() const =0
The Symmetry3D object must return the maximum degree of symmetry it exhibits about any one axis.

References EMAN::Symmetry3D::get_max_csym(), and platonic_params.

Referenced by EMAN::IcosahedralSym::IcosahedralSym(), EMAN::OctahedralSym::OctahedralSym(), EMAN::TetrahedralSym::TetrahedralSym(), and EMAN::Icosahedral2Sym::~Icosahedral2Sym().

◆ is_in_asym_unit()

bool PlatonicSym::is_in_asym_unit ( const float &  altitude,
const float &  azimuth,
const bool  inc_mirror 
) const
virtual

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

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.

Reimplemented in EMAN::TetrahedralSym.

Definition at line 1711 of file symmetry.cpp.

1712{
1713 Dict d = get_delimiters(inc_mirror);
1714 float alt_max = d["alt_max"];
1715 float az_max = d["az_max"];
1716
1717 if ( altitude >= 0 && altitude <= alt_max && azimuth < az_max && azimuth >= 0) {
1718
1719 // Convert azimuth to radians
1720 float tmpaz = (float)(EMConsts::deg2rad * azimuth);
1721
1722 float cap_sig = platonic_params["az_max"];
1723 float alt_max = platonic_params["alt_max"];
1724 tmpaz = Util::get_min( tmpaz, cap_sig-tmpaz);
1725
1726 // convert altitude to radians
1727 float tmpalt = (float)(EMConsts::deg2rad * altitude);
1728 if ( platonic_alt_lower_bound(tmpaz, alt_max ) > tmpalt ) return true;
1729 /*if ( inc_mirror == false ) {
1730 if ( tmpaz > cap_sig/2.0f) return false; // this if is always false so I removed it PAP
1731 else return true;
1732 } else return true;*/
1733 else return false;
1734 } else return false;
1735}
static const double deg2rad
Definition: emobject.h:78
float platonic_alt_lower_bound(const float &azimuth, const float &alpha) const
Returns the lower bound of the asymmetric unit, as dependent on azimuth, and on alpha - alpha is alt_...
Definition: symmetry.cpp:1737
virtual Dict get_delimiters(const bool inc_mirror=false) const
Returns the range of altitude and azimuth angles which encompass the asymmetric unit of the Platonic ...
Definition: symmetry.cpp:1694
static int get_min(int f1, int f2)
Get the minimum of 2 numbers.
Definition: util.h:922

References EMAN::EMConsts::deg2rad, get_delimiters(), EMAN::Util::get_min(), platonic_alt_lower_bound(), and platonic_params.

◆ is_platonic_sym()

virtual bool EMAN::PlatonicSym::is_platonic_sym ( ) const
inlinevirtual

Determines whether or not this Symmetry3D is the platonic type - returns true.

Returns
true - indicating that this is a platonic symmetry object

Reimplemented from EMAN::Symmetry3D.

Definition at line 627 of file symmetry.h.

627{ return true; }

◆ operator=()

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

Disallow assignment.

◆ platonic_alt_lower_bound()

float PlatonicSym::platonic_alt_lower_bound ( const float &  azimuth,
const float &  alpha 
) const
protected

Returns the lower bound of the asymmetric unit, as dependent on azimuth, and on alpha - alpha is alt_max for icos and oct, but may be alt_max/2.0 for tet depending on mirror symmetry etc.

Parameters
azimuthan EMAN style 3D azimuth angle, in radians
alphaan EMAN style altitude angle that helps to define arcs on the unit sphere. See Baldwin and Penczek, 2007. The Transform Class in SPARX and EMAN2. JSB 157(250-261) where the angle alpha is described
Returns
the altitude corresponding to the lower bound for the given azimuth, in radians

Definition at line 1737 of file symmetry.cpp.

1738{
1739 float cap_sig = platonic_params["az_max"];
1740 float theta_c_on_two = platonic_params["theta_c_on_two"];
1741
1742 float baldwin_lower_alt_bound = sin(cap_sig/2.0f-azimuth)/tan(theta_c_on_two);
1743 baldwin_lower_alt_bound += sin(azimuth)/tan(alpha);
1744 baldwin_lower_alt_bound *= 1/sin(cap_sig/2.0f);
1745 baldwin_lower_alt_bound = atan(1/baldwin_lower_alt_bound);
1746
1747 return baldwin_lower_alt_bound;
1748}

References platonic_params.

Referenced by is_in_asym_unit(), and EMAN::TetrahedralSym::is_in_asym_unit().

Member Data Documentation

◆ platonic_params

Dict EMAN::PlatonicSym::platonic_params
protected

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