EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | List of all 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]

Public Member Functions

 CSym ()
 
virtual ~CSym ()
 
virtual string get_name () const
 Return CSym::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 c 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 C symmetry, this is simply 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
 to demarcate the asymmetric unit. 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_c_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_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...
 
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 = "c"
 The name of this class - used to access it from factories etc. Should be "c". More...
 

Private Member Functions

 CSym (const CSym &)
 Disallow copy construction. More...
 
CSymoperator= (const CSym &)
 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 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

◆ CSym() [1/2]

EMAN::CSym::CSym ( )
inline

Definition at line 236 of file symmetry.h.

236{};

Referenced by NEW().

◆ ~CSym()

virtual EMAN::CSym::~CSym ( )
inlinevirtual

Definition at line 237 of file symmetry.h.

237{};

◆ CSym() [2/2]

EMAN::CSym::CSym ( const CSym )
private

Disallow copy construction.

Member Function Documentation

◆ get_asym_unit_points()

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

Implements EMAN::Symmetry3D.

Definition at line 1370 of file symmetry.cpp.

1371{
1372 Dict delim = get_delimiters(inc_mirror);
1373 int nsym = params.set_default("nsym",0);
1374 vector<Vec3f> ret;
1375
1376 if ( nsym == 1 ) {
1377 if (inc_mirror == false ) {
1378 ret.push_back(Vec3f(0,-1,0));
1379 ret.push_back(Vec3f(1,0,0));
1380 ret.push_back(Vec3f(0,1,0));
1381 ret.push_back(Vec3f(-1,0,0));
1382 }
1383 // else return ret; // an empty vector! this is fine
1384 }
1385 else if (nsym == 2 && !inc_mirror) {
1386 ret.push_back(Vec3f(0,0,1));
1387 ret.push_back(Vec3f(0,-1,0));
1388 ret.push_back(Vec3f(1,0,0));
1389 ret.push_back(Vec3f(0,1,0));
1390 }
1391 else {
1392 ret.push_back(Vec3f(0,0,1));
1393 ret.push_back(Vec3f(0,-1,0));
1394 if (inc_mirror == true) {
1395 ret.push_back(Vec3f(0,0,-1));
1396 }
1397 float angle = (float)(EMConsts::deg2rad*float(delim["az_max"]));
1398 float y = -cos(angle);
1399 float x = sin(angle);
1400 ret.push_back(Vec3f(x,y,0));
1401 }
1402
1403 return ret;
1404
1405}
virtual Dict get_delimiters(const bool inc_mirror=false) const
Get the altitude and phi angle of the c symmetry, which depends on nysm.
Definition: symmetry.cpp:1249
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 > > 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_mirrorwhether to include the mirror portion of the asymmetric unit

Implements EMAN::Symmetry3D.

Definition at line 1275 of file symmetry.cpp.

1275 {
1276 vector<Vec3f> v = get_asym_unit_points(inc_mirror);
1277 int nsym = params.set_default("nsym",0);
1278
1279 vector<vector<Vec3f> > ret;
1280 if (v.size() == 0) return ret; // nsym == 1 and inc_mirror == true, this is the entire sphere!
1281 if (nsym == 1 && !inc_mirror) {
1282 Vec3f z(0,0,1);
1283 vector<Vec3f> tmp;
1284 tmp.push_back(z);
1285 tmp.push_back(v[1]);
1286 tmp.push_back(v[0]);
1287 ret.push_back(tmp);
1288
1289 vector<Vec3f> tmp2;
1290 tmp2.push_back(z);
1291 tmp2.push_back(v[2]);
1292 tmp2.push_back(v[1]);
1293 ret.push_back(tmp2);
1294
1295 vector<Vec3f> tmp3;
1296 tmp3.push_back(z);
1297 tmp3.push_back(v[3]);
1298 tmp3.push_back(v[2]);
1299 ret.push_back(tmp3);
1300
1301 vector<Vec3f> tmp4;
1302 tmp4.push_back(z);
1303 tmp4.push_back(v[0]);
1304 tmp4.push_back(v[3]);
1305 ret.push_back(tmp4);
1306 }
1307 else if (nsym == 2 && inc_mirror) {
1308 Vec3f x(1,0,0);
1309 vector<Vec3f> tmp;
1310 tmp.push_back(v[1]);
1311 tmp.push_back(v[0]);
1312 tmp.push_back(x);
1313 ret.push_back(tmp);
1314
1315 vector<Vec3f> tmp2;
1316 tmp2.push_back(v[2]);
1317 tmp2.push_back(v[1]);
1318 tmp2.push_back(x);
1319 ret.push_back(tmp2);
1320
1321 vector<Vec3f> tmp3;
1322 tmp3.push_back(v[3]);
1323 tmp3.push_back(v[2]);
1324 tmp3.push_back(x);
1325 ret.push_back(tmp3);
1326
1327 vector<Vec3f> tmp4;
1328 tmp4.push_back(v[0]);
1329 tmp4.push_back(v[3]);
1330 tmp4.push_back(x);
1331 ret.push_back(tmp4);
1332 }
1333 else if (nsym == 2 && !inc_mirror) {
1334 vector<Vec3f> tmp;
1335 tmp.push_back(v[0]);
1336 tmp.push_back(v[2]);
1337 tmp.push_back(v[1]);
1338 ret.push_back(tmp);
1339
1340 vector<Vec3f> tmp2;
1341 tmp2.push_back(v[2]);
1342 tmp2.push_back(v[0]);
1343 tmp2.push_back(v[3]);
1344 ret.push_back(tmp2);
1345 }
1346 else if (v.size() == 3) {
1347 vector<Vec3f> tmp;
1348 tmp.push_back(v[0]);
1349 tmp.push_back(v[2]);
1350 tmp.push_back(v[1]);
1351 ret.push_back(tmp);
1352 }
1353 else if (v.size() == 4) {
1354 vector<Vec3f> tmp;
1355 tmp.push_back(v[0]);
1356 tmp.push_back(v[3]);
1357 tmp.push_back(v[1]);
1358 ret.push_back(tmp);
1359
1360 vector<Vec3f> tmp2;
1361 tmp2.push_back(v[1]);
1362 tmp2.push_back(v[3]);
1363 tmp2.push_back(v[2]);
1364 ret.push_back(tmp2);
1365 }
1366
1367 return ret;
1368}
virtual vector< Vec3f > get_asym_unit_points(bool inc_mirror=false) const
to demarcate the asymmetric unit.
Definition: symmetry.cpp:1370

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

