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]
List of all members.

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.
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).
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.
virtual bool is_platonic_sym () const
 Determines whether or not this Symmetry3D is the platonic type - returns true.

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.
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.
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.

Protected Attributes

Dict platonic_params
 A dictionary that stores important angles, in radians.

Private Member Functions

 PlatonicSym (const PlatonicSym &)
 Disallow copy construction.
PlatonicSymoperator= (const PlatonicSym &)
 Disallow assignment.

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 583 of file symmetry.h.


Constructor & Destructor Documentation

EMAN::PlatonicSym::PlatonicSym (  )  [inline]

Definition at line 586 of file symmetry.h.

00586 {};

virtual EMAN::PlatonicSym::~PlatonicSym (  )  [inline, virtual]

Definition at line 587 of file symmetry.h.

00587 {};

EMAN::PlatonicSym::PlatonicSym ( const PlatonicSym  )  [private]

Disallow copy construction.


Member Function Documentation

vector< Vec3f > PlatonicSym::get_asym_unit_points ( bool  inc_mirror = false  )  const [protected, virtual]

Parameters:
inc_mirror whether 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 1675 of file symmetry.cpp.

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

Referenced by get_asym_unit_triangles().

01676 {
01677         vector<Vec3f> ret;
01678 
01679         Vec3f b = Vec3f(0,0,1);
01680         ret.push_back(b);
01681         float theta_c_on_two = (float)platonic_params["theta_c_on_two"]; // already in radians
01682         float theta_c = 2*theta_c_on_two;
01683 
01684         Vec3f c_on_two = Vec3f(0,-sin(theta_c_on_two),cos(theta_c_on_two));
01685         Vec3f c = Vec3f(0,-sin(theta_c),cos(theta_c));
01686         ret.push_back(c_on_two);
01687 
01688         float cap_sig = platonic_params["az_max"];
01689         Vec3f a = Vec3f(sin(theta_c)*sin(cap_sig),-sin(theta_c)*cos(cap_sig),cos(theta_c));
01690 
01691         Vec3f f = a+b+c;
01692         f.normalize();
01693 
01694         ret.push_back(f);
01695 
01696         if ( inc_mirror ) {
01697                 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));
01698                 ret.push_back(a_on_two);
01699         }
01700 
01701         if ( get_az_alignment_offset() != 0 ) {
01702                 Dict d("type","eman");
01703                 d["az"] = get_az_alignment_offset();
01704                 d["phi"] = 0.0f;
01705                 d["alt"] = 0.0f;
01706                 Transform t(d);
01707                 for (vector<Vec3f>::iterator it = ret.begin(); it != ret.end(); ++it )
01708                 {
01709                         *it = (*it)*t;
01710                 }
01711         }
01712         //
01713         return ret;
01714 
01715 }

