EMAN2
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
EMAN::Symmetry3D Class Referenceabstract

Symmetry3D - A base class for 3D Symmetry objects. More...

#include <symmetry.h>

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

Public Types

typedef vector< vector< Vec3f > >::const_iterator cit
 
typedef vector< vector< Vec3f > >::iterator ncit
 

Public Member Functions

 Symmetry3D ()
 
virtual ~Symmetry3D ()
 
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 unit (this is not strictly true in the case of the PlatonicSym class) More...
 
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 function. More...
 
virtual int get_nsym () const =0
 The total number of unique symmetry operations that will be return by this object when a calling program access Symmetry3D::get_sym. More...
 
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_c_sym () const
 A function that is used to determine if this is a c symmetry object This function is only virtually overidden by the CSym object, which returns true. 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...
 
virtual int get_max_csym () const =0
 The Symmetry3D object must return the maximum degree of symmetry it exhibits about any one axis. More...
 
virtual vector< Vec3fget_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 define its asymmetric unit (with mirror considerations). 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 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 parameters returned by get_delimiters. 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< vector< Vec3f > > get_asym_unit_triangles (bool inc_mirror) const =0
 Get triangles that precisely occlude the projection area of the default asymmetric unit. 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 ()
 
virtual string get_name () const =0
 Get the unique name of this class (especially for factory based instantiation access) More...
 
virtual string get_desc () const =0
 Get a clear, concise description of this class. More...
 
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)
 
virtual TypeDict get_param_types () const =0
 
void insert_params (const Dict &new_params)
 Insert parameters. More...
 
Dict copy_relevant_params (const FactoryBase *const that) const
 

Static Public Member Functions

static vector< Transformget_symmetries (const string &symmetry)
 

Protected Member Functions

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

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

Private Member Functions

 Symmetry3D (const Symmetry3D &)
 Disallow copy construction. More...
 
Symmetry3Doperator= (const Symmetry3D &)
 Disallow assignment. More...
 

Detailed Description

Symmetry3D - A base class for 3D Symmetry objects.

Objects of this type must provide delimiters for the asymmetric unit (get_delimiters), and must also provide all of the rotational symmetric operations (get_sym(const int n)). They must also provide the total number of unique symmetric operations with get_nsym (except in helical symmetry). get_delimiter returns a dictionary with "alt_max" and "az_max" keys, which correspond to the encompassing azimuth and altitude angles of the asymmetric unit. These can be interpreted in a relatively straight forward fashion when dealing with C and D symmetries to demarcate the asymmetric unit, however when dealing with Platonic symmetries the asymmetric unit is not so trivial. see http://blake.bcm.edu/emanwiki/EMAN2/Symmetry for figures and description of what we're doing here, for all the symmetries, and look in the comments of the PlatonicSym classes themselves. It inherits from a factory base, making it amenable to incorporation in EMAN2 style factories

Author
David Woolford with Philip Baldwin and Steven Ludtke
Date
Feb 2008

Definition at line 56 of file symmetry.h.

Member Typedef Documentation

◆ cit

typedef vector<vector<Vec3f>>::const_iterator EMAN::Symmetry3D::cit

Definition at line 59 of file symmetry.h.

◆ ncit

typedef vector<vector<Vec3f>>::iterator EMAN::Symmetry3D::ncit

Definition at line 60 of file symmetry.h.

Constructor & Destructor Documentation

◆ Symmetry3D() [1/2]

Symmetry3D::Symmetry3D ( )

Definition at line 962 of file symmetry.cpp.

int num_triangles
This is stores the number of triangles returned by get_asym_unit_triangles(true)
Definition: symmetry.h:212
vector< vector< Vec3f > > au_sym_triangles
This cache is of size cache_size.
Definition: symmetry.h:214
int cache_size
Have to remember the cache size.
Definition: symmetry.h:210
float ** cached_au_planes
The asymmetric unit planes are cached to provide a great speed up the point_in_which_asym_unit functi...
Definition: symmetry.h:207

◆ ~Symmetry3D()

Symmetry3D::~Symmetry3D ( )
virtual

