Skip to content

Commit

Permalink
Merge pull request #43 from bkhanal-11/main
Browse files Browse the repository at this point in the history
Fixed CGAL conditions
  • Loading branch information
LiangliangNan authored Mar 12, 2024
2 parents 87db6ff + 5a96aea commit 8923228
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions code/Example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ int main(int argc, char **argv)
Logger::initialize();

// input point cloud file name
const std::string input_file = std::string(POLYFIT_CODE_DIR) + "/../data/toy_data.bvg";
const std::string input_file = (argc > 1) ? argv[1] : std::string(POLYFIT_CODE_DIR) + "/../data/toy_data.bvg";
// output mesh file name
const std::string output_file = std::string(POLYFIT_CODE_DIR) + "/../data/toy_data-result.obj";
const std::string output_file = (argc > 2) ? argv[2] : std::string(POLYFIT_CODE_DIR) + "/../data/toy_data-result.obj";

// below are the default parameters (change these when necessary)
Method::lambda_data_fitting = 0.43;
Expand Down
52 changes: 26 additions & 26 deletions code/method/alpha_shape_CGAL4.10_and_earlier.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class Alpha_shape_2 : public Dt

typedef typename internal::Alpha_nt_selector_2<Gt,ExactAlphaComparisonTag>::Type_of_alpha Type_of_alpha;
//check simplices are correctly instantiated
CGAL_static_assertion( (boost::is_same<Type_of_alpha,typename Dt::Face::FT>::value) );
CGAL_static_assertion( (boost::is_same<Type_of_alpha,typename Dt::Vertex::FT>::value) );
static_assert( (boost::is_same<Type_of_alpha,typename Dt::Face::FT>::value) );
static_assert( (boost::is_same<Type_of_alpha,typename Dt::Vertex::FT>::value) );

