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

EMAN::DSym Class Reference

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

#include <symmetry.h>

Inheritance diagram for EMAN::DSym:

[legend]
Collaboration diagram for EMAN::DSym:
[legend]
List of all members.

Public Member Functions

 DSym ()
virtual ~DSym ()
virtual string get_name () const
 Return DSym::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 d 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 D symmetry, this is simply 2*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
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_d_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

Symmetry3DNEW ()
 Factory support function NEW.

Static Public Attributes

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

Private Member Functions

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

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

EMAN::DSym::DSym  )  [inline]
 

Definition at line 343 of file symmetry.h.

00343 {};

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

Definition at line 344 of file symmetry.h.

00344 {};

EMAN::DSym::DSym const DSym  )  [private]
 

Disallow copy construction.


Member Function Documentation

vector< Vec3f > DSym::get_asym_unit_points bool  inc_mirror = false  )  const [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.

Definition at line 1427 of file symmetry.cpp.

References get_delimiters(), EMAN::Dict::set_default(), EMAN::Vec3f, x, and y.

Referenced by get_asym_unit_triangles().

01428 {
01429         Dict delim = get_delimiters(inc_mirror);
01430 
01431         vector<Vec3f> ret;
01432         int nsym = params.set_default("nsym",0);
01433         if ( nsym == 1 ) {
01434                 if (inc_mirror == false ) {
01435                         ret.push_back(Vec3f(0,0,1));
01436                         ret.push_back(Vec3f(0,-1,0));
01437                         ret.push_back(Vec3f(1,0,0));
01438                         ret.push_back(Vec3f(0,1,0));
01439                 }
01440                 else {
01441                         ret.push_back(Vec3f(0,-1,0));
01442                         ret.push_back(Vec3f(1,0,0));
01443                         ret.push_back(Vec3f(0,1,0));
01444                         ret.push_back(Vec3f(-1,0,0));
01445                 }
01446         }
01447         else if ( nsym == 2 && inc_mirror ) {
01448                 ret.push_back(Vec3f(0,0,1));
01449                 ret.push_back(Vec3f(0,-1,0));
01450                 ret.push_back(Vec3f(1,0,0));
01451                 ret.push_back(Vec3f(0,1,0));
01452         }
01453         else {
01454                 float angle = (float)(EMConsts::deg2rad*float(delim["az_max"]));
01455                 ret.push_back(Vec3f(0,0,1));
01456                 ret.push_back(Vec3f(0,-1,0));
01457                 float y = -cos(angle);
01458                 float x = sin(angle);
01459                 ret.push_back(Vec3f(x,y,0));
01460         }
01461 
01462         return ret;
01463 
01464 }

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

Implements EMAN::Symmetry3D.

Definition at line 1372 of file symmetry.cpp.

References get_asym_unit_points(), EMAN::Dict::set_default(), v, and EMAN::Vec3f.

01372                                                                          {
01373         vector<Vec3f> v = get_asym_unit_points(inc_mirror);
01374         int nsym = params.set_default("nsym",0);
01375         vector<vector<Vec3f> > ret;
01376         if ( (nsym == 1 && inc_mirror == false) || (nsym == 2 && inc_mirror)) {
01377                 vector<Vec3f> tmp;
01378                 tmp.push_back(v[0]);
01379                 tmp.push_back(v[2]);
01380                 tmp.push_back(v[1]);
01381                 ret.push_back(tmp);
01382 
01383                 vector<Vec3f> tmp2;
01384                 tmp2.push_back(v[2]);
01385                 tmp2.push_back(v[0]);
01386                 tmp2.push_back(v[3]);
01387                 ret.push_back(tmp2);
01388         }
01389         else if (nsym == 1) {
01390                 Vec3f z(0,0,1);
01391                 vector<Vec3f> tmp;
01392                 tmp.push_back(z);
01393                 tmp.push_back(v[1]);
01394                 tmp.push_back(v[0]);
01395                 ret.push_back(tmp);
01396 
01397                 vector<Vec3f> tmp2;
01398                 tmp2.push_back(z);
01399                 tmp2.push_back(v[2]);
01400                 tmp2.push_back(v[1]);
01401                 ret.push_back(tmp2);
01402 
01403                 vector<Vec3f> tmp3;
01404                 tmp3.push_back(z);
01405                 tmp3.push_back(v[3]);
01406                 tmp3.push_back(v[2]);
01407                 ret.push_back(tmp3);
01408 
01409                 vector<Vec3f> tmp4;
01410                 tmp4.push_back(z);
01411                 tmp4.push_back(v[0]);
01412                 tmp4.push_back(v[3]);
01413                 ret.push_back(tmp4);
01414         }
01415         else {
01416 //              if v.size() == 3
01417                 vector<Vec3f> tmp;
01418                 tmp.push_back(v[0]);
01419                 tmp.push_back(v[2]);
01420                 tmp.push_back(v[1]);
01421                 ret.push_back(tmp);
01422         }
01423 
01424         return ret;
01425 }

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

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

Referenced by get_asym_unit_points(), and is_in_asym_unit().

01320                                                      {
01321         Dict returnDict;
01322 
01323         // Get the parameters of interest
01324         int nsym = params.set_default("nsym",0);
01325         if ( nsym <= 0 ) throw InvalidValueException(nsym,"Error, you must specify a positive non zero nsym");
01326 
01327         returnDict["alt_max"] = 90.0;
01328 
01329         if ( inc_mirror )  returnDict["az_max"] = 360.0/(float)nsym;
01330         else returnDict["az_max"] = 180.0/(float)nsym;
01331 
01332         return returnDict;
01333 }

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

Get a description.

Returns:
a clear desciption of this class

Implements EMAN::FactoryBase.

Definition at line 362 of file symmetry.h.

00362 { return "D symmetry support"; }

virtual int EMAN::DSym::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:
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.

00404 { return params["nsym"]; }

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

Return DSym::NAME.

Returns:
the unique name of this class

Implements EMAN::FactoryBase.

Definition at line 357 of file symmetry.h.

00357 { return NAME; }

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

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.

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

virtual TypeDict EMAN::DSym::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 367 of file symmetry.h.

References EMAN::TypeDict::put().

00368                 {
00369                         TypeDict d;
00370                         d.put("nsym", EMObject::INT, "The symmetry number");
00371                         return d;
00372                 }

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

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

01353 {
01354         int nsym = 2*params.set_default("nsym",0);
01355         if ( nsym <= 0 ) throw InvalidValueException(n,"Error, you must specify a positive non zero nsym");
01356 
01357         Dict d("type","eman");
01358         // courtesy of Phil Baldwin
01359         if (n >= nsym / 2) {
01360                 d["az"] = ( (n%nsym) - nsym/2) * 360.0f / (nsym / 2);
01361                 d["alt"] = 180.0f;
01362                 d["phi"] = 0.0f;
01363         }
01364         else {
01365                 d["az"] = (n%nsym) * 360.0f / (nsym / 2);
01366                 d["alt"] = 0.0f;
01367                 d["phi"] = 0.0f;
01368         }
01369         return Transform(d);
01370 }

virtual bool EMAN::DSym::is_d_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 428 of file symmetry.h.

00428 { return  true; }

bool DSym::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 1335 of file symmetry.cpp.

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

01336 {
01337         Dict d = get_delimiters(inc_mirror);
01338         float alt_max = d["alt_max"];
01339         float az_max = d["az_max"];
01340 
01341         int nsym = params.set_default("nsym",0);
01342 
01343         if ( nsym == 1 && inc_mirror ) {
01344                 if (altitude >= 0 && altitude <= alt_max && azimuth <= az_max ) return true;
01345         }
01346         else {
01347                 if ( altitude >= 0 && altitude <= alt_max && azimuth <= az_max && azimuth >= 0 ) return true;
01348         }
01349         return false;
01350 }

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

Factory support function NEW.

Returns:
a newly instantiated class of this type

Definition at line 349 of file symmetry.h.

00350                 {
00351                         return new DSym();
00352                 }

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

Disallow assignment.


Member Data Documentation

const string DSym::NAME = "d" [static]
 

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

Definition at line 41 of file symmetry.cpp.


The documentation for this class was generated from the following files:
Generated on Fri Apr 30 15:39:34 2010 for EMAN2 by  doxygen 1.3.9.1