Definition at line 963 of file symmetry.cpp.

963 {
964 if (cached_au_planes != 0 ) {
966 }
967}
void delete_au_planes()
Clear the asymmetric unit planes cache.
Definition: symmetry.cpp:1059

References cached_au_planes, and delete_au_planes().

◆ Symmetry3D() [2/2]

EMAN::Symmetry3D::Symmetry3D ( const Symmetry3D )
private

Disallow copy construction.

Member Function Documentation

◆ cache_au_planes()

void Symmetry3D::cache_au_planes ( ) const
protected

Establish the asymmetric unit planes cache.

Definition at line 1020 of file symmetry.cpp.

1020 {
1021 if (cached_au_planes == 0 ) {
1022 vector< vector<Vec3f> > au_triangles = get_asym_unit_triangles(true);
1023 num_triangles = au_triangles.size();
1024 cache_size = get_nsym()*au_triangles.size();
1025
1026 cached_au_planes = new float*[cache_size];
1027 float** fit = cached_au_planes;
1028 for(int i =0; i < cache_size; ++i,++fit) {
1029 float *t = new float[4];
1030 *fit = t;
1031 }
1032
1033
1034 int k = 0;
1035 for(int i = 0; i < get_nsym(); ++i) {
1036
1037 for( ncit it = au_triangles.begin(); it != au_triangles.end(); ++it, ++k)
1038 {
1039 // For each given triangle
1040 vector<Vec3f> points = *it;
1041 if ( i != 0 ) {
1042 for (vector<Vec3f>::iterator iit = points.begin(); iit != points.end(); ++iit ) {
1043 // Rotate the points in the triangle so that the triangle occupies the
1044 // space of the current asymmetric unit
1045 *iit = (*iit)*get_sym(i);
1046 }
1047 }
1048
1049 au_sym_triangles.push_back(points);
1050
1051 // Determine the equation of the plane for the points, store it in plane
1052 Util::equation_of_plane(points[0],points[2],points[1],cached_au_planes[k]);
1053 }
1054 }
1055 }
1056 else throw UnexpectedBehaviorException("Attempt to generate a cache when cache exists");
1057}
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.
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
Definition: symmetry.h:60
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.
Definition: util.cpp:1293
#define UnexpectedBehaviorException(desc)
Definition: exception.h:400

References au_sym_triangles, cache_size, cached_au_planes, EMAN::Util::equation_of_plane(), get_asym_unit_triangles(), get_nsym(), get_sym(), num_triangles, and UnexpectedBehaviorException.

Referenced by point_in_which_asym_unit().

◆ delete_au_planes()

void Symmetry3D::delete_au_planes ( )
protected

Clear the asymmetric unit planes cache.

Definition at line 1059 of file symmetry.cpp.

1059 {
1060 if (cached_au_planes == 0 ) throw UnexpectedBehaviorException("Attempt to delete a cache that does not exist");
1061 float** fit = cached_au_planes;
1062 for(int i =0; i < cache_size; ++i,++fit) {
1063 if (*fit == 0) throw UnexpectedBehaviorException("Attempt to delete a cache that does not exist");
1064 delete [] *fit;
1065 *fit = 0;
1066 }
1067
1068 delete [] cached_au_planes;
1069 cached_au_planes = 0;
1070}

References cache_size, cached_au_planes, and UnexpectedBehaviorException.

Referenced by ~Symmetry3D().

◆ gen_orientations()

vector< Transform > Symmetry3D::gen_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).

This is reminiscent of the strategy design pattern

Parameters
generatornamethe string name of the OrientationGenerator, as accessed for the OrientationGenerator factory
parmsthe parameters handed to OrientationGenerator::set_params after initial construction
Returns
a set of orientations in the unit sphere

Definition at line 167 of file symmetry.cpp.

168{
169 ENTERFUNC;
170 vector<Transform> ret;
172 if (g) {
173 ret = g->gen_orientations(this);
174 if( g )
175 {
176 delete g;
177 g = 0;
178 }
179 }
180 else throw;
181
182 EXITFUNC;
183
184 return ret;
185}
Factory is used to store objects to create new instances.
Definition: emobject.h:725
An orientation generator is a kind of class that will generate orientations for a given symmetry If o...
Definition: symmetry.h:1000
virtual vector< Transform > gen_orientations(const Symmetry3D *const sym) const =0
generate orientations given some symmetry type
static string str_to_lower(const string &s)
Return a lower case version of the argument string.
Definition: util.cpp:283
#define ENTERFUNC
Definition: log.h:48
#define EXITFUNC
Definition: log.h:49

References ENTERFUNC, EXITFUNC, EMAN::OrientationGenerator::gen_orientations(), and EMAN::Util::str_to_lower().

Referenced by EMAN::RT3DSphereAligner::xform_align_nbest(), EMAN::RT2Dto3DTreeAligner::xform_align_nbest(), EMAN::RT3DTreeAligner::xform_align_nbest(), and EMAN::RT3DLocalTreeAligner::xform_align_nbest().

◆ get_asym_unit_points()

virtual vector< Vec3f > EMAN::Symmetry3D::get_asym_unit_points ( bool  inc_mirror) const
pure virtual

The Symmetry3D object must be capable of returning an ordered list of points on the unit sphere that define its asymmetric unit (with mirror considerations).

The list can be any length, and must be constructed carefully. If the list consists of points A B and C, then arcs on the unit sphere connecting A to B, then B to C, then C to A must define the asymmetric unit (with or without its mirror portion). i.e. it is a cyclic list, on any length

Parameters
inc_mirrorwhether or not to include the mirror portion of the asymmetric unit
Returns
a vector or points which define a cyclic set of great arcs on the unit sphere. Each point may be connected to the point that proceeds it, and the last point may be connected to the first point, and this demarcates the asymmetric unit.

Implemented in EMAN::CSym, EMAN::DSym, EMAN::HSym, EMAN::PlatonicSym, and EMAN::TetrahedralSym.

Referenced by get_touching_au_transforms().

◆ get_asym_unit_triangles()

virtual vector< vector< Vec3f > > EMAN::Symmetry3D::get_asym_unit_triangles ( bool  inc_mirror) const
pure virtual

Get triangles that precisely occlude the projection area of the default asymmetric unit.

This will be used for collision detection in Symmetry3D::reduce

Parameters
inc_mirrorwhether to include the mirror portion of the asymmetric unit

Implemented in EMAN::CSym, EMAN::DSym, EMAN::HSym, and EMAN::PlatonicSym.

Referenced by cache_au_planes().

◆ get_az_alignment_offset()

virtual float EMAN::Symmetry3D::get_az_alignment_offset ( ) const
inlinevirtual

This functionality is only relevant to platonic symmetries.

But it could grow into functionality for the other symmetries.

Reimplemented in EMAN::TetrahedralSym, EMAN::IcosahedralSym, and EMAN::Icosahedral2Sym.

Definition at line 86 of file symmetry.h.

86{ return 0.0; }

Referenced by EMAN::EmanOrientationGenerator::gen_orientations(), EMAN::EvenOrientationGenerator::gen_orientations(), EMAN::SaffOrientationGenerator::gen_orientations(), and EMAN::PlatonicSym::get_asym_unit_points().

◆ get_delimiters()

virtual Dict EMAN::Symmetry3D::get_delimiters ( const bool  inc_mirror = false) const
pure virtual

Every Symmetry3D object must return a dictionary containing the delimiters that define its asymmetric unit (this is not strictly true in the case of the PlatonicSym class)

Parameters
inc_mirrorwhether or not the mirror part of the asymmetric unit should be included in the consideration
Returns
a dictionary containing atleast "alt_max" and "az_max"

Implemented in EMAN::CSym, EMAN::DSym, EMAN::HSym, and EMAN::PlatonicSym.

Referenced by EMAN::EmanOrientationGenerator::gen_orientations(), EMAN::EvenOrientationGenerator::gen_orientations(), EMAN::SaffOrientationGenerator::gen_orientations(), EMAN::EmanOrientationGenerator::get_orientations_tally(), EMAN::EvenOrientationGenerator::get_orientations_tally(), EMAN::SaffOrientationGenerator::get_orientations_tally(), and get_touching_au_transforms().

◆ get_max_csym()

virtual int EMAN::Symmetry3D::get_max_csym ( ) const
pure virtual

The Symmetry3D object must return the maximum degree of symmetry it exhibits about any one axis.

This function is only called in the AsymmUnitOrientationGenerator.

Implemented in EMAN::CSym, EMAN::DSym, EMAN::HSym, EMAN::TetrahedralSym, EMAN::OctahedralSym, EMAN::IcosahedralSym, and EMAN::Icosahedral2Sym.

Referenced by EMAN::EmanOrientationGenerator::gen_orientations(), EMAN::EmanOrientationGenerator::get_orientations_tally(), and EMAN::PlatonicSym::init().

◆ get_nsym()

virtual int EMAN::Symmetry3D::get_nsym ( ) const
pure virtual

◆ get_sym()

virtual Transform EMAN::Symmetry3D::get_sym ( const int  n) const
pure virtual

Every Symmetry3D object must provide access to the full set of its symmetry operators via this function.

Parameters
nthe symmetry operator number
Returns
a Transform object describing the symmetry operation

Implemented in EMAN::CSym, EMAN::DSym, EMAN::HSym, EMAN::TetrahedralSym, EMAN::OctahedralSym, EMAN::IcosahedralSym, and EMAN::Icosahedral2Sym.

Referenced by cache_au_planes(), EMAN::EmanOrientationGenerator::gen_orientations(), EMAN::Transform::get_sym(), EMAN::Transform::get_sym_proj(), get_syms(), get_touching_au_transforms(), and reduce().

◆ get_symmetries()

vector< Transform > Symmetry3D::get_symmetries ( const string &  symmetry)
static

◆ get_syms()

vector< Transform > Symmetry3D::get_syms ( ) const
virtual

Definition at line 1224 of file symmetry.cpp.

1225{
1226
1227 vector<Transform> ret;
1228// if (t.is_identity()) {
1229 for(int i = 0; i < get_nsym(); ++i ) {
1230 ret.push_back(get_sym(i));
1231 }
1232// } else {
1233// for(int i = 0; i < get_nsym(); ++i ) {
1234// ret.push_back(get_sym(i)*t);
1235// }
1236// }
1237 return ret;
1238}

References get_nsym(), and get_sym().

Referenced by EMAN::BackProjectionReconstructor::finish(), EMAN::RealMedianReconstructor::finish(), get_symmetries(), EMAN::ApplySymProcessor::process(), and EMAN::SegmentSubunitProcessor::process_inplace().

◆ get_touching_au_transforms()

vector< Transform > Symmetry3D::get_touching_au_transforms ( bool  inc_mirror = true) const
virtual

Gets a vector of Transform objects that define the set of asymmetric units that touch the default asymmetric unit.

The 'default asymmetric unit' is defined by the results of Symmetry3d::get_asym_unit_points and is sensitive to whether or not you want to include the mirror part of the asymmetric unit. This function is useful when used in conjunction with Symmetry3D::reduce, and particularly when finding the angular deviation of particles through different stages of iterative Single Particle Reconstruction This function could be expanded to work for an asymmetric unit number supplied by the user.

Parameters
inc_mirrorwhether or not to include the mirror portion of the asymmetric unit
Returns
a vector of Transform objects that map the default asymmetric unit to the neighboring asymmetric unit

Definition at line 1155 of file symmetry.cpp.

