mirror of https://github.com/CGAL/cgal
Remove trailing whitespace / tabs
This commit is contained in:
parent
fb8463f470
commit
580a1efd5c
|
|
@ -74,7 +74,7 @@ operator<<(VRML_2_ostream& os,
|
||||||
os << Indent << " ";
|
os << Indent << " ";
|
||||||
for (int i=0; i<4; i++)
|
for (int i=0; i<4; i++)
|
||||||
if (i != (*Flist_it).second){
|
if (i != (*Flist_it).second){
|
||||||
os << V[(*Flist_it).first->vertex(i)];
|
os << V[(*Flist_it).first->vertex(i)];
|
||||||
os << ", ";
|
os << ", ";
|
||||||
}
|
}
|
||||||
if (Flist_it != Flist_end)
|
if (Flist_it != Flist_end)
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,12 @@ digraph example {
|
||||||
\cgalHeading{Notations}
|
\cgalHeading{Notations}
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt>`G`</dt> <dd>A type that is a model of a graph concept.</dd>
|
<dt>`G`</dt> <dd>A type that is a model of a graph concept.</dd>
|
||||||
<dt>`g`</dt> <dd>An object of type `G`.</dd>
|
<dt>`g`</dt> <dd>An object of type `G`.</dd>
|
||||||
<dt>`u`, `v`</dt> <dd>Objects of type `boost::graph_traits<G>::%vertex_descriptor`.</dd>
|
<dt>`u`, `v`</dt> <dd>Objects of type `boost::graph_traits<G>::%vertex_descriptor`.</dd>
|
||||||
<dt>`h`</dt> <dd>An object of type `boost::graph_traits<G>::%halfedge_descriptor`.</dd>
|
<dt>`h`</dt> <dd>An object of type `boost::graph_traits<G>::%halfedge_descriptor`.</dd>
|
||||||
<dt>`e`</dt> <dd>An object of type `boost::graph_traits<G>::%edge_descriptor`.</dd>
|
<dt>`e`</dt> <dd>An object of type `boost::graph_traits<G>::%edge_descriptor`.</dd>
|
||||||
<dt>`f`</dt> <dd>An object of type `boost::graph_traits<G>::%face_descriptor`.</dd>
|
<dt>`f`</dt> <dd>An object of type `boost::graph_traits<G>::%face_descriptor`.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
\cgalHeading{%VertexListGraph}
|
\cgalHeading{%VertexListGraph}
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,8 @@ namespace CGAL {
|
||||||
class CGAL_EXPORT Geomview_stream {
|
class CGAL_EXPORT Geomview_stream {
|
||||||
public:
|
public:
|
||||||
Geomview_stream(const Bbox_3 &bbox = Bbox_3(0,0,0, 1,1,1),
|
Geomview_stream(const Bbox_3 &bbox = Bbox_3(0,0,0, 1,1,1),
|
||||||
const char *machine = nullptr,
|
const char *machine = nullptr,
|
||||||
const char *login = nullptr);
|
const char *login = nullptr);
|
||||||
|
|
||||||
bool fail() const { return false; }
|
bool fail() const { return false; }
|
||||||
bool good() const { return true; }
|
bool good() const { return true; }
|
||||||
|
|
@ -90,62 +90,62 @@ public:
|
||||||
|
|
||||||
double get_vertex_radius() const
|
double get_vertex_radius() const
|
||||||
{
|
{
|
||||||
return radius;
|
return radius;
|
||||||
}
|
}
|
||||||
double set_vertex_radius(double r)
|
double set_vertex_radius(double r)
|
||||||
{
|
{
|
||||||
std::swap(r, radius);
|
std::swap(r, radius);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_line_width() const
|
int get_line_width() const
|
||||||
{
|
{
|
||||||
return line_width;
|
return line_width;
|
||||||
}
|
}
|
||||||
int set_line_width(int w)
|
int set_line_width(int w)
|
||||||
{
|
{
|
||||||
std::swap(w, line_width);
|
std::swap(w, line_width);
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool set_wired(bool b)
|
bool set_wired(bool b)
|
||||||
{
|
{
|
||||||
std::swap(b, wired_flag);
|
std::swap(b, wired_flag);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
bool get_wired() const
|
bool get_wired() const
|
||||||
{
|
{
|
||||||
return wired_flag;
|
return wired_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool set_echo(bool b)
|
bool set_echo(bool b)
|
||||||
{
|
{
|
||||||
std::swap(b, echo_flag);
|
std::swap(b, echo_flag);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
bool get_echo() const
|
bool get_echo() const
|
||||||
{
|
{
|
||||||
return echo_flag;
|
return echo_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool set_raw(bool b)
|
bool set_raw(bool b)
|
||||||
{
|
{
|
||||||
std::swap(b, raw_flag);
|
std::swap(b, raw_flag);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
bool get_raw() const
|
bool get_raw() const
|
||||||
{
|
{
|
||||||
return raw_flag;
|
return raw_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool set_trace(bool b)
|
bool set_trace(bool b)
|
||||||
{
|
{
|
||||||
std::swap(b, trace_flag);
|
std::swap(b, trace_flag);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
bool get_trace() const
|
bool get_trace() const
|
||||||
{
|
{
|
||||||
return trace_flag;
|
return trace_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void trace(const std::string s) const
|
void trace(const std::string s) const
|
||||||
|
|
@ -171,27 +171,27 @@ public:
|
||||||
|
|
||||||
bool set_binary_mode(bool b = true)
|
bool set_binary_mode(bool b = true)
|
||||||
{
|
{
|
||||||
std::swap(b, binary_flag);
|
std::swap(b, binary_flag);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
bool set_ascii_mode(bool b = true)
|
bool set_ascii_mode(bool b = true)
|
||||||
{
|
{
|
||||||
return !set_binary_mode(!b);
|
return !set_binary_mode(!b);
|
||||||
}
|
}
|
||||||
bool get_binary_mode() const
|
bool get_binary_mode() const
|
||||||
{
|
{
|
||||||
return binary_flag;
|
return binary_flag;
|
||||||
}
|
}
|
||||||
bool get_ascii_mode() const
|
bool get_ascii_mode() const
|
||||||
{
|
{
|
||||||
return !binary_flag;
|
return !binary_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string get_new_id(const std::string & s);
|
std::string get_new_id(const std::string & s);
|
||||||
|
|
||||||
const Bbox_3 & get_bbox()
|
const Bbox_3 & get_bbox()
|
||||||
{
|
{
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pickplane()
|
void pickplane()
|
||||||
|
|
@ -201,7 +201,7 @@ public:
|
||||||
|
|
||||||
static char* nth(char* s, int count);
|
static char* nth(char* s, int count);
|
||||||
static void parse_point(const char* pickpoint,
|
static void parse_point(const char* pickpoint,
|
||||||
double &x, double &y, double &z, double &w);
|
double &x, double &y, double &z, double &w);
|
||||||
private:
|
private:
|
||||||
void setup_geomview(const char *machine, const char *login);
|
void setup_geomview(const char *machine, const char *login);
|
||||||
void frame(const Bbox_3 &bbox);
|
void frame(const Bbox_3 &bbox);
|
||||||
|
|
@ -228,9 +228,9 @@ output_point(Geomview_stream &gv, const FT &x, const FT &y, const FT &z)
|
||||||
{
|
{
|
||||||
bool ascii_bak = true; // the initialization value shuts up the compiler.
|
bool ascii_bak = true; // the initialization value shuts up the compiler.
|
||||||
if (!gv.get_raw()) {
|
if (!gv.get_raw()) {
|
||||||
ascii_bak = gv.set_ascii_mode();
|
ascii_bak = gv.set_ascii_mode();
|
||||||
gv << "(geometry " << gv.get_new_id("P")
|
gv << "(geometry " << gv.get_new_id("P")
|
||||||
<< " {appearance {linewidth 5 material {edgecolor "
|
<< " {appearance {linewidth 5 material {edgecolor "
|
||||||
<< gv.vcr() << gv.vcg() << gv.vcb() << "}}{SKEL 1 1 ";
|
<< gv.vcr() << gv.vcg() << gv.vcb() << "}}{SKEL 1 1 ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -238,7 +238,7 @@ output_point(Geomview_stream &gv, const FT &x, const FT &y, const FT &z)
|
||||||
|
|
||||||
if (!gv.get_raw()) {
|
if (!gv.get_raw()) {
|
||||||
gv << "1 0\n}})";
|
gv << "1 0\n}})";
|
||||||
gv.set_ascii_mode(ascii_bak);
|
gv.set_ascii_mode(ascii_bak);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -363,8 +363,8 @@ Geomview_stream::draw_triangles(InputIterator begin, InputIterator end)
|
||||||
std::vector<Point> points;
|
std::vector<Point> points;
|
||||||
for (Tit i = triangles.begin(); i != triangles.end(); ++i)
|
for (Tit i = triangles.begin(); i != triangles.end(); ++i)
|
||||||
for (int j = 0; j < 3; ++j)
|
for (int j = 0; j < 3; ++j)
|
||||||
if (point_map.insert(typename Point_map::value_type(i->vertex(j),
|
if (point_map.insert(typename Point_map::value_type(i->vertex(j),
|
||||||
points.size())).second)
|
points.size())).second)
|
||||||
points.push_back(i->vertex(j));
|
points.push_back(i->vertex(j));
|
||||||
|
|
||||||
bool ascii_bak = get_ascii_mode();
|
bool ascii_bak = get_ascii_mode();
|
||||||
|
|
@ -383,8 +383,8 @@ Geomview_stream::draw_triangles(InputIterator begin, InputIterator end)
|
||||||
// Triangles vertices indices.
|
// Triangles vertices indices.
|
||||||
for (Tit tit = triangles.begin(); tit != triangles.end(); ++tit) {
|
for (Tit tit = triangles.begin(); tit != triangles.end(); ++tit) {
|
||||||
(*this) << 3;
|
(*this) << 3;
|
||||||
for (int j = 0; j < 3; ++j)
|
for (int j = 0; j < 3; ++j)
|
||||||
(*this) << point_map[tit->vertex(j)];
|
(*this) << point_map[tit->vertex(j)];
|
||||||
(*this) << 0; // without color.
|
(*this) << 0; // without color.
|
||||||
}
|
}
|
||||||
// Footer.
|
// Footer.
|
||||||
|
|
@ -487,14 +487,14 @@ operator<<(Geomview_stream &gv, const Ray_2<R> &r)
|
||||||
// Note: it won't work if double is not convertible to an RT...
|
// Note: it won't work if double is not convertible to an RT...
|
||||||
const Bbox_3 & bb = gv.get_bbox();
|
const Bbox_3 & bb = gv.get_bbox();
|
||||||
Object result = intersection(Iso_rectangle_2<R>(
|
Object result = intersection(Iso_rectangle_2<R>(
|
||||||
Point_2<R>(bb.xmin(), bb.ymin()),
|
Point_2<R>(bb.xmin(), bb.ymin()),
|
||||||
Point_2<R>(bb.xmax(), bb.ymax())), r);
|
Point_2<R>(bb.xmax(), bb.ymax())), r);
|
||||||
Point_2<R> ipoint;
|
Point_2<R> ipoint;
|
||||||
Segment_2<R> iseg;
|
Segment_2<R> iseg;
|
||||||
if (assign(ipoint, result))
|
if (assign(ipoint, result))
|
||||||
gv << ipoint;
|
gv << ipoint;
|
||||||
else if (assign(iseg, result))
|
else if (assign(iseg, result))
|
||||||
gv << iseg;
|
gv << iseg;
|
||||||
return gv;
|
return gv;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -509,14 +509,14 @@ operator<<(Geomview_stream &gv, const Line_2<R> &r)
|
||||||
// Note: it won't work if double is not convertible to an RT...
|
// Note: it won't work if double is not convertible to an RT...
|
||||||
const Bbox_3 & bb = gv.get_bbox();
|
const Bbox_3 & bb = gv.get_bbox();
|
||||||
Object result = intersection(Iso_rectangle_2<R>(
|
Object result = intersection(Iso_rectangle_2<R>(
|
||||||
Point_2<R>(bb.xmin(), bb.ymin()),
|
Point_2<R>(bb.xmin(), bb.ymin()),
|
||||||
Point_2<R>(bb.xmax(), bb.ymax())), r);
|
Point_2<R>(bb.xmax(), bb.ymax())), r);
|
||||||
Point_2<R> ipoint;
|
Point_2<R> ipoint;
|
||||||
Segment_2<R> iseg;
|
Segment_2<R> iseg;
|
||||||
if (assign(ipoint, result))
|
if (assign(ipoint, result))
|
||||||
gv << ipoint;
|
gv << ipoint;
|
||||||
else if (assign(iseg, result))
|
else if (assign(iseg, result))
|
||||||
gv << iseg;
|
gv << iseg;
|
||||||
return gv;
|
return gv;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -563,7 +563,7 @@ Geomview_stream&
|
||||||
operator>>(Geomview_stream &gv, Point_3<R> &point)
|
operator>>(Geomview_stream &gv, Point_3<R> &point)
|
||||||
{
|
{
|
||||||
const char *gclpick =
|
const char *gclpick =
|
||||||
"(pick world pickplane * nil nil nil nil nil nil nil)";
|
"(pick world pickplane * nil nil nil nil nil nil nil)";
|
||||||
|
|
||||||
bool ascii_bak = gv.set_ascii_mode();
|
bool ascii_bak = gv.set_ascii_mode();
|
||||||
gv << "(pickable pickplane yes) (ui-target pickplane yes)"
|
gv << "(pickable pickplane yes) (ui-target pickplane yes)"
|
||||||
|
|
@ -580,7 +580,7 @@ operator>>(Geomview_stream &gv, Point_3<R> &point)
|
||||||
|
|
||||||
// we echo the input
|
// we echo the input
|
||||||
if (gv.get_echo())
|
if (gv.get_echo())
|
||||||
gv << point;
|
gv << point;
|
||||||
|
|
||||||
// we are done and tell geomview to stop sending pick events
|
// we are done and tell geomview to stop sending pick events
|
||||||
gv << "(uninterest " << gclpick << ") (pickable pickplane no)";
|
gv << "(uninterest " << gclpick << ") (pickable pickplane no)";
|
||||||
|
|
|
||||||
|
|
@ -272,10 +272,10 @@ write_cdt_points(std::ostream& os,
|
||||||
template <class T>
|
template <class T>
|
||||||
void
|
void
|
||||||
write_attribute_tag_2 (std::ostream& os,
|
write_attribute_tag_2 (std::ostream& os,
|
||||||
const std::string& attr_name,
|
const std::string& attr_name,
|
||||||
const std::vector<T>& attribute,
|
const std::vector<T>& attribute,
|
||||||
bool binary,
|
bool binary,
|
||||||
std::size_t& offset)
|
std::size_t& offset)
|
||||||
{
|
{
|
||||||
std::string format = binary ? "appended" : "ascii";
|
std::string format = binary ? "appended" : "ascii";
|
||||||
std::string type = (sizeof(T) == 8) ? "Float64" : "Float32";
|
std::string type = (sizeof(T) == 8) ? "Float64" : "Float32";
|
||||||
|
|
@ -289,8 +289,8 @@ write_attribute_tag_2 (std::ostream& os,
|
||||||
typedef typename std::vector<T>::const_iterator Iterator;
|
typedef typename std::vector<T>::const_iterator Iterator;
|
||||||
os << "\">\n";
|
os << "\">\n";
|
||||||
for (Iterator it = attribute.begin();
|
for (Iterator it = attribute.begin();
|
||||||
it != attribute.end();
|
it != attribute.end();
|
||||||
++it )
|
++it )
|
||||||
os << *it << " ";
|
os << *it << " ";
|
||||||
os << " </DataArray>\n";
|
os << " </DataArray>\n";
|
||||||
}
|
}
|
||||||
|
|
@ -300,7 +300,7 @@ write_attribute_tag_2 (std::ostream& os,
|
||||||
template <typename FT>
|
template <typename FT>
|
||||||
void
|
void
|
||||||
write_attributes_2(std::ostream& os,
|
write_attributes_2(std::ostream& os,
|
||||||
const std::vector<FT>& att)
|
const std::vector<FT>& att)
|
||||||
{
|
{
|
||||||
IO::internal::write_vector(os,att);
|
IO::internal::write_vector(os,att);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,11 +83,11 @@ write_cells_tag(std::ostream& os,
|
||||||
os << ">\n";
|
os << ">\n";
|
||||||
std::size_t cells_offset = 0;
|
std::size_t cells_offset = 0;
|
||||||
for( Cell_iterator cit = c3t3.cells_in_complex_begin() ;
|
for( Cell_iterator cit = c3t3.cells_in_complex_begin() ;
|
||||||
cit != c3t3.cells_in_complex_end() ;
|
cit != c3t3.cells_in_complex_end() ;
|
||||||
++cit )
|
++cit )
|
||||||
{
|
{
|
||||||
cells_offset += 4;
|
cells_offset += 4;
|
||||||
os << cells_offset << " ";
|
os << cells_offset << " ";
|
||||||
}
|
}
|
||||||
os << "\n </DataArray>\n";
|
os << "\n </DataArray>\n";
|
||||||
}
|
}
|
||||||
|
|
@ -104,8 +104,8 @@ write_cells_tag(std::ostream& os,
|
||||||
else {
|
else {
|
||||||
os << ">\n";
|
os << ">\n";
|
||||||
for( Cell_iterator cit = c3t3.cells_in_complex_begin() ;
|
for( Cell_iterator cit = c3t3.cells_in_complex_begin() ;
|
||||||
cit != c3t3.cells_in_complex_end() ;
|
cit != c3t3.cells_in_complex_end() ;
|
||||||
++cit )
|
++cit )
|
||||||
os << "10 ";
|
os << "10 ";
|
||||||
os << "\n </DataArray>\n";
|
os << "\n </DataArray>\n";
|
||||||
}
|
}
|
||||||
|
|
@ -131,7 +131,7 @@ write_cells(std::ostream& os,
|
||||||
off += 4;
|
off += 4;
|
||||||
offsets.push_back(off);
|
offsets.push_back(off);
|
||||||
for (int i=0; i<4; i++)
|
for (int i=0; i<4; i++)
|
||||||
connectivity_table.push_back(V[cit->vertex(i)]);
|
connectivity_table.push_back(V[cit->vertex(i)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
IO::internal::write_vector<std::size_t>(os,connectivity_table);
|
IO::internal::write_vector<std::size_t>(os,connectivity_table);
|
||||||
|
|
@ -219,10 +219,10 @@ write_c3t3_points(std::ostream& os,
|
||||||
template <class T>
|
template <class T>
|
||||||
void
|
void
|
||||||
write_attribute_tag(std::ostream& os,
|
write_attribute_tag(std::ostream& os,
|
||||||
const std::string& attr_name,
|
const std::string& attr_name,
|
||||||
const std::vector<T>& attribute,
|
const std::vector<T>& attribute,
|
||||||
bool binary,
|
bool binary,
|
||||||
std::size_t& offset)
|
std::size_t& offset)
|
||||||
{
|
{
|
||||||
std::string format = binary ? "appended" : "ascii";
|
std::string format = binary ? "appended" : "ascii";
|
||||||
std::string type = "";
|
std::string type = "";
|
||||||
|
|
@ -249,8 +249,8 @@ write_attribute_tag(std::ostream& os,
|
||||||
typedef typename std::vector<T>::const_iterator Iterator;
|
typedef typename std::vector<T>::const_iterator Iterator;
|
||||||
os << "\">\n";
|
os << "\">\n";
|
||||||
for (Iterator it = attribute.begin();
|
for (Iterator it = attribute.begin();
|
||||||
it != attribute.end();
|
it != attribute.end();
|
||||||
++it )
|
++it )
|
||||||
os << *it << " ";
|
os << *it << " ";
|
||||||
os << "\n </DataArray>\n";
|
os << "\n </DataArray>\n";
|
||||||
}
|
}
|
||||||
|
|
@ -260,7 +260,7 @@ write_attribute_tag(std::ostream& os,
|
||||||
template <typename FT>
|
template <typename FT>
|
||||||
void
|
void
|
||||||
write_attributes(std::ostream& os,
|
write_attributes(std::ostream& os,
|
||||||
const std::vector<FT>& att)
|
const std::vector<FT>& att)
|
||||||
{
|
{
|
||||||
IO::internal::write_vector(os,att);
|
IO::internal::write_vector(os,att);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
#ifdef CGAL_USE_SCIP // defined (or not) by CMake scripts, do not define by hand
|
#ifdef CGAL_USE_SCIP // defined (or not) by CMake scripts, do not define by hand
|
||||||
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
||||||
typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
#elif defined(CGAL_USE_GLPK) // defined (or not) by CMake scripts, do not define by hand
|
#elif defined(CGAL_USE_GLPK) // defined (or not) by CMake scripts, do not define by hand
|
||||||
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
||||||
typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -20,17 +20,17 @@ typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
|
||||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||||
typedef Kernel::Point_3 Point;
|
typedef Kernel::Point_3 Point;
|
||||||
typedef Kernel::Vector_3 Vector;
|
typedef Kernel::Vector_3 Vector;
|
||||||
typedef CGAL::Polygonal_surface_reconstruction<Kernel> Polygonal_surface_reconstruction;
|
typedef CGAL::Polygonal_surface_reconstruction<Kernel> Polygonal_surface_reconstruction;
|
||||||
typedef CGAL::Surface_mesh<Point> Surface_mesh;
|
typedef CGAL::Surface_mesh<Point> Surface_mesh;
|
||||||
|
|
||||||
// Point with normal, and plane index
|
// Point with normal, and plane index
|
||||||
typedef boost::tuple<Point, Vector, int> PNI;
|
typedef boost::tuple<Point, Vector, int> PNI;
|
||||||
typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map;
|
typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map;
|
||||||
typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map;
|
typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map;
|
||||||
typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
|
typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following example shows how to control the model complexity by
|
* The following example shows how to control the model complexity by
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
#ifdef CGAL_USE_SCIP // defined (or not) by CMake scripts, do not define by hand
|
#ifdef CGAL_USE_SCIP // defined (or not) by CMake scripts, do not define by hand
|
||||||
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
||||||
typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
#elif defined(CGAL_USE_GLPK) // defined (or not) by CMake scripts, do not define by hand
|
#elif defined(CGAL_USE_GLPK) // defined (or not) by CMake scripts, do not define by hand
|
||||||
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
||||||
typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -20,17 +20,17 @@ typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
|
||||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||||
typedef Kernel::Point_3 Point;
|
typedef Kernel::Point_3 Point;
|
||||||
typedef Kernel::Vector_3 Vector;
|
typedef Kernel::Vector_3 Vector;
|
||||||
typedef CGAL::Polygonal_surface_reconstruction<Kernel> Polygonal_surface_reconstruction;
|
typedef CGAL::Polygonal_surface_reconstruction<Kernel> Polygonal_surface_reconstruction;
|
||||||
typedef CGAL::Surface_mesh<Point> Surface_mesh;
|
typedef CGAL::Surface_mesh<Point> Surface_mesh;
|
||||||
|
|
||||||
// Point with normal, and plane index
|
// Point with normal, and plane index
|
||||||
typedef boost::tuple<Point, Vector, int> PNI;
|
typedef boost::tuple<Point, Vector, int> PNI;
|
||||||
typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map;
|
typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map;
|
||||||
typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map;
|
typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map;
|
||||||
typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
|
typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following example shows the reconstruction using user-provided
|
* The following example shows the reconstruction using user-provided
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
#elif defined(CGAL_USE_GLPK) // defined (or not) by CMake scripts, do not define by hand
|
#elif defined(CGAL_USE_GLPK) // defined (or not) by CMake scripts, do not define by hand
|
||||||
|
|
||||||
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
||||||
typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -23,19 +23,19 @@ typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <CGAL/Timer.h>
|
#include <CGAL/Timer.h>
|
||||||
|
|
||||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||||
|
|
||||||
typedef Kernel::FT FT;
|
typedef Kernel::FT FT;
|
||||||
typedef Kernel::Point_3 Point;
|
typedef Kernel::Point_3 Point;
|
||||||
typedef Kernel::Vector_3 Vector;
|
typedef Kernel::Vector_3 Vector;
|
||||||
|
|
||||||
// Point with normal, and plane index.
|
// Point with normal, and plane index.
|
||||||
typedef boost::tuple<Point, Vector, int> PNI;
|
typedef boost::tuple<Point, Vector, int> PNI;
|
||||||
typedef std::vector<PNI> Point_vector;
|
typedef std::vector<PNI> Point_vector;
|
||||||
|
|
||||||
typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map;
|
typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map;
|
||||||
typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map;
|
typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map;
|
||||||
typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
|
typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
|
||||||
|
|
||||||
typedef CGAL::Shape_detection::Point_set::
|
typedef CGAL::Shape_detection::Point_set::
|
||||||
Sphere_neighbor_query<Kernel, Point_vector, Point_map> Neighbor_query;
|
Sphere_neighbor_query<Kernel, Point_vector, Point_map> Neighbor_query;
|
||||||
|
|
@ -44,8 +44,8 @@ Least_squares_plane_fit_region<Kernel, Point_vector, Point_map, Normal_map> Regi
|
||||||
typedef CGAL::Shape_detection::
|
typedef CGAL::Shape_detection::
|
||||||
Region_growing<Point_vector, Neighbor_query, Region_type> Region_growing;
|
Region_growing<Point_vector, Neighbor_query, Region_type> Region_growing;
|
||||||
|
|
||||||
typedef CGAL::Surface_mesh<Point> Surface_mesh;
|
typedef CGAL::Surface_mesh<Point> Surface_mesh;
|
||||||
typedef CGAL::Polygonal_surface_reconstruction<Kernel> Polygonal_surface_reconstruction;
|
typedef CGAL::Polygonal_surface_reconstruction<Kernel> Polygonal_surface_reconstruction;
|
||||||
|
|
||||||
class Index_map {
|
class Index_map {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,12 @@
|
||||||
#ifdef CGAL_USE_SCIP // defined (or not) by CMake scripts, do not define by hand
|
#ifdef CGAL_USE_SCIP // defined (or not) by CMake scripts, do not define by hand
|
||||||
|
|
||||||
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
||||||
typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
|
|
||||||
#elif defined(CGAL_USE_GLPK) // defined (or not) by CMake scripts, do not define by hand
|
#elif defined(CGAL_USE_GLPK) // defined (or not) by CMake scripts, do not define by hand
|
||||||
|
|
||||||
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
||||||
typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -25,26 +25,26 @@ typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
|
||||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||||
|
|
||||||
typedef Kernel::Point_3 Point;
|
typedef Kernel::Point_3 Point;
|
||||||
typedef Kernel::Vector_3 Vector;
|
typedef Kernel::Vector_3 Vector;
|
||||||
|
|
||||||
// Point with normal, and plane index
|
// Point with normal, and plane index
|
||||||
typedef boost::tuple<Point, Vector, int> PNI;
|
typedef boost::tuple<Point, Vector, int> PNI;
|
||||||
typedef std::vector<PNI> Point_vector;
|
typedef std::vector<PNI> Point_vector;
|
||||||
typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map;
|
typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map;
|
||||||
typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map;
|
typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map;
|
||||||
typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
|
typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
|
||||||
|
|
||||||
typedef CGAL::Shape_detection::Efficient_RANSAC_traits<Kernel, Point_vector, Point_map, Normal_map> Traits;
|
typedef CGAL::Shape_detection::Efficient_RANSAC_traits<Kernel, Point_vector, Point_map, Normal_map> Traits;
|
||||||
|
|
||||||
typedef CGAL::Shape_detection::Efficient_RANSAC<Traits> Efficient_ransac;
|
typedef CGAL::Shape_detection::Efficient_RANSAC<Traits> Efficient_ransac;
|
||||||
typedef CGAL::Shape_detection::Plane<Traits> Plane;
|
typedef CGAL::Shape_detection::Plane<Traits> Plane;
|
||||||
typedef CGAL::Shape_detection::Point_to_shape_index_map<Traits> Point_to_shape_index_map;
|
typedef CGAL::Shape_detection::Point_to_shape_index_map<Traits> Point_to_shape_index_map;
|
||||||
|
|
||||||
typedef CGAL::Polygonal_surface_reconstruction<Kernel> Polygonal_surface_reconstruction;
|
typedef CGAL::Polygonal_surface_reconstruction<Kernel> Polygonal_surface_reconstruction;
|
||||||
typedef CGAL::Surface_mesh<Point> Surface_mesh;
|
typedef CGAL::Surface_mesh<Point> Surface_mesh;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This example first extracts planes from the input point cloud
|
* This example first extracts planes from the input point cloud
|
||||||
|
|
|
||||||
|
|
@ -47,13 +47,13 @@ typedef boost::associative_property_map< Face2Vector_map > Face2Vector_property_
|
||||||
//RIDGES
|
//RIDGES
|
||||||
typedef CGAL::Ridge_line<PolyhedralSurf> Ridge_line;
|
typedef CGAL::Ridge_line<PolyhedralSurf> Ridge_line;
|
||||||
typedef CGAL::Ridge_approximation < PolyhedralSurf,
|
typedef CGAL::Ridge_approximation < PolyhedralSurf,
|
||||||
VertexFT_property_map,
|
VertexFT_property_map,
|
||||||
VertexVector_property_map > Ridge_approximation;
|
VertexVector_property_map > Ridge_approximation;
|
||||||
//UMBILICS
|
//UMBILICS
|
||||||
typedef CGAL::Umbilic<PolyhedralSurf> Umbilic;
|
typedef CGAL::Umbilic<PolyhedralSurf> Umbilic;
|
||||||
typedef CGAL::Umbilic_approximation < PolyhedralSurf,
|
typedef CGAL::Umbilic_approximation < PolyhedralSurf,
|
||||||
VertexFT_property_map,
|
VertexFT_property_map,
|
||||||
VertexVector_property_map > Umbilic_approximation;
|
VertexVector_property_map > Umbilic_approximation;
|
||||||
|
|
||||||
//create property maps
|
//create property maps
|
||||||
VertexFT_map vertex_k1_map, vertex_k2_map,
|
VertexFT_map vertex_k1_map, vertex_k2_map,
|
||||||
|
|
@ -86,8 +86,8 @@ unsigned int min_nb_points = (d_fitting + 1) * (d_fitting + 2) / 2;
|
||||||
*/
|
*/
|
||||||
template <typename VertexPointMap>
|
template <typename VertexPointMap>
|
||||||
void gather_fitting_points(vertex_descriptor v,
|
void gather_fitting_points(vertex_descriptor v,
|
||||||
std::vector<Point_3> &in_points,
|
std::vector<Point_3> &in_points,
|
||||||
Poly_rings& poly_rings,
|
Poly_rings& poly_rings,
|
||||||
VertexPointMap vpm)
|
VertexPointMap vpm)
|
||||||
{
|
{
|
||||||
//container to collect vertices of v on the PolyhedralSurf
|
//container to collect vertices of v on the PolyhedralSurf
|
||||||
|
|
@ -148,7 +148,7 @@ void compute_differential_quantities(PolyhedralSurf& P, Poly_rings& poly_rings)
|
||||||
assert( d_monge >= 3);
|
assert( d_monge >= 3);
|
||||||
// run the main fct : perform the fitting
|
// run the main fct : perform the fitting
|
||||||
monge_form = monge_fit(in_points.begin(), in_points.end(),
|
monge_form = monge_fit(in_points.begin(), in_points.end(),
|
||||||
d_fitting, d_monge);
|
d_fitting, d_monge);
|
||||||
|
|
||||||
//switch min-max ppal curv/dir wrt the mesh orientation
|
//switch min-max ppal curv/dir wrt the mesh orientation
|
||||||
const Vector_3 normal_mesh = computeFacetsAverageUnitNormal(P,v, face2normal_pm, Kernel());
|
const Vector_3 normal_mesh = computeFacetsAverageUnitNormal(P,v, face2normal_pm, Kernel());
|
||||||
|
|
@ -164,18 +164,18 @@ void compute_differential_quantities(PolyhedralSurf& P, Poly_rings& poly_rings)
|
||||||
if ( d_monge >= 4) {
|
if ( d_monge >= 4) {
|
||||||
//= 3*b1^2+(k1-k2)(c0-3k1^3)
|
//= 3*b1^2+(k1-k2)(c0-3k1^3)
|
||||||
vertex_P1_map[v] =
|
vertex_P1_map[v] =
|
||||||
3*monge_form.coefficients()[3]*monge_form.coefficients()[3]
|
3*monge_form.coefficients()[3]*monge_form.coefficients()[3]
|
||||||
+(monge_form.coefficients()[0]-monge_form.coefficients()[1])
|
+(monge_form.coefficients()[0]-monge_form.coefficients()[1])
|
||||||
*(monge_form.coefficients()[6]
|
*(monge_form.coefficients()[6]
|
||||||
-3*monge_form.coefficients()[0]*monge_form.coefficients()[0]
|
-3*monge_form.coefficients()[0]*monge_form.coefficients()[0]
|
||||||
*monge_form.coefficients()[0]);
|
*monge_form.coefficients()[0]);
|
||||||
//= 3*b2^2+(k2-k1)(c4-3k2^3)
|
//= 3*b2^2+(k2-k1)(c4-3k2^3)
|
||||||
vertex_P2_map[v] =
|
vertex_P2_map[v] =
|
||||||
3*monge_form.coefficients()[4]*monge_form.coefficients()[4]
|
3*monge_form.coefficients()[4]*monge_form.coefficients()[4]
|
||||||
+(-monge_form.coefficients()[0]+monge_form.coefficients()[1])
|
+(-monge_form.coefficients()[0]+monge_form.coefficients()[1])
|
||||||
*(monge_form.coefficients()[10]
|
*(monge_form.coefficients()[10]
|
||||||
-3*monge_form.coefficients()[1]*monge_form.coefficients()[1]
|
-3*monge_form.coefficients()[1]*monge_form.coefficients()[1]
|
||||||
*monge_form.coefficients()[1]);
|
*monge_form.coefficients()[1]);
|
||||||
}
|
}
|
||||||
} //END FOR LOOP
|
} //END FOR LOOP
|
||||||
}
|
}
|
||||||
|
|
@ -228,8 +228,8 @@ int main()
|
||||||
if ( int_tag == 3 ) tag_order = CGAL::Ridge_order_3;
|
if ( int_tag == 3 ) tag_order = CGAL::Ridge_order_3;
|
||||||
if ( int_tag == 4 ) tag_order = CGAL::Ridge_order_4;
|
if ( int_tag == 4 ) tag_order = CGAL::Ridge_order_4;
|
||||||
if ( int_tag != 3 && int_tag != 4 )
|
if ( int_tag != 3 && int_tag != 4 )
|
||||||
{std::cerr << "ridge_order must be CGAL::Ridge_order_3 or CGAL::Ridge_order_4";
|
{std::cerr << "ridge_order must be CGAL::Ridge_order_3 or CGAL::Ridge_order_4";
|
||||||
return 1;}
|
return 1;}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
std::cerr << "Command-line options require Boost.ProgramOptions" << std::endl;
|
std::cerr << "Command-line options require Boost.ProgramOptions" << std::endl;
|
||||||
|
|
@ -261,26 +261,26 @@ int main()
|
||||||
if (of_name[i] == '/') of_name[i]='_';
|
if (of_name[i] == '/') of_name[i]='_';
|
||||||
std::ostringstream str_4ogl;
|
std::ostringstream str_4ogl;
|
||||||
str_4ogl << "data/"
|
str_4ogl << "data/"
|
||||||
<< of_name << "RIDGES"
|
<< of_name << "RIDGES"
|
||||||
<< "-d" << d_fitting
|
<< "-d" << d_fitting
|
||||||
<< "-m" << d_monge
|
<< "-m" << d_monge
|
||||||
<< "-t" << tag_order
|
<< "-t" << tag_order
|
||||||
<< "-a" << nb_rings
|
<< "-a" << nb_rings
|
||||||
<< "-p" << nb_points_to_use
|
<< "-p" << nb_points_to_use
|
||||||
<< ".4ogl.txt";
|
<< ".4ogl.txt";
|
||||||
std::cout << str_4ogl.str() << std::endl ;
|
std::cout << str_4ogl.str() << std::endl ;
|
||||||
std::ofstream out_4ogl(str_4ogl.str().c_str() , std::ios::out);
|
std::ofstream out_4ogl(str_4ogl.str().c_str() , std::ios::out);
|
||||||
|
|
||||||
//if verbose only...
|
//if verbose only...
|
||||||
std::ostringstream str_verb;
|
std::ostringstream str_verb;
|
||||||
str_verb << "data/"
|
str_verb << "data/"
|
||||||
<< of_name << "RIDGES"
|
<< of_name << "RIDGES"
|
||||||
<< "-d" << d_fitting
|
<< "-d" << d_fitting
|
||||||
<< "-m" << d_monge
|
<< "-m" << d_monge
|
||||||
<< "-t" << tag_order
|
<< "-t" << tag_order
|
||||||
<< "-a" << nb_rings
|
<< "-a" << nb_rings
|
||||||
<< "-p" << nb_points_to_use
|
<< "-p" << nb_points_to_use
|
||||||
<< ".verb.txt";
|
<< ".verb.txt";
|
||||||
std::cout << str_verb.str() << std::endl ;
|
std::cout << str_verb.str() << std::endl ;
|
||||||
std::ofstream out_verb(str_verb.str().c_str() , std::ios::out);
|
std::ofstream out_verb(str_verb.str().c_str() , std::ios::out);
|
||||||
|
|
||||||
|
|
@ -288,11 +288,11 @@ int main()
|
||||||
PolyhedralSurf P;
|
PolyhedralSurf P;
|
||||||
CGAL::read_OFF(if_name.c_str(), P);
|
CGAL::read_OFF(if_name.c_str(), P);
|
||||||
fprintf(stderr, "loadMesh %d Ves %d Facets\n",
|
fprintf(stderr, "loadMesh %d Ves %d Facets\n",
|
||||||
(int)num_vertices(P), (int)num_faces(P));
|
(int)num_vertices(P), (int)num_faces(P));
|
||||||
if(verbose)
|
if(verbose)
|
||||||
out_verb << "Polysurf with " << num_vertices(P)
|
out_verb << "Polysurf with " << num_vertices(P)
|
||||||
<< " vertices and " << num_faces(P)
|
<< " vertices and " << num_faces(P)
|
||||||
<< " facets. " << std::endl;
|
<< " facets. " << std::endl;
|
||||||
|
|
||||||
//exit if not enough points in the model
|
//exit if not enough points in the model
|
||||||
if (min_nb_points > num_vertices(P))
|
if (min_nb_points > num_vertices(P))
|
||||||
|
|
@ -313,10 +313,10 @@ int main()
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
std::cout << "Compute ridges..." << std::endl;
|
std::cout << "Compute ridges..." << std::endl;
|
||||||
Ridge_approximation ridge_approximation(P,
|
Ridge_approximation ridge_approximation(P,
|
||||||
vertex_k1_pm, vertex_k2_pm,
|
vertex_k1_pm, vertex_k2_pm,
|
||||||
vertex_b0_pm, vertex_b3_pm,
|
vertex_b0_pm, vertex_b3_pm,
|
||||||
vertex_d1_pm, vertex_d2_pm,
|
vertex_d1_pm, vertex_d2_pm,
|
||||||
vertex_P1_pm, vertex_P2_pm );
|
vertex_P1_pm, vertex_P2_pm );
|
||||||
std::vector<Ridge_line*> ridge_lines;
|
std::vector<Ridge_line*> ridge_lines;
|
||||||
std::back_insert_iterator<std::vector<Ridge_line*> > ii(ridge_lines);
|
std::back_insert_iterator<std::vector<Ridge_line*> > ii(ridge_lines);
|
||||||
|
|
||||||
|
|
@ -327,11 +327,11 @@ int main()
|
||||||
|
|
||||||
// or with the global function
|
// or with the global function
|
||||||
CGAL::compute_max_ridges(P,
|
CGAL::compute_max_ridges(P,
|
||||||
vertex_k1_pm, vertex_k2_pm,
|
vertex_k1_pm, vertex_k2_pm,
|
||||||
vertex_b0_pm, vertex_b3_pm,
|
vertex_b0_pm, vertex_b3_pm,
|
||||||
vertex_d1_pm, vertex_d2_pm,
|
vertex_d1_pm, vertex_d2_pm,
|
||||||
vertex_P1_pm, vertex_P2_pm,
|
vertex_P1_pm, vertex_P2_pm,
|
||||||
ii, tag_order);
|
ii, tag_order);
|
||||||
|
|
||||||
std::vector<Ridge_line*>::iterator iter_lines = ridge_lines.begin(),
|
std::vector<Ridge_line*>::iterator iter_lines = ridge_lines.begin(),
|
||||||
iter_end = ridge_lines.end();
|
iter_end = ridge_lines.end();
|
||||||
|
|
@ -360,14 +360,14 @@ int main()
|
||||||
|
|
||||||
//explicit construction of the class
|
//explicit construction of the class
|
||||||
// Umbilic_approximation umbilic_approximation(P,
|
// Umbilic_approximation umbilic_approximation(P,
|
||||||
// vertex_k1_pm, vertex_k2_pm,
|
// vertex_k1_pm, vertex_k2_pm,
|
||||||
// vertex_d1_pm, vertex_d2_pm);
|
// vertex_d1_pm, vertex_d2_pm);
|
||||||
// umbilic_approximation.compute(umb_it, umb_size);
|
// umbilic_approximation.compute(umb_it, umb_size);
|
||||||
//or global function call
|
//or global function call
|
||||||
CGAL::compute_umbilics(P,
|
CGAL::compute_umbilics(P,
|
||||||
vertex_k1_pm, vertex_k2_pm,
|
vertex_k1_pm, vertex_k2_pm,
|
||||||
vertex_d1_pm, vertex_d2_pm,
|
vertex_d1_pm, vertex_d2_pm,
|
||||||
umb_it, umb_size);
|
umb_it, umb_size);
|
||||||
|
|
||||||
std::vector<Umbilic*>::iterator iter_umb = umbilics.begin(),
|
std::vector<Umbilic*>::iterator iter_umb = umbilics.begin(),
|
||||||
iter_umb_end = umbilics.end();
|
iter_umb_end = umbilics.end();
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ int main( int argc, char **argv) {
|
||||||
}
|
}
|
||||||
if ( !*p_in) {
|
if ( !*p_in) {
|
||||||
cerr << argv[0] << ": error: cannot open file '"<< iname
|
cerr << argv[0] << ": error: cannot open file '"<< iname
|
||||||
<< "' for reading." <<endl;
|
<< "' for reading." <<endl;
|
||||||
exit( 1);
|
exit( 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ private:
|
||||||
public:
|
public:
|
||||||
value_type::size_type size_of_indices () const // RO
|
value_type::size_type size_of_indices () const // RO
|
||||||
{ return m_indices.size(); }
|
{ return m_indices.size(); }
|
||||||
typedef value_type::size_type indices_size_type; // RO
|
typedef value_type::size_type indices_size_type; // RO
|
||||||
public:
|
public:
|
||||||
typedef File_scanner_OFF Scanner;
|
typedef File_scanner_OFF Scanner;
|
||||||
typedef I_Scanner_OFF_facet_iterator Self;
|
typedef I_Scanner_OFF_facet_iterator Self;
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@ In case the surface is manifold the triangles can be oriented.
|
||||||
|
|
||||||
template <class SurfaceMeshComplex_2InTriangulation_3>
|
template <class SurfaceMeshComplex_2InTriangulation_3>
|
||||||
bool output_surface_facets_to_off (std::ostream& os,
|
bool output_surface_facets_to_off (std::ostream& os,
|
||||||
const SurfaceMeshComplex_2InTriangulation_3& c2t3,
|
const SurfaceMeshComplex_2InTriangulation_3& c2t3,
|
||||||
int options =
|
int options =
|
||||||
Surface_mesher::IO_ORIENT_SURFACE);
|
Surface_mesher::IO_ORIENT_SURFACE);
|
||||||
|
|
||||||
namespace Surface_mesher {
|
namespace Surface_mesher {
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,13 @@ namespace CGAL { namespace Surface_mesher {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool write_header(const typename Tr::size_type number_of_vertices,
|
bool write_header(const typename Tr::size_type number_of_vertices,
|
||||||
const typename Tr::size_type number_of_facets)
|
const typename Tr::size_type number_of_facets)
|
||||||
{
|
{
|
||||||
off.header().set_no_comments(true);
|
off.header().set_no_comments(true);
|
||||||
off.write_header(os,
|
off.write_header(os,
|
||||||
number_of_vertices,
|
number_of_vertices,
|
||||||
0, // fake number of halfedges, not used.
|
0, // fake number of halfedges, not used.
|
||||||
number_of_facets);
|
number_of_facets);
|
||||||
return os.good();
|
return os.good();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,8 +70,8 @@ namespace CGAL { namespace Surface_mesher {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool write_facet(const int index1,
|
bool write_facet(const int index1,
|
||||||
const int index2,
|
const int index2,
|
||||||
const int index3)
|
const int index3)
|
||||||
{
|
{
|
||||||
off.write_facet_begin(3);
|
off.write_facet_begin(3);
|
||||||
off.write_facet_vertex_index(index1);
|
off.write_facet_vertex_index(index1);
|
||||||
|
|
@ -101,10 +101,10 @@ namespace CGAL { namespace Surface_mesher {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool write_header(const typename Tr::size_type number_of_vertices,
|
bool write_header(const typename Tr::size_type number_of_vertices,
|
||||||
const typename Tr::size_type number_of_facets)
|
const typename Tr::size_type number_of_facets)
|
||||||
{
|
{
|
||||||
builder.begin_surface(number_of_vertices,
|
builder.begin_surface(number_of_vertices,
|
||||||
number_of_facets);
|
number_of_facets);
|
||||||
return !builder.error();
|
return !builder.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,8 +121,8 @@ namespace CGAL { namespace Surface_mesher {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool write_facet(const int index1,
|
bool write_facet(const int index1,
|
||||||
const int index2,
|
const int index2,
|
||||||
const int index3)
|
const int index3)
|
||||||
{
|
{
|
||||||
int indices[3];
|
int indices[3];
|
||||||
indices[0]=index1;
|
indices[0]=index1;
|
||||||
|
|
@ -140,16 +140,16 @@ namespace CGAL { namespace Surface_mesher {
|
||||||
}; // end class Write_to_HDS
|
}; // end class Write_to_HDS
|
||||||
|
|
||||||
enum IO_option { NO_OPTION = 0,
|
enum IO_option { NO_OPTION = 0,
|
||||||
IO_ORIENT_SURFACE = 1,
|
IO_ORIENT_SURFACE = 1,
|
||||||
IO_VERBOSE = 2 };
|
IO_VERBOSE = 2 };
|
||||||
|
|
||||||
} // end namespace Surface_mesher
|
} // end namespace Surface_mesher
|
||||||
|
|
||||||
template <class C2t3>
|
template <class C2t3>
|
||||||
bool output_surface_facets_to_off (std::ostream& os,
|
bool output_surface_facets_to_off (std::ostream& os,
|
||||||
const C2t3& c2t3,
|
const C2t3& c2t3,
|
||||||
int options =
|
int options =
|
||||||
Surface_mesher::IO_ORIENT_SURFACE)
|
Surface_mesher::IO_ORIENT_SURFACE)
|
||||||
{
|
{
|
||||||
using CGAL::Surface_mesher::number_of_facets_on_surface;
|
using CGAL::Surface_mesher::number_of_facets_on_surface;
|
||||||
|
|
||||||
|
|
@ -169,7 +169,7 @@ bool output_surface_facets_to_off (std::ostream& os,
|
||||||
off(os, (options & Surface_mesher::IO_VERBOSE) != 0);
|
off(os, (options & Surface_mesher::IO_VERBOSE) != 0);
|
||||||
|
|
||||||
success &= off.write_header(tr.number_of_vertices(),
|
success &= off.write_header(tr.number_of_vertices(),
|
||||||
c2t3.number_of_facets());
|
c2t3.number_of_facets());
|
||||||
|
|
||||||
CGAL_assertion(c2t3.number_of_facets() == number_of_facets_on_surface(tr));
|
CGAL_assertion(c2t3.number_of_facets() == number_of_facets_on_surface(tr));
|
||||||
|
|
||||||
|
|
@ -189,16 +189,16 @@ bool output_surface_facets_to_off (std::ostream& os,
|
||||||
if((options & Surface_mesher::IO_ORIENT_SURFACE) == 0)
|
if((options & Surface_mesher::IO_ORIENT_SURFACE) == 0)
|
||||||
{
|
{
|
||||||
for( Finite_facets_iterator fit = tr.finite_facets_begin();
|
for( Finite_facets_iterator fit = tr.finite_facets_begin();
|
||||||
fit != tr.finite_facets_end(); ++fit)
|
fit != tr.finite_facets_end(); ++fit)
|
||||||
{
|
{
|
||||||
const typename Tr::Cell_handle cell = fit->first;
|
const typename Tr::Cell_handle cell = fit->first;
|
||||||
const int& index = fit->second;
|
const int& index = fit->second;
|
||||||
if (cell->is_facet_on_surface(index)==true)
|
if (cell->is_facet_on_surface(index)==true)
|
||||||
{
|
{
|
||||||
const int index1 = V[cell->vertex(tr.vertex_triple_index(index, 0))];
|
const int index1 = V[cell->vertex(tr.vertex_triple_index(index, 0))];
|
||||||
const int index2 = V[cell->vertex(tr.vertex_triple_index(index, 1))];
|
const int index2 = V[cell->vertex(tr.vertex_triple_index(index, 1))];
|
||||||
const int index3 = V[cell->vertex(tr.vertex_triple_index(index, 2))];
|
const int index3 = V[cell->vertex(tr.vertex_triple_index(index, 2))];
|
||||||
success &= off.write_facet(index1, index2, index3);
|
success &= off.write_facet(index1, index2, index3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -215,50 +215,50 @@ bool output_surface_facets_to_off (std::ostream& os,
|
||||||
|
|
||||||
while (oriented_set.size() != number_of_facets)
|
while (oriented_set.size() != number_of_facets)
|
||||||
{
|
{
|
||||||
while ( fit->first->is_facet_on_surface(fit->second) == false ||
|
while ( fit->first->is_facet_on_surface(fit->second) == false ||
|
||||||
oriented_set.find(*fit) != oriented_set.end() ||
|
oriented_set.find(*fit) != oriented_set.end() ||
|
||||||
|
|
||||||
oriented_set.find(c2t3.opposite_facet(*fit)) !=
|
oriented_set.find(c2t3.opposite_facet(*fit)) !=
|
||||||
oriented_set.end() )
|
oriented_set.end() )
|
||||||
{
|
{
|
||||||
++fit;
|
++fit;
|
||||||
}
|
}
|
||||||
oriented_set.insert(*fit);
|
oriented_set.insert(*fit);
|
||||||
stack.push(*fit);
|
stack.push(*fit);
|
||||||
while(! stack.empty() )
|
while(! stack.empty() )
|
||||||
{
|
{
|
||||||
Facet f = stack.top();
|
Facet f = stack.top();
|
||||||
stack.pop();
|
stack.pop();
|
||||||
for(int ih = 0 ; ih < 3 ; ++ih) {
|
for(int ih = 0 ; ih < 3 ; ++ih) {
|
||||||
const int i1 = tr.vertex_triple_index(f.second, tr. cw(ih));
|
const int i1 = tr.vertex_triple_index(f.second, tr. cw(ih));
|
||||||
const int i2 = tr.vertex_triple_index(f.second, tr.ccw(ih));
|
const int i2 = tr.vertex_triple_index(f.second, tr.ccw(ih));
|
||||||
|
|
||||||
const typename C2t3::Face_status face_status
|
const typename C2t3::Face_status face_status
|
||||||
= c2t3.face_status(Edge(f.first, i1, i2));
|
= c2t3.face_status(Edge(f.first, i1, i2));
|
||||||
if(face_status == C2t3::REGULAR) {
|
if(face_status == C2t3::REGULAR) {
|
||||||
Facet fn = c2t3.neighbor(f, ih);
|
Facet fn = c2t3.neighbor(f, ih);
|
||||||
if (oriented_set.find(fn) == oriented_set.end()) {
|
if (oriented_set.find(fn) == oriented_set.end()) {
|
||||||
if(oriented_set.find(c2t3.opposite_facet(fn)) == oriented_set.end())
|
if(oriented_set.find(c2t3.opposite_facet(fn)) == oriented_set.end())
|
||||||
{
|
{
|
||||||
oriented_set.insert(fn);
|
oriented_set.insert(fn);
|
||||||
stack.push(fn);
|
stack.push(fn);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
success = false; // non-orientable
|
success = false; // non-orientable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(face_status != C2t3::BOUNDARY) {
|
else if(face_status != C2t3::BOUNDARY) {
|
||||||
success = false; // non manifold, thus non-orientable
|
success = false; // non manifold, thus non-orientable
|
||||||
}
|
}
|
||||||
} // end "for each neighbor of f"
|
} // end "for each neighbor of f"
|
||||||
} // end "stack non empty"
|
} // end "stack non empty"
|
||||||
} // end "oriented_set not full"
|
} // end "oriented_set not full"
|
||||||
|
|
||||||
for(typename std::set<Facet>::const_iterator fit =
|
for(typename std::set<Facet>::const_iterator fit =
|
||||||
oriented_set.begin();
|
oriented_set.begin();
|
||||||
fit != oriented_set.end();
|
fit != oriented_set.end();
|
||||||
++fit)
|
++fit)
|
||||||
{
|
{
|
||||||
const typename Tr::Cell_handle cell = fit->first;
|
const typename Tr::Cell_handle cell = fit->first;
|
||||||
const int& index = fit->second;
|
const int& index = fit->second;
|
||||||
|
|
@ -289,89 +289,89 @@ bool output_surface_facets_to_off (std::ostream& os,
|
||||||
// CGAL::Polyhedron_incremental_builder_3<HalfedgeDS> builder(hds, true);
|
// CGAL::Polyhedron_incremental_builder_3<HalfedgeDS> builder(hds, true);
|
||||||
// const typename Tr::size_type number_of_facets = c2t3.number_of_facets();
|
// const typename Tr::size_type number_of_facets = c2t3.number_of_facets();
|
||||||
// builder.begin_surface(tr.number_of_vertices(),
|
// builder.begin_surface(tr.number_of_vertices(),
|
||||||
// number_of_facets);
|
// number_of_facets);
|
||||||
// {
|
// {
|
||||||
// // Finite vertices coordinates.
|
// // Finite vertices coordinates.
|
||||||
// std::map<Vertex_handle, int> V;
|
// std::map<Vertex_handle, int> V;
|
||||||
// int inum = 0;
|
// int inum = 0;
|
||||||
// for(Finite_vertices_iterator vit = tr.finite_vertices_begin();
|
// for(Finite_vertices_iterator vit = tr.finite_vertices_begin();
|
||||||
// vit != tr.finite_vertices_end();
|
// vit != tr.finite_vertices_end();
|
||||||
// ++vit)
|
// ++vit)
|
||||||
// {
|
// {
|
||||||
// V[vit] = inum++;
|
// V[vit] = inum++;
|
||||||
// Point p = static_cast<Point>(vit->point());
|
// Point p = static_cast<Point>(vit->point());
|
||||||
// builder.add_vertex(p);
|
// builder.add_vertex(p);
|
||||||
// }
|
// }
|
||||||
// Finite_facets_iterator fit = tr.finite_facets_begin();
|
// Finite_facets_iterator fit = tr.finite_facets_begin();
|
||||||
// std::set<Facet> oriented_set;
|
// std::set<Facet> oriented_set;
|
||||||
// std::stack<Facet> stack;
|
// std::stack<Facet> stack;
|
||||||
|
|
||||||
// CGAL_assertion_code(typename Tr::size_type nb_facets = 0; )
|
// CGAL_assertion_code(typename Tr::size_type nb_facets = 0; )
|
||||||
|
|
||||||
// while (oriented_set.size() != number_of_facets) {
|
// while (oriented_set.size() != number_of_facets) {
|
||||||
// while ( fit->first->is_facet_on_surface(fit->second) == false ||
|
// while ( fit->first->is_facet_on_surface(fit->second) == false ||
|
||||||
// oriented_set.find(*fit) != oriented_set.end() ||
|
// oriented_set.find(*fit) != oriented_set.end() ||
|
||||||
|
|
||||||
// oriented_set.find(c2t3.opposite_facet(*fit)) !=
|
// oriented_set.find(c2t3.opposite_facet(*fit)) !=
|
||||||
// oriented_set.end() ) {
|
// oriented_set.end() ) {
|
||||||
// ++fit;
|
// ++fit;
|
||||||
// }
|
// }
|
||||||
// oriented_set.insert(*fit);
|
// oriented_set.insert(*fit);
|
||||||
// stack.push(*fit);
|
// stack.push(*fit);
|
||||||
// while(! stack.empty() ) {
|
// while(! stack.empty() ) {
|
||||||
// Facet f = stack.top();
|
// Facet f = stack.top();
|
||||||
// stack.pop();
|
// stack.pop();
|
||||||
// for(int ih = 0 ; ih < 3 ; ++ih) {
|
// for(int ih = 0 ; ih < 3 ; ++ih) {
|
||||||
// const int i1 = tr.vertex_triple_index(f.second, tr. cw(ih));
|
// const int i1 = tr.vertex_triple_index(f.second, tr. cw(ih));
|
||||||
// const int i2 = tr.vertex_triple_index(f.second, tr.ccw(ih));
|
// const int i2 = tr.vertex_triple_index(f.second, tr.ccw(ih));
|
||||||
// if( c2t3.face_status(Edge(f.first, i1, i2)) == C2t3::REGULAR ) {
|
// if( c2t3.face_status(Edge(f.first, i1, i2)) == C2t3::REGULAR ) {
|
||||||
// Facet fn = c2t3.neighbor(f, ih);
|
// Facet fn = c2t3.neighbor(f, ih);
|
||||||
// if (oriented_set.find(fn) == oriented_set.end() &&
|
// if (oriented_set.find(fn) == oriented_set.end() &&
|
||||||
// oriented_set.find(c2t3.opposite_facet(fn)) == oriented_set.end())
|
// oriented_set.find(c2t3.opposite_facet(fn)) == oriented_set.end())
|
||||||
// {
|
// {
|
||||||
// oriented_set.insert(fn);
|
// oriented_set.insert(fn);
|
||||||
// stack.push(fn);
|
// stack.push(fn);
|
||||||
// }
|
// }
|
||||||
// } // end "if the edge is regular"
|
// } // end "if the edge is regular"
|
||||||
// } // end "for each neighbor of f"
|
// } // end "for each neighbor of f"
|
||||||
// } // end "stack non empty"
|
// } // end "stack non empty"
|
||||||
// } // end "oriented_set not full"
|
// } // end "oriented_set not full"
|
||||||
|
|
||||||
// for(typename std::set<Facet>::const_iterator fit =
|
// for(typename std::set<Facet>::const_iterator fit =
|
||||||
// oriented_set.begin();
|
// oriented_set.begin();
|
||||||
// fit != oriented_set.end();
|
// fit != oriented_set.end();
|
||||||
// ++fit)
|
// ++fit)
|
||||||
// {
|
// {
|
||||||
// int indices[3];
|
// int indices[3];
|
||||||
// int index = 0;
|
// int index = 0;
|
||||||
// for (int i=0; i<3; i++)
|
// for (int i=0; i<3; i++)
|
||||||
// indices[index++] =
|
// indices[index++] =
|
||||||
// V[fit->first->vertex(tr.vertex_triple_index(fit->second, i))];
|
// V[fit->first->vertex(tr.vertex_triple_index(fit->second, i))];
|
||||||
// builder.add_facet(indices+0, indices+3);
|
// builder.add_facet(indices+0, indices+3);
|
||||||
// CGAL_assertion_code(++nb_facets);
|
// CGAL_assertion_code(++nb_facets);
|
||||||
// }
|
// }
|
||||||
// CGAL_assertion(nb_facets == number_of_facets);
|
// CGAL_assertion(nb_facets == number_of_facets);
|
||||||
// // for( Finite_facets_iterator fit = tr.finite_facets_begin();
|
// // for( Finite_facets_iterator fit = tr.finite_facets_begin();
|
||||||
// // fit != tr.finite_facets_end(); ++fit)
|
// // fit != tr.finite_facets_end(); ++fit)
|
||||||
// // if ((*fit).first->is_facet_on_surface((*fit).second)==true)
|
// // if ((*fit).first->is_facet_on_surface((*fit).second)==true)
|
||||||
// // {
|
// // {
|
||||||
// // int indices[3];
|
// // int indices[3];
|
||||||
// // int index = 0;
|
// // int index = 0;
|
||||||
// // for (int i=0; i<3; i++)
|
// // for (int i=0; i<3; i++)
|
||||||
// // std::cerr << ( indices[index++] = V[(*fit).first->vertex(tr.vertex_triple_index(fit->second, i))] ) << ", ";
|
// // std::cerr << ( indices[index++] = V[(*fit).first->vertex(tr.vertex_triple_index(fit->second, i))] ) << ", ";
|
||||||
// // std::cerr << "\n";
|
// // std::cerr << "\n";
|
||||||
// // if( builder.test_facet(indices+0, indices+3) )
|
// // if( builder.test_facet(indices+0, indices+3) )
|
||||||
// // builder.add_facet(indices+0, indices+3);
|
// // builder.add_facet(indices+0, indices+3);
|
||||||
// // else
|
// // else
|
||||||
// // {
|
// // {
|
||||||
// // builder.begin_facet();
|
// // builder.begin_facet();
|
||||||
// // builder.add_vertex_to_facet(indices[2]);
|
// // builder.add_vertex_to_facet(indices[2]);
|
||||||
// // builder.add_vertex_to_facet(indices[1]);
|
// // builder.add_vertex_to_facet(indices[1]);
|
||||||
// // builder.add_vertex_to_facet(indices[0]);
|
// // builder.add_vertex_to_facet(indices[0]);
|
||||||
// // builder.end_facet();
|
// // builder.end_facet();
|
||||||
// // }
|
// // }
|
||||||
// // CGAL_assertion_code(++nb_facets);
|
// // CGAL_assertion_code(++nb_facets);
|
||||||
// // }
|
// // }
|
||||||
// }
|
// }
|
||||||
// builder.end_surface();
|
// builder.end_surface();
|
||||||
// }
|
// }
|
||||||
|
|
@ -417,17 +417,17 @@ output_oriented_surface_facets_to_off (std::ostream& os, const Tr & T) {
|
||||||
fit != T.finite_facets_end(); ++fit)
|
fit != T.finite_facets_end(); ++fit)
|
||||||
if ((*fit).first->is_facet_on_surface((*fit).second)==true)
|
if ((*fit).first->is_facet_on_surface((*fit).second)==true)
|
||||||
{
|
{
|
||||||
typename Tr::Facet f = *fit;
|
typename Tr::Facet f = *fit;
|
||||||
typename Tr::Facet opposite = T.mirror_facet(f);
|
typename Tr::Facet opposite = T.mirror_facet(f);
|
||||||
CGAL_assertion (f.first->is_in_domain() !=
|
CGAL_assertion (f.first->is_in_domain() !=
|
||||||
opposite.first->is_in_domain());
|
opposite.first->is_in_domain());
|
||||||
if(!f.first->is_in_domain())
|
if(!f.first->is_in_domain())
|
||||||
f = T.mirror_facet(f);
|
f = T.mirror_facet(f);
|
||||||
os << "3 "
|
os << "3 "
|
||||||
<< V[f.first->vertex(T.vertex_triple_index(f.second,0))] << " "
|
<< V[f.first->vertex(T.vertex_triple_index(f.second,0))] << " "
|
||||||
<< V[f.first->vertex(T.vertex_triple_index(f.second,1))] << " "
|
<< V[f.first->vertex(T.vertex_triple_index(f.second,1))] << " "
|
||||||
<< V[f.first->vertex(T.vertex_triple_index(f.second,2))] << " "
|
<< V[f.first->vertex(T.vertex_triple_index(f.second,2))] << " "
|
||||||
<< "\n"; // without color.
|
<< "\n"; // without color.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -435,8 +435,8 @@ output_oriented_surface_facets_to_off (std::ostream& os, const Tr & T) {
|
||||||
template < class Tr>
|
template < class Tr>
|
||||||
void
|
void
|
||||||
output_surface_facets_to_ghs (std::ostream& os_points,
|
output_surface_facets_to_ghs (std::ostream& os_points,
|
||||||
std::ostream& os_faces,
|
std::ostream& os_faces,
|
||||||
const Tr & T) {
|
const Tr & T) {
|
||||||
typedef typename Tr::Finite_facets_iterator Finite_facets_iterator;
|
typedef typename Tr::Finite_facets_iterator Finite_facets_iterator;
|
||||||
typedef typename Tr::Finite_vertices_iterator Finite_vertices_iterator;
|
typedef typename Tr::Finite_vertices_iterator Finite_vertices_iterator;
|
||||||
typedef typename Tr::Vertex_handle Vertex_handle;
|
typedef typename Tr::Vertex_handle Vertex_handle;
|
||||||
|
|
@ -466,15 +466,15 @@ output_surface_facets_to_ghs (std::ostream& os_points,
|
||||||
fit != T.finite_facets_end(); ++fit)
|
fit != T.finite_facets_end(); ++fit)
|
||||||
if ((*fit).first->is_facet_on_surface((*fit).second)==true)
|
if ((*fit).first->is_facet_on_surface((*fit).second)==true)
|
||||||
{
|
{
|
||||||
Facet f = *fit;
|
Facet f = *fit;
|
||||||
if(!f.first->is_in_domain())
|
if(!f.first->is_in_domain())
|
||||||
f = T.mirror_facet(f);
|
f = T.mirror_facet(f);
|
||||||
os_faces
|
os_faces
|
||||||
<< "3 "
|
<< "3 "
|
||||||
<< V[f.first->vertex(T.vertex_triple_index(f.second,0))] << " "
|
<< V[f.first->vertex(T.vertex_triple_index(f.second,0))] << " "
|
||||||
<< V[f.first->vertex(T.vertex_triple_index(f.second,1))] << " "
|
<< V[f.first->vertex(T.vertex_triple_index(f.second,1))] << " "
|
||||||
<< V[f.first->vertex(T.vertex_triple_index(f.second,2))] << " "
|
<< V[f.first->vertex(T.vertex_triple_index(f.second,2))] << " "
|
||||||
<< "0 0 0 0\n";
|
<< "0 0 0 0\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -485,7 +485,7 @@ int number_of_facets_in_domain(const Tr& T) {
|
||||||
fit != T.finite_facets_end(); ++fit) {
|
fit != T.finite_facets_end(); ++fit) {
|
||||||
typename Tr::Cell_handle neighb = fit->first->neighbor (fit->second);
|
typename Tr::Cell_handle neighb = fit->first->neighbor (fit->second);
|
||||||
if ((fit->first->is_in_domain () || neighb->is_in_domain()) &&
|
if ((fit->first->is_in_domain () || neighb->is_in_domain()) &&
|
||||||
!fit->first->is_facet_on_surface (fit->second))
|
!fit->first->is_facet_on_surface (fit->second))
|
||||||
++result;
|
++result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -522,14 +522,14 @@ output_interior_facets_to_off (std::ostream& os, const Tr & T) {
|
||||||
fit != T.finite_facets_end(); ++fit){
|
fit != T.finite_facets_end(); ++fit){
|
||||||
typename Tr::Cell_handle neighb = fit->first->neighbor (fit->second);
|
typename Tr::Cell_handle neighb = fit->first->neighbor (fit->second);
|
||||||
if ((fit->first->is_in_domain () || neighb->is_in_domain()) &&
|
if ((fit->first->is_in_domain () || neighb->is_in_domain()) &&
|
||||||
!fit->first->is_facet_on_surface (fit->second))
|
!fit->first->is_facet_on_surface (fit->second))
|
||||||
{
|
{
|
||||||
os << "3 ";
|
os << "3 ";
|
||||||
for (int i=0; i<4; i++)
|
for (int i=0; i<4; i++)
|
||||||
if (i != (*fit).second)
|
if (i != (*fit).second)
|
||||||
os << V[(*fit).first->vertex(i)] << " ";
|
os << V[(*fit).first->vertex(i)] << " ";
|
||||||
|
|
||||||
os << "\n"; // without color.
|
os << "\n"; // without color.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,15 +128,15 @@ public:
|
||||||
bool is_edge(Face_handle fh, int i) const;
|
bool is_edge(Face_handle fh, int i) const;
|
||||||
bool is_edge(Vertex_handle va, Vertex_handle vb) const;
|
bool is_edge(Vertex_handle va, Vertex_handle vb) const;
|
||||||
bool is_edge(Vertex_handle va, Vertex_handle vb,
|
bool is_edge(Vertex_handle va, Vertex_handle vb,
|
||||||
Face_handle& fr, int& i) const;
|
Face_handle& fr, int& i) const;
|
||||||
bool is_face(Face_handle fh) const;
|
bool is_face(Face_handle fh) const;
|
||||||
bool is_face(Vertex_handle v1,
|
bool is_face(Vertex_handle v1,
|
||||||
Vertex_handle v2,
|
Vertex_handle v2,
|
||||||
Vertex_handle v3) const;
|
Vertex_handle v3) const;
|
||||||
bool is_face(Vertex_handle v1,
|
bool is_face(Vertex_handle v1,
|
||||||
Vertex_handle v2,
|
Vertex_handle v2,
|
||||||
Vertex_handle v3,
|
Vertex_handle v3,
|
||||||
Face_handle& fr) const;
|
Face_handle& fr) const;
|
||||||
|
|
||||||
// ITERATORS AND CIRCULATORS
|
// ITERATORS AND CIRCULATORS
|
||||||
public:
|
public:
|
||||||
|
|
@ -191,17 +191,17 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
Face_circulator incident_faces(Vertex_handle v,
|
Face_circulator incident_faces(Vertex_handle v,
|
||||||
Face_handle f = Face_handle()) const{
|
Face_handle f = Face_handle()) const{
|
||||||
return Face_circulator(v,f);
|
return Face_circulator(v,f);
|
||||||
}
|
}
|
||||||
Vertex_circulator incident_vertices(Vertex_handle v,
|
Vertex_circulator incident_vertices(Vertex_handle v,
|
||||||
Face_handle f = Face_handle()) const
|
Face_handle f = Face_handle()) const
|
||||||
{
|
{
|
||||||
return Vertex_circulator(v,f);
|
return Vertex_circulator(v,f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Edge_circulator incident_edges(Vertex_handle v,
|
Edge_circulator incident_edges(Vertex_handle v,
|
||||||
Face_handle f = Face_handle()) const{
|
Face_handle f = Face_handle()) const{
|
||||||
return Edge_circulator(v,f);
|
return Edge_circulator(v,f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -210,7 +210,7 @@ public:
|
||||||
Vertex_circulator vc = incident_vertices(v), done(vc);
|
Vertex_circulator vc = incident_vertices(v), done(vc);
|
||||||
if ( ! vc.is_empty()) {
|
if ( ! vc.is_empty()) {
|
||||||
do {
|
do {
|
||||||
count += 1;
|
count += 1;
|
||||||
} while (++vc != done);
|
} while (++vc != done);
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
|
@ -221,7 +221,7 @@ public:
|
||||||
mirror_vertex(Face_handle f, int i) const
|
mirror_vertex(Face_handle f, int i) const
|
||||||
{
|
{
|
||||||
CGAL_triangulation_precondition ( f->neighbor(i) != Face_handle()
|
CGAL_triangulation_precondition ( f->neighbor(i) != Face_handle()
|
||||||
&& f->dimension() >= 1);
|
&& f->dimension() >= 1);
|
||||||
return f->neighbor(i)->vertex(mirror_index(f,i));
|
return f->neighbor(i)->vertex(mirror_index(f,i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -230,7 +230,7 @@ public:
|
||||||
{
|
{
|
||||||
// return the index of opposite vertex in neighbor(i);
|
// return the index of opposite vertex in neighbor(i);
|
||||||
CGAL_triangulation_precondition (f->neighbor(i) != Face_handle() &&
|
CGAL_triangulation_precondition (f->neighbor(i) != Face_handle() &&
|
||||||
f->dimension() >= 1);
|
f->dimension() >= 1);
|
||||||
if (f->dimension() == 1) {
|
if (f->dimension() == 1) {
|
||||||
CGAL_assertion(i<=1);
|
CGAL_assertion(i<=1);
|
||||||
const int j = f->neighbor(i)->index(f->vertex((i==0) ? 1 : 0));
|
const int j = f->neighbor(i)->index(f->vertex((i==0) ? 1 : 0));
|
||||||
|
|
@ -257,7 +257,7 @@ public:
|
||||||
Vertex_handle insert_in_face(Face_handle f);
|
Vertex_handle insert_in_face(Face_handle f);
|
||||||
Vertex_handle insert_in_edge(Face_handle f, int i);
|
Vertex_handle insert_in_edge(Face_handle f, int i);
|
||||||
Vertex_handle insert_dim_up(Vertex_handle w = Vertex_handle(),
|
Vertex_handle insert_dim_up(Vertex_handle w = Vertex_handle(),
|
||||||
bool orient=true);
|
bool orient=true);
|
||||||
|
|
||||||
void remove_degree_3(Vertex_handle v, Face_handle f = Face_handle());
|
void remove_degree_3(Vertex_handle v, Face_handle f = Face_handle());
|
||||||
void remove_1D(Vertex_handle v);
|
void remove_1D(Vertex_handle v);
|
||||||
|
|
@ -279,16 +279,16 @@ public:
|
||||||
|
|
||||||
// template< class EdgeIt, class FaceIt>
|
// template< class EdgeIt, class FaceIt>
|
||||||
// Vertex_handle star_hole(EdgeIt edge_begin,
|
// Vertex_handle star_hole(EdgeIt edge_begin,
|
||||||
// EdgeIt edge_end,
|
// EdgeIt edge_end,
|
||||||
// FaceIt face_begin,
|
// FaceIt face_begin,
|
||||||
// FaceIt face_end);
|
// FaceIt face_end);
|
||||||
|
|
||||||
// template< class EdgeIt, class FaceIt>
|
// template< class EdgeIt, class FaceIt>
|
||||||
// void star_hole(Vertex_handle v,
|
// void star_hole(Vertex_handle v,
|
||||||
// EdgeIt edge_begin,
|
// EdgeIt edge_begin,
|
||||||
// EdgeIt edge_end,
|
// EdgeIt edge_end,
|
||||||
// FaceIt face_begin,
|
// FaceIt face_begin,
|
||||||
// FaceIt face_end);
|
// FaceIt face_end);
|
||||||
|
|
||||||
Vertex_handle create_vertex();
|
Vertex_handle create_vertex();
|
||||||
Vertex_handle create_vertex(const Vertex &v);
|
Vertex_handle create_vertex(const Vertex &v);
|
||||||
|
|
@ -298,20 +298,20 @@ public:
|
||||||
Face_handle create_face(Face_handle f); //calls copy constructor
|
Face_handle create_face(Face_handle f); //calls copy constructor
|
||||||
|
|
||||||
Face_handle create_face(Face_handle f1, int i1,
|
Face_handle create_face(Face_handle f1, int i1,
|
||||||
Face_handle f2, int i2,
|
Face_handle f2, int i2,
|
||||||
Face_handle f3, int i3);
|
Face_handle f3, int i3);
|
||||||
Face_handle create_face(Face_handle f1, int i1,
|
Face_handle create_face(Face_handle f1, int i1,
|
||||||
Face_handle f2, int i2);
|
Face_handle f2, int i2);
|
||||||
Face_handle create_face(Face_handle f1, int i1, Vertex_handle v);
|
Face_handle create_face(Face_handle f1, int i1, Vertex_handle v);
|
||||||
Face_handle create_face(Vertex_handle v1,
|
Face_handle create_face(Vertex_handle v1,
|
||||||
Vertex_handle v2,
|
Vertex_handle v2,
|
||||||
Vertex_handle v3);
|
Vertex_handle v3);
|
||||||
Face_handle create_face(Vertex_handle v1,
|
Face_handle create_face(Vertex_handle v1,
|
||||||
Vertex_handle v2,
|
Vertex_handle v2,
|
||||||
Vertex_handle v3,
|
Vertex_handle v3,
|
||||||
Face_handle f1,
|
Face_handle f1,
|
||||||
Face_handle f2,
|
Face_handle f2,
|
||||||
Face_handle f3);
|
Face_handle f3);
|
||||||
|
|
||||||
void set_adjacency(Face_handle f0, int i0, Face_handle f1, int i1) const;
|
void set_adjacency(Face_handle f0, int i0, Face_handle f1, int i1) const;
|
||||||
|
|
||||||
|
|
@ -357,8 +357,8 @@ private:
|
||||||
typedef std::pair<Vertex_handle,Vertex_handle> Vh_pair;
|
typedef std::pair<Vertex_handle,Vertex_handle> Vh_pair;
|
||||||
public:
|
public:
|
||||||
void set_adjacency(Face_handle fh,
|
void set_adjacency(Face_handle fh,
|
||||||
int ih,
|
int ih,
|
||||||
std::map< Vh_pair, Edge>& edge_map);
|
std::map< Vh_pair, Edge>& edge_map);
|
||||||
void reorient_faces();
|
void reorient_faces();
|
||||||
private:
|
private:
|
||||||
bool dim_down_precondition(Face_handle f, int i);
|
bool dim_down_precondition(Face_handle f, int i);
|
||||||
|
|
@ -416,12 +416,12 @@ public:
|
||||||
// I/O
|
// I/O
|
||||||
Vertex_handle file_input(std::istream& is, bool skip_first=false);
|
Vertex_handle file_input(std::istream& is, bool skip_first=false);
|
||||||
void file_output(std::ostream& os,
|
void file_output(std::ostream& os,
|
||||||
Vertex_handle v = Vertex_handle(),
|
Vertex_handle v = Vertex_handle(),
|
||||||
bool skip_first=false) const;
|
bool skip_first=false) const;
|
||||||
Vertex_handle off_file_input(std::istream& is, bool verbose=false);
|
Vertex_handle off_file_input(std::istream& is, bool verbose=false);
|
||||||
void vrml_output(std::ostream& os,
|
void vrml_output(std::ostream& os,
|
||||||
Vertex_handle v = Vertex_handle(),
|
Vertex_handle v = Vertex_handle(),
|
||||||
bool skip_first=false) const;
|
bool skip_first=false) const;
|
||||||
|
|
||||||
// SETTING (had to make them public for use in remove from Triangulations)
|
// SETTING (had to make them public for use in remove from Triangulations)
|
||||||
void set_dimension (int n) {_dimension = n ;}
|
void set_dimension (int n) {_dimension = n ;}
|
||||||
|
|
@ -550,19 +550,19 @@ public:
|
||||||
{
|
{
|
||||||
std::list<Face_handle> empty_list;
|
std::list<Face_handle> empty_list;
|
||||||
star_hole(v,
|
star_hole(v,
|
||||||
edge_begin,
|
edge_begin,
|
||||||
edge_end,
|
edge_end,
|
||||||
empty_list.begin(),
|
empty_list.begin(),
|
||||||
empty_list.end());
|
empty_list.end());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template< class EdgeIt, class FaceIt>
|
template< class EdgeIt, class FaceIt>
|
||||||
Vertex_handle star_hole(EdgeIt edge_begin,
|
Vertex_handle star_hole(EdgeIt edge_begin,
|
||||||
EdgeIt edge_end,
|
EdgeIt edge_end,
|
||||||
FaceIt face_begin,
|
FaceIt face_begin,
|
||||||
FaceIt face_end)
|
FaceIt face_end)
|
||||||
// creates a new vertex
|
// creates a new vertex
|
||||||
// and stars from it
|
// and stars from it
|
||||||
// the hole described by the range [edge_begin,edge_end[
|
// the hole described by the range [edge_begin,edge_end[
|
||||||
|
|
@ -577,10 +577,10 @@ public:
|
||||||
|
|
||||||
template< class EdgeIt, class FaceIt>
|
template< class EdgeIt, class FaceIt>
|
||||||
void star_hole(Vertex_handle newv,
|
void star_hole(Vertex_handle newv,
|
||||||
EdgeIt edge_begin,
|
EdgeIt edge_begin,
|
||||||
EdgeIt edge_end,
|
EdgeIt edge_end,
|
||||||
FaceIt face_begin,
|
FaceIt face_begin,
|
||||||
FaceIt face_end)
|
FaceIt face_end)
|
||||||
// uses vertex v
|
// uses vertex v
|
||||||
// to star the hole described by the range [edge_begin,edge_end[
|
// to star the hole described by the range [edge_begin,edge_end[
|
||||||
// reusing the faces in the range [face_begin,face_end[
|
// reusing the faces in the range [face_begin,face_end[
|
||||||
|
|
@ -615,10 +615,10 @@ public:
|
||||||
private:
|
private:
|
||||||
template< class FaceIt>
|
template< class FaceIt>
|
||||||
Face_handle reset_or_create_face(Face_handle fn,
|
Face_handle reset_or_create_face(Face_handle fn,
|
||||||
int in,
|
int in,
|
||||||
Vertex_handle v,
|
Vertex_handle v,
|
||||||
FaceIt& fit,
|
FaceIt& fit,
|
||||||
const FaceIt& face_end)
|
const FaceIt& face_end)
|
||||||
{
|
{
|
||||||
if (fit == face_end) return create_face(fn, in, v);
|
if (fit == face_end) return create_face(fn, in, v);
|
||||||
(*fit)->set_vertices(fn->vertex(cw(in)), fn->vertex(ccw(in)), v);
|
(*fit)->set_vertices(fn->vertex(cw(in)), fn->vertex(ccw(in)), v);
|
||||||
|
|
@ -790,7 +790,7 @@ template <class Vb, class Fb>
|
||||||
bool
|
bool
|
||||||
Triangulation_data_structure_2<Vb,Fb>::
|
Triangulation_data_structure_2<Vb,Fb>::
|
||||||
is_edge(Vertex_handle va, Vertex_handle vb,
|
is_edge(Vertex_handle va, Vertex_handle vb,
|
||||||
Face_handle &fr, int & i) const
|
Face_handle &fr, int & i) const
|
||||||
// assume va is a vertex of t
|
// assume va is a vertex of t
|
||||||
// returns true (false) if the line segment ab is (is not) an edge of t
|
// returns true (false) if the line segment ab is (is not) an edge of t
|
||||||
// if true is returned (fr,i) is the edge ab
|
// if true is returned (fr,i) is the edge ab
|
||||||
|
|
@ -828,8 +828,8 @@ template <class Vb, class Fb>
|
||||||
inline bool
|
inline bool
|
||||||
Triangulation_data_structure_2<Vb,Fb>::
|
Triangulation_data_structure_2<Vb,Fb>::
|
||||||
is_face(Vertex_handle v1,
|
is_face(Vertex_handle v1,
|
||||||
Vertex_handle v2,
|
Vertex_handle v2,
|
||||||
Vertex_handle v3) const
|
Vertex_handle v3) const
|
||||||
{
|
{
|
||||||
Face_handle f;
|
Face_handle f;
|
||||||
return is_face(v1,v2,v3,f);
|
return is_face(v1,v2,v3,f);
|
||||||
|
|
@ -839,9 +839,9 @@ template <class Vb, class Fb>
|
||||||
bool
|
bool
|
||||||
Triangulation_data_structure_2<Vb,Fb>::
|
Triangulation_data_structure_2<Vb,Fb>::
|
||||||
is_face(Vertex_handle v1,
|
is_face(Vertex_handle v1,
|
||||||
Vertex_handle v2,
|
Vertex_handle v2,
|
||||||
Vertex_handle v3,
|
Vertex_handle v3,
|
||||||
Face_handle &f) const
|
Face_handle &f) const
|
||||||
{
|
{
|
||||||
if (dimension() != 2) return false;
|
if (dimension() != 2) return false;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -896,7 +896,7 @@ Triangulation_data_structure_2<Vb,Fb>::
|
||||||
insert_first( )
|
insert_first( )
|
||||||
{
|
{
|
||||||
CGAL_triangulation_precondition( number_of_vertices() == 0 &&
|
CGAL_triangulation_precondition( number_of_vertices() == 0 &&
|
||||||
dimension()==-2 );
|
dimension()==-2 );
|
||||||
return insert_dim_up();
|
return insert_dim_up();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -906,7 +906,7 @@ Triangulation_data_structure_2<Vb,Fb>::
|
||||||
insert_second()
|
insert_second()
|
||||||
{
|
{
|
||||||
CGAL_triangulation_precondition( number_of_vertices() == 1 &&
|
CGAL_triangulation_precondition( number_of_vertices() == 1 &&
|
||||||
dimension()==-1 );
|
dimension()==-1 );
|
||||||
return insert_dim_up();
|
return insert_dim_up();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -960,8 +960,8 @@ insert_in_edge(Face_handle f, int i)
|
||||||
CGAL_triangulation_precondition(f != Face_handle() && dimension() >= 1);
|
CGAL_triangulation_precondition(f != Face_handle() && dimension() >= 1);
|
||||||
if (dimension() == 1) {CGAL_triangulation_precondition(i == 2);}
|
if (dimension() == 1) {CGAL_triangulation_precondition(i == 2);}
|
||||||
if (dimension() == 2) {CGAL_triangulation_precondition(i == 0 ||
|
if (dimension() == 2) {CGAL_triangulation_precondition(i == 0 ||
|
||||||
i == 1 ||
|
i == 1 ||
|
||||||
i == 2);}
|
i == 2);}
|
||||||
Vertex_handle v;
|
Vertex_handle v;
|
||||||
if (dimension() == 1) {
|
if (dimension() == 1) {
|
||||||
v = create_vertex();
|
v = create_vertex();
|
||||||
|
|
@ -1022,7 +1022,7 @@ insert_dim_up(Vertex_handle w, bool orient)
|
||||||
Face_iterator ib= face_iterator_base_begin();
|
Face_iterator ib= face_iterator_base_begin();
|
||||||
Face_iterator ib_end = face_iterator_base_end();
|
Face_iterator ib_end = face_iterator_base_end();
|
||||||
for (; ib != ib_end ; ++ib){
|
for (; ib != ib_end ; ++ib){
|
||||||
faces_list.push_back( ib);
|
faces_list.push_back( ib);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<Face_handle> to_delete;
|
std::list<Face_handle> to_delete;
|
||||||
|
|
@ -1030,51 +1030,51 @@ insert_dim_up(Vertex_handle w, bool orient)
|
||||||
Face_handle f, g;
|
Face_handle f, g;
|
||||||
|
|
||||||
for ( ; lfit != faces_list.end() ; ++lfit) {
|
for ( ; lfit != faces_list.end() ; ++lfit) {
|
||||||
f = * lfit;
|
f = * lfit;
|
||||||
g = create_face(f); //calls copy constructor of face
|
g = create_face(f); //calls copy constructor of face
|
||||||
f->set_vertex(dim,v);
|
f->set_vertex(dim,v);
|
||||||
g->set_vertex(dim,w);
|
g->set_vertex(dim,w);
|
||||||
set_adjacency(f, dim, g, dim);
|
set_adjacency(f, dim, g, dim);
|
||||||
if (f->has_vertex(w)) to_delete.push_back(g); // flat face to delete
|
if (f->has_vertex(w)) to_delete.push_back(g); // flat face to delete
|
||||||
}
|
}
|
||||||
|
|
||||||
lfit = faces_list.begin();
|
lfit = faces_list.begin();
|
||||||
for ( ; lfit != faces_list.end() ; ++lfit) {
|
for ( ; lfit != faces_list.end() ; ++lfit) {
|
||||||
f = * lfit;
|
f = * lfit;
|
||||||
g = f->neighbor(dim);
|
g = f->neighbor(dim);
|
||||||
for(int j = 0; j < dim ; ++j) {
|
for(int j = 0; j < dim ; ++j) {
|
||||||
g->set_neighbor(j, f->neighbor(j)->neighbor(dim));
|
g->set_neighbor(j, f->neighbor(j)->neighbor(dim));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// couldn't unify the code for reorientation mater
|
// couldn't unify the code for reorientation mater
|
||||||
lfit = faces_list.begin() ;
|
lfit = faces_list.begin() ;
|
||||||
if (dim == 1){
|
if (dim == 1){
|
||||||
if (orient) {
|
if (orient) {
|
||||||
(*lfit)->reorient(); ++lfit ; (*lfit)->neighbor(1)->reorient();
|
(*lfit)->reorient(); ++lfit ; (*lfit)->neighbor(1)->reorient();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*lfit)->neighbor(1)->reorient(); ++lfit ; (*lfit)->reorient();
|
(*lfit)->neighbor(1)->reorient(); ++lfit ; (*lfit)->reorient();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // dimension == 2
|
else { // dimension == 2
|
||||||
for( ;lfit != faces_list.end(); ++lfit ) {
|
for( ;lfit != faces_list.end(); ++lfit ) {
|
||||||
if (orient) {(*lfit)->neighbor(2)->reorient();}
|
if (orient) {(*lfit)->neighbor(2)->reorient();}
|
||||||
else { (*lfit)->reorient();}
|
else { (*lfit)->reorient();}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lfit = to_delete.begin();
|
lfit = to_delete.begin();
|
||||||
int i1, i2;
|
int i1, i2;
|
||||||
for ( ;lfit != to_delete.end(); ++lfit){
|
for ( ;lfit != to_delete.end(); ++lfit){
|
||||||
f = *lfit ;
|
f = *lfit ;
|
||||||
int j ;
|
int j ;
|
||||||
if (f->vertex(0) == w) {j=0;}
|
if (f->vertex(0) == w) {j=0;}
|
||||||
else {j=1;}
|
else {j=1;}
|
||||||
f1= f->neighbor(dim); i1= mirror_index(f,dim); //f1->index(f);
|
f1= f->neighbor(dim); i1= mirror_index(f,dim); //f1->index(f);
|
||||||
f2= f->neighbor(j); i2= mirror_index(f,j); //f2->index(f);
|
f2= f->neighbor(j); i2= mirror_index(f,j); //f2->index(f);
|
||||||
set_adjacency(f1, i1, f2, i2);
|
set_adjacency(f1, i1, f2, i2);
|
||||||
delete_face(f);
|
delete_face(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
v->set_face( *(faces_list.begin()));
|
v->set_face( *(faces_list.begin()));
|
||||||
|
|
@ -1176,7 +1176,7 @@ dim_down(Face_handle f, int i)
|
||||||
Vertex_handle v1 = f->vertex(1);
|
Vertex_handle v1 = f->vertex(1);
|
||||||
f->set_vertex(1, v);
|
f->set_vertex(1, v);
|
||||||
Face_handle fl = create_face(v, v1, Vertex_handle(),
|
Face_handle fl = create_face(v, v1, Vertex_handle(),
|
||||||
n0, f, Face_handle());
|
n0, f, Face_handle());
|
||||||
f->set_neighbor(0, fl);
|
f->set_neighbor(0, fl);
|
||||||
n0->set_neighbor(1, fl);
|
n0->set_neighbor(1, fl);
|
||||||
v->set_face(f);
|
v->set_face(f);
|
||||||
|
|
@ -1217,15 +1217,15 @@ remove_dim_down(Vertex_handle v)
|
||||||
for( ; lfit != to_downgrade.end() ; ++lfit) {
|
for( ; lfit != to_downgrade.end() ; ++lfit) {
|
||||||
f = *lfit; j = f->index(v);
|
f = *lfit; j = f->index(v);
|
||||||
if (dimension() == 1) {
|
if (dimension() == 1) {
|
||||||
if (j == 0) f->reorient();
|
if (j == 0) f->reorient();
|
||||||
f->set_vertex(1,Vertex_handle());
|
f->set_vertex(1,Vertex_handle());
|
||||||
f->set_neighbor(1, Face_handle());
|
f->set_neighbor(1, Face_handle());
|
||||||
}
|
}
|
||||||
else { //dimension() == 2
|
else { //dimension() == 2
|
||||||
if (j == 0) f->cw_permute();
|
if (j == 0) f->cw_permute();
|
||||||
else if(j == 1) f->ccw_permute();
|
else if(j == 1) f->ccw_permute();
|
||||||
f->set_vertex(2, Vertex_handle());
|
f->set_vertex(2, Vertex_handle());
|
||||||
f->set_neighbor(2, Face_handle());
|
f->set_neighbor(2, Face_handle());
|
||||||
}
|
}
|
||||||
f->vertex(0)->set_face(f);
|
f->vertex(0)->set_face(f);
|
||||||
}
|
}
|
||||||
|
|
@ -1246,7 +1246,7 @@ Triangulation_data_structure_2<Vb,Fb>::
|
||||||
remove_1D(Vertex_handle v)
|
remove_1D(Vertex_handle v)
|
||||||
{
|
{
|
||||||
CGAL_triangulation_precondition( dimension() == 1 &&
|
CGAL_triangulation_precondition( dimension() == 1 &&
|
||||||
number_of_vertices() > 3);
|
number_of_vertices() > 3);
|
||||||
Face_handle f = v->face();
|
Face_handle f = v->face();
|
||||||
int i = f->index(v);
|
int i = f->index(v);
|
||||||
if (i==0) {f = f->neighbor(1);}
|
if (i==0) {f = f->neighbor(1);}
|
||||||
|
|
@ -1268,7 +1268,7 @@ Triangulation_data_structure_2<Vb,Fb>::
|
||||||
remove_second(Vertex_handle v)
|
remove_second(Vertex_handle v)
|
||||||
{
|
{
|
||||||
CGAL_triangulation_precondition(number_of_vertices()== 2 &&
|
CGAL_triangulation_precondition(number_of_vertices()== 2 &&
|
||||||
dimension() == 0);
|
dimension() == 0);
|
||||||
remove_dim_down(v);
|
remove_dim_down(v);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1280,7 +1280,7 @@ Triangulation_data_structure_2<Vb,Fb>::
|
||||||
remove_first(Vertex_handle v)
|
remove_first(Vertex_handle v)
|
||||||
{
|
{
|
||||||
CGAL_triangulation_precondition(number_of_vertices()== 1 &&
|
CGAL_triangulation_precondition(number_of_vertices()== 1 &&
|
||||||
dimension() == -1);
|
dimension() == -1);
|
||||||
remove_dim_down(v);
|
remove_dim_down(v);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1404,13 +1404,13 @@ template <class Vb, class Fb>
|
||||||
typename Triangulation_data_structure_2<Vb,Fb>::Face_handle
|
typename Triangulation_data_structure_2<Vb,Fb>::Face_handle
|
||||||
Triangulation_data_structure_2<Vb,Fb>::
|
Triangulation_data_structure_2<Vb,Fb>::
|
||||||
create_face(Face_handle f1, int i1,
|
create_face(Face_handle f1, int i1,
|
||||||
Face_handle f2, int i2,
|
Face_handle f2, int i2,
|
||||||
Face_handle f3, int i3)
|
Face_handle f3, int i3)
|
||||||
{
|
{
|
||||||
Face_handle newf = faces().emplace(f1->vertex(cw(i1)),
|
Face_handle newf = faces().emplace(f1->vertex(cw(i1)),
|
||||||
f2->vertex(cw(i2)),
|
f2->vertex(cw(i2)),
|
||||||
f3->vertex(cw(i3)),
|
f3->vertex(cw(i3)),
|
||||||
f2, f3, f1);
|
f2, f3, f1);
|
||||||
f1->set_neighbor(i1,newf);
|
f1->set_neighbor(i1,newf);
|
||||||
f2->set_neighbor(i2,newf);
|
f2->set_neighbor(i2,newf);
|
||||||
f3->set_neighbor(i3,newf);
|
f3->set_neighbor(i3,newf);
|
||||||
|
|
@ -1423,9 +1423,9 @@ Triangulation_data_structure_2<Vb,Fb>::
|
||||||
create_face(Face_handle f1, int i1, Face_handle f2, int i2)
|
create_face(Face_handle f1, int i1, Face_handle f2, int i2)
|
||||||
{
|
{
|
||||||
Face_handle newf = faces().emplace(f1->vertex(cw(i1)),
|
Face_handle newf = faces().emplace(f1->vertex(cw(i1)),
|
||||||
f2->vertex(cw(i2)),
|
f2->vertex(cw(i2)),
|
||||||
f2->vertex(ccw(i2)),
|
f2->vertex(ccw(i2)),
|
||||||
f2, Face_handle(), f1);
|
f2, Face_handle(), f1);
|
||||||
f1->set_neighbor(i1,newf);
|
f1->set_neighbor(i1,newf);
|
||||||
f2->set_neighbor(i2,newf);
|
f2->set_neighbor(i2,newf);
|
||||||
return newf;
|
return newf;
|
||||||
|
|
@ -1457,7 +1457,7 @@ template <class Vb, class Fb>
|
||||||
typename Triangulation_data_structure_2<Vb,Fb>::Face_handle
|
typename Triangulation_data_structure_2<Vb,Fb>::Face_handle
|
||||||
Triangulation_data_structure_2<Vb,Fb>::
|
Triangulation_data_structure_2<Vb,Fb>::
|
||||||
create_face(Vertex_handle v1, Vertex_handle v2, Vertex_handle v3,
|
create_face(Vertex_handle v1, Vertex_handle v2, Vertex_handle v3,
|
||||||
Face_handle f1, Face_handle f2, Face_handle f3)
|
Face_handle f1, Face_handle f2, Face_handle f3)
|
||||||
{
|
{
|
||||||
Face_handle newf = faces().emplace(v1, v2, v3, f1, f2, f3);
|
Face_handle newf = faces().emplace(v1, v2, v3, f1, f2, f3);
|
||||||
|
|
||||||
|
|
@ -1484,7 +1484,7 @@ delete_face(Face_handle f)
|
||||||
CGAL_triangulation_expensive_precondition( dimension() != 2 || is_face(f));
|
CGAL_triangulation_expensive_precondition( dimension() != 2 || is_face(f));
|
||||||
CGAL_triangulation_expensive_precondition( dimension() != 1 || is_edge(f,2));
|
CGAL_triangulation_expensive_precondition( dimension() != 1 || is_edge(f,2));
|
||||||
CGAL_triangulation_expensive_precondition( dimension() != 0 ||
|
CGAL_triangulation_expensive_precondition( dimension() != 0 ||
|
||||||
is_vertex(f->vertex(0)) );
|
is_vertex(f->vertex(0)) );
|
||||||
faces().erase(f);
|
faces().erase(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1671,7 +1671,7 @@ join_vertices(Face_handle f, int i, Vertex_handle v)
|
||||||
// / \ / \
|
// / \ / \
|
||||||
// / \ g / \
|
// / \ g / \
|
||||||
// / bl \ / br \
|
// / bl \ / br \
|
||||||
// / \ / \
|
// / \ / \
|
||||||
// *---------*---------*
|
// *---------*---------*
|
||||||
// ibl j=v4 ibr
|
// ibl j=v4 ibr
|
||||||
//
|
//
|
||||||
|
|
@ -1687,9 +1687,9 @@ join_vertices(Face_handle f, int i, Vertex_handle v)
|
||||||
// * v1
|
// * v1
|
||||||
// /|\
|
// /|\
|
||||||
// / | \
|
// / | \
|
||||||
// / | \
|
// / | \
|
||||||
// / bl|br \
|
// / bl|br \
|
||||||
// / | \
|
// / | \
|
||||||
// *-----*-----*
|
// *-----*-----*
|
||||||
//
|
//
|
||||||
*/
|
*/
|
||||||
|
|
@ -1788,7 +1788,7 @@ insert_degree_2(Face_handle f, int i)
|
||||||
// i / \
|
// i / \
|
||||||
// * / \
|
// * / \
|
||||||
// / \ / f \
|
// / \ / f \
|
||||||
// / \ / _____ \
|
// / \ / _____ \
|
||||||
// / f \ / / f1 \ \
|
// / f \ / / f1 \ \
|
||||||
// / \ |/ v \|
|
// / \ |/ v \|
|
||||||
// v0=ccw(i) *---------* v1=cw(i) ===> v0 *----*----* v1
|
// v0=ccw(i) *---------* v1=cw(i) ===> v0 *----*----* v1
|
||||||
|
|
@ -1891,7 +1891,7 @@ is_valid(bool verbose, int level) const
|
||||||
|
|
||||||
result = result && (count_stored_faces == number_of_full_dim_faces());
|
result = result && (count_stored_faces == number_of_full_dim_faces());
|
||||||
CGAL_triangulation_assertion(
|
CGAL_triangulation_assertion(
|
||||||
count_stored_faces == number_of_full_dim_faces());
|
count_stored_faces == number_of_full_dim_faces());
|
||||||
|
|
||||||
// vertex count
|
// vertex count
|
||||||
size_type vertex_count = 0;
|
size_type vertex_count = 0;
|
||||||
|
|
@ -1996,8 +1996,8 @@ copy_tds(const TDS_src& tds_src,
|
||||||
fit1 = tds_src.faces().begin();
|
fit1 = tds_src.faces().begin();
|
||||||
for ( ; fit1 != tds_src.faces_end(); ++fit1) {
|
for ( ; fit1 != tds_src.faces_end(); ++fit1) {
|
||||||
for (int j = 0; j < dim ; ++j) {
|
for (int j = 0; j < dim ; ++j) {
|
||||||
fmap[fit1]->set_vertex(j, vmap[fit1->vertex(j)] );
|
fmap[fit1]->set_vertex(j, vmap[fit1->vertex(j)] );
|
||||||
fmap[fit1]->set_neighbor(j, fmap[fit1->neighbor(j)]);
|
fmap[fit1]->set_neighbor(j, fmap[fit1->neighbor(j)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2096,10 +2096,10 @@ file_output( std::ostream& os, Vertex_handle v, bool skip_first) const
|
||||||
// other vertices
|
// other vertices
|
||||||
for( Vertex_iterator vit= vertices_begin(); vit != vertices_end() ; ++vit) {
|
for( Vertex_iterator vit= vertices_begin(); vit != vertices_end() ; ++vit) {
|
||||||
if ( v != vit ) {
|
if ( v != vit ) {
|
||||||
V[vit] = inum++;
|
V[vit] = inum++;
|
||||||
// os << vit->point();
|
// os << vit->point();
|
||||||
os << *vit;
|
os << *vit;
|
||||||
if(is_ascii(os)) os << "\n";
|
if(is_ascii(os)) os << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(is_ascii(os)) os << "\n";
|
if(is_ascii(os)) os << "\n";
|
||||||
|
|
@ -2173,11 +2173,11 @@ file_input( std::istream& is, bool skip_first)
|
||||||
for(i = 0; i < m; ++i) {
|
for(i = 0; i < m; ++i) {
|
||||||
F[i] = create_face() ;
|
F[i] = create_face() ;
|
||||||
for(int j = 0; j < dim ; ++j){
|
for(int j = 0; j < dim ; ++j){
|
||||||
is >> index;
|
is >> index;
|
||||||
F[i]->set_vertex(j, V[index]);
|
F[i]->set_vertex(j, V[index]);
|
||||||
// The face pointer of vertices is set too often,
|
// The face pointer of vertices is set too often,
|
||||||
// but otherwise we had to use a further map
|
// but otherwise we had to use a further map
|
||||||
V[index]->set_face(F[i]);
|
V[index]->set_face(F[i]);
|
||||||
}
|
}
|
||||||
// read in non combinatorial info of the face
|
// read in non combinatorial info of the face
|
||||||
is >> *(F[i]) ;
|
is >> *(F[i]) ;
|
||||||
|
|
@ -2188,8 +2188,8 @@ file_input( std::istream& is, bool skip_first)
|
||||||
{
|
{
|
||||||
for(i = 0; i < m; ++i) {
|
for(i = 0; i < m; ++i) {
|
||||||
for(int j = 0; j < dimension()+1; ++j){
|
for(int j = 0; j < dimension()+1; ++j){
|
||||||
is >> index;
|
is >> index;
|
||||||
F[i]->set_neighbor(j, F[index]);
|
F[i]->set_neighbor(j, F[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2242,11 +2242,11 @@ vrml_output( std::ostream& os, Vertex_handle v, bool skip_infinite) const
|
||||||
// faces
|
// faces
|
||||||
for(fit= faces_begin(); fit != faces_end(); ++fit) {
|
for(fit= faces_begin(); fit != faces_end(); ++fit) {
|
||||||
if (!skip_infinite || !fit->has_vertex(v)) {
|
if (!skip_infinite || !fit->has_vertex(v)) {
|
||||||
os << "\t\t\t";
|
os << "\t\t\t";
|
||||||
os << vmap[(*fit).vertex(0)] << ", ";
|
os << vmap[(*fit).vertex(0)] << ", ";
|
||||||
os << vmap[(*fit).vertex(1)] << ", ";
|
os << vmap[(*fit).vertex(1)] << ", ";
|
||||||
os << vmap[(*fit).vertex(2)] << ", ";
|
os << vmap[(*fit).vertex(2)] << ", ";
|
||||||
os << "-1, " << std::endl;
|
os << "-1, " << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os << "\t\t]" << std::endl;
|
os << "\t\t]" << std::endl;
|
||||||
|
|
@ -2270,8 +2270,8 @@ off_file_input( std::istream& is, bool verbose)
|
||||||
if (! is) {
|
if (! is) {
|
||||||
if (scanner.verbose()) {
|
if (scanner.verbose()) {
|
||||||
std::cerr << " " << std::endl;
|
std::cerr << " " << std::endl;
|
||||||
std::cerr << "TDS::off_file_input" << std::endl;
|
std::cerr << "TDS::off_file_input" << std::endl;
|
||||||
std::cerr << " input error: file format is not OFF." << std::endl;
|
std::cerr << " input error: file format is not OFF." << std::endl;
|
||||||
}
|
}
|
||||||
return vinf;
|
return vinf;
|
||||||
}
|
}
|
||||||
|
|
@ -2306,10 +2306,10 @@ off_file_input( std::istream& is, bool verbose)
|
||||||
scanner.scan_facet( no, i);
|
scanner.scan_facet( no, i);
|
||||||
if( ! is || no != 3) {
|
if( ! is || no != 3) {
|
||||||
if ( scanner.verbose()) {
|
if ( scanner.verbose()) {
|
||||||
std::cerr << " " << std::endl;
|
std::cerr << " " << std::endl;
|
||||||
std::cerr << "TDS::off_file_input" << std::endl;
|
std::cerr << "TDS::off_file_input" << std::endl;
|
||||||
std::cerr << "facet " << i << "does not have 3 vertices."
|
std::cerr << "facet " << i << "does not have 3 vertices."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
is.clear( std::ios::badbit);
|
is.clear( std::ios::badbit);
|
||||||
return vinf;
|
return vinf;
|
||||||
|
|
@ -2323,7 +2323,7 @@ off_file_input( std::istream& is, bool verbose)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::size_t ih = 0; ih < no; ++ih) {
|
for (std::size_t ih = 0; ih < no; ++ih) {
|
||||||
set_adjacency(fh, ih, edge_map);
|
set_adjacency(fh, ih, edge_map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2335,8 +2335,8 @@ off_file_input( std::istream& is, bool verbose)
|
||||||
Face_handle fh = edge_map.begin()->second.first;
|
Face_handle fh = edge_map.begin()->second.first;
|
||||||
int ih = edge_map.begin()->second.second;
|
int ih = edge_map.begin()->second.second;
|
||||||
Face_handle fn = create_face( vinf,
|
Face_handle fn = create_face( vinf,
|
||||||
fh->vertex(cw(ih)),
|
fh->vertex(cw(ih)),
|
||||||
fh->vertex(ccw(ih)));
|
fh->vertex(ccw(ih)));
|
||||||
vinf->set_face(fn);
|
vinf->set_face(fn);
|
||||||
set_adjacency(fn, 0, fh, ih);
|
set_adjacency(fn, 0, fh, ih);
|
||||||
set_adjacency(fn, 1, inf_edge_map);
|
set_adjacency(fn, 1, inf_edge_map);
|
||||||
|
|
@ -2357,8 +2357,8 @@ template < class Vb, class Fb>
|
||||||
void
|
void
|
||||||
Triangulation_data_structure_2<Vb,Fb>::
|
Triangulation_data_structure_2<Vb,Fb>::
|
||||||
set_adjacency(Face_handle fh,
|
set_adjacency(Face_handle fh,
|
||||||
int ih,
|
int ih,
|
||||||
std::map< Vh_pair, Edge>& edge_map)
|
std::map< Vh_pair, Edge>& edge_map)
|
||||||
{
|
{
|
||||||
// set adjacency to (fh,ih) using the the map edge_map
|
// set adjacency to (fh,ih) using the the map edge_map
|
||||||
// or insert (fh,ih) in edge map
|
// or insert (fh,ih) in edge map
|
||||||
|
|
@ -2404,13 +2404,13 @@ reorient_faces()
|
||||||
Face_handle fh = st.top();
|
Face_handle fh = st.top();
|
||||||
st.pop();
|
st.pop();
|
||||||
for(int ih = 0 ; ih < 3 ; ++ih){
|
for(int ih = 0 ; ih < 3 ; ++ih){
|
||||||
Face_handle fn = fh->neighbor(ih);
|
Face_handle fn = fh->neighbor(ih);
|
||||||
if (oriented_set.insert(fn).second){
|
if (oriented_set.insert(fn).second){
|
||||||
int in = fn->index(fh);
|
int in = fn->index(fh);
|
||||||
if (fn->vertex(cw(in)) != fh->vertex(ccw(ih))) fn->reorient();
|
if (fn->vertex(cw(in)) != fh->vertex(ccw(ih))) fn->reorient();
|
||||||
--nf;
|
--nf;
|
||||||
st.push(fn);
|
st.push(fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2422,7 +2422,7 @@ reorient_faces()
|
||||||
template < class Vb, class Fb>
|
template < class Vb, class Fb>
|
||||||
std::istream&
|
std::istream&
|
||||||
operator>>(std::istream& is,
|
operator>>(std::istream& is,
|
||||||
Triangulation_data_structure_2<Vb,Fb>& tds)
|
Triangulation_data_structure_2<Vb,Fb>& tds)
|
||||||
{
|
{
|
||||||
tds.file_input(is);
|
tds.file_input(is);
|
||||||
return is;
|
return is;
|
||||||
|
|
@ -2432,7 +2432,7 @@ operator>>(std::istream& is,
|
||||||
template < class Vb, class Fb>
|
template < class Vb, class Fb>
|
||||||
std::ostream&
|
std::ostream&
|
||||||
operator<<(std::ostream& os,
|
operator<<(std::ostream& os,
|
||||||
const Triangulation_data_structure_2<Vb,Fb> &tds)
|
const Triangulation_data_structure_2<Vb,Fb> &tds)
|
||||||
{
|
{
|
||||||
tds.file_output(os);
|
tds.file_output(os);
|
||||||
return os;
|
return os;
|
||||||
|
|
|
||||||
|
|
@ -57,36 +57,36 @@ int main( int argc, char **argv) {
|
||||||
for (int i = 1; i < argc; i++) { // check commandline options
|
for (int i = 1; i < argc; i++) { // check commandline options
|
||||||
if ( strcmp( "-v", argv[i]) == 0)
|
if ( strcmp( "-v", argv[i]) == 0)
|
||||||
verbose = true;
|
verbose = true;
|
||||||
else if ( strcmp( "-b", argv[i]) == 0)
|
else if ( strcmp( "-b", argv[i]) == 0)
|
||||||
binary = true;
|
binary = true;
|
||||||
else if ( strcmp( "-noc", argv[i]) == 0)
|
else if ( strcmp( "-noc", argv[i]) == 0)
|
||||||
noc = true;
|
noc = true;
|
||||||
else if ( strcmp( "-delaunay", argv[i]) == 0)
|
else if ( strcmp( "-delaunay", argv[i]) == 0)
|
||||||
delaunay = true;
|
delaunay = true;
|
||||||
else if ( strcmp( "-incr", argv[i]) == 0)
|
else if ( strcmp( "-incr", argv[i]) == 0)
|
||||||
incr = true;
|
incr = true;
|
||||||
else if ( (strcmp( "-h", argv[i]) == 0) ||
|
else if ( (strcmp( "-h", argv[i]) == 0) ||
|
||||||
(strcmp( "-help", argv[i]) == 0))
|
(strcmp( "-help", argv[i]) == 0))
|
||||||
help = true;
|
help = true;
|
||||||
else if ( n < 2 ) {
|
else if ( n < 2 ) {
|
||||||
filename[ n++] = argv[i];
|
filename[ n++] = argv[i];
|
||||||
} else {
|
} else {
|
||||||
++n;
|
++n;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((n > 2) || help) {
|
if ((n > 2) || help) {
|
||||||
if ( ! help)
|
if ( ! help)
|
||||||
cerr << "Error: in parameter list" << endl;
|
cerr << "Error: in parameter list" << endl;
|
||||||
cerr << "Usage: " << argv[0] << " [<options>] [<infile> [<outfile>]]"
|
cerr << "Usage: " << argv[0] << " [<options>] [<infile> [<outfile>]]"
|
||||||
<< endl;
|
<< endl;
|
||||||
cerr << " Terrain triangulation in the xy-plane." << endl;
|
cerr << " Terrain triangulation in the xy-plane." << endl;
|
||||||
cerr << " -delaunay Delaunay triangulation (default)." << endl;
|
cerr << " -delaunay Delaunay triangulation (default)." << endl;
|
||||||
cerr << " -incr Incremental insertion (no flips)." << endl;
|
cerr << " -incr Incremental insertion (no flips)." << endl;
|
||||||
cerr << " -b binary output (default is ASCII)." << endl;
|
cerr << " -b binary output (default is ASCII)." << endl;
|
||||||
cerr << " -noc no comments in file." << endl;
|
cerr << " -noc no comments in file." << endl;
|
||||||
cerr << " -v verbose." << endl;
|
cerr << " -v verbose." << endl;
|
||||||
exit( ! help);
|
exit( ! help);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL::Verbose_ostream vout( verbose);
|
CGAL::Verbose_ostream vout( verbose);
|
||||||
|
|
@ -96,77 +96,77 @@ int main( int argc, char **argv) {
|
||||||
istream* p_in = &cin;
|
istream* p_in = &cin;
|
||||||
ifstream in;
|
ifstream in;
|
||||||
if ( n > 0) {
|
if ( n > 0) {
|
||||||
in.open( filename[0]);
|
in.open( filename[0]);
|
||||||
p_in = ∈
|
p_in = ∈
|
||||||
iname = filename[0];
|
iname = filename[0];
|
||||||
}
|
}
|
||||||
if ( !*p_in) {
|
if ( !*p_in) {
|
||||||
cerr << argv[0] << ": error: cannot open file '" << iname
|
cerr << argv[0] << ": error: cannot open file '" << iname
|
||||||
<< "' for reading." <<endl;
|
<< "' for reading." <<endl;
|
||||||
exit( 1);
|
exit( 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL::File_scanner_OFF scanner( * p_in, true);
|
CGAL::File_scanner_OFF scanner( * p_in, true);
|
||||||
if ( !*p_in)
|
if ( !*p_in)
|
||||||
exit( 1);
|
exit( 1);
|
||||||
|
|
||||||
const char* oname = "cout";
|
const char* oname = "cout";
|
||||||
ostream* p_out = &cout;
|
ostream* p_out = &cout;
|
||||||
ofstream out;
|
ofstream out;
|
||||||
if ( n > 1) {
|
if ( n > 1) {
|
||||||
out.open( filename[1]);
|
out.open( filename[1]);
|
||||||
p_out = &out;
|
p_out = &out;
|
||||||
oname = filename[1];
|
oname = filename[1];
|
||||||
}
|
}
|
||||||
if ( !*p_out) {
|
if ( !*p_out) {
|
||||||
cerr << argv[0] << ": error: cannot open file '"<< oname
|
cerr << argv[0] << ": error: cannot open file '"<< oname
|
||||||
<< "' for writing." <<endl;
|
<< "' for writing." <<endl;
|
||||||
exit( 1);
|
exit( 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// index array.
|
// index array.
|
||||||
int* indices = new int[ scanner.size_of_vertices()];
|
int* indices = new int[ scanner.size_of_vertices()];
|
||||||
for ( std::size_t k = 0; k < scanner.size_of_vertices(); k++)
|
for ( std::size_t k = 0; k < scanner.size_of_vertices(); k++)
|
||||||
indices[k] = -1;
|
indices[k] = -1;
|
||||||
|
|
||||||
if ( delaunay || ! incr) {
|
if ( delaunay || ! incr) {
|
||||||
Delaunay_triangulation triang;
|
Delaunay_triangulation triang;
|
||||||
vout << "Scanning and triangulating ..." << endl;
|
vout << "Scanning and triangulating ..." << endl;
|
||||||
for ( std::size_t j = 0; j < scanner.size_of_vertices(); j++) {
|
for ( std::size_t j = 0; j < scanner.size_of_vertices(); j++) {
|
||||||
double x, y, z;
|
double x, y, z;
|
||||||
scanner.scan_vertex( x, y, z);
|
scanner.scan_vertex( x, y, z);
|
||||||
IPoint p( x, y, z, indices + j);
|
IPoint p( x, y, z, indices + j);
|
||||||
triang.insert( p);
|
triang.insert( p);
|
||||||
}
|
}
|
||||||
vout << " .... done." << endl;
|
vout << " .... done." << endl;
|
||||||
vout << "write_triangulation( " << oname
|
vout << "write_triangulation( " << oname
|
||||||
<< (binary ? ", binary" : ", ASCII") << ") ...." << endl;
|
<< (binary ? ", binary" : ", ASCII") << ") ...." << endl;
|
||||||
CGAL::triangulation_print_OFF( *p_out, triang, binary, noc, verbose);
|
CGAL::triangulation_print_OFF( *p_out, triang, binary, noc, verbose);
|
||||||
vout << " .... done." << endl;
|
vout << " .... done." << endl;
|
||||||
} else {
|
} else {
|
||||||
Triangulation triang;
|
Triangulation triang;
|
||||||
vout << "Scanning and triangulating ..." << endl;
|
vout << "Scanning and triangulating ..." << endl;
|
||||||
for ( std::size_t j = 0; j < scanner.size_of_vertices(); j++) {
|
for ( std::size_t j = 0; j < scanner.size_of_vertices(); j++) {
|
||||||
double x, y, z;
|
double x, y, z;
|
||||||
scanner.scan_vertex( x, y, z);
|
scanner.scan_vertex( x, y, z);
|
||||||
IPoint p( x, y, z, indices + j);
|
IPoint p( x, y, z, indices + j);
|
||||||
triang.insert( p);
|
triang.insert( p);
|
||||||
}
|
}
|
||||||
vout << " .... done." << endl;
|
vout << " .... done." << endl;
|
||||||
vout << "write_triangulation( " << oname
|
vout << "write_triangulation( " << oname
|
||||||
<< (binary ? ", binary" : ", ASCII") << ") ...." << endl;
|
<< (binary ? ", binary" : ", ASCII") << ") ...." << endl;
|
||||||
CGAL::triangulation_print_OFF( *p_out, triang, binary, noc, verbose);
|
CGAL::triangulation_print_OFF( *p_out, triang, binary, noc, verbose);
|
||||||
vout << " .... done." << endl;
|
vout << " .... done." << endl;
|
||||||
}
|
}
|
||||||
if ( !*p_in) {
|
if ( !*p_in) {
|
||||||
cerr << argv[0] << " read error: while reading file '"<< iname << "'."
|
cerr << argv[0] << " read error: while reading file '"<< iname << "'."
|
||||||
<< endl;
|
<< endl;
|
||||||
exit( 1);
|
exit( 1);
|
||||||
}
|
}
|
||||||
if ( !*p_out) {
|
if ( !*p_out) {
|
||||||
cerr << argv[0] << " write error: while writing file '"<< oname << "'."
|
cerr << argv[0] << " write error: while writing file '"<< oname << "'."
|
||||||
<< endl;
|
<< endl;
|
||||||
exit( 1);
|
exit( 1);
|
||||||
}
|
}
|
||||||
delete[] indices;
|
delete[] indices;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue