#include <symmetry.h>
Inheritance diagram for EMAN::CSym:
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< Vec3f > | get_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 Symmetry3D * | NEW () |
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. | |
CSym & | operator= (const CSym &) |
Disallow assignment. |
Definition at line 233 of file symmetry.h.
EMAN::CSym::CSym | ( | ) | [inline] |
virtual EMAN::CSym::~CSym | ( | ) | [inline, virtual] |
EMAN::CSym::CSym | ( | const CSym & | ) | [private] |
Disallow copy construction.
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.
inc_mirror | whether or not to include the mirror portion of the asymmetric unit |
Implements EMAN::Symmetry3D.
Definition at line 1330 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().
01331 { 01332 Dict delim = get_delimiters(inc_mirror); 01333 int nsym = params.set_default("nsym",0); 01334 vector<Vec3f> ret; 01335 01336 if ( nsym == 1 ) { 01337 if (inc_mirror == false ) { 01338 ret.push_back(Vec3f(0,-1,0)); 01339 ret.push_back(Vec3f(1,0,0)); 01340 ret.push_back(Vec3f(0,1,0)); 01341 ret.push_back(Vec3f(-1,0,0)); 01342 } 01343 // else return ret; // an empty vector! this is fine 01344 } 01345 else if (nsym == 2 && !inc_mirror) { 01346 ret.push_back(Vec3f(0,0,1)); 01347 ret.push_back(Vec3f(0,-1,0)); 01348 ret.push_back(Vec3f(1,0,0)); 01349 ret.push_back(Vec3f(0,1,0)); 01350 } 01351 else { 01352 ret.push_back(Vec3f(0,0,1)); 01353 ret.push_back(Vec3f(0,-1,0)); 01354 if (inc_mirror == true) { 01355 ret.push_back(Vec3f(0,0,-1)); 01356 } 01357 float angle = (float)(EMConsts::deg2rad*float(delim["az_max"])); 01358 float y = -cos(angle); 01359 float x = sin(angle); 01360 ret.push_back(Vec3f(x,y,0)); 01361 } 01362 01363 return ret; 01364 01365 }
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
inc_mirror | whether to include the mirror portion of the asymmetric unit |
Implements EMAN::Symmetry3D.
Definition at line 1235 of file symmetry.cpp.
References get_asym_unit_points(), EMAN::FactoryBase::params, EMAN::Dict::set_default(), v, and x.
01235 { 01236 vector<Vec3f> v = get_asym_unit_points(inc_mirror); 01237 int nsym = params.set_default("nsym",0); 01238 01239 vector<vector<Vec3f> > ret; 01240 if (v.size() == 0) return ret; // nsym == 1 and inc_mirror == true, this is the entire sphere! 01241 if (nsym == 1 && !inc_mirror) { 01242 Vec3f z(0,0,1); 01243 vector<Vec3f> tmp; 01244 tmp.push_back(z); 01245 tmp.push_back(v[1]); 01246 tmp.push_back(v[0]); 01247 ret.push_back(tmp); 01248 01249 vector<Vec3f> tmp2; 01250 tmp2.push_back(z); 01251 tmp2.push_back(v[2]); 01252 tmp2.push_back(v[1]); 01253 ret.push_back(tmp2); 01254 01255 vector<Vec3f> tmp3; 01256 tmp3.push_back(z); 01257 tmp3.push_back(v[3]); 01258 tmp3.push_back(v[2]); 01259 ret.push_back(tmp3); 01260 01261 vector<Vec3f> tmp4; 01262 tmp4.push_back(z); 01263 tmp4.push_back(v[0]); 01264 tmp4.push_back(v[3]); 01265 ret.push_back(tmp4); 01266 } 01267 else if (nsym == 2 && inc_mirror) { 01268 Vec3f x(1,0,0); 01269 vector<Vec3f> tmp; 01270 tmp.push_back(v[1]); 01271 tmp.push_back(v[0]); 01272 tmp.push_back(x); 01273 ret.push_back(tmp); 01274 01275 vector<Vec3f> tmp2; 01276 tmp2.push_back(v[2]); 01277 tmp2.push_back(v[1]); 01278 tmp2.push_back(x); 01279 ret.push_back(tmp2); 01280 01281 vector<Vec3f> tmp3; 01282 tmp3.push_back(v[3]); 01283 tmp3.push_back(v[2]); 01284 tmp3.push_back(x); 01285 ret.push_back(tmp3); 01286 01287 vector<Vec3f> tmp4; 01288 tmp4.push_back(v[0]); 01289 tmp4.push_back(v[3]); 01290 tmp4.push_back(x); 01291 ret.push_back(tmp4); 01292 } 01293 else if (nsym == 2 && !inc_mirror) { 01294 vector<Vec3f> tmp; 01295 tmp.push_back(v[0]); 01296 tmp.push_back(v[2]); 01297 tmp.push_back(v[1]); 01298 ret.push_back(tmp); 01299 01300 vector<Vec3f> tmp2; 01301 tmp2.push_back(v[2]); 01302 tmp2.push_back(v[0]); 01303 tmp2.push_back(v[3]); 01304 ret.push_back(tmp2); 01305 } 01306 else if (v.size() == 3) { 01307 vector<Vec3f> tmp; 01308 tmp.push_back(v[0]); 01309 tmp.push_back(v[2]); 01310 tmp.push_back(v[1]); 01311 ret.push_back(tmp); 01312 } 01313 else if (v.size() == 4) { 01314 vector<Vec3f> tmp; 01315 tmp.push_back(v[0]); 01316 tmp.push_back(v[3]); 01317 tmp.push_back(v[1]); 01318 ret.push_back(tmp); 01319 01320 vector<Vec3f> tmp2; 01321 tmp2.push_back(v[1]); 01322 tmp2.push_back(v[3]); 01323 tmp2.push_back(v[2]); 01324 ret.push_back(tmp2); 01325 } 01326 01327 return ret; 01328 }
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.
inc_mirror | whether or not to include the part of the asymmetric unit which contains the mirror projections of the other half |
InvalidValueException | if nsym is less than or equal to zero |
Implements EMAN::Symmetry3D.
Definition at line 1209 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().
01209 { 01210 Dict returnDict; 01211 // Get the parameters of interest 01212 int nsym = params.set_default("nsym",0); 01213 if ( nsym <= 0 ) throw InvalidValueException(nsym,"Error, you must specify a positive non zero nsym"); 01214 01215 if ( inc_mirror ) returnDict["alt_max"] = 180.0f; 01216 else returnDict["alt_max"] = 90.0f; 01217 01218 returnDict["az_max"] = 360.0f/(float)nsym; 01219 01220 return returnDict; 01221 }
virtual string EMAN::CSym::get_desc | ( | ) | const [inline, virtual] |
Get a description.
Implements EMAN::FactoryBase.
Definition at line 255 of file symmetry.h.
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.
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.
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.
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.
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.
n | the rotational symmetry operation number. If n is greater than nsym we take n modulo nsym |
InvalidValueException | if nsym is less than or equal to zero |
Implements EMAN::Symmetry3D.
Definition at line 1367 of file symmetry.cpp.
References InvalidValueException, EMAN::FactoryBase::params, and EMAN::Dict::set_default().
01367 { 01368 int nsym = params.set_default("nsym",0); 01369 if ( nsym <= 0 ) throw InvalidValueException(n,"Error, you must specify a positive non zero nsym"); 01370 01371 Dict d("type","eman"); 01372 // courtesy of Phil Baldwin 01373 d["az"] = (n%nsym) * 360.0f / nsym; 01374 d["alt"] = 0.0f; 01375 d["phi"] = 0.0f; 01376 return Transform(d); 01377 }
virtual bool EMAN::CSym::is_c_sym | ( | ) | const [inline, virtual] |
Returns true - this is indeed a c symmetry object.
Reimplemented from EMAN::Symmetry3D.
Definition at line 320 of file symmetry.h.
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.
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 |
Implements EMAN::Symmetry3D.
Definition at line 1223 of file symmetry.cpp.
References get_delimiters(), EMAN::FactoryBase::params, and EMAN::Dict::set_default().
01224 { 01225 Dict d = get_delimiters(inc_mirror); 01226 float alt_max = d["alt_max"]; 01227 float az_max = d["az_max"]; 01228 01229 int nsym = params.set_default("nsym",0); 01230 if ( nsym != 1 && azimuth < 0) return false; 01231 if ( altitude <= alt_max && azimuth <= az_max ) return true; 01232 return false; 01233 }
static Symmetry3D* EMAN::CSym::NEW | ( | ) | [inline, static] |
Factory support function NEW.
Definition at line 242 of file symmetry.h.
References CSym().
00243 { 00244 return new CSym(); 00245 }
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().