Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::CSym Class Reference

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

#include <symmetry.h>

Inheritance diagram for EMAN::CSym:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CSym ()
virtual ~CSym ()
virtual string get_name () const
 Return CSym::NAME.
virtual string get_desc () const
 Get a description.
virtual TypeDict get_param_types () const
 Get a dictionary containing the permissable parameters of this class.
virtual Dict get_delimiters (const bool inc_mirror=false) const
 Get the altitude and phi angle of the c symmetry, which depends on nysm.
virtual Transform get_sym (const int n) const
 Provides access to the complete set of rotational symmetry operations associated with this symmetry.
virtual int get_nsym () const
 Gets the total number of unique roational symmetry operations associated with this symmetry For C symmetry, this is simply nsym.
virtual int get_max_csym () const
 Gets the maximum symmetry of this object.
virtual vector< Vec3fget_asym_unit_points (bool inc_mirror=false) const
 to demarcate the asymmetric unit.
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_c_sym () const
 Returns true - this is indeed a c symmetry object.
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.

Static Public Member Functions

static Symmetry3DNEW ()
 Factory support function NEW.

Static Public Attributes

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

Private Member Functions

 CSym (const CSym &)
 Disallow copy construction.
CSymoperator= (const CSym &)
 Disallow assignment.

Detailed Description

An encapsulation of cyclic 3D symmetry.

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

Definition at line 233 of file symmetry.h.


Constructor & Destructor Documentation

EMAN::CSym::CSym  )  [inline]
 

Definition at line 236 of file symmetry.h.

Referenced by NEW().

00236 {};

virtual EMAN::CSym::~CSym  )  [inline, virtual]
 

Definition at line 237 of file symmetry.h.

00237 {};

EMAN::CSym::CSym const CSym  )  [private]
 

Disallow copy construction.


Member Function Documentation

vector< Vec3f > CSym::get_asym_unit_points bool  inc_mirror = false  )  const [virtual]
 

to demarcate the asymmetric unit.

The last should may be connected to the first.

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

Implements EMAN::Symmetry3D.

Definition at line 1270 of file symmetry.cpp.

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

Referenced by get_asym_unit_triangles().

01271 {
01272         Dict delim = get_delimiters(inc_mirror);
01273         int nsym = params.set_default("nsym",0);
01274         vector<Vec3f> ret;
01275 
01276         if ( nsym == 1 ) {
01277                 if (inc_mirror == false ) {
01278                         ret.push_back(Vec3f(0,-1,0));
01279                         ret.push_back(Vec3f(1,0,0));
01280                         ret.push_back(Vec3f(0,1,0));
01281                         ret.push_back(Vec3f(-1,0,0));
01282                 }
01283                 // else return ret; // an empty vector! this is fine
01284         }
01285         else if (nsym == 2 && !inc_mirror) {
01286                 ret.push_back(Vec3f(0,0,1));
01287                 ret.push_back(Vec3f(0,-1,0));
01288                 ret.push_back(Vec3f(1,0,0));
01289                 ret.push_back(Vec3f(0,1,0));
01290         }
01291         else {
01292                 ret.push_back(Vec3f(0,0,1));
01293                 ret.push_back(Vec3f(0,-1,0));
01294                 if (inc_mirror == true) {
01295                         ret.push_back(Vec3f(0,0,-1));
01296                 }
01297                 float angle = (float)(EMConsts::deg2rad*float(delim["az_max"]));
01298                 float y = -cos(angle);
01299                 float x = sin(angle);
01300                 ret.push_back(Vec3f(x,y,0));
01301         }
01302 
01303         return ret;
01304 
01305 }

vector< vector< Vec3f > > CSym::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_mirror whether to include the mirror portion of the asymmetric unit

Implements EMAN::Symmetry3D.

Definition at line 1175 of file symmetry.cpp.

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

01175                                                                           {
01176         vector<Vec3f> v = get_asym_unit_points(inc_mirror);
01177         int nsym = params.set_default("nsym",0);
01178 
01179         vector<vector<Vec3f> > ret;
01180         if (v.size() == 0) return ret; // nsym == 1 and inc_mirror == true, this is the entire sphere!
01181         if (nsym == 1 && !inc_mirror) {
01182                 Vec3f z(0,0,1);
01183                 vector<Vec3f> tmp;
01184                 tmp.push_back(z);
01185                 tmp.push_back(v[1]);
01186                 tmp.push_back(v[0]);
01187                 ret.push_back(tmp);
01188 
01189                 vector<Vec3f> tmp2;
01190                 tmp2.push_back(z);
01191                 tmp2.push_back(v[2]);
01192                 tmp2.push_back(v[1]);
01193                 ret.push_back(tmp2);
01194 
01195                 vector<Vec3f> tmp3;
01196                 tmp3.push_back(z);
01197                 tmp3.push_back(v[3]);
01198                 tmp3.push_back(v[2]);
01199                 ret.push_back(tmp3);
01200 
01201                 vector<Vec3f> tmp4;
01202                 tmp4.push_back(z);
01203                 tmp4.push_back(v[0]);
01204                 tmp4.push_back(v[3]);
01205                 ret.push_back(tmp4);
01206         }
01207         else if (nsym == 2 && inc_mirror) {
01208                 Vec3f x(1,0,0);
01209                 vector<Vec3f> tmp;
01210                 tmp.push_back(v[1]);
01211                 tmp.push_back(v[0]);
01212                 tmp.push_back(x);
01213                 ret.push_back(tmp);
01214 
01215                 vector<Vec3f> tmp2;
01216                 tmp2.push_back(v[2]);
01217                 tmp2.push_back(v[1]);
01218                 tmp2.push_back(x);
01219                 ret.push_back(tmp2);
01220 
01221                 vector<Vec3f> tmp3;
01222                 tmp3.push_back(v[3]);
01223                 tmp3.push_back(v[2]);
01224                 tmp3.push_back(x);
01225                 ret.push_back(tmp3);
01226 
01227                 vector<Vec3f> tmp4;
01228                 tmp4.push_back(v[0]);
01229                 tmp4.push_back(v[3]);
01230                 tmp4.push_back(x);
01231                 ret.push_back(tmp4);
01232         }
01233         else if (nsym == 2 && !inc_mirror) {
01234                 vector<Vec3f> tmp;
01235                 tmp.push_back(v[0]);
01236                 tmp.push_back(v[2]);
01237                 tmp.push_back(v[1]);
01238                 ret.push_back(tmp);
01239 
01240                 vector<Vec3f> tmp2;
01241                 tmp2.push_back(v[2]);
01242                 tmp2.push_back(v[0]);
01243                 tmp2.push_back(v[3]);
01244                 ret.push_back(tmp2);
01245         }
01246         else if (v.size() == 3) {
01247                 vector<Vec3f> tmp;
01248                 tmp.push_back(v[0]);
01249                 tmp.push_back(v[2]);
01250                 tmp.push_back(v[1]);
01251                 ret.push_back(tmp);
01252         }
01253         else if (v.size() == 4) {
01254                 vector<Vec3f> tmp;
01255                 tmp.push_back(v[0]);
01256                 tmp.push_back(v[3]);
01257                 tmp.push_back(v[1]);
01258                 ret.push_back(tmp);
01259 
01260                 vector<Vec3f> tmp2;
01261                 tmp2.push_back(v[1]);
01262                 tmp2.push_back(v[3]);
01263                 tmp2.push_back(v[2]);
01264                 ret.push_back(tmp2);
01265         }
01266 
01267         return ret;
01268 }

Dict CSym::get_delimiters const bool  inc_mirror = false  )  const [virtual]
 

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

The "alt_max" value in the return dicts is 180 or 90 degrees, depending inc_mirror The "az_max" is 360/nsym degrees.

Parameters:
inc_mirror whether 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:
InvalidValueException if nsym is less than or equal to zero

Implements EMAN::Symmetry3D.

Definition at line 1149 of file symmetry.cpp.

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

Referenced by get_asym_unit_points(), and is_in_asym_unit().