1156{
1157 vector<Transform> ret;
1158 vector<int> hit_cache;
1159
1160 vector<Vec3f> points = get_asym_unit_points(inc_mirror);
1161 // Warning, this is a gross hack because it is assuming that the asym_unit_points
1162 // returned by DSym are in a particular orientation with respect to symmetric axes
1163 // if the internals of DSym change it could change what we should do here...
1164 // but for the time being it will do
1165 if (inc_mirror && is_d_sym() && (get_nsym()/2 % 2 == 0)) {
1166 Dict delim = get_delimiters(false);
1167 float angle = (float)(EMConsts::deg2rad*float(delim["az_max"]));
1168 float y = -cos(angle);
1169 float x = sin(angle);
1170 points.push_back(Vec3f(x,y,0));
1171 }
1172 else if ( is_d_sym() && (get_nsym()/2 % 2 == 1)) {
1173 Dict delim = get_delimiters(false);
1174 float angle = float(delim["az_max"])/2.0f;
1175// cout << "Odd dsym using " << angle << endl;
1176 angle *= (float)EMConsts::deg2rad;
1177 float y = -cos(angle);
1178 float x = sin(angle);
1179 points.push_back(Vec3f(x,y,0));
1180
1181 if ( inc_mirror ) {
1182 angle = 3.0f*(float(delim["az_max"]))/2.0f;
1183 angle *= (float)EMConsts::deg2rad;
1184 float y = -cos(angle);
1185 float x = sin(angle);
1186 points.push_back(Vec3f(x,y,0));
1187 }
1188 }
1189
1190 typedef vector<Vec3f>::const_iterator const_point_it;
1191 for(const_point_it point = points.begin(); point != points.end(); ++point ) {
1192
1193 for(int i = 1; i < get_nsym(); ++i) {
1194
1195 if ( find(hit_cache.begin(),hit_cache.end(),i) != hit_cache.end() ) continue;
1196 Transform t = get_sym(i);
1197 Vec3f result = (*point)*t;
1198
1199 if (is_platonic_sym()) {
1200 for(const_point_it tmp = points.begin(); tmp != points.end(); ++tmp ) {
1201 Vec3f tt = result-(*tmp);
1202 if (tt.squared_length() < 0.01f) {
1203 hit_cache.push_back(i);
1204 ret.push_back(t);
1205 }
1206
1207 }
1208 }
1209 else {
1210 result -= *point;
1211 if (result.squared_length() < 0.05f) {
1212 hit_cache.push_back(i);
1213 ret.push_back(t);
1214 }
1215 }
1216 }
1217
1218 }
1219
1220 return ret;
1221}
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
static const double deg2rad
Definition: emobject.h:78
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...
Definition: symmetry.h:94
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 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 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...
Definition: symmetry.h:112
A Transform object is a somewhat specialized object designed specifically for EMAN2/Sparx storage of ...
Definition: transform.h:75
Type squared_length() const
Calculate its squared length.
Definition: vec3.h:362
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_asym_unit_points(), get_delimiters(), get_nsym(), get_sym(), is_d_sym(), is_platonic_sym(), EMAN::Vec3< Type >::squared_length(), x, and y.

◆ in_which_asym_unit()

int Symmetry3D::in_which_asym_unit ( const Transform t3d) const
virtual

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.

Parameters
t3da Transform characterizing an orientation
Returns
the asymmetric unit number the the orientation is in

Definition at line 1001 of file symmetry.cpp.

1002{
1003 // Here it is assumed that final destination of the orientation (as encapsulated in the t3d object) is
1004 // in the z direction, so in essence we will start in the direction z and 'undo' the orientation to get the real
1005 // direction
1006 Vec3f p(0,0,1);
1007
1008 Transform o(t3d);
1009 // Orientations are alway transposed when dealing with asymmetric units, projections,etc
1010 // We take the transpose to 'undo' the transform and get the true direction of the point.
1011 o.invert();
1012 // Figure out where the point would end up. No we could just as easily not transpose and do
1013 // left multiplation (as in what occurs in the FourierReconstructor during slice insertion)
1014 p = o*p;
1015
1016 return point_in_which_asym_unit(p);
1017}
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...
Definition: symmetry.cpp:1072

References EMAN::Transform::invert(), and point_in_which_asym_unit().

Referenced by reduce().

◆ is_c_sym()

virtual bool EMAN::Symmetry3D::is_c_sym ( ) const
inlinevirtual

A function that is used to determine if this is a c symmetry object This function is only virtually overidden by the CSym object, which returns true.

Returns
false - indicating that this is not a helical symmetry object

Reimplemented in EMAN::CSym.

Definition at line 106 of file symmetry.h.

106{ return false; }