◆ get_delimiters()

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

1249 {
1250 Dict returnDict;
1251 // Get the parameters of interest
1252 int nsym = params.set_default("nsym",0);
1253 if ( nsym <= 0 ) throw InvalidValueException(nsym,"Error, you must specify a positive non zero nsym");
1254
1255 if ( inc_mirror ) returnDict["alt_max"] = 180.0f;
1256 else returnDict["alt_max"] = 90.0f;
1257
1258 returnDict["az_max"] = 360.0f/(float)nsym;
1259
1260 return returnDict;
1261}
#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::CSym::get_desc ( ) const
inlinevirtual

Get a description.

Returns
a clear desciption of this class

Implements EMAN::FactoryBase.

Definition at line 255 of file symmetry.h.

255{ return "C symmetry support"; }

◆ get_max_csym()

virtual int EMAN::CSym::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
the degree of of cyclic symmetry (nsym) - this is the maximum symmetry

Implements EMAN::Symmetry3D.

Definition at line 296 of file symmetry.h.

296{ return params["nsym"]; }

References EMAN::FactoryBase::params.

◆ get_name()

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

Return CSym::NAME.

Returns
the unique name of this class

Implements EMAN::FactoryBase.

Definition at line 250 of file symmetry.h.

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

References NAME.

◆ get_nsym()

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

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.

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

References EMAN::FactoryBase::params.

◆ get_param_types()

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

261 {
262 TypeDict d;
263 d.put("nsym", EMObject::INT, "The symmetry number");
264 return d;
265 }

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

◆ get_sym()

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

1407 {
1408 int nsym = params.set_default("nsym",0);
1409 if ( nsym <= 0 ) throw InvalidValueException(n,"Error, you must specify a positive non zero nsym");
1410
1411 Dict d("type","eman");
1412 // courtesy of Phil Baldwin
1413 d["az"] = (n%nsym) * 360.0f / nsym;
1414 d["alt"] = 0.0f;
1415 d["phi"] = 0.0f;
1416 return Transform(d);
1417}
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_c_sym()

virtual bool EMAN::CSym::is_c_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 320 of file symmetry.h.

320{ return true; }

◆ is_in_asym_unit()

bool CSym::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 1263 of file symmetry.cpp.

1264{
1265 Dict d = get_delimiters(inc_mirror);
1266 float alt_max = d["alt_max"];
1267 float az_max = d["az_max"];
1268
1269 int nsym = params.set_default("nsym",0);
1270 if ( nsym != 1 && azimuth < 0) return false;
1271 if ( altitude <= alt_max && azimuth < az_max ) return true;
1272 return false;
1273}

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

◆ NEW()

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

Factory support function NEW.

Returns
a newly instantiated class of this type

Definition at line 242 of file symmetry.h.

243 {
244 return new CSym();
245 }

References CSym().

◆ operator=()

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

Disallow assignment.

Member Data Documentation

◆ NAME

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: