40const string CSym::NAME = 
"c";
 
   41const string DSym::NAME = 
"d";
 
   42const string HSym::NAME = 
"h";
 
   43const string TetrahedralSym::NAME = 
"tet";
 
   44const string OctahedralSym::NAME = 
"oct";
 
   45const string IcosahedralSym::NAME = 
"icos";
 
   46const string Icosahedral2Sym::NAME = 
"icos2";
 
   47const string EmanOrientationGenerator::NAME = 
"eman";
 
   48const string SingleOrientationGenerator::NAME = 
"single";
 
   49const string SaffOrientationGenerator::NAME = 
"saff";
 
   50const string EvenOrientationGenerator::NAME = 
"even";
 
   51const string RandomOrientationGenerator::NAME = 
"rand";
 
   52const string OptimumOrientationGenerator::NAME = 
"opt";
 
   59        force_add<TetrahedralSym>();
 
   60        force_add<OctahedralSym>();
 
   61        force_add<IcosahedralSym>();
 
   62        force_add<Icosahedral2Sym>();
 
   67        dump_factory < Symmetry3D > ();
 
   72        return dump_factory_list < Symmetry3D > ();
 
   80        string instancename = Util::str_to_lower(instancename_);
 
   82        unsigned int n = instancename.size();
 
   85        char leadingchar = instancename[0];
 
   86        if (leadingchar == 
'c' || leadingchar == 
'd' || leadingchar == 
'h' ) {
 
   89                        int nsym = atoi(instancename.c_str() + 1);
 
   93                if (leadingchar == 
'c') {
 
   94                        return get(
"c",parms);
 
   96                if (leadingchar == 
'd') {
 
   97                        return get(
"d",parms);
 
   99                if (leadingchar == 
'h') {
 
  101                        float daz=0.,tz=0.,maxtilt=90.0;
 
  105                        if (sscanf(temp.c_str(),
"%d:%d:%f:%f:%f",&nsym,&nstart,&daz,&tz,&maxtilt)<4) {
 
  106                                sscanf(temp.c_str(),
"%d,%d,%f,%f,%f",&nsym,&nstart,&daz,&tz,&maxtilt);
 
  108                        parms[
"nstart"]=nstart;
 
  112                        parms[
"maxtilt"]=maxtilt;
 
  113                        return get(
"h",parms);
 
  118        else if ( instancename == 
"icos" || instancename == 
"oct" || instancename == 
"tet" || instancename == 
"icos2" || instancename == 
"icos5" )
 
  120                if (instancename == 
"icos5") {
 
  121                        instancename = 
"icos";
 
  124                map < string, InstanceType >::iterator fi =
 
  125                                my_instance->my_dict.find(instancename);
 
  126                if (fi != my_instance->my_dict.end()) {
 
  127                        return my_instance->my_dict[instancename] ();
 
  130                string lower = instancename;
 
  131                for (
unsigned int i=0; i<lower.length(); i++) lower[i]=tolower(lower[i]);
 
  133                fi = my_instance->my_dict.find(lower);
 
  134                if (fi != my_instance->my_dict.end()) {
 
  135                        return my_instance->my_dict[lower] ();
 
  147        force_add<EmanOrientationGenerator>();
 
  148        force_add<SingleOrientationGenerator>();
 
  149        force_add<RandomOrientationGenerator>();
 
  150        force_add<EvenOrientationGenerator>();
 
  151        force_add<SaffOrientationGenerator>();
 
  152        force_add<OptimumOrientationGenerator>();
 
  159        dump_factory < OrientationGenerator > ();
 
  164        return dump_factory_list < OrientationGenerator > ();
 
  167vector<Transform> Symmetry3D::gen_orientations(
const string& generatorname, 
const Dict& parms)
 
  170        vector<Transform> ret;
 
  190        if ( sym->
is_d_sym() && alt_iterator == altmax && ( (sym->
get_nsym())/2 % 2 == 1 )) {
 
  192                        azmax_adjusted /= 4.0f;
 
  193                        d_odd_mirror_flag = 
true;
 
  195                else azmax_adjusted /= 2.0f;
 
  197        else if (sym->
is_d_sym() && alt_iterator == altmax && ( (sym->
get_nsym())/2 % 2 == 0 ) && inc_mirror) {
 
  198                azmax_adjusted /= 2.0f;
 
  202        else if (sym->
is_c_sym() && !inc_mirror && alt_iterator == altmax && (sym->
get_nsym() % 2 == 1 ) ){
 
  203                azmax_adjusted /= 2.0f;
 
  208                azmax_adjusted -=  h/4.0f;
 
  213                azmax_adjusted -=  h/4.0f;
 
  240        float delta_soln = 180.0f;
 
  241        float delta_upper_bound = delta_soln;
 
  242        float delta_lower_bound = 0.0f;
 
  248        bool soln_found = 
false;
 
  250        while ( soln_found == 
false ) {
 
  252                if ( tally == n ) soln_found = 
true;
 
  253                else if ( (delta_upper_bound - delta_lower_bound) < 0.0001 ) {
 
  257                        delta_soln = (delta_upper_bound+delta_lower_bound)/2.0f;
 
  259                else if (tally < n) {
 
  260                        delta_upper_bound = delta_soln;
 
  261                        delta_soln = delta_soln - (delta_soln-delta_lower_bound)/2.0f;
 
  264                        delta_lower_bound = delta_soln;
 
  265                        delta_soln = delta_soln  + (delta_upper_bound-delta_soln)/2.0f;
 
  279        if ( phitoo < 0 ) 
throw InvalidValueException(phitoo, 
"Error, if you specify phitoo is must be positive");
 
  288                if (phitoo < 0) 
return false;
 
  290                        for ( 
float p = phitoo; p <= 360.0f-phitoo; p+= phitoo )
 
  292                                d[
"phi"] = fmod(phi+p,360);
 
  318        return altitude==0?360.0f:delta/sin(tmp);
 
  330        float altmax = delimiters[
"alt_max"];
 
  331        float azmax = delimiters[
"az_max"];
 
  335        if (altmax>paltmax) altmax=paltmax;
 
  337        float alt_iterator = 0.0f;
 
  341        if (sym->
is_h_sym()) alt_iterator = delimiters[
"alt_min"];
 
  344        while ( alt_iterator <= altmax ) {
 
  348                if ( (alt_iterator > 0) && ( (azmax/h) < 2.8f) ) h = azmax / 2.1f;
 
  349                else if (alt_iterator == 0) h = azmax;
 
  351                float az_iterator = 0.0f;
 
  353                float azmax_adjusted = azmax;
 
  354                bool d_odd_mirror_flag = 
false;
 
  355                get_az_max(sym,altmax, inc_mirror,alt_iterator, h,d_odd_mirror_flag, azmax_adjusted);
 
  356                if (alt_iterator<paltmin) { alt_iterator += delta; 
continue; }
 
  358                while ( az_iterator <= azmax_adjusted ) {
 
  366                                if ( sym->
is_in_asym_unit(alt_iterator, az_iterator,inc_mirror) == 
false ) {
 
  373                        if ( sym->
is_h_sym() && inc_mirror && alt_iterator != (
float) delimiters[
"alt_min"] ) {
 
  377                        if ( (az_iterator > azmax_adjusted) && d_odd_mirror_flag) {
 
  378                                azmax_adjusted = azmax;
 
  379                                az_iterator += azmax/2.0f;
 
  382                alt_iterator += delta;
 
  385        if (breaksym) 
return tally*sym->
get_nsym();
 
  397        if ( delta > 0 && n > 0 ) 
throw InvalidParameterException(
"Error, the delta and the n arguments are mutually exclusive");
 
  404        bool inc_mirror_real = inc_mirror;
 
  405        if (breaksym) inc_mirror=
true;          
 
  411        float altmax = delimiters[
"alt_max"];
 
  412        float azmax = delimiters[
"az_max"];
 
  416        if (altmax>paltmax) altmax=paltmax;
 
  420        float alt_iterator = 0.0f;
 
  424        if (sym->
is_h_sym()) alt_iterator = delimiters[
"alt_min"];
 
  426        vector<Transform> ret;
 
  427        while ( alt_iterator <= altmax ) {
 
  431                if ( (alt_iterator > 0) && ( (azmax/h) < 2.8f) ) h = azmax / 2.1f;
 
  432                else if (alt_iterator == 0) h = azmax;
 
  434                float az_iterator = 0.0f;
 
  436                float azmax_adjusted = azmax;
 
  438                bool d_odd_mirror_flag = 
false;
 
  439                get_az_max(sym,altmax, inc_mirror,alt_iterator, h,d_odd_mirror_flag, azmax_adjusted);
 
  440                if (alt_iterator<paltmin) { alt_iterator += delta; 
continue; }
 
  443                while ( az_iterator <= azmax_adjusted ) {
 
  452                        if (alt_iterator == 0 && az_iterator > 0){
 
  458                        float alt_soln = alt_iterator;
 
  459                        float az_soln = az_iterator;
 
  470                        if ( perturb &&  alt_soln != 0 ) {
 
  479                        if ( sym->
is_h_sym() && inc_mirror && alt_iterator != (
float) delimiters[
"alt_min"] ) {
 
  480                                add_orientation(ret, az_soln,2.0f*(
float)delimiters[
"alt_min"]-alt_soln);
 
  484                        if ( (az_iterator > azmax_adjusted) && d_odd_mirror_flag) {
 
  485                                azmax_adjusted = azmax;
 
  486                                az_iterator += azmax/2.0f;
 
  489                alt_iterator += delta;
 
  496                int nwithsym=ret.size();        
 
  498                for (
int j=1; j<nsym; j++) {
 
  500                        for (
int i=0; i<nwithsym; i++) {
 
  501                                ret.push_back(ret[i]*t);                
 
  504                if (breaksymreal) 
return ret;
 
  506                if (!inc_mirror_real) {
 
  507                        vector<Transform> ret2;
 
  508                        for (vector<Transform>::iterator t=ret.begin(); t!=ret.end(); ++t) {
 
  509                                if ((*t)[2][2]>=0) ret2.push_back(*t); 
 
  530        float alt_iterator = 0.0f;
 
  532        Transform base(
Dict(
"type",
"eman",
"az",az,
"alt",alt,
"phi",phi));
 
  534        vector<Transform> ret;
 
  550        if ( n <= 0 ) 
throw InvalidParameterException(
"You must specify a positive, non zero n for the Random Orientation Generator");
 
  555        vector<Transform> ret;
 
  558        Dict d(
"type",
"eman");
 
  562                float s = u1*u1 + u2*u2;
 
  563                if ( s > 1.0f ) 
continue;
 
  564                float alpha = 2.0f*sqrtf(1.0f-s);
 
  565                float x = alpha * u1;
 
  566                float y = alpha * u2;
 
  567                float z = 2.0f*s-1.0f;
 
  575                d[
"az"] = azimuth; d[
"phi"] = phi; d[
"alt"] = altitude;
 
  595        float altmax = delimiters[
"alt_max"];
 
  596        float azmax = delimiters[
"az_max"];
 
  601        if (sym->
is_h_sym()) altmin = delimiters[
"alt_min"];
 
  605        for (
float alt = altmin; alt <= altmax; alt += delta) {
 
  608                if ((0.0f == alt)||(180.0f == alt)) {
 
  613                        lt = int(azmax/detaz)-1;
 
  615                        detaz = azmax/(float)lt;
 
  619                for (
int i = 0; i < lt; i++) {
 
  620                        float az = (float)i*detaz;
 
  625                        if ( sym->
is_h_sym() && inc_mirror && alt != altmin ) {
 
  640        if ( delta > 0 && n > 0 ) 
throw InvalidParameterException(
"Error, the delta and the n arguments are mutually exzclusive");
 
  648        float altmax = delimiters[
"alt_max"];
 
  649        float azmax = delimiters[
"az_max"];
 
  654        if (sym->
is_h_sym()) altmin = delimiters[
"alt_min"];
 
  656        vector<Transform> ret;
 
  658        for (
float alt = altmin; alt <= altmax; alt += delta) {
 
  661                if ((0.0f == alt)||(180.0f == alt))  detaz = 360.0f;
 
  671                        if ( sym->
is_h_sym() && inc_mirror && alt != altmin ) {
 
  685        float altmax = delimiters[
"alt_max"];
 
  686        float azmax = delimiters[
"az_max"];
 
  692                altmin = delimiters[
"alt_min"];
 
  694                        altmin -= (float) sym->
get_params()[
"maxtilt"];
 
  699        float s = delta*M_PI/180.0f;
 
  700        float NFactor = 3.6f/s;
 
  701        float wedgeFactor = fabs( Deltaz*(azmax)/720.0f) ;
 
  702        int NumPoints   =  
static_cast<int> (NFactor*NFactor*wedgeFactor);
 
  708        for(
int i = 1; i < NumPoints; ++i ){
 
  709                float z = dz + Deltaz* (float)i/ 
float(NumPoints-1);
 
  710                float r= 
sqrt(1.0f-z*z);
 
  711                az = fmod(az + delta/r,azmax);
 
  728        if ( delta > 0 && n > 0 ) 
throw InvalidParameterException(
"Error, the delta and the n arguments are mutually exclusive");
 
  738        float altmax = delimiters[
"alt_max"];
 
  739        float azmax = delimiters[
"az_max"];
 
  745                altmin = delimiters[
"alt_min"];
 
  747                        altmin -= (float) sym->
get_params()[
"maxtilt"];
 
  752        float s = delta*M_PI/180.0f;
 
  753        float NFactor = 3.6f/s;
 
  754        float wedgeFactor = fabs( Deltaz*(azmax)/720.0f) ;
 
  755        int NumPoints   =  
static_cast<int> (NFactor*NFactor*wedgeFactor);
 
  757        vector<Transform> ret;
 
  762        for(
int i = 1; i < NumPoints; ++i ){
 
  763                float z = dz + Deltaz* (float)i/ 
float(NumPoints-1);
 
  764                float r= 
sqrt(1.0f-z*z);
 
  765                az = fmod(az + delta/r,azmax);
 
  802        if ( delta > 0 && n > 0 ) 
throw InvalidParameterException(
"Error, the delta and the n arguments are mutually exclusive");
 
  814        params[
"inc_mirror"] = 
true;
 
  823        vector<Transform> unitsphereorientations = g->
gen_orientations(unit_sphere);
 
  825        delete unit_sphere; unit_sphere = 0;
 
  829        vector<Transform> ret;
 
  830        for (vector<Vec3f>::const_iterator it = angles.begin(); it != angles.end(); ++it ) {
 
  837        params[
"inc_mirror"] = inc_mirror;
 
  846        vector<Vec3f> points;
 
  848        for (vector<Transform>::const_iterator it = v.begin(); it != v.end(); ++it ) {
 
  849                points.push_back(
Vec3f(0,0,1)*(*it));
 
  852        if ( points.size() >= 2 ) {
 
  854                float percentage = 0.01f;
 
  856                for ( 
int i = 0; i < max_it; ++i ){
 
  860                        float distsquared = (points[p1]-points[p2]).squared_length();
 
  863                        for(
unsigned int j = 0; j < points.size(); ++j) {
 
  864                                for(
unsigned int k = j+1; k < points.size(); ++k) {
 
  865                                        float d = (points[j]-points[k]).squared_length();
 
  866                                        if ( d < distsquared ) {
 
  875                        Vec3f delta = percentage*(points[p2]-points[p1]);
 
  885        for (vector<Vec3f>::const_iterator it = points.begin(); it != points.end(); ++it ) {
 
  888                ret.push_back(
Vec3f(90.0f+azimuth,altitude,0));
 
  969void verify(
const Vec3f& tmp, 
float * plane, 
const string& message )
 
  971        cout << message << 
" residual " << plane[0]*tmp[0]+plane[1]*tmp[1]+plane[2]*tmp[2] + plane[3]  << endl;
 
  981                cout << 
"error, no solution found!" << endl;
 
 1029                        float *t = 
new float[4];
 
 1035                for(
int i = 0; i < 
get_nsym(); ++i) {
 
 1037                        for( 
ncit it = au_triangles.begin(); it != au_triangles.end(); ++it, ++k)
 
 1040                                vector<Vec3f> points = *it;
 
 1042                                        for (vector<Vec3f>::iterator iit = points.begin(); iit != points.end(); ++iit ) {
 
 1080        for(
int i = 0; i < 
get_nsym(); ++i) {
 
 1088                        float scale = plane[0]*tmp[0]+plane[1]*tmp[1]+plane[2]*tmp[2];
 
 1090                                scale = -plane[3]/scale;
 
 1097                        if (scale <= 0) 
continue;
 
 1100                        Vec3f pp = tmp*scale;
 
 1106                        Vec3f v = points[2]-points[0];
 
 1107                        Vec3f u = points[1]-points[0];
 
 1108                        Vec3f w = pp - points[0];
 
 1110                        float udotu = u.
dot(u);
 
 1111                        float udotv = u.
dot(v);
 
 1112                        float udotw = u.
dot(w);
 
 1113                        float vdotv = v.
dot(v);
 
 1114                        float vdotw = v.
dot(w);
 
 1116                        float d = 1.0f/(udotv*udotv - udotu*vdotv);
 
 1117                        float s = udotv*vdotw - vdotv*udotw;
 
 1120                        float t = udotv*udotw - udotu*vdotw;
 
 1146                        if ( s >= -epsNow && t >= -epsNow && (s+t) <= 1+epsNow ) {
 
 1157        vector<Transform>  ret;
 
 1158        vector<int> hit_cache;
 
 1168                float y = -cos(angle);
 
 1169                float x = sin(angle);
 
 1170                points.push_back(
Vec3f(
x,
y,0));
 
 1174                float angle = float(delim[
"az_max"])/2.0f;
 
 1177                float y = -cos(angle);
 
 1178                float x = sin(angle);
 
 1179                points.push_back(
Vec3f(
x,
y,0));
 
 1182                        angle = 3.0f*(float(delim[
"az_max"]))/2.0f;
 
 1184                        float y = -cos(angle);
 
 1185                        float x = sin(angle);
 
 1186                        points.push_back(
Vec3f(
x,
y,0));
 
 1190        typedef vector<Vec3f>::const_iterator const_point_it;
 
 1191        for(const_point_it point = points.begin(); point != points.end(); ++point ) {
 
 1193                for(
int i = 1; i < 
get_nsym(); ++i) {
 
 1195                        if ( find(hit_cache.begin(),hit_cache.end(),i) != hit_cache.end() ) 
continue;
 
 1197                        Vec3f result = (*point)*t;
 
 1200                                for(const_point_it tmp = points.begin(); tmp != points.end(); ++tmp ) {
 
 1201                                        Vec3f tt = result-(*tmp);
 
 1203                                                hit_cache.push_back(i);
 
 1212                                        hit_cache.push_back(i);
 
 1227        vector<Transform> ret;
 
 1229                for(
int i = 0; i < 
get_nsym(); ++i ) {
 
 1243        vector<Transform> ret = sym->
get_syms();
 
 1253        if ( nsym <= 0 ) 
throw InvalidValueException(nsym,
"Error, you must specify a positive non zero nsym");
 
 1255        if ( inc_mirror ) returnDict[
"alt_max"] = 180.0f;
 
 1256        else  returnDict[
"alt_max"] = 90.0f;
 
 1258        returnDict[
"az_max"] = 360.0f/(float)nsym;
 
 1266        float alt_max = d[
"alt_max"];
 
 1267        float az_max = d[
"az_max"];
 
 1270        if ( nsym != 1 && azimuth < 0) 
return false;
 
 1271        if ( altitude <= alt_max && azimuth < az_max ) 
return true;
 
 1279        vector<vector<Vec3f> > ret;
 
 1280        if (v.size() == 0) 
return ret; 
 
 1281        if (nsym == 1 && !inc_mirror) {
 
 1285                tmp.push_back(v[1]);
 
 1286                tmp.push_back(v[0]);
 
 1291                tmp2.push_back(v[2]);
 
 1292                tmp2.push_back(v[1]);
 
 1293                ret.push_back(tmp2);
 
 1297                tmp3.push_back(v[3]);
 
 1298                tmp3.push_back(v[2]);
 
 1299                ret.push_back(tmp3);
 
 1303                tmp4.push_back(v[0]);
 
 1304                tmp4.push_back(v[3]);
 
 1305                ret.push_back(tmp4);
 
 1307        else if (nsym == 2 && inc_mirror) {
 
 1310                tmp.push_back(v[1]);
 
 1311                tmp.push_back(v[0]);
 
 1316                tmp2.push_back(v[2]);
 
 1317                tmp2.push_back(v[1]);
 
 1319                ret.push_back(tmp2);
 
 1322                tmp3.push_back(v[3]);
 
 1323                tmp3.push_back(v[2]);
 
 1325                ret.push_back(tmp3);
 
 1328                tmp4.push_back(v[0]);
 
 1329                tmp4.push_back(v[3]);
 
 1331                ret.push_back(tmp4);
 
 1333        else if (nsym == 2 && !inc_mirror) {
 
 1335                tmp.push_back(v[0]);
 
 1336                tmp.push_back(v[2]);
 
 1337                tmp.push_back(v[1]);
 
 1341                tmp2.push_back(v[2]);
 
 1342                tmp2.push_back(v[0]);
 
 1343                tmp2.push_back(v[3]);
 
 1344                ret.push_back(tmp2);
 
 1346        else if (v.size() == 3) {
 
 1348                tmp.push_back(v[0]);
 
 1349                tmp.push_back(v[2]);
 
 1350                tmp.push_back(v[1]);
 
 1353        else if (v.size() == 4) {
 
 1355                tmp.push_back(v[0]);
 
 1356                tmp.push_back(v[3]);
 
 1357                tmp.push_back(v[1]);
 
 1361                tmp2.push_back(v[1]);
 
 1362                tmp2.push_back(v[3]);
 
 1363                tmp2.push_back(v[2]);
 
 1364                ret.push_back(tmp2);
 
 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));
 
 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));
 
 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));
 
 1398                float y = -cos(angle);
 
 1399                float x = sin(angle);
 
 1411        Dict d(
"type",
"eman");
 
 1413        d[
"az"] = (n%nsym) * 360.0f / nsym;
 
 1425        if ( nsym <= 0 ) 
throw InvalidValueException(nsym,
"Error, you must specify a positive non zero nsym");
 
 1427        returnDict[
"alt_max"] = 90.0f;
 
 1429        if ( inc_mirror )  returnDict[
"az_max"] = 360.0f/(float)nsym;
 
 1430        else returnDict[
"az_max"] = 180.0f/(float)nsym;
 
 1438        float alt_max = d[
"alt_max"];
 
 1439        float az_max = d[
"az_max"];
 
 1443        if ( nsym == 1 && inc_mirror ) {
 
 1444                if (altitude >= 0 && altitude <= alt_max && azimuth < az_max ) 
return true;
 
 1447                if ( altitude >= 0 && altitude <= alt_max && azimuth < az_max && azimuth >= 0 ) 
return true;
 
 1457        Dict d(
"type",
"eman");
 
 1459        if (n >= nsym / 2) {
 
 1460                d[
"az"] = ( (n%nsym) - nsym/2) * 360.0f / (nsym / 2);
 
 1465                d[
"az"] = (n%nsym) * 360.0f / (nsym / 2);
 
 1475        vector<vector<Vec3f> > ret;
 
 1476        if ( (nsym == 1 && inc_mirror == 
false) || (nsym == 2 && inc_mirror)) {
 
 1478                tmp.push_back(v[0]);
 
 1479                tmp.push_back(v[2]);
 
 1480                tmp.push_back(v[1]);
 
 1484                tmp2.push_back(v[2]);
 
 1485                tmp2.push_back(v[0]);
 
 1486                tmp2.push_back(v[3]);
 
 1487                ret.push_back(tmp2);
 
 1489        else if (nsym == 1) {
 
 1493                tmp.push_back(v[1]);
 
 1494                tmp.push_back(v[0]);
 
 1499                tmp2.push_back(v[2]);
 
 1500                tmp2.push_back(v[1]);
 
 1501                ret.push_back(tmp2);
 
 1505                tmp3.push_back(v[3]);
 
 1506                tmp3.push_back(v[2]);
 
 1507                ret.push_back(tmp3);
 
 1511                tmp4.push_back(v[0]);
 
 1512                tmp4.push_back(v[3]);
 
 1513                ret.push_back(tmp4);
 
 1518                tmp.push_back(v[0]);
 
 1519                tmp.push_back(v[2]);
 
 1520                tmp.push_back(v[1]);
 
 1534                if (inc_mirror == 
false ) {
 
 1535                        ret.push_back(
Vec3f(0,0,1));
 
 1536                        ret.push_back(
Vec3f(0,-1,0));
 
 1537                        ret.push_back(
Vec3f(1,0,0));
 
 1538                        ret.push_back(
Vec3f(0,1,0));
 
 1541                        ret.push_back(
Vec3f(0,-1,0));
 
 1542                        ret.push_back(
Vec3f(1,0,0));
 
 1543                        ret.push_back(
Vec3f(0,1,0));
 
 1544                        ret.push_back(
Vec3f(-1,0,0));
 
 1547        else if ( nsym == 2 && inc_mirror ) {
 
 1548                ret.push_back(
Vec3f(0,0,1));
 
 1549                ret.push_back(
Vec3f(0,-1,0));
 
 1550                ret.push_back(
Vec3f(1,0,0));
 
 1551                ret.push_back(
Vec3f(0,1,0));
 
 1555                ret.push_back(
Vec3f(0,0,1));
 
 1556                ret.push_back(
Vec3f(0,-1,0));
 
 1557                float y = -cos(angle);
 
 1558                float x = sin(angle);
 
 1572        if ( nsym <= 0 ) 
throw InvalidValueException(nsym,
"Error, you must specify a positive non zero nsym");
 
 1576        returnDict[
"alt_max"] = 90.0f;
 
 1578        returnDict[
"alt_min"] = 90.0f - maxtilt;
 
 1580        returnDict[
"az_max"] = 360.0f;
 
 1588        float alt_max = d[
"alt_max"];
 
 1589        float alt_min = d[
"alt_min"];
 
 1596        float az_max = d[
"az_max"];
 
 1598        if ( altitude >=alt_min && altitude <= alt_max && azimuth <= az_max && azimuth >= 0 ) 
return true;
 
 1604        vector<vector<Vec3f> > ret;
 
 1614        float az = -(float)delim[
"az_max"];
 
 1617        bool tracing_arcs = 
false;
 
 1620        if ( !tracing_arcs) {
 
 1625                        Dict d(
"type",
"eman");
 
 1634                        ret.push_back(
Vec3f(1,0,0));
 
 1636                        ret.push_back(
Vec3f(0,1,0));
 
 1639                                ret.push_back(
Vec3f(-1,0,0));
 
 1650        int nstart=
params[
"nstart"];
 
 1653        float daz= 
params[
"daz"];
 
 1656        Dict d(
"type",
"eman");
 
 1663        if (n>1 && n%2==0) ii*=-1; 
 
 1664        d[
"az"]=(ii%nstart)*(360.0/nstart)+floor(
float(ii)/nstart)*daz; 
 
 1684        float alpha = acos(1.0f/(sqrtf(3.0f)*tan(cap_sig/2.0f)));
 
 1689        platonic_params[
"theta_c_on_two"] = 1.0f/2.0f*acos( cos(cap_sig)/(1.0f-cos(cap_sig)));
 
 1699        if ( inc_mirror == 
false )
 
 1714        float alt_max = d[
"alt_max"];
 
 1715        float az_max = d[
"az_max"];
 
 1717        if ( altitude >= 0 &&  altitude <= alt_max && azimuth < az_max && azimuth >= 0) {
 
 1734        }       
else return false;
 
 1742        float baldwin_lower_alt_bound = sin(cap_sig/2.0f-azimuth)/tan(theta_c_on_two);
 
 1743        baldwin_lower_alt_bound += sin(azimuth)/tan(alpha);
 
 1744        baldwin_lower_alt_bound *= 1/sin(cap_sig/2.0f);
 
 1745        baldwin_lower_alt_bound = atan(1/baldwin_lower_alt_bound);
 
 1747        return baldwin_lower_alt_bound;
 
 1752        vector<vector<Vec3f> > ret;
 
 1753        if (v.size() == 3) {
 
 1755                tmp.push_back(v[0]);
 
 1756                tmp.push_back(v[2]);
 
 1757                tmp.push_back(v[1]);
 
 1762                tmp.push_back(v[0]);
 
 1763                tmp.push_back(v[2]);
 
 1764                tmp.push_back(v[1]);
 
 1768                tmp2.push_back(v[0]);
 
 1769                tmp2.push_back(v[3]);
 
 1770                tmp2.push_back(v[2]);
 
 1771                ret.push_back(tmp2);
 
 1784        float theta_c = 2*theta_c_on_two;
 
 1786        Vec3f c_on_two = 
Vec3f(0,-sin(theta_c_on_two),cos(theta_c_on_two));
 
 1787        Vec3f c = 
Vec3f(0,-sin(theta_c),cos(theta_c));
 
 1788        ret.push_back(c_on_two);
 
 1791        Vec3f a = 
Vec3f(sin(theta_c)*sin(cap_sig),-sin(theta_c)*cos(cap_sig),cos(theta_c));
 
 1799                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));
 
 1800                ret.push_back(a_on_two);
 
 1804                Dict d(
"type",
"eman");
 
 1809                for (vector<Vec3f>::iterator it = ret.begin(); it != ret.end(); ++it )
 
 1826        float   lvl2 = 180.0f - lvl1;
 
 1827        float   lvl3 = 180.0f;
 
 1830                0,lvl0,0,    0,lvl0,288,   0,lvl0,216,   0,lvl0,144,  0,lvl0,72,
 
 1831                0,lvl1,36,   0,lvl1,324,   0,lvl1,252,   0,lvl1,180,  0,lvl1,108,
 
 1832                72,lvl1,36,  72,lvl1,324,  72,lvl1,252,  72,lvl1,180,  72,lvl1,108,
 
 1833                144,lvl1,36, 144,lvl1,324, 144,lvl1,252, 144,lvl1,180, 144,lvl1,108,
 
 1834                216,lvl1,36, 216,lvl1,324, 216,lvl1,252, 216,lvl1,180, 216,lvl1,108,
 
 1835                288,lvl1,36, 288,lvl1,324, 288,lvl1,252, 288,lvl1,180, 288,lvl1,108,
 
 1836                36,lvl2,0,   36,lvl2,288,  36,lvl2,216,  36,lvl2,144,  36,lvl2,72,
 
 1837                108,lvl2,0,  108,lvl2,288, 108,lvl2,216, 108,lvl2,144, 108,lvl2,72,
 
 1838                180,lvl2,0,  180,lvl2,288, 180,lvl2,216, 180,lvl2,144, 180,lvl2,72,
 
 1839                252,lvl2,0,  252,lvl2,288, 252,lvl2,216, 252,lvl2,144, 252,lvl2,72,
 
 1840                324,lvl2,0,  324,lvl2,288, 324,lvl2,216, 324,lvl2,144, 324,lvl2,72,
 
 1841                0,lvl3,0,    0,lvl3,288,   0,lvl3,216,   0,lvl3,144,   0,lvl3,72
 
 1845        Dict d(
"type",
"eman");
 
 1848                d[
"az"]  = ICOS[idx * 3 ]+90;
 
 1849                d[
"alt"] = ICOS[idx * 3 + 1];
 
 1850                d[
"phi"] = ICOS[idx * 3 + 2]-90;
 
 1854                d[
"az"]  = ICOS[idx * 3 ];
 
 1855                d[
"alt"] = ICOS[idx * 3 + 1];
 
 1856                d[
"phi"] = ICOS[idx * 3 + 2];
 
 1873        static float matrices[60*9] = {
 
 1874                1, 0, 0, 0, 1, 0, 0, 0, 1,
 
 1875                0.30902, -0.80902, 0.5, 0.80902, 0.5, 0.30902, -0.5, 0.30902, 0.80902,
 
 1876                -0.80902, -0.5, 0.30902, 0.5, -0.30902, 0.80902, -0.30902, 0.80902, 0.5,
 
 1877                -0.80902, 0.5, -0.30902, -0.5, -0.30902, 0.80902, 0.30902, 0.80902, 0.5,
 
 1878                0.30902, 0.80902, -0.5, -0.80902, 0.5, 0.30902, 0.5, 0.30902, 0.80902,
 
 1879                -1, 0, 0, 0, -1, 0, 0, 0, 1,
 
 1880                -0.30902, -0.80902, 0.5, 0.80902, -0.5, -0.30902, 0.5, 0.30902, 0.80902,
 
 1881                0.30902, 0.80902, 0.5, -0.80902, 0.5, -0.30902, -0.5, -0.30902, 0.80902,
 
 1882                -0.30902, 0.80902, 0.5, -0.80902, -0.5, 0.30902, 0.5, -0.30902, 0.80902,
 
 1883                -0.5, 0.30902, 0.80902, 0.30902, -0.80902, 0.5, 0.80902, 0.5, 0.30902,
 
 1884                0.5, -0.30902, 0.80902, -0.30902, 0.80902, 0.5, -0.80902, -0.5, 0.30902,
 
 1885                0.80902, 0.5, 0.30902, -0.5, 0.30902, 0.80902, 0.30902, -0.80902, 0.5,
 
 1886                0.80902, -0.5, -0.30902, 0.5, 0.30902, 0.80902, -0.30902, -0.80902, 0.5,
 
 1887                0.5, 0.30902, -0.80902, 0.30902, 0.80902, 0.5, 0.80902, -0.5, 0.30902,
 
 1888                -0.5, -0.30902, -0.80902, -0.30902, -0.80902, 0.5, -0.80902, 0.5, 0.30902,
 
 1889                -0.30902, -0.80902, -0.5, 0.80902, -0.5, 0.30902, -0.5, -0.30902, 0.80902,
 
 1890                0.30902, -0.80902, -0.5, 0.80902, 0.5, -0.30902, 0.5, -0.30902, 0.80902,
 
 1891                -0.30902, 0.80902, -0.5, -0.80902, -0.5, -0.30902, -0.5, 0.30902, 0.80902,
 
 1892                0.5, -0.30902, -0.80902, -0.30902, 0.80902, -0.5, 0.80902, 0.5, 0.30902,
 
 1893                -0.5, 0.30902, -0.80902, 0.30902, -0.80902, -0.5, -0.80902, -0.5, 0.30902,
 
 1894                -0.80902, -0.5, -0.30902, 0.5, -0.30902, -0.80902, 0.30902, -0.80902, 0.5,
 
 1895                0.80902, 0.5, -0.30902, -0.5, 0.30902, -0.80902, -0.30902, 0.80902, 0.5,
 
 1896                0.80902, -0.5, 0.30902, 0.5, 0.30902, -0.80902, 0.30902, 0.80902, 0.5,
 
 1897                -0.80902, 0.5, 0.30902, -0.5, -0.30902, -0.80902, -0.30902, -0.80902, 0.5,
 
 1898                -0.5, -0.30902, 0.80902, -0.30902, -0.80902, -0.5, 0.80902, -0.5, 0.30902,
 
 1899                0.5, 0.30902, 0.80902, 0.30902, 0.80902, -0.5, -0.80902, 0.5, 0.30902,
 
 1900                0, 0, 1, 1, 0, 0, 0, 1, 0,
 
 1901                0, 1, 0, 0, 0, 1, 1, 0, 0,
 
 1902                0, -1, 0, 0, 0, 1, -1, 0, 0,
 
 1903                0, 0, -1, -1, 0, 0, 0, 1, 0,
 
 1904                0, -1, 0, 0, 0, -1, 1, 0, 0,
 
 1905                0, 1, 0, 0, 0, -1, -1, 0, 0,
 
 1906                -0.80902, -0.5, 0.30902, -0.5, 0.30902, -0.80902, 0.30902, -0.80902, -0.5,
 
 1907                0.80902, -0.5, -0.30902, -0.5, -0.30902, -0.80902, 0.30902, 0.80902, -0.5,
 
 1908                0.5, 0.30902, -0.80902, -0.30902, -0.80902, -0.5, -0.80902, 0.5, -0.30902,
 
 1909                -0.30902, -0.80902, -0.5, -0.80902, 0.5, -0.30902, 0.5, 0.30902, -0.80902,
 
 1910                -0.80902, 0.5, -0.30902, 0.5, 0.30902, -0.80902, -0.30902, -0.80902, -0.5,
 
 1911                -0.5, -0.30902, -0.80902, 0.30902, 0.80902, -0.5, 0.80902, -0.5, -0.30902,
 
 1912                -0.5, 0.30902, -0.80902, -0.30902, 0.80902, 0.5, 0.80902, 0.5, -0.30902,
 
 1913                0, 0, -1, 1, 0, 0, 0, -1, 0,
 
 1914                -0.80902, 0.5, 0.30902, 0.5, 0.30902, 0.80902, 0.30902, 0.80902, -0.5,
 
 1915                0.80902, 0.5, -0.30902, 0.5, -0.30902, 0.80902, 0.30902, -0.80902, -0.5,
 
 1916                -0.30902, 0.80902, -0.5, 0.80902, 0.5, 0.30902, 0.5, -0.30902, -0.80902,
 
 1917                0.5, -0.30902, -0.80902, 0.30902, -0.80902, 0.5, -0.80902, -0.5, -0.30902,
 
 1918                -0.80902, -0.5, -0.30902, -0.5, 0.30902, 0.80902, -0.30902, 0.80902, -0.5,
 
 1919                -0.30902, -0.80902, 0.5, -0.80902, 0.5, 0.30902, -0.5, -0.30902, -0.80902,
 
 1920                -0.30902, 0.80902, 0.5, 0.80902, 0.5, -0.30902, -0.5, 0.30902, -0.80902,
 
 1921                1, 0, 0, 0, -1, 0, 0, 0, -1,
 
 1922                0.30902, 0.80902, -0.5, 0.80902, -0.5, -0.30902, -0.5, -0.30902, -0.80902,
 
 1923                0.30902, -0.80902, -0.5, -0.80902, -0.5, 0.30902, -0.5, 0.30902, -0.80902,
 
 1924                -1, 0, 0, 0, 1, 0, 0, 0, -1,
 
 1925                0.80902, 0.5, 0.30902, 0.5, -0.30902, -0.80902, -0.30902, 0.80902, -0.5,
 
 1926                0.30902, -0.80902, 0.5, -0.80902, -0.5, -0.30902, 0.5, -0.30902, -0.80902,
 
 1927                -0.5, 0.30902, 0.80902, -0.30902, 0.80902, -0.5, -0.80902, -0.5, -0.30902,
 
 1928                0, 0, 1, -1, 0, 0, 0, -1, 0,
 
 1929                0.5, -0.30902, 0.80902, 0.30902, -0.80902, -0.5, 0.80902, 0.5, -0.30902,
 
 1930                0.30902, 0.80902, 0.5, 0.80902, -0.5, 0.30902, 0.5, 0.30902, -0.80902,
 
 1931                0.80902, -0.5, 0.30902, -0.5, -0.30902, 0.80902, -0.30902, -0.80902, -0.5,
 
 1932                -0.5, -0.30902, 0.80902, 0.30902, 0.80902, 0.5, -0.80902, 0.5, -0.30902,
 
 1933                0.5, 0.30902, 0.80902, -0.30902, -0.80902, 0.5, 0.80902, -0.5, -0.30902
 
 1938        std::vector<float> matrix(12, 0);
 
 1939        for (
int r = 0; r < 3; ++r) {
 
 1940                for (
int c = 0; c < 3; ++c) {
 
 1941                        matrix[r*4 + c] = matrices[idx*9 + r*3 + c];
 
 1955        float lvl2 = 180.0f;
 
 1958                0,lvl0,0,   0,lvl0,90,    0,lvl0,180,    0,lvl0,270,
 
 1959                0,lvl1,0,   0,lvl1,90,    0,lvl1,180,    0,lvl1,270,
 
 1960                90,lvl1,0,  90,lvl1,90,   90,lvl1,180,   90,lvl1,270,
 
 1961                180,lvl1,0, 180,lvl1,90,  180,lvl1,180,  180,lvl1,270,
 
 1962                270,lvl1,0, 270,lvl1,90,  270,lvl1,180,  270,lvl1,270,
 
 1963                0,lvl2,0,   0,lvl2,90,    0,lvl2,180,    0,lvl2,270
 
 1969        Dict d(
"type",
"eman");
 
 1970        d[
"az"]  = OCT[idx * 3 ];
 
 1971        d[
"alt"] = OCT[idx * 3 + 1];
 
 1972        d[
"phi"] = OCT[idx * 3 + 2];
 
 1982        float alt_max = d[
"alt_max"];
 
 1983        float az_max = d[
"az_max"];
 
 1984        if ( altitude >= 0 &&  altitude <= alt_max && azimuth < az_max && azimuth >= 0) {
 
 1995                        if ( inc_mirror ) 
return true;
 
 2001                } 
else return false;
 
 2002        } 
else return false;
 
 2014                0,lvl0,0,   0,lvl0,120,    0,lvl0,240,
 
 2015                0,lvl1,60,   0,lvl1,180,    0,lvl1,300,
 
 2016                120,lvl1,60, 120,lvl1,180,  120,lvl1,300,
 
 2017                240,lvl1,60, 240,lvl1,180,  240,lvl1,300
 
 2022        Dict d(
"type",
"eman");
 
 2023        d[
"az"]  = TET[idx * 3 ];
 
 2024        d[
"alt"] = TET[idx * 3 + 1];
 
 2025        d[
"phi"] = TET[idx * 3 + 2];
 
 2038        float theta_c = 2*theta_c_on_two;
 
 2040        Vec3f c_on_two = 
Vec3f(0,-sin(theta_c_on_two),cos(theta_c_on_two));
 
 2041        Vec3f c = 
Vec3f(0,-sin(theta_c),cos(theta_c));
 
 2042        ret.push_back(c_on_two);
 
 2045                Vec3f a = 
Vec3f(sin(theta_c)*sin(cap_sig),-sin(theta_c)*cos(cap_sig),cos(theta_c));
 
 2053        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));
 
 2054        ret.push_back(a_on_two);
 
 2058                Dict d(
"type",
"eman");
 
 2063                for (vector<Vec3f>::iterator it = ret.begin(); it != ret.end(); ++it )
 
An encapsulation of cyclic 3D symmetry.
 
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 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 paramet...
 
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.
 
virtual vector< Vec3f > get_asym_unit_points(bool inc_mirror=false) const
to demarcate the asymmetric unit.
 
virtual Transform get_sym(const int n) const
Provides access to the complete set of rotational symmetry operations associated with this symmetry.
 
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 paramet...
 
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.
 
virtual vector< Vec3f > get_asym_unit_points(bool inc_mirror=false) const
 
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.
 
Dict is a dictionary to store <string, EMObject> pair.
 
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...
 
static const double rad2deg
 
static const double deg2rad
 
float get_az_delta(const float &delta, const float &altitude, const int maxcsym) const
Gets the optimum azimuth delta (angular step) for a given altitude, delta and maximum symmetry.
 
virtual int get_orientations_tally(const Symmetry3D *const sym, const float &delta) const
This function returns how many orientations will be generated for a given delta (angular spacing) It ...
 
virtual vector< Transform > gen_orientations(const Symmetry3D *const sym) const
generate orientations given some symmetry type
 
virtual vector< Transform > gen_orientations(const Symmetry3D *const sym) const
Generate even distributed orientations in the asymmetric unit of the symmetry.
 
virtual int get_orientations_tally(const Symmetry3D *const sym, const float &delta) const
This function returns how many orientations will be generated for a given delta (angular spacing) It ...
 
Dict copy_relevant_params(const FactoryBase *const that) const
 
void set_params(const Dict &new_params)
Set new parameters.
 
Dict params
This is the dictionary the stores the parameters of the object.
 
virtual string get_name() const =0
Get the unique name of this class (especially for factory based instantiation access)
 
Dict get_params() const
get a copy of the parameters of this class
 
Factory is used to store objects to create new instances.
 
static T * get(const string &instance_name)
 
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 vector< vector< Vec3f > > get_asym_unit_triangles(bool inc_mirror) const
Get triangles that precisely occlude the projection area of the default asymmetric unit.
 
virtual Transform get_sym(const int n) const
Provides access to the complete set of rotational and translational symmetry operations associated wi...
 
virtual vector< Vec3f > get_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 paramet...
 
virtual Transform get_sym(const int n) const
This function provides access to the unique rotational symmetries of an icosahedron.
 
virtual float get_az_alignment_offset() const
Get the azimuth alignment offset required to ensure that orientations align correctly with symmetric ...
 
static const string NAME
The name of this class - used to access it from factories etc. Should be "icos".
 
virtual Transform get_sym(const int n) const
This function provides access to the unique rotational symmetries of an icosahedron.
 
virtual float get_az_alignment_offset() const
Get the azimuth alignment offset required to ensure that orientations align correctly with symmetric ...
 
virtual Transform get_sym(const int n) const
This function provides access to the unique rotational symmetries of an octahedron.
 
static const string NAME
The name of this class - used to access it from factories etc. Should be "oct".
 
virtual int get_orientations_tally(const Symmetry3D *const sym, const float &delta) const
This function returns how many orientations will be generated for a given delta (angular spacing) It ...
 
virtual vector< Transform > gen_orientations(const Symmetry3D *const sym) const
Generate Saff orientations in the asymmetric unit of the symmetry.
 
vector< Vec3f > optimize_distances(const vector< Transform > &v) const
Optimize the distances in separating points on the unit sphere, as described by the the rotations in ...
 
An orientation generator is a kind of class that will generate orientations for a given symmetry If o...
 
bool add_orientation(vector< Transform > &v, const float &az, const float &alt) const
This functions adds one or more Transform objects to the vector v, depending on the parameters stored...
 
virtual vector< Transform > gen_orientations(const Symmetry3D *const sym) const =0
generate orientations given some symmetry type
 
float get_optimal_delta(const Symmetry3D *const sym, const int &n) const
This function gets the optimal value of the delta (or angular spacing) of the orientations based on a...
 
virtual int get_orientations_tally(const Symmetry3D *const sym, const float &delta) const =0
This function returns how many orientations will be generated for a given delta (angular spacing) It ...
 
void get_az_max(const Symmetry3D *const sym, const float &altmax, const bool inc_mirror, const float &alt_iterator, const float &h, bool &d_odd_mirror_flag, float &azmax_adjusted) const
 
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_...
 
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.
 
virtual vector< Vec3f > get_asym_unit_points(bool inc_mirror=false) const
 
void init()
Init - Called to initialize platonic_params, should be called in the constructor of all Platonic soli...
 
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 ...
 
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 paramet...
 
Dict platonic_params
A dictionary that stores important angles, in radians.
 
static const string NAME
The name of this class - used to access it from factories etc.
 
virtual vector< Transform > gen_orientations(const Symmetry3D *const sym) const
Generate random orientations in the asymmetric unit of the symmetry.
 
virtual int get_orientations_tally(const Symmetry3D *const sym, const float &delta) const
This function returns how many orientations will be generated for a given delta (angular spacing) It ...
 
virtual vector< Transform > gen_orientations(const Symmetry3D *const sym) const
Generate Saff orientations in the asymmetric unit of the symmetry.
 
virtual vector< Transform > gen_orientations(const Symmetry3D *const sym) const
generate orientations given some symmetry type
 
virtual int get_orientations_tally(const Symmetry3D *const sym, const float &delta) const
This function returns how many orientations will be generated for a given delta (angular spacing) It ...
 
Symmetry3D - A base class for 3D Symmetry objects.
 
int num_triangles
This is stores the number of triangles returned by get_asym_unit_triangles(true)
 
vector< vector< Vec3f > > au_sym_triangles
This cache is of size cache_size.
 
void cache_au_planes() const
Establish the asymmetric unit planes cache.
 
virtual bool is_c_sym() const
A function that is used to determine if this is a c symmetry object This function is only virtually o...
 
virtual bool is_h_sym() const
A function that is used to determine if this is a Helical symmetry object This function is only virtu...
 
virtual int get_max_csym() const =0
The Symmetry3D object must return the maximum degree of symmetry it exhibits about any one axis.
 
virtual bool is_tet_sym() const
A function that is used to determine if this is the tetrahedral symmetry object This function is only...
 
virtual vector< Transform > get_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 asy...
 
virtual int get_nsym() const =0
The total number of unique symmetry operations that will be return by this object when a calling prog...
 
virtual vector< vector< Vec3f > > get_asym_unit_triangles(bool inc_mirror) const =0
Get triangles that precisely occlude the projection area of the default asymmetric unit.
 
static vector< Transform > get_symmetries(const string &symmetry)
 
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 un...
 
int cache_size
Have to remember the cache size.
 
virtual bool is_platonic_sym() const
A function that is used to determine if this is a platonic symmetry object This function is only virt...
 
void delete_au_planes()
Clear the asymmetric unit planes cache.
 
virtual vector< Vec3f > get_asym_unit_points(bool inc_mirror) const =0
The Symmetry3D object must be capable of returning an ordered list of points on the unit sphere that ...
 
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 'n...
 
virtual vector< Transform > get_syms() const
 
virtual bool is_in_asym_unit(const float &altitude, const float &azimuth, const bool inc_mirror) const =0
A function to be used when generating orientations over portion of the unit sphere defined by paramet...
 
float ** cached_au_planes
The asymmetric unit planes are cached to provide a great speed up the point_in_which_asym_unit functi...
 
virtual Transform get_sym(const int n) const =0
Every Symmetry3D object must provide access to the full set of its symmetry operators via this functi...
 
vector< vector< Vec3f > >::iterator ncit
 
virtual Dict get_delimiters(const bool inc_mirror=false) const =0
Every Symmetry3D object must return a dictionary containing the delimiters that define its asymmetric...
 
virtual float get_az_alignment_offset() const
This functionality is only relevant to platonic symmetries.
 
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 o...
 
virtual vector< Vec3f > get_asym_unit_points(bool inc_mirror=false) const
 
virtual float get_az_alignment_offset() const
Get the azimuth alignment offset required to ensure that orientations align correctly with symmetric ...
 
virtual Transform get_sym(const int n) const
This function provides access to the unique rotational symmetries of a tetrahedron.
 
virtual bool is_in_asym_unit(const float &altitude, const float &azimuth, const bool inc_mirror) const
In tetrahedral symmetry special consideration must be taken when generating orientations in the asymm...
 
static string str_to_lower(const string &s)
Return a lower case version of the argument string.
 
static float get_frand(int low, int high)
Get a float random number between low and high, [low, high)
 
static int get_min(int f1, int f2)
Get the minimum of 2 numbers.
 
static void equation_of_plane(const Vec3f &p1, const Vec3f &p2, const Vec3f &p3, float *plane)
Determine the equation of a plane that intersects 3 points in 3D space.
 
static float get_gauss_rand(float mean, float sigma)
Get a Gaussian random number.
 
Type squared_length() const
Calculate its squared length.
 
Type dot(const Vec3< Type2 > &v) const
Calculate the dot product of 'this' vector with a second vector.
 
float normalize()
Normalize the vector and return its length before the normalization.
 
EMData * sqrt() const
return square root of current image
 
#define InvalidParameterException(desc)
 
#define InvalidValueException(val, desc)
 
#define NotExistingObjectException(objname, desc)
 
#define UnexpectedBehaviorException(desc)
 
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 asymmetr...
 
void dump_orientgens()
Dumps useful information about the OrientationGenerator factory.
 
map< string, vector< string > > dump_symmetries_list()
dump_symmetries_list, useful for obtaining symmetry information
 
map< string, vector< string > > dump_orientgens_list()
Can be used to get useful information about the OrientationGenerator factory.
 
void dump_symmetries()
dump symmetries, useful for obtaining symmetry information
 
void verify(const Vec3f &tmp, float *plane, const string &message)