typedef Type_of_alpha NT;
typedef Type_of_alpha FT;
Expand Down Expand Up @@ -851,7 +851,7 @@ Alpha_shape_2<Dt,EACT>::initialize_interval_edge_map()
{
// both faces are infinite by definition unattached
// the edge is finite by construction
CGAL_triangulation_precondition((is_infinite(pNeighbor)
CGAL_precondition((is_infinite(pNeighbor)
&& is_infinite(pFace)));
interval = make_triple(squared_radius(pFace, i),
Infinity,
Expand All @@ -861,7 +861,7 @@ Alpha_shape_2<Dt,EACT>::initialize_interval_edge_map()
else
{ // is_infinite(pNeighbor)

CGAL_triangulation_precondition((is_infinite(pNeighbor)
CGAL_precondition((is_infinite(pNeighbor)
&& !is_infinite(pFace)));
if (is_attached(pFace, i))
interval = make_triple(UNDEFINED,
Expand Down Expand Up @@ -1111,7 +1111,7 @@ Alpha_shape_2<Dt,EACT>::update_alpha_shape_vertex_list()const {
// which might be infinity
// write the vertex
v = (*vertex_alpha_it).second;
CGAL_triangulation_assertion((classify(v) == REGULAR));
CGAL_assertion((classify(v) == REGULAR));
Alpha_shape_vertices_list.push_back(v);
}
}
Expand All @@ -1124,7 +1124,7 @@ Alpha_shape_2<Dt,EACT>::update_alpha_shape_vertex_list()const {
++vertex_alpha_it)
{
v = (*vertex_alpha_it).second;
CGAL_triangulation_assertion((classify(v) == SINGULAR));
CGAL_assertion((classify(v) == SINGULAR));

Alpha_shape_vertices_list.push_back(v);
}
Expand Down Expand Up @@ -1161,7 +1161,7 @@ Alpha_shape_2<Dt,EACT>::update_alpha_shape_edges_list() const
{
pInterval = &(*edge_alpha_it).first;

CGAL_triangulation_assertion(pInterval->second != Infinity);
CGAL_assertion(pInterval->second != Infinity);
// since this happens only for convex hull of dimension 2
// thus singular

Expand All @@ -1173,7 +1173,7 @@ Alpha_shape_2<Dt,EACT>::update_alpha_shape_edges_list() const
// and alpha is smaller than the upper boundary
// which might be infinity
// visualize the boundary
CGAL_triangulation_assertion((classify((*edge_alpha_it).second.first,
CGAL_assertion((classify((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second)
== REGULAR));
Alpha_shape_edges_list.push_back(Edge((*edge_alpha_it).second.first,
Expand All @@ -1193,7 +1193,7 @@ Alpha_shape_2<Dt,EACT>::update_alpha_shape_edges_list() const

if (pInterval->first == UNDEFINED)
{
CGAL_triangulation_assertion(pInterval->second != Infinity);
CGAL_assertion(pInterval->second != Infinity);
// since this happens only for convex hull of dimension 2
// thus singular

Expand All @@ -1205,7 +1205,7 @@ Alpha_shape_2<Dt,EACT>::update_alpha_shape_edges_list() const
// and alpha is smaller than the upper boundary
// which might be infinity
// visualize the boundary
CGAL_triangulation_assertion((classify((*edge_alpha_it).second.first,
CGAL_assertion((classify((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second)
== REGULAR));
Alpha_shape_edges_list.push_back(Edge((*edge_alpha_it).second.first,
Expand All @@ -1221,7 +1221,7 @@ Alpha_shape_2<Dt,EACT>::update_alpha_shape_edges_list() const
// if alpha is smaller than the upper boundary
// which might be infinity
// visualize the boundary
CGAL_triangulation_assertion(((classify((*edge_alpha_it).second.first,
CGAL_assertion(((classify((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second)
== REGULAR)
|| (classify((*edge_alpha_it).second.first,
Expand Down Expand Up @@ -1326,7 +1326,7 @@ Alpha_shape_2<Dt,EACT>::number_of_solid_components(const Type_of_alpha& alpha) c
++face_it)
{
Face_handle pFace = face_it;
CGAL_triangulation_postcondition( pFace != NULL);
CGAL_postcondition( pFace != NULL);

if (classify(pFace, alpha) == INTERIOR){
Data& data = marked_face_set[pFace];
Expand Down Expand Up @@ -1360,7 +1360,7 @@ Alpha_shape_2<Dt,EACT>::traverse(const Face_handle& pFace,
for (int i=0; i<3; i++)
{
pNeighbor = fh->neighbor(i);
CGAL_triangulation_assertion(pNeighbor != NULL);
CGAL_assertion(pNeighbor != NULL);
if (classify(pNeighbor, alpha) == INTERIOR){
Data& data = marked_face_set[pNeighbor];
if(data == false){
Expand Down Expand Up @@ -1587,7 +1587,7 @@ Alpha_shape_2<Dt,EACT>::op_ostream(std::ostream& os) const
// write the vertex

v = (*vertex_alpha_it).second;
CGAL_triangulation_assertion((classify(v) ==
CGAL_assertion((classify(v) ==
Alpha_shape_2<Dt,EACT>::REGULAR));
// if we used Edelsbrunner and Muecke's definition
// regular means incident to a higher-dimensional face
Expand All @@ -1610,7 +1610,7 @@ Alpha_shape_2<Dt,EACT>::op_ostream(std::ostream& os) const

pInterval = &(*edge_alpha_it).first;

CGAL_triangulation_assertion(pInterval->second != Infinity);
CGAL_assertion(pInterval->second != Infinity);
// since this happens only for convex hull of dimension 1
// thus singular

Expand Down Expand Up @@ -1638,10 +1638,10 @@ Alpha_shape_2<Dt,EACT>::op_ostream(std::ostream& os) const
f = pNeighbor;
}

CGAL_triangulation_assertion((classify(f) ==
CGAL_assertion((classify(f) ==
Alpha_shape_2<Dt,EACT>::INTERIOR));

CGAL_triangulation_assertion((classify(f, i) ==
CGAL_assertion((classify(f, i) ==
Alpha_shape_2<Dt,EACT>::REGULAR));

os << V[f->vertex(f->ccw(i))] << ' '
Expand Down Expand Up @@ -1673,7 +1673,7 @@ Alpha_shape_2<Dt,EACT>::op_ostream(std::ostream& os) const
// write the vertex

v = (*vertex_alpha_it).second;
CGAL_triangulation_assertion((classify(v) ==
CGAL_assertion((classify(v) ==
Alpha_shape_2<Dt,EACT>::REGULAR));
V[v] = number_of_vertices++;
os << v->point() << std::endl;
Expand All @@ -1687,7 +1687,7 @@ Alpha_shape_2<Dt,EACT>::op_ostream(std::ostream& os) const
{

v = (*vertex_alpha_it).second;
CGAL_triangulation_assertion((classify(v) ==
CGAL_assertion((classify(v) ==
Alpha_shape_2<Dt,EACT>::SINGULAR));

V[v] = number_of_vertices++;
Expand Down Expand Up @@ -1734,7 +1734,7 @@ Alpha_shape_2<Dt,EACT>::op_ostream(std::ostream& os) const
pInterval->second <= get_alpha())
{

CGAL_triangulation_assertion((classify(f, i) ==
CGAL_assertion((classify(f, i) ==
Alpha_shape_2<Dt,EACT>::REGULAR));
// assure that all vertices are in ccw order
if (classify(f) == Alpha_shape_2<Dt,EACT>::EXTERIOR)
Expand All @@ -1748,7 +1748,7 @@ Alpha_shape_2<Dt,EACT>::op_ostream(std::ostream& os) const
f = pNeighbor;
}

CGAL_triangulation_assertion((classify(f) ==
CGAL_assertion((classify(f) ==
Alpha_shape_2<Dt,EACT>::INTERIOR));

os << V[f->vertex(f->ccw(i))] << ' '
Expand All @@ -1764,7 +1764,7 @@ Alpha_shape_2<Dt,EACT>::op_ostream(std::ostream& os) const
// write the singular edges
if (pInterval->first != UNDEFINED)
{
CGAL_triangulation_assertion((classify(f, i) ==
CGAL_assertion((classify(f, i) ==
Alpha_shape_2<Dt,EACT>::SINGULAR));
os << V[f->vertex(f->ccw(i))] << ' '
<< V[f->vertex(f->cw(i))] << std::endl;
Expand Down Expand Up @@ -1830,7 +1830,7 @@ Alpha_shape_2<Dt,EACT>::Output ()
// which might be infinity
// visualize the boundary

CGAL_triangulation_assertion((classify((*edge_alpha_it).second.first,
CGAL_assertion((classify((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second) ==
REGULAR));

Expand Down Expand Up @@ -1861,7 +1861,7 @@ Alpha_shape_2<Dt,EACT>::Output ()
if (pInterval->first == UNDEFINED)
{

CGAL_triangulation_assertion(pInterval->second != Infinity);
CGAL_assertion(pInterval->second != Infinity);
// since this happens only for convex hull of dimension 1
// thus singular

Expand All @@ -1874,7 +1874,7 @@ Alpha_shape_2<Dt,EACT>::Output ()
// which might be infinity
// visualize the boundary

CGAL_triangulation_assertion((classify((*edge_alpha_it).second.first,
CGAL_assertion((classify((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second) ==
REGULAR));
L.push_back((segment((*edge_alpha_it).second.first,
Expand All @@ -1895,7 +1895,7 @@ Alpha_shape_2<Dt,EACT>::Output ()
// which might be infinity
// visualize the boundary

CGAL_triangulation_assertion(((classify((*edge_alpha_it).second.first,
CGAL_assertion(((classify((*edge_alpha_it).second.first,
(*edge_alpha_it).second.second) ==
REGULAR) ||
(classify((*edge_alpha_it).second.first,
Expand Down
4 changes: 2 additions & 2 deletions code/method/alpha_shape_CGAL4.11_and_later.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class Alpha_shape_2 : public Dt
typedef Type_of_alpha FT;

//check simplices are correctly instantiated
CGAL_static_assertion( (boost::is_same<NT, typename Dt::Face::NT>::value) );
CGAL_static_assertion( (boost::is_same<NT, typename Dt::Vertex::NT>::value) );
static_assert( (boost::is_same<NT, typename Dt::Face::NT>::value) );
static_assert( (boost::is_same<NT, typename Dt::Vertex::NT>::value) );

typedef typename Dt::Point Point;

Expand Down

0 comments on commit 8923228

Please sign in to comment.