-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Siwang Li
committed
Jul 25, 2015
1 parent
7f5c035
commit 92bfd19
Showing
16 changed files
with
1,639 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "HashedId.h" | ||
using namespace UTILITY; | ||
|
||
HashedId::HashedId(){ | ||
_id[0]=_id[1]=_id[2]=_id[3]=-1; | ||
_no=-1; | ||
} | ||
|
||
HashedId::HashedId(int a,int b,const int& no){ | ||
if(a > b) | ||
std::swap(a,b); | ||
_id[0]=-1; | ||
_id[1]=-1; | ||
_id[2]=a; | ||
_id[3]=b; | ||
_no=no; | ||
} | ||
|
||
HashedId::HashedId(int a,int b,int c,const int& no){ | ||
|
||
if(a > b)std::swap(a,b); | ||
if(b > c)std::swap(b,c); | ||
if(a > b)std::swap(a,b); | ||
|
||
_id[0]=a; | ||
_id[1]=b; | ||
_id[2]=c; | ||
_id[3]=-1; | ||
|
||
_no=no; | ||
} | ||
|
||
HashedId::HashedId(const Eigen::Vector3i&pos,const int&edgeLen,const int&no){ | ||
|
||
_id[0]=edgeLen; | ||
_id[1]=pos.x(); | ||
_id[2]=pos.y(); | ||
_id[3]=pos.z(); | ||
_no=no; | ||
} | ||
|
||
bool HashedId::operator==(const HashedId& other) const{ | ||
|
||
return _id[0] == other._id[0] && | ||
_id[1] == other._id[1] && | ||
_id[2] == other._id[2] && | ||
_id[3] == other._id[3]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef _HASHEDID_H_ | ||
#define _HASHEDID_H_ | ||
|
||
#include <boost/unordered_set.hpp> | ||
#include <boost/unordered_map.hpp> | ||
#include <eigen3/Eigen/Dense> | ||
|
||
namespace UTILITY{ | ||
|
||
struct HashedId{ | ||
public: | ||
HashedId(); | ||
HashedId(int a,int b,const int& no); | ||
HashedId(int a,int b,int c,const int& no); | ||
HashedId(const Eigen::Vector3i& pos,const int& edgeLen,const int& no); | ||
bool operator==(const HashedId& other) const; | ||
int _id[4]; | ||
int _no; | ||
}; | ||
|
||
struct HashedIdHash: public boost::hash<HashedId>{ | ||
|
||
std::size_t operator()(const HashedId& i) const{ | ||
const boost::hash<int> h; | ||
return h(i._id[0])+h(i._id[1])+h(i._id[2])+h(i._id[3]); | ||
} | ||
}; | ||
} | ||
|
||
#endif /* _HASHEDID_H_ */ | ||
|
Oops, something went wrong.