mirror of https://github.com/CGAL/cgal
Merge remote-tracking branch 'lrineau/Triangulation_3-fix_simplex_traverser-GF' into Triangulation_3-CDT_3-lrineau
This commit is contained in:
commit
f7b949834c
|
|
@ -26,22 +26,25 @@ if( NOT GMP_in_cache )
|
|||
NAMES gmp.h
|
||||
HINTS ENV GMP_INC_DIR
|
||||
ENV GMP_DIR
|
||||
$ENV{GMP_DIR}/include
|
||||
${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/include
|
||||
PATH_SUFFIXES include
|
||||
DOC "The directory containing the GMP header files"
|
||||
)
|
||||
|
||||
find_library(GMP_LIBRARY_RELEASE NAMES gmp libgmp-10 mpir
|
||||
find_library(GMP_LIBRARY_RELEASE NAMES gmp libgmp-10 gmp-10 mpir
|
||||
HINTS ENV GMP_LIB_DIR
|
||||
ENV GMP_DIR
|
||||
$ENV{GMP_DIR}/lib
|
||||
${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/lib
|
||||
PATH_SUFFIXES lib
|
||||
DOC "Path to the Release GMP library"
|
||||
)
|
||||
|
||||
find_library(GMP_LIBRARY_DEBUG NAMES gmpd gmp libgmp-10 mpir
|
||||
find_library(GMP_LIBRARY_DEBUG NAMES gmpd gmp libgmp-10 gmp-10 mpir
|
||||
HINTS ENV GMP_LIB_DIR
|
||||
ENV GMP_DIR
|
||||
$ENV{GMP_DIR}/include
|
||||
${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/lib
|
||||
PATH_SUFFIXES lib
|
||||
DOC "Path to the Debug GMP library"
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ if (NOT MPFR_in_cache)
|
|||
NAMES mpfr.h
|
||||
HINTS ENV MPFR_INC_DIR
|
||||
ENV MPFR_DIR
|
||||
$ENV{MPFR_DIR}/include
|
||||
${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/include
|
||||
PATH_SUFFIXES include
|
||||
DOC "The directory containing the MPFR header files"
|
||||
|
|
@ -33,6 +34,7 @@ if (NOT MPFR_in_cache)
|
|||
find_library(MPFR_LIBRARIES NAMES mpfr libmpfr-4 libmpfr-1
|
||||
HINTS ENV MPFR_LIB_DIR
|
||||
ENV MPFR_DIR
|
||||
$ENV{MPFR_DIR}/lib
|
||||
${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/lib
|
||||
PATH_SUFFIXES lib
|
||||
DOC "Path to the MPFR library"
|
||||
|
|
|
|||
|
|
@ -8,10 +8,8 @@ int main() {
|
|||
#define GMP_SONAME "libgmp-10"
|
||||
#define MPFR_SONAME "libmpfr-4"
|
||||
#define GMP_SONAME_BACKUP "gmp"
|
||||
#define GMP_SONAME_BACKUP_2 "gmp-10"
|
||||
#define MPFR_SONAME_BACKUP "mpfr-6"
|
||||
#define GMP_MAJOR 5
|
||||
#define MPFR_MAJOR 3
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
|
|
@ -35,12 +33,21 @@ bool get_version_info(const LPCTSTR name,
|
|||
std::cerr << name << " is not loaded!\n";
|
||||
return false;
|
||||
}
|
||||
else
|
||||
std::cerr << name << " is loaded.\n";
|
||||
|
||||
char fileName[_MAX_PATH];
|
||||
DWORD size = GetModuleFileName(g_dllHandle, fileName, _MAX_PATH);
|
||||
fileName[size] = NULL;
|
||||
std::cerr << "Query FileVersion of \"" << fileName << "\"\n";
|
||||
DWORD handle = 0;
|
||||
size = GetFileVersionInfoSize(fileName, &handle);
|
||||
|
||||
DWORD err = GetLastError();
|
||||
if (size == 0) {
|
||||
std::cerr << "GetFileVersionInfoSize failed with error " << err << std::endl;
|
||||
}
|
||||
|
||||
BYTE* versionInfo = new BYTE[size];
|
||||
if (!GetFileVersionInfo(fileName, handle, size, versionInfo))
|
||||
{
|
||||
|
|
@ -66,7 +73,9 @@ int main() {
|
|||
int major, minor, patch, build;
|
||||
if(!get_version_info(GMP_SONAME, major, minor, patch, build)) {
|
||||
if(!get_version_info(GMP_SONAME_BACKUP, major, minor, patch, build)) {
|
||||
return 1;
|
||||
if (!get_version_info(GMP_SONAME_BACKUP_2, major, minor, patch, build)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,18 +23,32 @@ int main(int argc, char* argv[])
|
|||
Surface_mesh mesh;
|
||||
if(!PMP::IO::read_polygon_mesh(filename, mesh))
|
||||
{
|
||||
std::cerr << "Invalid input." << std::endl;
|
||||
return 1;
|
||||
std::cerr << "Error: Invalid input." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if(is_empty(mesh))
|
||||
{
|
||||
std::cerr << "Warning: empty file?" << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
if(!CGAL::is_triangle_mesh(mesh))
|
||||
std::cout << "Input mesh is not triangulated." << std::endl;
|
||||
else
|
||||
std::cout << "Input mesh is triangulated." << std::endl;
|
||||
|
||||
PMP::triangulate_faces(mesh);
|
||||
|
||||
// Confirm that all faces are triangles.
|
||||
for(boost::graph_traits<Surface_mesh>::face_descriptor f : faces(mesh))
|
||||
{
|
||||
if(!CGAL::is_triangle(halfedge(f, mesh), mesh))
|
||||
std::cerr << "Error: non-triangular face left in mesh." << std::endl;
|
||||
}
|
||||
|
||||
|
||||
CGAL::IO::write_polygon_mesh(outfilename, mesh, CGAL::parameters::stream_precision(17));
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ bool read_polygon_mesh(const std::string& fname,
|
|||
|
||||
std::vector<Point> points;
|
||||
std::vector<std::vector<std::size_t> > faces;
|
||||
if(!CGAL::IO::read_polygon_soup(fname, points, faces))
|
||||
if(!CGAL::IO::read_polygon_soup(fname, points, faces, CGAL::parameters::verbose(verbose)))
|
||||
{
|
||||
if(verbose)
|
||||
std::cerr << "Warning: cannot read polygon soup" << std::endl;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <boost/range/value_type.hpp>
|
||||
#include <CGAL/Named_function_parameters.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
|
@ -67,12 +68,30 @@ bool read_OBJ(std::istream& is,
|
|||
bool tex_found(false), norm_found(false);
|
||||
while(getline(is, line))
|
||||
{
|
||||
if(line.empty())
|
||||
continue;
|
||||
// get last non-whitespace, non-null character
|
||||
auto last = std::find_if(line.rbegin(), line.rend(), [](char c) { return c != '\0' && !std::isspace(c); });
|
||||
if(last == line.rend())
|
||||
continue; // line is empty or only whitespace
|
||||
|
||||
// keep reading lines as long as the last non-whitespace, non-null character is a backslash
|
||||
while(last != line.rend() && *last == '\\')
|
||||
{
|
||||
// remove everything from the backslash (included)
|
||||
line = line.substr(0, line.size() - (last - line.rbegin()) - 1);
|
||||
|
||||
std::string next_line;
|
||||
if(!getline(is, next_line))
|
||||
break;
|
||||
|
||||
line += next_line;
|
||||
last = std::find_if(line.rbegin(), line.rend(), [](char c) { return c != '\0' && !std::isspace(c); });
|
||||
}
|
||||
|
||||
CGAL_assertion(!line.empty());
|
||||
|
||||
std::istringstream iss(line);
|
||||
if(!(iss >> s))
|
||||
continue; // can't read anything on the line, whitespace only?
|
||||
continue;
|
||||
|
||||
if(s == "v")
|
||||
{
|
||||
|
|
@ -122,7 +141,11 @@ bool read_OBJ(std::istream& is,
|
|||
}
|
||||
|
||||
if(iss.bad())
|
||||
{
|
||||
if(verbose)
|
||||
std::cerr << "error while reading OBJ face." << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(s.front() == '#')
|
||||
{
|
||||
|
|
@ -148,15 +171,15 @@ bool read_OBJ(std::istream& is,
|
|||
else
|
||||
{
|
||||
if(verbose)
|
||||
std::cerr << "error: unrecognized line: " << s << std::endl;
|
||||
std::cerr << "Error: unrecognized line: " << s << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(norm_found && verbose)
|
||||
std::cout<<"NOTE: normals were found in this file, but were discarded."<<std::endl;
|
||||
std::cout << "NOTE: normals were found in this file, but were discarded." << std::endl;
|
||||
if(tex_found && verbose)
|
||||
std::cout<<"NOTE: textures were found in this file, but were discarded."<<std::endl;
|
||||
std::cout << "NOTE: textures were found in this file, but were discarded." << std::endl;
|
||||
|
||||
if(points.empty() || polygons.empty())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ operator==(Triangulation_simplex_3<TriangulationDataStructure_3> s0,
|
|||
}
|
||||
return false;
|
||||
case (3):
|
||||
return (&(*s0.ch) == &(*s1.ch));
|
||||
return s0.ch.operator->() == s1.ch.operator->();
|
||||
}
|
||||
CGAL_error();
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -241,6 +241,7 @@ walk_to_next() {
|
|||
// The target is inside the cell.
|
||||
_prev = Simplex( cell(), Tr::VERTEX, ti, -1 );
|
||||
cell() = Cell_handle();
|
||||
lt() = Locate_type::VERTEX;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -228,6 +228,8 @@ public:
|
|||
*/
|
||||
const Point& target() const { return _target; }
|
||||
|
||||
Vertex_handle target_vertex() const { return _t_vertex; }
|
||||
|
||||
// gives a handle to the current cell.
|
||||
/* By invariance, this cell is intersected by the segment
|
||||
* between `source()` and `target()`.
|
||||
|
|
@ -809,7 +811,7 @@ public:
|
|||
else
|
||||
ch = _cell_iterator.previous();
|
||||
|
||||
Cell_handle chnext = Cell_handle(_cell_iterator);
|
||||
const Cell_handle chnext = Cell_handle(_cell_iterator);
|
||||
//_cell_iterator is one step forward _curr_simplex
|
||||
CGAL_assertion(ch != chnext);
|
||||
|
||||
|
|
@ -834,8 +836,13 @@ public:
|
|||
{
|
||||
if (prev == ch && ltprev == Locate_type::VERTEX)
|
||||
{
|
||||
CGAL_assertion(prev->vertex(liprev) == get_vertex());
|
||||
_curr_simplex = ch;
|
||||
const auto current_vertex = get_vertex();
|
||||
if(current_vertex == _cell_iterator.target_vertex()) {
|
||||
_curr_simplex = Simplex_3();
|
||||
} else {
|
||||
CGAL_assertion(prev->vertex(liprev) == _cell_iterator.target_vertex());
|
||||
_curr_simplex = ch;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue