00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "VoronoiCell.hpp"
00031
00032 bool VoronoiCell::EqualFaces(Face<3>& face1, bool orientation1, Face<3>& face2, bool orientation2)
00033 {
00034 if ( orientation1 == orientation2)
00035 {
00036 return face1==face2;
00037 }
00038 else
00039 {
00040 Face<3> face3=-face2;
00041 return face1==face3;
00042 }
00043 };
00044
00045 bool VoronoiCell::operator==(VoronoiCell& otherCell)
00046 {
00047 if ( mFaces.size() != otherCell.mFaces.size() )
00048 {
00049 return false;
00050 }
00051
00052 std::vector< bool > other_faces_matched;
00053
00054 std::vector< Face<3>* >::iterator this_face_iterator=mFaces.begin();
00055 std::vector< bool >::iterator this_orientation_iterator=mOrientations.begin();
00056
00057 while (this_face_iterator!=mFaces.end())
00058 {
00059 std::vector< Face<3>* >::iterator other_face_iterator=otherCell.mFaces.begin();
00060 std::vector< bool >::iterator other_orientation_iterator=otherCell.mOrientations.begin();
00061 while ( other_face_iterator != otherCell.mFaces.end()
00062 && !EqualFaces(**this_face_iterator, *this_orientation_iterator,
00063 **other_face_iterator, *other_orientation_iterator) )
00064 {
00065 other_face_iterator++;
00066 other_orientation_iterator++;
00067 }
00068 if (other_face_iterator == otherCell.mFaces.end())
00069 {
00070 return false;
00071 }
00072 this_face_iterator++;
00073 this_orientation_iterator++;
00074 }
00075 return true;
00076 };
00077
00078 c_vector<double, 3>& VoronoiCell::rGetVoronoiCellCentre()
00079 {
00080 return mCellCentre;
00081 };