Referenced by EMAN::RandomOrientationGenerator::gen_orientations(), and EMAN::OrientationGenerator::get_az_max().

◆ is_d_sym()

virtual bool EMAN::Symmetry3D::is_d_sym ( ) const
inlinevirtual

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.

Returns
false - indicating that this is not a helical symmetry object

Reimplemented in EMAN::DSym.

Definition at line 112 of file symmetry.h.

112{ return false; }

Referenced by EMAN::OrientationGenerator::get_az_max(), and get_touching_au_transforms().

◆ is_h_sym()

virtual bool EMAN::Symmetry3D::is_h_sym ( ) const
inlinevirtual

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.

Returns
false - indicating that this is not a helical symmetry object

Reimplemented in EMAN::HSym.

Definition at line 100 of file symmetry.h.

100{ return false; }

Referenced by EMAN::EmanOrientationGenerator::gen_orientations(), EMAN::EvenOrientationGenerator::gen_orientations(), EMAN::SaffOrientationGenerator::gen_orientations(), EMAN::EmanOrientationGenerator::get_orientations_tally(), EMAN::EvenOrientationGenerator::get_orientations_tally(), and EMAN::SaffOrientationGenerator::get_orientations_tally().

◆ is_in_asym_unit()

virtual bool EMAN::Symmetry3D::is_in_asym_unit ( const float &  altitude,
const float &  azimuth,
const bool  inc_mirror 
) const
pure 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

Implemented in EMAN::CSym, EMAN::DSym, EMAN::HSym, EMAN::PlatonicSym, and EMAN::TetrahedralSym.

Referenced by EMAN::EmanOrientationGenerator::gen_orientations(), EMAN::RandomOrientationGenerator::gen_orientations(), EMAN::EvenOrientationGenerator::gen_orientations(), EMAN::SaffOrientationGenerator::gen_orientations(), EMAN::OptimumOrientationGenerator::gen_orientations(), EMAN::EmanOrientationGenerator::get_orientations_tally(), EMAN::EvenOrientationGenerator::get_orientations_tally(), and EMAN::SaffOrientationGenerator::get_orientations_tally().

◆ is_platonic_sym()

virtual bool EMAN::Symmetry3D::is_platonic_sym ( ) const
inlinevirtual

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.

Returns
false - indicating that this is not a platonic symmetry object

Reimplemented in EMAN::PlatonicSym.

Definition at line 94 of file symmetry.h.

94{ return false; }

Referenced by EMAN::EmanOrientationGenerator::gen_orientations(), EMAN::EvenOrientationGenerator::gen_orientations(), EMAN::SaffOrientationGenerator::gen_orientations(), EMAN::OrientationGenerator::get_az_max(), EMAN::EmanOrientationGenerator::get_orientations_tally(), EMAN::EvenOrientationGenerator::get_orientations_tally(), EMAN::SaffOrientationGenerator::get_orientations_tally(), and get_touching_au_transforms().

◆ is_tet_sym()

virtual bool EMAN::Symmetry3D::is_tet_sym ( ) const
inlinevirtual

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.

Returns
false - indicating that this is not a tetrahedral symmetry object

Reimplemented in EMAN::TetrahedralSym.

Definition at line 118 of file symmetry.h.

118{ return false; }

Referenced by EMAN::OrientationGenerator::get_az_max().

◆ operator=()

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

Disallow assignment.

◆ point_in_which_asym_unit()

int Symmetry3D::point_in_which_asym_unit ( const Vec3f v) const
virtual

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.

Parameters
va Vec3f characterizing a point
Returns
the asymmetric unit number the the orientation is in

Definition at line 1072 of file symmetry.cpp.