01149                                                      {
01150         Dict returnDict;
01151         // Get the parameters of interest
01152         int nsym = params.set_default("nsym",0);
01153         if ( nsym <= 0 ) throw InvalidValueException(nsym,"Error, you must specify a positive non zero nsym");
01154 
01155         if ( inc_mirror ) returnDict["alt_max"] = 180.0f;
01156         else  returnDict["alt_max"] = 90.0f;
01157 
01158         returnDict["az_max"] = 360.0f/(float)nsym;
01159 
01160         return returnDict;
01161 }

virtual string EMAN::CSym::get_desc  )  const [inline, virtual]
 

Get a description.

Returns:
a clear desciption of this class

Implements EMAN::FactoryBase.

Definition at line 255 of file symmetry.h.

00255 { return "C symmetry support"; }

virtual int EMAN::CSym::get_max_csym  )  const [inline, virtual]
 

Gets the maximum symmetry of this object.

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

Returns:
the degree of of cyclic symmetry (nsym) - this is the maximum symmetry

Implements EMAN::Symmetry3D.

Definition at line 296 of file symmetry.h.

References EMAN::FactoryBase::params.

00296 { return params["nsym"]; }

virtual string EMAN::CSym::get_name  )  const [inline, virtual]
 

Return CSym::NAME.

Returns:
the unique name of this class

Implements EMAN::FactoryBase.

Definition at line 250 of file symmetry.h.

References NAME.

00250 { return NAME; }

virtual int EMAN::CSym::get_nsym  )  const [inline, virtual]
 

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

Returns:
the degree of of cyclic symmetry (nsym)

Implements EMAN::Symmetry3D.

Definition at line 289 of file symmetry.h.

References EMAN::FactoryBase::params.

00289 { return params["nsym"]; };

virtual TypeDict EMAN::CSym::get_param_types  )  const [inline, virtual]
 

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

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

00261                 {
00262                         TypeDict d;
00263                         d.put("nsym", EMObject::INT, "The symmetry number");
00264                         return d;
00265                 }

Transform CSym::get_sym const int  n  )  const [virtual]
 

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

Rotational symmetry operations for C symmetry are always about the z-axis (in the EMAN convention), and therefore the only non zero return angle is azimuth. Specifically, it is n*360/nsym degrees.

Parameters:
n the rotational symmetry operation number. If n is greater than nsym we take n modulo nsym
Returns:
a transform3d containing the correct rotational symmetric operation.
Exceptions:
InvalidValueException if nsym is less than or equal to zero

Implements EMAN::Symmetry3D.

Definition at line 1307 of file symmetry.cpp.

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

01307                                          {
01308         int nsym = params.set_default("nsym",0);
01309         if ( nsym <= 0 ) throw InvalidValueException(n,"Error, you must specify a positive non zero nsym");
01310 
01311         Dict d("type","eman");
01312         // courtesy of Phil Baldwin
01313         d["az"] = (n%nsym) * 360.0f / nsym;
01314         d["alt"] = 0.0f;
01315         d["phi"] = 0.0f;
01316         return Transform(d);
01317 }

virtual bool EMAN::CSym::is_c_sym  )  const [inline, virtual]
 

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

00320 { return  true; }

bool CSym::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.

In platonic symmetry 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.

Definition at line 1163 of file symmetry.cpp.

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

01164 {
01165         Dict d = get_delimiters(inc_mirror);
01166         float alt_max = d["alt_max"];
01167         float az_max = d["az_max"];
01168 
01169         int nsym = params.set_default("nsym",0);
01170         if ( nsym != 1 && azimuth < 0) return false;
01171         if ( altitude <= alt_max && azimuth <= az_max ) return true;
01172         return false;
01173 }

static Symmetry3D* EMAN::CSym::NEW  )  [inline, static]
 

Factory support function NEW.

Returns:
a newly instantiated class of this type

Definition at line 242 of file symmetry.h.

References CSym().

00243                 {
00244                         return new CSym();
00245                 }

CSym& EMAN::CSym::operator= const CSym  )  [private]
 

Disallow assignment.


Member Data Documentation

const string CSym::NAME = "c" [static]
 

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

Definition at line 299 of file symmetry.h.

Referenced by get_name().


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