vector< vector< Vec3f > > PlatonicSym::get_asym_unit_triangles ( bool  inc_mirror  )  const [protected, 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_mirror whether to include the mirror portion of the asymmetric unit

Implements EMAN::Symmetry3D.

Definition at line 1648 of file symmetry.cpp.

References get_asym_unit_points(), and v.

01648                                                                                 {
01649         vector<Vec3f> v = get_asym_unit_points(inc_mirror);
01650         vector<vector<Vec3f> > ret;
01651         if (v.size() == 3) {
01652                 vector<Vec3f> tmp;
01653                 tmp.push_back(v[0]);
01654                 tmp.push_back(v[2]);
01655                 tmp.push_back(v[1]);
01656                 ret.push_back(tmp);
01657         }
01658         else /* v.size() == 4*/ {
01659                 vector<Vec3f> tmp;
01660                 tmp.push_back(v[0]);
01661                 tmp.push_back(v[2]);
01662                 tmp.push_back(v[1]);
01663                 ret.push_back(tmp);
01664 
01665                 vector<Vec3f> tmp2;
01666                 tmp2.push_back(v[0]);
01667                 tmp2.push_back(v[3]);
01668                 tmp2.push_back(v[2]);
01669                 ret.push_back(tmp2);
01670         }
01671 
01672         return ret;
01673 }

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_mirror whether 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 1586 of file symmetry.cpp.

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

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

01587 {
01588         Dict ret;
01589         ret["az_max"] = EMConsts::rad2deg * (float) platonic_params["az_max"];
01590         // For icos and oct symmetries, excluding the mirror means halving az_maz
01591         if ( inc_mirror == false )
01592                 if ( get_name() ==  IcosahedralSym::NAME || get_name() == OctahedralSym::NAME )
01593                         ret["az_max"] = 0.5f*EMConsts::rad2deg * (float) platonic_params["az_max"];
01594                 //else
01595                 //the alt_max variable should probably be altered if the symmetry is tet, but
01596                 //this is taken care of in TetSym::is_in_asym_unit
01597 
01598         ret["alt_max"] = (float)(EMConsts::rad2deg * (float) platonic_params["alt_max"]);
01599         return ret;
01600 }

virtual TypeDict EMAN::PlatonicSym::get_param_types (  )  const [inline, virtual]

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 593 of file symmetry.h.

00594                 {
00595                         TypeDict d;
00596                         return d;
00597                 }

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

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

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

01566 {
01567         //See the manuscript "The Transform Class in Sparx and EMAN2", Baldwin & Penczek 2007. J. Struct. Biol. 157 (250-261)
01568         //In particular see pages 257-259
01569         //cap_sig is capital sigma in the Baldwin paper
01570         float cap_sig =  2.0f*M_PI/ get_max_csym();
01571         //In EMAN2 projection cap_sig is really az_max
01572         platonic_params["az_max"] = cap_sig;
01573 
01574         // Alpha is the angle between (immediately) neighborhing 3 fold axes of symmetry
01575         // This follows the conventions in the Baldwin paper
01576         float alpha = acos(1.0f/(sqrtf(3.0f)*tan(cap_sig/2.0f)));
01577         // In EMAN2 projection alpha is really al_maz
01578         platonic_params["alt_max"] = alpha;
01579 
01580         // This is half of "theta_c" as in the conventions of the Balwin paper. See also http://blake.bcm.edu/emanwiki/EMAN2/Symmetry.
01581         platonic_params["theta_c_on_two"] = 1.0f/2.0f*acos( cos(cap_sig)/(1.0f-cos(cap_sig)));
01582 
01583 }

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:
altitude the EMAN style altitude of the 3D orientation in degrees
azimuth the EMAN style azimuth of the 3D orientation in degrees
inc_mirror whether 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 1603 of file symmetry.cpp.

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

01604 {
01605         Dict d = get_delimiters(inc_mirror);
01606         float alt_max = d["alt_max"];
01607         float az_max = d["az_max"];
01608 
01609         if ( altitude >= 0 &&  altitude <= alt_max && azimuth <= az_max && azimuth >= 0) {
01610 
01611                 // Convert azimuth to radians
01612                 float tmpaz = (float)(EMConsts::deg2rad * azimuth);
01613 
01614                 float cap_sig = platonic_params["az_max"];
01615                 float alt_max = platonic_params["alt_max"];
01616                 if ( tmpaz > ( cap_sig/2.0f ) )tmpaz = cap_sig - tmpaz;
01617 
01618                 float lower_alt_bound = platonic_alt_lower_bound(tmpaz, alt_max );
01619 
01620                 // convert altitude to radians
01621                 float tmpalt = (float)(EMConsts::deg2rad * altitude);
01622                 if ( lower_alt_bound > tmpalt ) {
01623                         if ( inc_mirror == false )
01624                         {
01625                                 if ( cap_sig/2.0f < tmpaz ) return false;
01626                                 else return true;
01627                         }
01628                         else return true;
01629                 }
01630                 return false;
01631         }
01632         return false;
01633 }

virtual bool EMAN::PlatonicSym::is_platonic_sym (  )  const [inline, virtual]

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 629 of file symmetry.h.

00629 { return true; }

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

Disallow assignment.

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:
azimuth an EMAN style 3D azimuth angle, in radians
alpha an 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 1635 of file symmetry.cpp.

References platonic_params.

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

01636 {
01637         float cap_sig = platonic_params["az_max"];
01638         float theta_c_on_two = platonic_params["theta_c_on_two"];
01639 
01640         float baldwin_lower_alt_bound = sin(cap_sig/2.0f-azimuth)/tan(theta_c_on_two);
01641         baldwin_lower_alt_bound += sin(azimuth)/tan(alpha);
01642         baldwin_lower_alt_bound *= 1/sin(cap_sig/2.0f);
01643         baldwin_lower_alt_bound = atan(1/baldwin_lower_alt_bound);
01644 
01645         return baldwin_lower_alt_bound;
01646 }


Member Data Documentation

Dict EMAN::PlatonicSym::platonic_params [protected]

A dictionary that stores important angles, in radians.

Definition at line 633 of file symmetry.h.

Referenced by EMAN::TetrahedralSym::get_asym_unit_points(), get_asym_unit_points(), get_delimiters(), init(), EMAN::TetrahedralSym::is_in_asym_unit(), is_in_asym_unit(), and platonic_alt_lower_bound().


The documentation for this class was generated from the following files:
Generated on Tue May 25 17:18:17 2010 for EMAN2 by  doxygen 1.4.7