1073{
1074 if (cached_au_planes == 0) {
1076 }
1077
1078 float epsNow=0.01f;
1079 int k = 0;
1080 for(int i = 0; i < get_nsym(); ++i) {
1081 for( int j = 0; j < num_triangles; ++j,++k) {
1082 vector<Vec3f> points = au_sym_triangles[k];
1083
1084 float* plane = cached_au_planes[k];
1085 Vec3f tmp = p;
1086
1087 // Determine the intersection of p with the plane - do this by finding out how much p should be scaled by
1088 float scale = plane[0]*tmp[0]+plane[1]*tmp[1]+plane[2]*tmp[2];
1089 if ( scale != 0 )
1090 scale = -plane[3]/scale;
1091 else {
1092 // parralel!
1093 continue;
1094 }
1095
1096 // If the scale factor is less than zero, then p is definitely not in this asymmetric unit
1097 if (scale <= 0) continue;
1098
1099 // This is the intersection point
1100 Vec3f pp = tmp*scale;
1101
1102 // Now we have to see if the point p is inside the region bounded by the points, or if it is outside
1103 // If it is inside the region then p is in this asymmetric unit.
1104
1105 // This formula take from FIXME fill in once I get to work
1106 Vec3f v = points[2]-points[0];
1107 Vec3f u = points[1]-points[0];
1108 Vec3f w = pp - points[0];
1109
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);
1115
1116 float d = 1.0f/(udotv*udotv - udotu*vdotv);
1117 float s = udotv*vdotw - vdotv*udotw;
1118 s *= d;
1119
1120 float t = udotv*udotw - udotu*vdotw;
1121 t *= d;
1122
1123 // We've done a few multiplications, so detect when there are tiny residuals that may throw off the final
1124 // decision
1125// printf("%d, s: %f, t: %f, d: %f\n",i,s,t,d);
1126 if (fabs(s) < Transform::ERR_LIMIT ) s = 0;
1127 if (fabs(t) < Transform::ERR_LIMIT ) t = 0;
1128
1129 // Edited by Muyuan Chen, 2015-08-19
1130 if ( fabs((fabs(s)-1.0)) < Transform::ERR_LIMIT ){
1131 if (s>0)
1132 s = 1;
1133 else
1134 s = -1;
1135 }
1136 if ( fabs((fabs(t)-1.0)) < Transform::ERR_LIMIT ){
1137 if (t>0)
1138 t = 1;
1139 else
1140 t = -1;
1141 }
1142
1143 // The final decision, if this is true then we've hit the jackpot
1144
1145
1146 if ( s >= -epsNow && t >= -epsNow && (s+t) <= 1+epsNow ) {
1147// cout << " i " << i << " j " << j << " s " << s << " t " << t << " s+t " << s+t << endl;
1148 return i;
1149 }
1150 }
1151 }
1152
1153 return -1;
1154}
void cache_au_planes() const
Establish the asymmetric unit planes cache.
Definition: symmetry.cpp:1020
static const float ERR_LIMIT
Definition: transform.h:78
Type dot(const Vec3< Type2 > &v) const
Calculate the dot product of 'this' vector with a second vector.
Definition: vec3.h:373

References au_sym_triangles, cache_au_planes(), cached_au_planes, EMAN::Vec3< Type >::dot(), EMAN::Transform::ERR_LIMIT, get_nsym(), and num_triangles.

Referenced by in_which_asym_unit(), and EMAN::AutoMaskAsymUnit::process_inplace().

Member Data Documentation

◆ au_sym_triangles

vector< vector<Vec3f> > EMAN::Symmetry3D::au_sym_triangles
mutableprotected

This cache is of size cache_size.

Definition at line 214 of file symmetry.h.

Referenced by cache_au_planes(), and point_in_which_asym_unit().

◆ cache_size

int EMAN::Symmetry3D::cache_size
mutableprotected

Have to remember the cache size.

Definition at line 210 of file symmetry.h.

Referenced by cache_au_planes(), and delete_au_planes().

◆ cached_au_planes

float** EMAN::Symmetry3D::cached_au_planes
mutableprotected

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.

Definition at line 207 of file symmetry.h.

Referenced by cache_au_planes(), delete_au_planes(), point_in_which_asym_unit(), and ~Symmetry3D().

◆ num_triangles

int EMAN::Symmetry3D::num_triangles
mutableprotected

This is stores the number of triangles returned by get_asym_unit_triangles(true)

Definition at line 212 of file symmetry.h.

Referenced by cache_au_planes(), and point_in_which_asym_unit().


The documentation for this class was generated from the following files: