Last active
August 29, 2015 14:18
-
-
Save pranavkantgaur/43332452b5c52747dd80 to your computer and use it in GitHub Desktop.
Experimenting with beta pointers in LCC associated with infinite vertex.
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
#include <iostream> | |
#include <map> | |
#include <CGAL/Delaunay_triangulation_3.h> | |
#include <CGAL/Linear_cell_complex.h> | |
#include <CGAL/Linear_cell_complex_constructors.h> | |
using namespace std; | |
using namespace CGAL; | |
typedef Exact_predicates_inexact_constructions_kernel K; | |
typedef Linear_cell_complex_traits<3, K> Traits; | |
typedef Linear_cell_complex<3,3, Traits> LCC; | |
typedef Delaunay_triangulation_3<K> Delaunay; | |
typedef Point_3<K> Point; | |
LCC lcc; | |
static size_t nDarts = 0; | |
int infiniteVertexMark; | |
void markInfiniteVertexDart(LCC::Dart_handle d) | |
{ | |
if (!lcc.is_marked(d, infiniteVertexMark)) | |
{ | |
lcc.mark(d, infiniteVertexMark); | |
nDarts++; | |
d = lcc.beta(d, 2, 1); | |
markInfiniteVertexDart(d); | |
d = lcc.beta(d, 3, 1); | |
markInfiniteVertexDart(d); | |
} | |
return; | |
} | |
/*! \fn int main() | |
* \brief Main procedure | |
*/ | |
int main() | |
{ | |
vector<Point> ptVector; | |
// create a cube | |
ptVector.push_back(Point(0, 0, 0)); | |
ptVector.push_back(Point(0, 0, 1)); | |
ptVector.push_back(Point(0, 1, 0)); | |
ptVector.push_back(Point(0, 1, 1)); | |
ptVector.push_back(Point(1, 0, 0)); | |
ptVector.push_back(Point(1, 0, 1)); | |
ptVector.push_back(Point(1, 1, 0)); | |
ptVector.push_back(Point(1, 1, 1)); | |
// compute Delaunay triangulation | |
Delaunay DT; | |
DT.insert(ptVector.begin(), ptVector.end()); | |
map<Delaunay::Cell_handle, LCC::Dart_handle>* DTToLCCMap = NULL; | |
// import DT to LCC | |
LCC::Dart_handle dartToInfiniteVertex = import_from_triangulation_3(lcc, DT, DTToLCCMap); | |
// mark all darts defining infinite vertex | |
infiniteVertexMark = lcc.get_new_mark(); | |
if (infiniteVertexMark == -1) | |
exit(0); | |
// Marking all darts associated with segments incident on the infinite vertex. | |
size_t nSegments = 0; | |
for (LCC::One_dart_per_incident_cell_range<1, 0>::iterator segIter = lcc.one_dart_per_incident_cell<1, 0>(dartToInfiniteVertex).begin(), segIterEnd = lcc.one_dart_per_incident_cell<1, 0>(dartToInfiniteVertex).end(); segIter != segIterEnd; segIter++) | |
{ | |
lcc.mark(segIter, infiniteVertexMark); | |
nSegments++; | |
} | |
cout << "Number of segments incident on the infinite vertex: " << nSegments << "\n"; | |
// reuse the mark | |
lcc.free_mark(infiniteVertexMark); | |
infiniteVertexMark = lcc.get_new_mark(); | |
if (infiniteVertexMark == -1) | |
exit(0); | |
// Marking all darts associated with the infinite vertex. | |
markInfiniteVertexDart(dartToInfiniteVertex); | |
cout << "Number of darts associated with the infinite vertex: " << nDarts << "\n"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment