46 size_t e1 =
AddEdge(idx1, idx2);
47 size_t e2 =
AddEdge(idx2, idx3);
48 size_t e3 =
AddEdge(idx3, idx1);
57 float min_dist = 1e10f;
58 size_t min_idx = (size_t)-1;
62 if (dist < min_dist) {
68 if (min_dist > 1e-6f) {
82 edge.
Set(vert2, vert1);
85 vector<CVect2<size_t> >::iterator iter;
89 return (
size_t(iter -
m_Edges.begin()));
99 vector<int> edge_tris(
m_Edges.size(), 0);
103 for (
int j = 0; j < 3; ++j)
107 vector<size_t> unshared_edges;
108 for (
i = 0;
i < edge_tris.size(); ++
i) {
109 if (edge_tris[
i] == 1)
110 unshared_edges.push_back(
i);
113 vector<size_t> perimeter_vertices;
114 vector<CVect2<float> > perimeter;
121 if (unshared_edges.size() < 3)
124 size_t first_vert =
m_Edges[unshared_edges.back()][0];
125 size_t last_vert =
m_Edges[unshared_edges.back()][1];
127 perimeter_vertices.push_back(first_vert);
128 perimeter_vertices.push_back(last_vert);
130 unshared_edges.pop_back();
132 while (!
done && unshared_edges.size() > 0) {
135 for (
i = 0;
i < unshared_edges.size() && next_edge == -1; ++
i) {
136 if (
m_Edges[unshared_edges[
i]][0] == last_vert) {
137 last_vert =
m_Edges[unshared_edges[
i]][1];
138 if (last_vert == first_vert)
141 perimeter_vertices.push_back(last_vert);
145 else if (
m_Edges[unshared_edges[
i]][1] == last_vert) {
146 last_vert =
m_Edges[unshared_edges[
i]][0];
147 if (last_vert == first_vert)
150 perimeter_vertices.push_back(last_vert);
155 if (next_edge != -1) {
156 unshared_edges.erase(unshared_edges.begin() + next_edge);
163 if (unshared_edges.size() == 0) {
164 for (
i = 0;
i < perimeter_vertices.size(); ++
i)
165 perimeter.push_back(
m_Vertices[perimeter_vertices[
i]]);
std::vector< CVect3< size_t > > m_Triangles
std::vector< CVect2< float > > m_Vertices
size_t AddTri(CVect2< float > &v1p, CVect2< float > &v2p, CVect2< float > &v3p)
size_t AddVertex(CVect2< float > &v)
std::vector< CVect2< float > > GetPerimiter() const
returns empty vec if no perimeter can be found.
std::vector< CVect2< size_t > > m_Edges
size_t AddEdge(size_t vert1, size_t vert2)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
unsigned int
A callback function used to compare two keys in a database.