From dc77fbd3840c01dc0f4e6f147b0decc686dc6ac8 Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Tue, 8 Aug 2017 14:14:30 +0200 Subject: [PATCH 001/118] only compute normals for faces that are not deleted --- src/OpenMesh/Core/Mesh/PolyMeshT.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenMesh/Core/Mesh/PolyMeshT.cc b/src/OpenMesh/Core/Mesh/PolyMeshT.cc index e77c0ba8..827306dc 100644 --- a/src/OpenMesh/Core/Mesh/PolyMeshT.cc +++ b/src/OpenMesh/Core/Mesh/PolyMeshT.cc @@ -261,7 +261,7 @@ void PolyMeshT:: update_face_normals() { - FaceIter f_it(Kernel::faces_begin()), f_end(Kernel::faces_end()); + FaceIter f_it(Kernel::faces_sbegin()), f_end(Kernel::faces_end()); for (; f_it != f_end; ++f_it) this->set_normal(*f_it, calc_face_normal(*f_it)); From b85ba1d671e7873855458aed1126abc0a710e658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 17 Oct 2017 15:13:15 +0200 Subject: [PATCH 002/118] Fixed broken version macros (Thanks to Frederik Salomonsson for the fix) --- src/OpenMesh/Core/System/config.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenMesh/Core/System/config.h b/src/OpenMesh/Core/System/config.h index b48b1536..e0d436e3 100644 --- a/src/OpenMesh/Core/System/config.h +++ b/src/OpenMesh/Core/System/config.h @@ -71,9 +71,9 @@ // only defined, if it is a beta version //#define OM_VERSION_BETA 4 -#define OM_GET_VER ((OM_VERSION && 0xf0000) >> 16) -#define OM_GET_MAJ ((OM_VERSION && 0x0ff00) >> 8) -#define OM_GET_MIN (OM_VERSION && 0x000ff) +#define OM_GET_VER ((OM_VERSION & 0xf0000) >> 16) +#define OM_GET_MAJ ((OM_VERSION & 0x0ff00) >> 8) +#define OM_GET_MIN (OM_VERSION & 0x000ff) #ifdef WIN32 # ifdef min From acb62194f4268651250cda546dc8c93610893877 Mon Sep 17 00:00:00 2001 From: Jan Date: Fri, 20 Oct 2017 17:02:49 +0200 Subject: [PATCH 003/118] Fixed Build on gcc-7.2 --- src/OpenMesh/Tools/Utils/conio.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OpenMesh/Tools/Utils/conio.cc b/src/OpenMesh/Tools/Utils/conio.cc index 3a7c04ee..5459dcde 100644 --- a/src/OpenMesh/Tools/Utils/conio.cc +++ b/src/OpenMesh/Tools/Utils/conio.cc @@ -91,6 +91,7 @@ int getche() { return ::getche(); } #endif #include /* tcsetattr() */ #include /* ioctl() */ +#include /* timeval struct */ namespace OpenMesh { namespace Utils { From 29cbe8204847492d7db85b64a64bd79ce5e2d69c Mon Sep 17 00:00:00 2001 From: Martin Schultz Date: Tue, 24 Oct 2017 15:58:29 +0200 Subject: [PATCH 004/118] changed the way status propertzies are copied. refcount is set to 1 if it was > 0 in the original mesh fixes #48 --- src/OpenMesh/Core/Mesh/ArrayKernel.cc | 421 +++++++++++++------------- src/OpenMesh/Core/Mesh/ArrayKernel.hh | 10 +- 2 files changed, 216 insertions(+), 215 deletions(-) diff --git a/src/OpenMesh/Core/Mesh/ArrayKernel.cc b/src/OpenMesh/Core/Mesh/ArrayKernel.cc index 00c8d3c5..a22f8785 100644 --- a/src/OpenMesh/Core/Mesh/ArrayKernel.cc +++ b/src/OpenMesh/Core/Mesh/ArrayKernel.cc @@ -37,146 +37,145 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * - * ========================================================================= */ - -/*===========================================================================*\ - * * - * $Revision$ * - * $Date$ * - * * -\*===========================================================================*/ - -#include - -namespace OpenMesh -{ - -ArrayKernel::ArrayKernel() -: refcount_vstatus_(0), refcount_hstatus_(0), - refcount_estatus_(0), refcount_fstatus_(0) -{ - init_bit_masks(); //Status bit masks initialization -} - -ArrayKernel::~ArrayKernel() -{ - clear(); -} - -// ArrayKernel::ArrayKernel(const ArrayKernel& _rhs) -// : BaseKernel(_rhs), -// vertices_(_rhs.vertices_), edges_(_rhs.edges_), faces_(_rhs.faces_), -// vertex_status_(_rhs.vertex_status_), halfedge_status_(_rhs.halfedge_status_), -// edge_status_(_rhs.edge_status_), face_status_(_rhs.face_status_), -// refcount_vstatus_(_rhs.refcount_vstatus_), refcount_hstatus_(_rhs.refcount_hstatus_), -// refcount_estatus_(_rhs.refcount_estatus_), refcount_fstatus_(_rhs.refcount_fstatus_) -// {} - - -void ArrayKernel::assign_connectivity(const ArrayKernel& _other) -{ - vertices_ = _other.vertices_; - edges_ = _other.edges_; - faces_ = _other.faces_; - - vprops_resize(n_vertices()); - hprops_resize(n_halfedges()); - eprops_resize(n_edges()); - fprops_resize(n_faces()); - -#define COPY_STATUS_PROPERTY(ENTITY) \ - if (_other.ENTITY##_status_.is_valid()) \ - { \ - if (!ENTITY##_status_.is_valid()) \ - { \ - request_##ENTITY##_status(); \ - } \ - property(ENTITY##_status_) = _other.property(_other.ENTITY##_status_); \ - } - COPY_STATUS_PROPERTY(vertex) - COPY_STATUS_PROPERTY(halfedge) - COPY_STATUS_PROPERTY(edge) - COPY_STATUS_PROPERTY(face) - -#undef COPY_STATUS_PROPERTY -} - -// --- handle -> item --- -VertexHandle ArrayKernel::handle(const Vertex& _v) const -{ - return VertexHandle( int( &_v - &vertices_.front())); -} - -HalfedgeHandle ArrayKernel::handle(const Halfedge& _he) const -{ - // Calculate edge belonging to given halfedge - // There are two halfedges stored per edge - // Get memory position inside edge vector and devide by size of an edge - // to get the corresponding edge for the requested halfedge - size_t eh = ( (char*)&_he - (char*)&edges_.front() ) / sizeof(Edge) ; - assert((&_he == &edges_[eh].halfedges_[0]) || - (&_he == &edges_[eh].halfedges_[1])); - return ((&_he == &edges_[eh].halfedges_[0]) ? - HalfedgeHandle( int(eh)<<1) : HalfedgeHandle((int(eh)<<1)+1)); -} - -EdgeHandle ArrayKernel::handle(const Edge& _e) const -{ - return EdgeHandle( int(&_e - &edges_.front() ) ); -} - -FaceHandle ArrayKernel::handle(const Face& _f) const -{ - return FaceHandle( int(&_f - &faces_.front()) ); -} - -#define SIGNED(x) signed( (x) ) - -bool ArrayKernel::is_valid_handle(VertexHandle _vh) const -{ - return 0 <= _vh.idx() && _vh.idx() < SIGNED(n_vertices()); -} - -bool ArrayKernel::is_valid_handle(HalfedgeHandle _heh) const -{ - return 0 <= _heh.idx() && _heh.idx() < SIGNED(n_edges()*2); -} - -bool ArrayKernel::is_valid_handle(EdgeHandle _eh) const -{ - return 0 <= _eh.idx() && _eh.idx() < SIGNED(n_edges()); -} - -bool ArrayKernel::is_valid_handle(FaceHandle _fh) const -{ - return 0 <= _fh.idx() && _fh.idx() < SIGNED(n_faces()); -} - -#undef SIGNED - -unsigned int ArrayKernel::delete_isolated_vertices() -{ - assert(has_vertex_status());//this function requires vertex status property - unsigned int n_isolated = 0; - for (KernelVertexIter v_it = vertices_begin(); v_it != vertices_end(); ++v_it) - { - if (is_isolated(handle(*v_it))) - { - status(handle(*v_it)).set_deleted(true); - n_isolated++; - } - } - return n_isolated; -} - -void ArrayKernel::garbage_collection(bool _v, bool _e, bool _f) -{ - std::vector empty_vh; - std::vector empty_hh; - std::vector empty_fh; - garbage_collection( empty_vh,empty_hh,empty_fh,_v, _e, _f); -} - + * ========================================================================= */ + +/*===========================================================================*\ + * * + * $Revision$ * + * $Date$ * + * * +\*===========================================================================*/ + +#include + +namespace OpenMesh +{ + +ArrayKernel::ArrayKernel() +: refcount_vstatus_(0), refcount_hstatus_(0), + refcount_estatus_(0), refcount_fstatus_(0) +{ + init_bit_masks(); //Status bit masks initialization +} + +ArrayKernel::~ArrayKernel() +{ + clear(); +} + +// ArrayKernel::ArrayKernel(const ArrayKernel& _rhs) +// : BaseKernel(_rhs), +// vertices_(_rhs.vertices_), edges_(_rhs.edges_), faces_(_rhs.faces_), +// vertex_status_(_rhs.vertex_status_), halfedge_status_(_rhs.halfedge_status_), +// edge_status_(_rhs.edge_status_), face_status_(_rhs.face_status_), +// refcount_vstatus_(_rhs.refcount_vstatus_), refcount_hstatus_(_rhs.refcount_hstatus_), +// refcount_estatus_(_rhs.refcount_estatus_), refcount_fstatus_(_rhs.refcount_fstatus_) +// {} + + +void ArrayKernel::assign_connectivity(const ArrayKernel& _other) +{ + vertices_ = _other.vertices_; + edges_ = _other.edges_; + faces_ = _other.faces_; + + vprops_resize(n_vertices()); + hprops_resize(n_halfedges()); + eprops_resize(n_edges()); + fprops_resize(n_faces()); + + //just copy status properties for now, + //until a proper solution for refcounted + //properties is available + vertex_status_ = _other.vertex_status_; + halfedge_status_ = _other.halfedge_status_; + edge_status_ = _other.edge_status_; + face_status_ = _other.face_status_; + + //initialize refcounter to 1 for the new mesh, + //if status is available. + refcount_estatus_ = _other.refcount_estatus_ > 0 ? 1 : 0; + refcount_vstatus_ = _other.refcount_vstatus_ > 0 ? 1 : 0; + refcount_hstatus_ = _other.refcount_hstatus_ > 0 ? 1 : 0; + refcount_fstatus_ = _other.refcount_fstatus_ > 0 ? 1 : 0; +} + +// --- handle -> item --- +VertexHandle ArrayKernel::handle(const Vertex& _v) const +{ + return VertexHandle( int( &_v - &vertices_.front())); +} + +HalfedgeHandle ArrayKernel::handle(const Halfedge& _he) const +{ + // Calculate edge belonging to given halfedge + // There are two halfedges stored per edge + // Get memory position inside edge vector and devide by size of an edge + // to get the corresponding edge for the requested halfedge + size_t eh = ( (char*)&_he - (char*)&edges_.front() ) / sizeof(Edge) ; + assert((&_he == &edges_[eh].halfedges_[0]) || + (&_he == &edges_[eh].halfedges_[1])); + return ((&_he == &edges_[eh].halfedges_[0]) ? + HalfedgeHandle( int(eh)<<1) : HalfedgeHandle((int(eh)<<1)+1)); +} + +EdgeHandle ArrayKernel::handle(const Edge& _e) const +{ + return EdgeHandle( int(&_e - &edges_.front() ) ); +} + +FaceHandle ArrayKernel::handle(const Face& _f) const +{ + return FaceHandle( int(&_f - &faces_.front()) ); +} + +#define SIGNED(x) signed( (x) ) + +bool ArrayKernel::is_valid_handle(VertexHandle _vh) const +{ + return 0 <= _vh.idx() && _vh.idx() < SIGNED(n_vertices()); +} + +bool ArrayKernel::is_valid_handle(HalfedgeHandle _heh) const +{ + return 0 <= _heh.idx() && _heh.idx() < SIGNED(n_edges()*2); +} + +bool ArrayKernel::is_valid_handle(EdgeHandle _eh) const +{ + return 0 <= _eh.idx() && _eh.idx() < SIGNED(n_edges()); +} + +bool ArrayKernel::is_valid_handle(FaceHandle _fh) const +{ + return 0 <= _fh.idx() && _fh.idx() < SIGNED(n_faces()); +} + +#undef SIGNED + +unsigned int ArrayKernel::delete_isolated_vertices() +{ + assert(has_vertex_status());//this function requires vertex status property + unsigned int n_isolated = 0; + for (KernelVertexIter v_it = vertices_begin(); v_it != vertices_end(); ++v_it) + { + if (is_isolated(handle(*v_it))) + { + status(handle(*v_it)).set_deleted(true); + n_isolated++; + } + } + return n_isolated; +} + +void ArrayKernel::garbage_collection(bool _v, bool _e, bool _f) +{ + std::vector empty_vh; + std::vector empty_hh; + std::vector empty_fh; + garbage_collection( empty_vh,empty_hh,empty_fh,_v, _e, _f); +} + void ArrayKernel::clean_keep_reservation() { vertices_.clear(); @@ -187,74 +186,74 @@ void ArrayKernel::clean_keep_reservation() } -void ArrayKernel::clean() -{ - - vertices_.clear(); - VertexContainer().swap( vertices_ ); - - edges_.clear(); - EdgeContainer().swap( edges_ ); - - faces_.clear(); - FaceContainer().swap( faces_ ); - -} - - -void ArrayKernel::clear() -{ - vprops_clear(); - eprops_clear(); - hprops_clear(); - fprops_clear(); - - clean(); -} - - - -void ArrayKernel::resize( size_t _n_vertices, size_t _n_edges, size_t _n_faces ) -{ - vertices_.resize(_n_vertices); - edges_.resize(_n_edges); - faces_.resize(_n_faces); - - vprops_resize(n_vertices()); - hprops_resize(n_halfedges()); - eprops_resize(n_edges()); - fprops_resize(n_faces()); -} - -void ArrayKernel::reserve(size_t _n_vertices, size_t _n_edges, size_t _n_faces ) -{ - vertices_.reserve(_n_vertices); - edges_.reserve(_n_edges); - faces_.reserve(_n_faces); - - vprops_reserve(_n_vertices); - hprops_reserve(_n_edges*2); - eprops_reserve(_n_edges); - fprops_reserve(_n_faces); -} - -// Status Sets API -void ArrayKernel::init_bit_masks(BitMaskContainer& _bmc) -{ - for (unsigned int i = Attributes::UNUSED; i != 0; i <<= 1) - { - _bmc.push_back(i); - } -} - -void ArrayKernel::init_bit_masks() -{ - init_bit_masks(vertex_bit_masks_); - edge_bit_masks_ = vertex_bit_masks_;//init_bit_masks(edge_bit_masks_); - face_bit_masks_ = vertex_bit_masks_;//init_bit_masks(face_bit_masks_); - halfedge_bit_masks_= vertex_bit_masks_;//init_bit_masks(halfedge_bit_masks_); -} - - -}; - +void ArrayKernel::clean() +{ + + vertices_.clear(); + VertexContainer().swap( vertices_ ); + + edges_.clear(); + EdgeContainer().swap( edges_ ); + + faces_.clear(); + FaceContainer().swap( faces_ ); + +} + + +void ArrayKernel::clear() +{ + vprops_clear(); + eprops_clear(); + hprops_clear(); + fprops_clear(); + + clean(); +} + + + +void ArrayKernel::resize( size_t _n_vertices, size_t _n_edges, size_t _n_faces ) +{ + vertices_.resize(_n_vertices); + edges_.resize(_n_edges); + faces_.resize(_n_faces); + + vprops_resize(n_vertices()); + hprops_resize(n_halfedges()); + eprops_resize(n_edges()); + fprops_resize(n_faces()); +} + +void ArrayKernel::reserve(size_t _n_vertices, size_t _n_edges, size_t _n_faces ) +{ + vertices_.reserve(_n_vertices); + edges_.reserve(_n_edges); + faces_.reserve(_n_faces); + + vprops_reserve(_n_vertices); + hprops_reserve(_n_edges*2); + eprops_reserve(_n_edges); + fprops_reserve(_n_faces); +} + +// Status Sets API +void ArrayKernel::init_bit_masks(BitMaskContainer& _bmc) +{ + for (unsigned int i = Attributes::UNUSED; i != 0; i <<= 1) + { + _bmc.push_back(i); + } +} + +void ArrayKernel::init_bit_masks() +{ + init_bit_masks(vertex_bit_masks_); + edge_bit_masks_ = vertex_bit_masks_;//init_bit_masks(edge_bit_masks_); + face_bit_masks_ = vertex_bit_masks_;//init_bit_masks(face_bit_masks_); + halfedge_bit_masks_= vertex_bit_masks_;//init_bit_masks(halfedge_bit_masks_); +} + + +}; + diff --git a/src/OpenMesh/Core/Mesh/ArrayKernel.hh b/src/OpenMesh/Core/Mesh/ArrayKernel.hh index 388c9267..ccf2748c 100644 --- a/src/OpenMesh/Core/Mesh/ArrayKernel.hh +++ b/src/OpenMesh/Core/Mesh/ArrayKernel.hh @@ -879,10 +879,7 @@ private: void init_bit_masks(BitMaskContainer& _bmc); void init_bit_masks(); -private: - VertexContainer vertices_; - EdgeContainer edges_; - FaceContainer faces_; +protected: VertexStatusPropertyHandle vertex_status_; HalfedgeStatusPropertyHandle halfedge_status_; @@ -894,6 +891,11 @@ private: unsigned int refcount_estatus_; unsigned int refcount_fstatus_; +private: + VertexContainer vertices_; + EdgeContainer edges_; + FaceContainer faces_; + BitMaskContainer halfedge_bit_masks_; BitMaskContainer edge_bit_masks_; BitMaskContainer vertex_bit_masks_; From b3417e5a88bf736132fa5bac0559f7db2ba98cc7 Mon Sep 17 00:00:00 2001 From: Martin Schultz Date: Tue, 24 Oct 2017 17:06:41 +0200 Subject: [PATCH 005/118] applied fix for bad or missing vertex tex coords --- src/OpenMesh/Core/IO/writer/OBJWriter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenMesh/Core/IO/writer/OBJWriter.cc b/src/OpenMesh/Core/IO/writer/OBJWriter.cc index 66cf3b3f..698e8bae 100644 --- a/src/OpenMesh/Core/IO/writer/OBJWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OBJWriter.cc @@ -363,7 +363,7 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec { // write vertex texture coordinate index if (_opt.check(Options::VertexTexCoord)) - _out << texMap[_be.texcoord(vh)]; + _out << texMap[_be.texcoord(vhandles[j])]; } // write vertex normal index From 06f089909b79dab01746e514a4f5fc64dcb2bbfa Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 24 Oct 2017 20:44:02 +0200 Subject: [PATCH 006/118] Updated changelog --- Doc/changelog.docu | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index f081c1f7..239174bc 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -22,11 +22,15 @@
  • fix halfedge indices in OpenMeshTrimeshCirculatorHalfedgeLoop CWAndCCWCheck
  • Fix wrong behaviour of HalfedgeLoopIterators by changing the template parameter
  • Added 1-4 triangle split funtion(splits all edges at Midpoints)
  • +
  • Boost range support (Thanks to Bastian Pranzas for the patch)
  • +
  • Made the face and edge split operations that copy properties also copy builtin properties
  • Utils
    • enable c++11 features of many classes for Visual Studio 2013
    • +
    • Fixed broken version macros (Thanks to Frederik Salomonsson for the fix)
    • +
    • Fixed Build on gcc-7.2 (Thanks to Gero Müller and Martial Tola for the patches)
    Tools @@ -39,11 +43,13 @@
    • QuadricT: implement Q+Q and Q*scalar operators for convenience.
    • Vector11T: Make converting ctor only accept 2 arguments
    • +
    • Only compute normals for faces that are not deleted
    IO
      +
    • ImporterT: Modified the add_face function of importerT to always return a valid FaceHandle
    • ImporterT: Return a valid FaceHandle when adding non-manifold faces.
    • BaseExporter: Added accessor functions for HalfEdgeHandles and faceTexCoords to base exporter and exporter template.
    • OBJ Writer: Added functionality to store FaceTexCoords to objwriter
    • @@ -53,7 +59,6 @@
    • OM Writer: Added Mark to the format header to identify end of stream correctly (Thanks to Jamie Kydd for the patch)
    • PLY Reader: Skip reading extra elements after face
    • PLY Reader: Return error when reaching EOF
    • -
    Unittests From 1b236885e5761503db7cabab62e416d07b9e586d Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 24 Oct 2017 20:51:19 +0200 Subject: [PATCH 007/118] Updated changelog --- Doc/changelog.docu | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 239174bc..5ec664d7 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -53,6 +53,7 @@
  • ImporterT: Return a valid FaceHandle when adding non-manifold faces.
  • BaseExporter: Added accessor functions for HalfEdgeHandles and faceTexCoords to base exporter and exporter template.
  • OBJ Writer: Added functionality to store FaceTexCoords to objwriter
  • +
  • OBJ Writer: Applied fix for bad or missing vertex tex coords (Thanks to Gero Müller for the patch)
  • >
  • OBJ Loader: range check for vertex colors and normals in OBJ loader
  • OBJ Loader: fixed handling of negative indices in OBJ loader
  • OM Writer: Fixed OMWriter when no faces are available (Thanks to Jamie Kydd for the patch)
  • From f714802c8d1835afb0483322309d307c881baca1 Mon Sep 17 00:00:00 2001 From: Martin Heistermann Date: Wed, 8 Nov 2017 11:14:32 +0100 Subject: [PATCH 008/118] Add missing break statements in OM::IO::restore --- src/OpenMesh/Core/IO/OMFormatT.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/OpenMesh/Core/IO/OMFormatT.cc b/src/OpenMesh/Core/IO/OMFormatT.cc index a61413b6..fa332b12 100644 --- a/src/OpenMesh/Core/IO/OMFormatT.cc +++ b/src/OpenMesh/Core/IO/OMFormatT.cc @@ -145,7 +145,7 @@ namespace IO { } - // helper to store a an integer + // helper to restore a an integer template< typename T > size_t restore( std::istream& _is, @@ -171,25 +171,28 @@ namespace IO { OMFormat::int16 v; bytes = restore( _is, v, _swap ); _val = static_cast(v); + break; } case OMFormat::Chunk::Integer_32: { OMFormat::int32 v; bytes = restore( _is, v, _swap ); _val = static_cast(v); + break; } case OMFormat::Chunk::Integer_64: { OMFormat::int64 v; bytes = restore( _is, v, _swap ); _val = static_cast(v); + break; } } return bytes; } - // helper to store a an unsigned integer + // helper to restore a an unsigned integer template< typename T > size_t restore( std::istream& _is, From 548a73bfade1e6ecab997683908afa7e34d83c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 5 Jan 2018 11:05:08 +0100 Subject: [PATCH 009/118] calc_sector_angle: Check for real division by zero not with epsilon that was way to large --- Doc/changelog.docu | 1 + src/OpenMesh/Core/Mesh/PolyMeshT.hh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 5ec664d7..9aff8b23 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -24,6 +24,7 @@
  • Added 1-4 triangle split funtion(splits all edges at Midpoints)
  • Boost range support (Thanks to Bastian Pranzas for the patch)
  • Made the face and edge split operations that copy properties also copy builtin properties
  • +
  • calc_sector_angle: Check for real division by zero not with epsilon that was way to large
  • Utils diff --git a/src/OpenMesh/Core/Mesh/PolyMeshT.hh b/src/OpenMesh/Core/Mesh/PolyMeshT.hh index 0554161e..b29ea40e 100644 --- a/src/OpenMesh/Core/Mesh/PolyMeshT.hh +++ b/src/OpenMesh/Core/Mesh/PolyMeshT.hh @@ -445,7 +445,7 @@ public: Normal v0, v1; calc_sector_vectors(_in_heh, v0, v1); Scalar denom = v0.norm()*v1.norm(); - if (is_zero(denom)) + if ( denom == Scalar(0)) { return 0; } From 2fb55bc26d1bd3067a9c6cebc79c4ad4630b9680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 26 Jan 2018 13:18:18 +0100 Subject: [PATCH 010/118] Fix vertex texture coordinates export in OBJ exporter (Thanks to Manuel Massing for the patch) --- Doc/changelog.docu | 1 + src/OpenMesh/Core/IO/writer/OBJWriter.cc | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 9aff8b23..ba67ebc9 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -55,6 +55,7 @@
  • BaseExporter: Added accessor functions for HalfEdgeHandles and faceTexCoords to base exporter and exporter template.
  • OBJ Writer: Added functionality to store FaceTexCoords to objwriter
  • OBJ Writer: Applied fix for bad or missing vertex tex coords (Thanks to Gero Müller for the patch)
  • > +
  • OBJ Writer: Fix vertex texture coordinates export in OBJ writer
  • OBJ Loader: range check for vertex colors and normals in OBJ loader
  • OBJ Loader: fixed handling of negative indices in OBJ loader
  • OM Writer: Fixed OMWriter when no faces are available (Thanks to Jamie Kydd for the patch)
  • diff --git a/src/OpenMesh/Core/IO/writer/OBJWriter.cc b/src/OpenMesh/Core/IO/writer/OBJWriter.cc index 698e8bae..434d9bc2 100644 --- a/src/OpenMesh/Core/IO/writer/OBJWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OBJWriter.cc @@ -270,10 +270,10 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec } } - //collect Texturevertices from vertices + //collect Texture coordinates from vertices if(_opt.check(Options::VertexTexCoord)) { - for (size_t i=0, nF=_be.n_faces(); i(i)); t = _be.texcoord(vh); From 0e3491ed88d403e4bc5c32dad060123caa59df43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 26 Jan 2018 13:29:22 +0100 Subject: [PATCH 011/118] obj exporter: fail if vertex color export was requested --- Doc/changelog.docu | 1 + src/OpenMesh/Core/IO/writer/OBJWriter.cc | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 9aff8b23..03e9e064 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -53,6 +53,7 @@
  • ImporterT: Modified the add_face function of importerT to always return a valid FaceHandle
  • ImporterT: Return a valid FaceHandle when adding non-manifold faces.
  • BaseExporter: Added accessor functions for HalfEdgeHandles and faceTexCoords to base exporter and exporter template.
  • +
  • OBJ Writer: Fail if vertex color export was requested (Thanks to Manuel Massing)
  • OBJ Writer: Added functionality to store FaceTexCoords to objwriter
  • OBJ Writer: Applied fix for bad or missing vertex tex coords (Thanks to Gero Müller for the patch)
  • >
  • OBJ Loader: range check for vertex colors and normals in OBJ loader
  • diff --git a/src/OpenMesh/Core/IO/writer/OBJWriter.cc b/src/OpenMesh/Core/IO/writer/OBJWriter.cc index 698e8bae..acae5486 100644 --- a/src/OpenMesh/Core/IO/writer/OBJWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OBJWriter.cc @@ -224,12 +224,22 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec if (!check( _be, _opt)) return false; + // No binary mode for OBJ + if ( _opt.check(Options::Binary) ) { + omout() << "[OBJWriter] : Warning, Binary mode requested for OBJ Writer (No support for Binary mode), falling back to standard." << std::endl; + } - // check writer features - if ( _opt.check(Options::Binary) || // not supported by format - _opt.check(Options::FaceNormal)) - return false; + // check for unsupported writer features + if (_opt.check(Options::FaceNormal) ) { + omerr() << "[OBJWriter] : FaceNormal not supported by OBJ Writer" << std::endl; + return false; + } + // check for unsupported writer features + if (_opt.check(Options::VertexColor) ) { + omerr() << "[OBJWriter] : VertexColor not supported by OBJ Writer" << std::endl; + return false; + } //create material file if needed if ( _opt.check(Options::FaceColor) ){ From 9856ed02a0d6a3f51dc0876028841d5938fd0325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 26 Jan 2018 13:33:24 +0100 Subject: [PATCH 012/118] Small compilation fix for MINGW64 cross-compilation --- Doc/changelog.docu | 1 + src/OpenMesh/Tools/Utils/conio.cc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 9aff8b23..9a8271d4 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -32,6 +32,7 @@
  • enable c++11 features of many classes for Visual Studio 2013
  • Fixed broken version macros (Thanks to Frederik Salomonsson for the fix)
  • Fixed Build on gcc-7.2 (Thanks to Gero Müller and Martial Tola for the patches)
  • +
  • Small compilation fix for MINGW64 cross-compilation(Thanks to Manuel Massing for the patch)
  • Tools diff --git a/src/OpenMesh/Tools/Utils/conio.cc b/src/OpenMesh/Tools/Utils/conio.cc index 5459dcde..985fbddb 100644 --- a/src/OpenMesh/Tools/Utils/conio.cc +++ b/src/OpenMesh/Tools/Utils/conio.cc @@ -64,7 +64,7 @@ int getche() { return ::_getche(); } } // AS // ----------------------------------------------------------------- Win32 ---- -#elif defined(WIN32) +#elif defined(WIN32) || defined(__MINGW32__) #include From d1088ae2e52f319e5c4b044d999699aa2f36f61c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 26 Jan 2018 13:38:21 +0100 Subject: [PATCH 013/118] Fix implicit fallthrough warning on gcc --- Doc/changelog.docu | 1 + src/OpenMesh/Core/IO/OMFormat.hh | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 9aff8b23..9d148bb0 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -61,6 +61,7 @@
  • OM Writer: Added Mark to the format header to identify end of stream correctly (Thanks to Jamie Kydd for the patch)
  • PLY Reader: Skip reading extra elements after face
  • PLY Reader: Return error when reaching EOF
  • +
  • OMFormat: Fix implicit fallthrough warning on gcc(Thanks to Manuel Massing for the patch)
  • Unittests diff --git a/src/OpenMesh/Core/IO/OMFormat.hh b/src/OpenMesh/Core/IO/OMFormat.hh index 13228e84..9bbcd860 100644 --- a/src/OpenMesh/Core/IO/OMFormat.hh +++ b/src/OpenMesh/Core/IO/OMFormat.hh @@ -315,16 +315,16 @@ namespace OMFormat { /// Return the size of chunk data in bytes inline size_t chunk_data_size( Header& _hdr, Chunk::Header& _chunk_hdr ) { - size_t C = 0; - + size_t C; switch( _chunk_hdr.entity_ ) { case Chunk::Entity_Vertex: C = _hdr.n_vertices_; break; case Chunk::Entity_Face: C = _hdr.n_faces_; break; - case Chunk::Entity_Halfedge: C = _hdr.n_edges_; // no break! - case Chunk::Entity_Edge: C += _hdr.n_edges_; break; + case Chunk::Entity_Halfedge: C = _hdr.n_edges_*2; break; + case Chunk::Entity_Edge: C = _hdr.n_edges_; break; case Chunk::Entity_Mesh: C = 1; break; default: + C = 0; std::cerr << "Invalid value in _chunk_hdr.entity_\n"; assert( false ); break; From ca212ba8f2bdd33506f4c14f7b5a878dbe1c6a11 Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Fri, 16 Feb 2018 13:57:26 +0100 Subject: [PATCH 014/118] let default range-based for skip deleted elements and add a version that includes deleted elements --- src/OpenMesh/Core/Mesh/PolyConnectivity.hh | 62 ++++++++++++++++++---- 1 file changed, 53 insertions(+), 9 deletions(-) diff --git a/src/OpenMesh/Core/Mesh/PolyConnectivity.hh b/src/OpenMesh/Core/Mesh/PolyConnectivity.hh index 3a93941f..d2ce6672 100644 --- a/src/OpenMesh/Core/Mesh/PolyConnectivity.hh +++ b/src/OpenMesh/Core/Mesh/PolyConnectivity.hh @@ -1138,45 +1138,89 @@ public: PolyConnectivity::ConstVertexIter, &PolyConnectivity::vertices_begin, &PolyConnectivity::vertices_end> ConstVertexRange; + typedef EntityRange< + const PolyConnectivity, + PolyConnectivity::ConstVertexIter, + &PolyConnectivity::vertices_sbegin, + &PolyConnectivity::vertices_end> ConstVertexRangeSkipping; typedef EntityRange< const PolyConnectivity, PolyConnectivity::ConstHalfedgeIter, &PolyConnectivity::halfedges_begin, &PolyConnectivity::halfedges_end> ConstHalfedgeRange; + typedef EntityRange< + const PolyConnectivity, + PolyConnectivity::ConstHalfedgeIter, + &PolyConnectivity::halfedges_sbegin, + &PolyConnectivity::halfedges_end> ConstHalfedgeRangeSkipping; typedef EntityRange< const PolyConnectivity, PolyConnectivity::ConstEdgeIter, &PolyConnectivity::edges_begin, &PolyConnectivity::edges_end> ConstEdgeRange; + typedef EntityRange< + const PolyConnectivity, + PolyConnectivity::ConstEdgeIter, + &PolyConnectivity::edges_sbegin, + &PolyConnectivity::edges_end> ConstEdgeRangeSkipping; typedef EntityRange< const PolyConnectivity, PolyConnectivity::ConstFaceIter, &PolyConnectivity::faces_begin, &PolyConnectivity::faces_end> ConstFaceRange; + typedef EntityRange< + const PolyConnectivity, + PolyConnectivity::ConstFaceIter, + &PolyConnectivity::faces_sbegin, + &PolyConnectivity::faces_end> ConstFaceRangeSkipping; /** * @return The vertices as a range object suitable - * for C++11 range based for loops. + * for C++11 range based for loops. Will skip deleted vertices. */ - ConstVertexRange vertices() const { return ConstVertexRange(*this); } + ConstVertexRangeSkipping vertices() const { return ConstVertexRangeSkipping(*this); } + + /** + * @return The vertices as a range object suitable + * for C++11 range based for loops. Will include deleted vertices. + */ + ConstVertexRange all_vertices() const { return ConstVertexRange(*this); } /** * @return The halfedges as a range object suitable - * for C++11 range based for loops. + * for C++11 range based for loops. Will skip deleted halfedges. */ - ConstHalfedgeRange halfedges() const { return ConstHalfedgeRange(*this); } + ConstHalfedgeRangeSkipping halfedges() const { return ConstHalfedgeRangeSkipping(*this); } /** - * @return The edges as a range object suitabl - * for C++11 range based for loops. + * @return The halfedges as a range object suitable + * for C++11 range based for loops. Will include deleted halfedges. */ - ConstEdgeRange edges() const { return ConstEdgeRange(*this); } + ConstHalfedgeRange all_halfedges() const { return ConstHalfedgeRange(*this); } + + /** + * @return The edges as a range object suitable + * for C++11 range based for loops. Will skip deleted edges. + */ + ConstEdgeRangeSkipping edges() const { return ConstEdgeRangeSkipping(*this); } + + /** + * @return The edges as a range object suitable + * for C++11 range based for loops. Will include deleted edges. + */ + ConstEdgeRange all_edges() const { return ConstEdgeRange(*this); } /** * @return The faces as a range object suitable - * for C++11 range based for loops. + * for C++11 range based for loops. Will skip deleted faces. */ - ConstFaceRange faces() const { return ConstFaceRange(*this); } + ConstFaceRangeSkipping faces() const { return ConstFaceRangeSkipping(*this); } + + /** + * @return The faces as a range object suitable + * for C++11 range based for loops. Will include deleted faces. + */ + ConstFaceRange all_faces() const { return ConstFaceRange(*this); } /// Generic class for iterator ranges. template< From 52275f945d16da8ab0e48b14b11789e74d8a553d Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Fri, 16 Feb 2018 13:59:45 +0100 Subject: [PATCH 015/118] add unit test for range iterators --- src/Unittests/unittests_trimesh_iterators.cc | 152 ++++++++++++++++++- 1 file changed, 151 insertions(+), 1 deletion(-) diff --git a/src/Unittests/unittests_trimesh_iterators.cc b/src/Unittests/unittests_trimesh_iterators.cc index 913c40f3..a91012c0 100644 --- a/src/Unittests/unittests_trimesh_iterators.cc +++ b/src/Unittests/unittests_trimesh_iterators.cc @@ -773,7 +773,7 @@ TEST_F(OpenMeshIterators, FaceIterEmptyMeshOneDeletedFace) { vhandle[1] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); vhandle[2] = mesh_.add_vertex(Mesh::Point(1, 1, 0)); - // Add two faces + // Add one faces std::vector face_vhandles; face_vhandles.push_back(vhandle[2]); @@ -841,4 +841,154 @@ TEST_F(OpenMeshIterators, FaceIterEmptyMeshOneDeletedFace) { mesh_.release_face_status(); } + + + +/* + * Test range iterators + */ +TEST_F(OpenMeshIterators, RangeIterators) { + + mesh_.clear(); + + // request delete_face capability + mesh_.request_vertex_status(); + mesh_.request_edge_status(); + mesh_.request_halfedge_status(); + mesh_.request_face_status(); + + // Add some vertices + Mesh::VertexHandle vhandle[4]; + + vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 0, 0)); + vhandle[1] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); + vhandle[2] = mesh_.add_vertex(Mesh::Point(1, 1, 0)); + vhandle[3] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); + + // Add two faces + std::vector face_vhandles; + + face_vhandles.push_back(vhandle[2]); + face_vhandles.push_back(vhandle[1]); + face_vhandles.push_back(vhandle[0]); + mesh_.add_face(face_vhandles); + + face_vhandles.clear(); + face_vhandles.push_back(vhandle[0]); + face_vhandles.push_back(vhandle[3]); + face_vhandles.push_back(vhandle[2]); + Mesh::FaceHandle fh = mesh_.add_face(face_vhandles); + + // Delete one face + mesh_.delete_face(fh); + + // Test setup (right face deleted) + // 1 --- 2 + // | / | + // | / | + // | / | + // 0 --- 3 + + + // ====== Faces ====== + + int count_faces_iter = 0; + for (auto f_it = mesh_.faces_begin(); f_it != mesh_.faces_end(); ++f_it) + ++count_faces_iter; + EXPECT_EQ(2, count_faces_iter) << "Wrong number of visited faces."; + + int count_faces_skipping_iter = 0; + for (auto f_it = mesh_.faces_sbegin(); f_it != mesh_.faces_end(); ++f_it) + ++count_faces_skipping_iter; + EXPECT_EQ(1, count_faces_skipping_iter) << "Wrong number of visited faces."; + + int count_faces_range = 0; + for (auto fh : mesh_.faces()) + ++count_faces_range; + EXPECT_EQ(1, count_faces_range) << "Wrong number of visited faces."; + + int count_faces_range_all = 0; + for (auto fh : mesh_.all_faces()) + ++count_faces_range_all; + EXPECT_EQ(2, count_faces_range_all) << "Wrong number of visited faces."; + + + // ====== Edges ====== + + int count_edges_iter = 0; + for (auto e_it = mesh_.edges_begin(); e_it != mesh_.edges_end(); ++e_it) + ++count_edges_iter; + EXPECT_EQ(5, count_edges_iter) << "Wrong number of visited edges."; + + int count_edges_skipping_iter = 0; + for (auto e_it = mesh_.edges_sbegin(); e_it != mesh_.edges_end(); ++e_it) + ++count_edges_skipping_iter; + EXPECT_EQ(3, count_edges_skipping_iter) << "Wrong number of visited edges."; + + int count_edges_range = 0; + for (auto eh : mesh_.edges()) + ++count_edges_range; + EXPECT_EQ(3, count_edges_range) << "Wrong number of visited edges."; + + int count_edges_range_all = 0; + for (auto eh : mesh_.all_edges()) + ++count_edges_range_all; + EXPECT_EQ(5, count_edges_range_all) << "Wrong number of visited edges."; + + + // ====== Halfedges ====== + + int count_halfedges_iter = 0; + for (auto h_it = mesh_.halfedges_begin(); h_it != mesh_.halfedges_end(); ++h_it) + ++count_halfedges_iter; + EXPECT_EQ(10, count_halfedges_iter) << "Wrong number of visited halfedges."; + + int count_halfedges_skipping_iter = 0; + for (auto h_it = mesh_.halfedges_sbegin(); h_it != mesh_.halfedges_end(); ++h_it) + ++count_halfedges_skipping_iter; + EXPECT_EQ(6, count_halfedges_skipping_iter) << "Wrong number of visited halfedges."; + + int count_halfedges_range = 0; + for (auto heh : mesh_.halfedges()) + ++count_halfedges_range; + EXPECT_EQ(6, count_halfedges_range) << "Wrong number of visited halfedges."; + + int count_halfedges_range_all = 0; + for (auto heh : mesh_.all_halfedges()) + ++count_halfedges_range_all; + EXPECT_EQ(10, count_halfedges_range_all) << "Wrong number of visited halfedges."; + + + // ====== Vertices ====== + + int count_vertices_iter = 0; + for (auto v_it = mesh_.vertices_begin(); v_it != mesh_.vertices_end(); ++v_it) + ++count_vertices_iter; + EXPECT_EQ(4, count_vertices_iter) << "Wrong number of visited vertices."; + + int count_vertices_skipping_iter = 0; + for (auto v_it = mesh_.vertices_sbegin(); v_it != mesh_.vertices_end(); ++v_it) + ++count_vertices_skipping_iter; + EXPECT_EQ(3, count_vertices_skipping_iter) << "Wrong number of visited vertices."; + + int count_vertices_range = 0; + for (auto vh : mesh_.vertices()) + ++count_vertices_range; + EXPECT_EQ(3, count_vertices_range) << "Wrong number of visited vertices."; + + int count_vertices_range_all = 0; + for (auto vh : mesh_.all_vertices()) + ++count_vertices_range_all; + EXPECT_EQ(4, count_vertices_range_all) << "Wrong number of visited vertices."; + + + mesh_.release_vertex_status(); + mesh_.release_edge_status(); + mesh_.release_halfedge_status(); + mesh_.release_face_status(); + +} + + + } From 07b5df2872780d101e0b713355f33215f9fdc7b6 Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Thu, 22 Feb 2018 13:11:06 +0100 Subject: [PATCH 016/118] add test to check if halfedges are marked as deleted after collapse --- src/Unittests/unittests_trimesh_collapse.cc | 135 ++++++++++++++++++++ 1 file changed, 135 insertions(+) diff --git a/src/Unittests/unittests_trimesh_collapse.cc b/src/Unittests/unittests_trimesh_collapse.cc index d2b0d99b..fea9307a 100644 --- a/src/Unittests/unittests_trimesh_collapse.cc +++ b/src/Unittests/unittests_trimesh_collapse.cc @@ -607,4 +607,139 @@ TEST_F(OpenMeshCollapse, LargeCollapseHalfEdge) { } + +/* + * Test collapsing an halfedge in a triangle mesh + * + */ +TEST_F(OpenMeshCollapse, DeletedStatus) { + + mesh_.clear(); + + // Add some vertices + Mesh::VertexHandle vhandle[6]; + + vhandle[0] = mesh_.add_vertex(Mesh::Point(-1, 0, 0)); + vhandle[1] = mesh_.add_vertex(Mesh::Point( 0, 2, 0)); + vhandle[2] = mesh_.add_vertex(Mesh::Point( 0, 1, 0)); + vhandle[3] = mesh_.add_vertex(Mesh::Point( 0,-1, 0)); + vhandle[4] = mesh_.add_vertex(Mesh::Point( 0,-2, 0)); + vhandle[5] = mesh_.add_vertex(Mesh::Point( 1, 0, 0)); + + // Add two faces + std::vector face_vhandles; + + face_vhandles.push_back(vhandle[0]); + face_vhandles.push_back(vhandle[2]); + face_vhandles.push_back(vhandle[1]); + mesh_.add_face(face_vhandles); + + face_vhandles.clear(); + + face_vhandles.push_back(vhandle[0]); + face_vhandles.push_back(vhandle[3]); + face_vhandles.push_back(vhandle[2]); + mesh_.add_face(face_vhandles); + + face_vhandles.clear(); + + face_vhandles.push_back(vhandle[0]); + face_vhandles.push_back(vhandle[4]); + face_vhandles.push_back(vhandle[3]); + mesh_.add_face(face_vhandles); + + face_vhandles.clear(); + + face_vhandles.push_back(vhandle[5]); + face_vhandles.push_back(vhandle[1]); + face_vhandles.push_back(vhandle[2]); + mesh_.add_face(face_vhandles); + + face_vhandles.clear(); + + face_vhandles.push_back(vhandle[5]); + face_vhandles.push_back(vhandle[2]); + face_vhandles.push_back(vhandle[3]); + mesh_.add_face(face_vhandles); + + face_vhandles.clear(); + + face_vhandles.push_back(vhandle[5]); + face_vhandles.push_back(vhandle[3]); + face_vhandles.push_back(vhandle[4]); + mesh_.add_face(face_vhandles); + + /* Test setup: + * 1 + * /|\ + * / | \ + * / _2_ \ + * /_/ | \_\ + * 0__ | __5 + * \ \_3_/ / + * \ | / + * \ | / + * \|/ + * 4 + */ + + EXPECT_EQ(mesh_.n_faces(), 6u) << "Could not add all faces"; + + // Request the status bits + mesh_.request_vertex_status(); + mesh_.request_edge_status(); + mesh_.request_halfedge_status(); + mesh_.request_face_status(); + + // ============================================= + // Collapse halfedge from 3 to 2 + // ============================================= + + Mesh::HalfedgeHandle heh_collapse = mesh_.find_halfedge(Mesh::VertexHandle(2), Mesh::VertexHandle(3)); + + EXPECT_TRUE(heh_collapse.is_valid()) << "Could not find halfedge from vertex 2 to vetex 3"; + EXPECT_TRUE(mesh_.is_collapse_ok(heh_collapse)) << "Collapse is not ok for halfedge from vertex 2 to vertex 3"; + + Mesh::HalfedgeHandle top_left = mesh_.find_halfedge(Mesh::VertexHandle(2), Mesh::VertexHandle(0)); + Mesh::HalfedgeHandle top_right = mesh_.find_halfedge(Mesh::VertexHandle(5), Mesh::VertexHandle(2)); + Mesh::HalfedgeHandle bottom_left = mesh_.find_halfedge(Mesh::VertexHandle(0), Mesh::VertexHandle(3)); + Mesh::HalfedgeHandle bottom_right = mesh_.find_halfedge(Mesh::VertexHandle(3), Mesh::VertexHandle(5)); + + EXPECT_TRUE(top_left.is_valid()) << "Could not find halfedge from vertex 2 to vetex 0"; + EXPECT_TRUE(top_right.is_valid()) << "Could not find halfedge from vertex 5 to vetex 2"; + EXPECT_TRUE(bottom_left.is_valid()) << "Could not find halfedge from vertex 0 to vetex 3"; + EXPECT_TRUE(bottom_right.is_valid()) << "Could not find halfedge from vertex 3 to vetex 5"; + + Mesh::FaceHandle left = mesh_.face_handle(top_left); + Mesh::FaceHandle right = mesh_.face_handle(top_right); + EXPECT_TRUE(left.is_valid()) << "Could not find left face"; + EXPECT_TRUE(right.is_valid()) << "Could not find right"; + + mesh_.collapse(heh_collapse); + + EXPECT_TRUE(mesh_.status(Mesh::VertexHandle(2)).deleted()) << "Collapsed vertex is not deleted."; + + EXPECT_TRUE(mesh_.status(left).deleted()) << "Left face is not deleted."; + EXPECT_TRUE(mesh_.status(right).deleted()) << "Right face is not deleted."; + + EXPECT_TRUE(mesh_.status(mesh_.edge_handle(heh_collapse)).deleted()) << "Collapsed edge is not deleted."; + EXPECT_TRUE(mesh_.status(mesh_.edge_handle(top_left)).deleted()) << "Top left edge is not deleted."; + EXPECT_TRUE(mesh_.status(mesh_.edge_handle(top_right)).deleted()) << "Top right edge is not deleted."; + EXPECT_FALSE(mesh_.status(mesh_.edge_handle(bottom_left)).deleted()) << "Bottom left edge is deleted."; + EXPECT_FALSE(mesh_.status(mesh_.edge_handle(bottom_right)).deleted()) << "Bottom right edge is deleted."; + + EXPECT_TRUE(mesh_.status(heh_collapse).deleted()) << "Collapsed halfedge is not deleted."; + EXPECT_TRUE(mesh_.status(mesh_.opposite_halfedge_handle(heh_collapse)).deleted()) << "Opposite of collapsed halfedge is not deleted."; + + EXPECT_TRUE(mesh_.status(top_left).deleted()) << "Halfedge from vertex 0 to vertex 2 is not deleted"; + EXPECT_TRUE(mesh_.status(mesh_.opposite_halfedge_handle(top_left)).deleted()) << "Halfedge from vertex 2 to vertex 0 is not deleted"; + EXPECT_TRUE(mesh_.status(top_right).deleted()) << "Halfedge from vertex 5 to vertex 2 is not deleted"; + EXPECT_TRUE(mesh_.status(mesh_.opposite_halfedge_handle(top_right)).deleted()) << "Halfedge from vertex 2 to vertex 5 is not deleted"; + EXPECT_FALSE(mesh_.status(bottom_left).deleted()) << "Halfedge from vertex 0 to vertex 3 is deleted"; + EXPECT_FALSE(mesh_.status(mesh_.opposite_halfedge_handle(bottom_left)).deleted()) << "Halfedge from vertex 3 to vertex 0 is deleted"; + EXPECT_FALSE(mesh_.status(bottom_right).deleted()) << "Halfedge from vertex 3 to vertex 5 is deleted"; + EXPECT_FALSE(mesh_.status(mesh_.opposite_halfedge_handle(bottom_right)).deleted()) << "Halfedge from vertex 5 to vertex 3 is deleted"; +} + + } From d36b24ac1815aee9feaa8cfae72376954948da90 Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Thu, 22 Feb 2018 13:16:22 +0100 Subject: [PATCH 017/118] mark halfedges as deleted after collapse --- src/OpenMesh/Core/Mesh/PolyConnectivity.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/OpenMesh/Core/Mesh/PolyConnectivity.cc b/src/OpenMesh/Core/Mesh/PolyConnectivity.cc index 3e26e6d2..e311f5cb 100644 --- a/src/OpenMesh/Core/Mesh/PolyConnectivity.cc +++ b/src/OpenMesh/Core/Mesh/PolyConnectivity.cc @@ -777,6 +777,11 @@ void PolyConnectivity::collapse_edge(HalfedgeHandle _hh) // delete stuff status(edge_handle(h)).set_deleted(true); status(vo).set_deleted(true); + if (has_halfedge_status()) + { + status(h).set_deleted(true); + status(o).set_deleted(true); + } } //----------------------------------------------------------------------------- @@ -827,6 +832,11 @@ void PolyConnectivity::collapse_loop(HalfedgeHandle _hh) status(fh).set_deleted(true); } status(edge_handle(h0)).set_deleted(true); + if (has_halfedge_status()) + { + status(h0).set_deleted(true); + status(o0).set_deleted(true); + } } //----------------------------------------------------------------------------- From dea881279210077f11789e774edad717c91f24d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 13 Mar 2018 12:54:26 +0100 Subject: [PATCH 018/118] Fixed cmake path --- CI/Windows.bat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CI/Windows.bat b/CI/Windows.bat index 3db66708..b5402dd2 100644 --- a/CI/Windows.bat +++ b/CI/Windows.bat @@ -93,7 +93,7 @@ IF "%APPS%" == "ON" ( ) -"C:\Program Files (x86)\CMake\bin\cmake.exe" -DGTEST_PREFIX="%LIBPATH%\%ARCHITECTURE%\%GTESTVERSION%" -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=Release -DBUILD_APPS=%APPS% -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DCMAKE_WINDOWS_LIBS_DIR="e:\libs" -DOPENMESH_BUILD_SHARED=%SHARED% %CMAKE_CONFIGURATION% .. +"C:\Program Files\CMake\bin\cmake.exe" -DGTEST_PREFIX="%LIBPATH%\%ARCHITECTURE%\%GTESTVERSION%" -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=Release -DBUILD_APPS=%APPS% -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DCMAKE_WINDOWS_LIBS_DIR="e:\libs" -DOPENMESH_BUILD_SHARED=%SHARED% %CMAKE_CONFIGURATION% .. %VS_PATH% /Build "Release" OpenMesh.sln /Project "ALL_BUILD" @@ -111,7 +111,7 @@ mkdir build-debug cd build-debug -"C:\Program Files (x86)\CMake\bin\cmake.exe" -DGTEST_PREFIX="%LIBPATH%\%ARCHITECTURE%\%GTESTVERSION%" -G "%GENERATOR%" -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_SHARED=%SHARED% -DBUILD_APPS=%APPS% %CMAKE_CONFIGURATION% .. +"C:\Program Files\CMake\bin\cmake.exe" -DGTEST_PREFIX="%LIBPATH%\%ARCHITECTURE%\%GTESTVERSION%" -G "%GENERATOR%" -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_SHARED=%SHARED% -DBUILD_APPS=%APPS% %CMAKE_CONFIGURATION% .. %VS_PATH% /Build "Debug" OpenMesh.sln /Project "ALL_BUILD" @@ -139,7 +139,7 @@ cd build-release del *.exe -"C:\Program Files (x86)\CMake\bin\cmake.exe" -DGTEST_PREFIX="%LIBPATH%\%ARCHITECTURE%\%GTESTVERSION%" -G "%GENERATOR%" -DBUILD_APPS=%APPS% -DCMAKE_BUILD_TYPE=Release %CMAKE_CONFIGURATION% .. +"C:\Program Files\CMake\bin\cmake.exe" -DGTEST_PREFIX="%LIBPATH%\%ARCHITECTURE%\%GTESTVERSION%" -G "%GENERATOR%" -DBUILD_APPS=%APPS% -DCMAKE_BUILD_TYPE=Release %CMAKE_CONFIGURATION% .. %VS_PATH% /Build "Release" OpenMesh.sln /Project "PACKAGE" From da81dbaffa3222041c9edb42b8ad22ab38342afe Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Mon, 19 Mar 2018 09:41:25 +0100 Subject: [PATCH 019/118] add unittest to check standard properties after mesh assignment --- src/Unittests/unittests_property.cc | 106 ++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/src/Unittests/unittests_property.cc b/src/Unittests/unittests_property.cc index 0a0a0a14..f9b0b45c 100644 --- a/src/Unittests/unittests_property.cc +++ b/src/Unittests/unittests_property.cc @@ -746,5 +746,111 @@ TEST_F(OpenMeshProperties, PropertyIterators ) { } +TEST_F(OpenMeshProperties, MeshAssignment ) { + + mesh_.clear(); + mesh_.add_vertex(Mesh::Point()); + + auto copy = mesh_; + + copy.request_vertex_status(); + copy.request_vertex_normals(); + copy.request_vertex_colors(); + copy.request_vertex_texcoords1D(); + copy.request_vertex_texcoords2D(); + copy.request_vertex_texcoords3D(); + copy.request_halfedge_status(); + copy.request_halfedge_texcoords1D(); + copy.request_halfedge_texcoords2D(); + copy.request_halfedge_texcoords3D(); + copy.request_edge_status(); + copy.request_edge_colors(); + copy.request_halfedge_normals(); + copy.request_halfedge_colors(); + copy.request_face_status(); + copy.request_face_normals(); + copy.request_face_colors(); + copy.request_face_texture_index(); + + EXPECT_TRUE(copy.has_vertex_status()); + EXPECT_TRUE(copy.has_vertex_normals()); + EXPECT_TRUE(copy.has_vertex_colors()); + EXPECT_TRUE(copy.has_vertex_texcoords1D()); + EXPECT_TRUE(copy.has_vertex_texcoords2D()); + EXPECT_TRUE(copy.has_vertex_texcoords3D()); + EXPECT_TRUE(copy.has_halfedge_status()); + EXPECT_TRUE(copy.has_halfedge_texcoords1D()); + EXPECT_TRUE(copy.has_halfedge_texcoords2D()); + EXPECT_TRUE(copy.has_halfedge_texcoords3D()); + EXPECT_TRUE(copy.has_edge_status()); + EXPECT_TRUE(copy.has_edge_colors()); + EXPECT_TRUE(copy.has_halfedge_normals()); + EXPECT_TRUE(copy.has_halfedge_colors()); + EXPECT_TRUE(copy.has_face_status()); + EXPECT_TRUE(copy.has_face_normals()); + EXPECT_TRUE(copy.has_face_colors()); + EXPECT_TRUE(copy.has_face_texture_index()); + + copy.assign(mesh_, true); + + EXPECT_FALSE(copy.has_vertex_status()); + EXPECT_FALSE(copy.has_vertex_normals()); + EXPECT_FALSE(copy.has_vertex_colors()); + EXPECT_FALSE(copy.has_vertex_texcoords1D()); + EXPECT_FALSE(copy.has_vertex_texcoords2D()); + EXPECT_FALSE(copy.has_vertex_texcoords3D()); + EXPECT_FALSE(copy.has_halfedge_status()); + EXPECT_FALSE(copy.has_halfedge_texcoords1D()); + EXPECT_FALSE(copy.has_halfedge_texcoords2D()); + EXPECT_FALSE(copy.has_halfedge_texcoords3D()); + EXPECT_FALSE(copy.has_edge_status()); + EXPECT_FALSE(copy.has_edge_colors()); + EXPECT_FALSE(copy.has_halfedge_normals()); + EXPECT_FALSE(copy.has_halfedge_colors()); + EXPECT_FALSE(copy.has_face_status()); + EXPECT_FALSE(copy.has_face_normals()); + EXPECT_FALSE(copy.has_face_colors()); + EXPECT_FALSE(copy.has_face_texture_index()); + + copy.request_vertex_status(); + copy.request_vertex_normals(); + copy.request_vertex_colors(); + copy.request_vertex_texcoords1D(); + copy.request_vertex_texcoords2D(); + copy.request_vertex_texcoords3D(); + copy.request_halfedge_status(); + copy.request_halfedge_texcoords1D(); + copy.request_halfedge_texcoords2D(); + copy.request_halfedge_texcoords3D(); + copy.request_edge_status(); + copy.request_edge_colors(); + copy.request_halfedge_normals(); + copy.request_halfedge_colors(); + copy.request_face_status(); + copy.request_face_normals(); + copy.request_face_colors(); + copy.request_face_texture_index(); + + EXPECT_TRUE(copy.has_vertex_status()) << "Mesh has no vertex status even though they have been requested"; + EXPECT_TRUE(copy.has_vertex_normals()) << "Mesh has no vertex normals even though they have been requested"; + EXPECT_TRUE(copy.has_vertex_colors()) << "Mesh has no vertex colors even though they have been requested"; + EXPECT_TRUE(copy.has_vertex_texcoords1D()) << "Mesh has no vertex texcoord1D even though they have been requested"; + EXPECT_TRUE(copy.has_vertex_texcoords2D()) << "Mesh has no vertex texcoord2D even though they have been requested"; + EXPECT_TRUE(copy.has_vertex_texcoords3D()) << "Mesh has no vertex texcoord3D even though they have been requested"; + EXPECT_TRUE(copy.has_halfedge_status()) << "Mesh has no halfedge status even though they have been requested"; + EXPECT_TRUE(copy.has_halfedge_texcoords1D()) << "Mesh has no halfedge texcoords1D even though they have been requested"; + EXPECT_TRUE(copy.has_halfedge_texcoords2D()) << "Mesh has no halfedge texcoords2D even though they have been requested"; + EXPECT_TRUE(copy.has_halfedge_texcoords3D()) << "Mesh has no halfedge texcoords3D even though they have been requested"; + EXPECT_TRUE(copy.has_edge_status()) << "Mesh has no edge status even though they have been requested"; + EXPECT_TRUE(copy.has_edge_colors()) << "Mesh has no edge colors even though they have been requested"; + EXPECT_TRUE(copy.has_halfedge_normals()) << "Mesh has no halfedge normals even though they have been requested"; + EXPECT_TRUE(copy.has_halfedge_colors()) << "Mesh has no halfedge colors even though they have been requested"; + EXPECT_TRUE(copy.has_face_status()) << "Mesh has no face status even though they have been requested"; + EXPECT_TRUE(copy.has_face_normals()) << "Mesh has no face normals even though they have been requested"; + EXPECT_TRUE(copy.has_face_colors()) << "Mesh has no face colors even though they have been requested"; + EXPECT_TRUE(copy.has_face_texture_index()) << "Mesh has no face texture index even though they have been requested"; + +} + } From e17b09f656fd4b3e7ea5fdd39893642135d1ee7c Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Mon, 19 Mar 2018 10:26:21 +0100 Subject: [PATCH 020/118] fix usage of wrong split function in unit test --- src/Unittests/unittests_split_edge_copy.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Unittests/unittests_split_edge_copy.cc b/src/Unittests/unittests_split_edge_copy.cc index 4dd2088d..c2fbd67e 100644 --- a/src/Unittests/unittests_split_edge_copy.cc +++ b/src/Unittests/unittests_split_edge_copy.cc @@ -91,13 +91,15 @@ TEST_F(OpenMeshSplitEdgeCopyTriangleMesh, SplitEdgeCopyTriangleMesh) { //set internal property mesh_.status(eh).set_tagged(true); - // split face with new vertex - mesh_.split_edge_copy(eh, vhandle[3]); + // split edge with new vertex + mesh_.split_copy(eh, vhandle[3]); // Check setup Mesh::EdgeHandle eh0 = mesh_.edge_handle( mesh_.next_halfedge_handle( mesh_.halfedge_handle(eh, 1) ) ); EXPECT_EQ(999, mesh_.property(eprop_int, eh0)) << "Different Property value"; EXPECT_TRUE(mesh_.status(eh0).tagged()) << "Different internal property value"; + + EXPECT_EQ(mesh_.valence(fh), 3) << "Face of TriMesh has valence other than 3"; } /* splits an edge that has a property in a poly mesh with split_edge_copy From 0d45e1e4c69f8b6b749a9bf633f93ea2ee83c7ee Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Mon, 19 Mar 2018 10:26:56 +0100 Subject: [PATCH 021/118] add unittest to check if face properties are copied correctly after edge split --- src/Unittests/unittests_split_edge_copy.cc | 98 ++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/src/Unittests/unittests_split_edge_copy.cc b/src/Unittests/unittests_split_edge_copy.cc index c2fbd67e..cb64e28f 100644 --- a/src/Unittests/unittests_split_edge_copy.cc +++ b/src/Unittests/unittests_split_edge_copy.cc @@ -154,4 +154,102 @@ TEST_F(OpenMeshSplitEdgeCopyPolyMesh, SplitEdgeCopyPolymesh) { EXPECT_EQ(999, mesh_.property(eprop_int, eh0)) << "Different Property value"; EXPECT_TRUE(mesh_.status(eh0).tagged()) << "Different internal property value"; } + + +/* splits an edge in a triangle mesh that has a face property with split_edge_copy + * the property should be copied to the new edge + */ +TEST_F(OpenMeshSplitEdgeCopyTriangleMesh, SplitEdgeCopyFacePropertiesTriangleMesh) { + + mesh_.clear(); + mesh_.request_edge_status(); + mesh_.request_face_status(); + + static_assert(std::is_same::value, "Mesh is not a triangle mesh"); + + // Add some vertices + Mesh::VertexHandle vhandle[4]; + + vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 0, 0)); + vhandle[1] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); + vhandle[2] = mesh_.add_vertex(Mesh::Point(1, 1, 0)); + vhandle[3] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); + + Mesh::VertexHandle inner_vertex = mesh_.add_vertex(Mesh::Point(0.5, 0.5, 0)); + Mesh::VertexHandle boundary_vertex = mesh_.add_vertex(Mesh::Point(0.0, 0.5, 0)); + + // Add two faces + std::vector face_vhandles; + face_vhandles.push_back(vhandle[2]); + face_vhandles.push_back(vhandle[1]); + face_vhandles.push_back(vhandle[0]); + + Mesh::FaceHandle fh0 = mesh_.add_face(face_vhandles); + + face_vhandles.clear(); + face_vhandles.push_back(vhandle[2]); + face_vhandles.push_back(vhandle[0]); + face_vhandles.push_back(vhandle[3]); + + Mesh::FaceHandle fh1 = mesh_.add_face(face_vhandles); + + Mesh::EdgeHandle inner_edge = Mesh::EdgeHandle(2); + + EXPECT_EQ(mesh_.n_faces(), 2u); + + // Test setup: + // 1 --- 2 + // | / | + // | / | + // | / | + // 0 --- 3 + + // set property + OpenMesh::FPropHandleT fprop_int; + mesh_.add_property(fprop_int); + mesh_.property(fprop_int, fh0) = 13; + mesh_.property(fprop_int, fh1) = 17; + //set internal property + mesh_.status(fh0).set_tagged(true); + + // 2 to 4 split + mesh_.split_copy(inner_edge, inner_vertex); + + EXPECT_EQ(mesh_.n_faces(), 4u); + + for (auto fh : mesh_.faces()) + { + EXPECT_EQ(mesh_.valence(fh), 3); + } + + // Check setup + Mesh::HalfedgeHandle heh21 = mesh_.find_halfedge(vhandle[2], vhandle[1]); + Mesh::HalfedgeHandle heh10 = mesh_.find_halfedge(vhandle[1], vhandle[0]); + Mesh::HalfedgeHandle heh03 = mesh_.find_halfedge(vhandle[0], vhandle[3]); + Mesh::HalfedgeHandle heh32 = mesh_.find_halfedge(vhandle[3], vhandle[2]); + + EXPECT_EQ(13, mesh_.property(fprop_int, mesh_.face_handle(heh21))) << "Different Property value"; + EXPECT_EQ(13, mesh_.property(fprop_int, mesh_.face_handle(heh10))) << "Different Property value"; + EXPECT_EQ(17, mesh_.property(fprop_int, mesh_.face_handle(heh03))) << "Different Property value"; + EXPECT_EQ(17, mesh_.property(fprop_int, mesh_.face_handle(heh32))) << "Different Property value"; + EXPECT_TRUE(mesh_.status(mesh_.face_handle(heh21)).tagged()) << "Different internal property value"; + EXPECT_TRUE(mesh_.status(mesh_.face_handle(heh10)).tagged()) << "Different internal property value"; + EXPECT_FALSE(mesh_.status(mesh_.face_handle(heh03)).tagged()) << "Different internal property value"; + EXPECT_FALSE(mesh_.status(mesh_.face_handle(heh32)).tagged()) << "Different internal property value"; + + // also test boundary split + Mesh::EdgeHandle boundary_edge = mesh_.edge_handle(heh10); + + // 1 to 2 split + mesh_.split_copy(boundary_edge, boundary_vertex); + + Mesh::HalfedgeHandle heh1b = mesh_.find_halfedge(vhandle[1], boundary_vertex); + Mesh::HalfedgeHandle hehb0 = mesh_.find_halfedge(boundary_vertex, vhandle[0]); + + EXPECT_EQ(13, mesh_.property(fprop_int, mesh_.face_handle(heh1b))) << "Different Property value"; + EXPECT_EQ(13, mesh_.property(fprop_int, mesh_.face_handle(hehb0))) << "Different Property value"; + EXPECT_TRUE(mesh_.status(mesh_.face_handle(heh1b)).tagged()) << "Different internal property value"; + EXPECT_TRUE(mesh_.status(mesh_.face_handle(hehb0)).tagged()) << "Different internal property value"; +} + } From 480f1175e17665ce9e85925085ea8d83b058d6bf Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Mon, 19 Mar 2018 10:54:06 +0100 Subject: [PATCH 022/118] also copy face properties in split_copy(EdgeHandle, VertexHandle) --- src/OpenMesh/Core/Mesh/TriConnectivity.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/OpenMesh/Core/Mesh/TriConnectivity.cc b/src/OpenMesh/Core/Mesh/TriConnectivity.cc index e3d69623..fc12ac00 100644 --- a/src/OpenMesh/Core/Mesh/TriConnectivity.cc +++ b/src/OpenMesh/Core/Mesh/TriConnectivity.cc @@ -488,6 +488,11 @@ void TriConnectivity::split(EdgeHandle _eh, VertexHandle _vh) void TriConnectivity::split_copy(EdgeHandle _eh, VertexHandle _vh) { + VertexHandle v0 = to_vertex_handle(halfedge_handle(_eh, 0)); + VertexHandle v1 = to_vertex_handle(halfedge_handle(_eh, 1)); + + int nf = n_faces(); + // Split the halfedge ( handle will be preserved) split(_eh, _vh); @@ -495,6 +500,22 @@ void TriConnectivity::split_copy(EdgeHandle _eh, VertexHandle _vh) // have been created for(VEIter ve_it = ve_iter(_vh); ve_it.is_valid(); ++ve_it) copy_all_properties(_eh, *ve_it, true); + + for (auto vh : {v0, v1}) + { + // get the halfedge pointing from new vertex to old vertex + HalfedgeHandle h = find_halfedge(_vh, vh); + if (!is_boundary(h)) // for boundaries there are no faces whose properties need to be copied + { + FaceHandle fh0 = face_handle(h); + FaceHandle fh1 = face_handle(opposite_halfedge_handle(prev_halfedge_handle(h))); + if (fh0.idx() >= nf) // is fh0 the new face? + std::swap(fh0, fh1); + + // copy properties from old face to new face + copy_all_properties(fh0, fh1, true); + } + } } }// namespace OpenMesh From 43031ea84f35f5c760352ce56e9e762a0eb1a02f Mon Sep 17 00:00:00 2001 From: schultz Date: Mon, 19 Mar 2018 14:45:17 +0100 Subject: [PATCH 023/118] fixes #50 by setting refcounters to 0 if the property is not present --- src/OpenMesh/Core/Mesh/AttribKernelT.hh | 70 ++++++++++--------------- 1 file changed, 28 insertions(+), 42 deletions(-) diff --git a/src/OpenMesh/Core/Mesh/AttribKernelT.hh b/src/OpenMesh/Core/Mesh/AttribKernelT.hh index ca1e55ef..c0d52a8f 100644 --- a/src/OpenMesh/Core/Mesh/AttribKernelT.hh +++ b/src/OpenMesh/Core/Mesh/AttribKernelT.hh @@ -744,48 +744,34 @@ private: { //mesh has no points? } - if(this->get_property_handle(vertex_normals_, - "v:normals")) - refcount_vnormals_ = 1; - if(this->get_property_handle(vertex_colors_, - "v:colors")) - refcount_vcolors_ = 1; - if(this->get_property_handle(vertex_texcoords1D_, - "v:texcoords1D")) - refcount_vtexcoords1D_ = 1; - if(this->get_property_handle(vertex_texcoords2D_, - "v:texcoords2D")) - refcount_vtexcoords2D_ = 1; - if(this->get_property_handle(vertex_texcoords3D_, - "v:texcoords3D")) - refcount_vtexcoords3D_ = 1; - if(this->get_property_handle(halfedge_texcoords1D_, - "h:texcoords1D")) - refcount_htexcoords1D_ = 1; - if(this->get_property_handle(halfedge_texcoords2D_, - "h:texcoords2D")) - refcount_htexcoords2D_ = 1; - if(this->get_property_handle(halfedge_texcoords3D_, - "h:texcoords3D")) - refcount_htexcoords3D_ = 1; - if(this->get_property_handle(halfedge_normals_, - "h:normals")) - refcount_henormals_ = 1; - if(this->get_property_handle(halfedge_colors_, - "h:colors")) - refcount_hecolors_ = 1; - if(this->get_property_handle(edge_colors_, - "e:colors")) - refcount_ecolors_ = 1; - if(this->get_property_handle(face_normals_, - "f:normals")) - refcount_fnormals_ = 1; - if(this->get_property_handle(face_colors_, - "f:colors")) - refcount_fcolors_ = 1; - if(this->get_property_handle(face_texture_index_, - "f:textureindex")) - refcount_ftextureIndex_ = 1; + refcount_vnormals_ = this->get_property_handle(vertex_normals_, + "v:normals") ? 1 : 0 ; + refcount_vcolors_ = this->get_property_handle(vertex_colors_, + "v:colors") ? 1 : 0 ; + refcount_vtexcoords1D_ = this->get_property_handle(vertex_texcoords1D_, + "v:texcoords1D") ? 1 : 0 ; + refcount_vtexcoords2D_ = this->get_property_handle(vertex_texcoords2D_, + "v:texcoords2D") ? 1 : 0 ; + refcount_vtexcoords3D_ = this->get_property_handle(vertex_texcoords3D_, + "v:texcoords3D") ? 1 : 0 ; + refcount_htexcoords1D_ = this->get_property_handle(halfedge_texcoords1D_, + "h:texcoords1D") ? 1 : 0 ; + refcount_htexcoords2D_ = this->get_property_handle(halfedge_texcoords2D_, + "h:texcoords2D") ? 1 : 0 ; + refcount_htexcoords3D_ = this->get_property_handle(halfedge_texcoords3D_, + "h:texcoords3D") ? 1 : 0 ; + refcount_henormals_ = this->get_property_handle(halfedge_normals_, + "h:normals") ? 1 : 0 ; + refcount_hecolors_ = this->get_property_handle(halfedge_colors_, + "h:colors") ? 1 : 0 ; + refcount_ecolors_ = this->get_property_handle(edge_colors_, + "e:colors") ? 1 : 0 ; + refcount_fnormals_ = this->get_property_handle(face_normals_, + "f:normals") ? 1 : 0 ; + refcount_fcolors_ = this->get_property_handle(face_colors_, + "f:colors") ? 1 : 0 ; + refcount_ftextureIndex_ = this->get_property_handle(face_texture_index_, + "f:textureindex") ? 1 : 0 ; } }; From d32df7f1ba57014dba143e330ab1211f39ad4868 Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Tue, 20 Mar 2018 09:58:27 +0100 Subject: [PATCH 024/118] add some consts --- src/OpenMesh/Core/Mesh/TriConnectivity.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OpenMesh/Core/Mesh/TriConnectivity.cc b/src/OpenMesh/Core/Mesh/TriConnectivity.cc index fc12ac00..fb77f87e 100644 --- a/src/OpenMesh/Core/Mesh/TriConnectivity.cc +++ b/src/OpenMesh/Core/Mesh/TriConnectivity.cc @@ -488,10 +488,10 @@ void TriConnectivity::split(EdgeHandle _eh, VertexHandle _vh) void TriConnectivity::split_copy(EdgeHandle _eh, VertexHandle _vh) { - VertexHandle v0 = to_vertex_handle(halfedge_handle(_eh, 0)); - VertexHandle v1 = to_vertex_handle(halfedge_handle(_eh, 1)); + const VertexHandle v0 = to_vertex_handle(halfedge_handle(_eh, 0)); + const VertexHandle v1 = to_vertex_handle(halfedge_handle(_eh, 1)); - int nf = n_faces(); + const int nf = n_faces(); // Split the halfedge ( handle will be preserved) split(_eh, _vh); @@ -504,7 +504,7 @@ void TriConnectivity::split_copy(EdgeHandle _eh, VertexHandle _vh) for (auto vh : {v0, v1}) { // get the halfedge pointing from new vertex to old vertex - HalfedgeHandle h = find_halfedge(_vh, vh); + const HalfedgeHandle h = find_halfedge(_vh, vh); if (!is_boundary(h)) // for boundaries there are no faces whose properties need to be copied { FaceHandle fh0 = face_handle(h); From ed77e39e8d46a22c471b8b240e5430afe5df3d9f Mon Sep 17 00:00:00 2001 From: Isaak Lim Date: Wed, 21 Mar 2018 15:33:22 +0100 Subject: [PATCH 025/118] remove the python bindings from this project --- CMakeLists.txt | 6 - Doc/changelog.docu | 1 + README.md | 3 + src/Python/Bindings.cc | 152 --- src/Python/Bindings.hh | 48 - src/Python/CMakeLists.txt | 215 ---- src/Python/Circulator.hh | 98 -- src/Python/Decimater.hh | 297 ------ src/Python/Example/CMakeLists.txt | 30 - src/Python/Example/Example.cc | 22 - src/Python/InputOutput.hh | 115 --- src/Python/Iterator.hh | 121 --- src/Python/Mesh.hh | 931 ------------------ src/Python/PropertyManager.hh | 143 --- src/Python/Unittests/test_add_face.py | 334 ------- src/Python/Unittests/test_boundary.py | 86 -- src/Python/Unittests/test_delete_face.py | 530 ---------- src/Python/Unittests/test_property.py | 289 ------ src/Python/Unittests/test_python.py | 71 -- src/Python/Unittests/test_read_write_obj.py | 229 ----- src/Python/Unittests/test_read_write_off.py | 163 --- src/Python/Unittests/test_read_write_om.py | 201 ---- src/Python/Unittests/test_read_write_ply.py | 342 ------- src/Python/Unittests/test_read_write_stl.py | 75 -- src/Python/Unittests/test_split_copy.py | 87 -- ...tor_current_halfedge_handle_replacement.py | 269 ----- .../test_trimesh_circulator_face_edge.py | 50 - .../test_trimesh_circulator_face_face.py | 156 --- .../test_trimesh_circulator_face_halfedge.py | 50 - .../test_trimesh_circulator_face_vertex.py | 48 - .../test_trimesh_circulator_halfedge_loop.py | 131 --- .../test_trimesh_circulator_vertex_edge.py | 55 -- .../test_trimesh_circulator_vertex_face.py | 93 -- ...est_trimesh_circulator_vertex_ihalfedge.py | 80 -- ...est_trimesh_circulator_vertex_ohalfedge.py | 80 -- .../test_trimesh_circulator_vertex_vertex.py | 56 -- src/Python/Unittests/test_trimesh_collapse.py | 516 ---------- .../test_trimesh_garbage_collection.py | 168 ---- .../Unittests/test_trimesh_iterators.py | 396 -------- .../test_trimesh_normal_calculations.py | 103 -- src/Python/Unittests/test_trimesh_others.py | 129 --- src/Python/Unittests/test_vector_type.py | 46 - src/Python/Vector.hh | 193 ---- 43 files changed, 4 insertions(+), 7204 deletions(-) delete mode 100644 src/Python/Bindings.cc delete mode 100644 src/Python/Bindings.hh delete mode 100644 src/Python/CMakeLists.txt delete mode 100644 src/Python/Circulator.hh delete mode 100644 src/Python/Decimater.hh delete mode 100644 src/Python/Example/CMakeLists.txt delete mode 100644 src/Python/Example/Example.cc delete mode 100644 src/Python/InputOutput.hh delete mode 100644 src/Python/Iterator.hh delete mode 100644 src/Python/Mesh.hh delete mode 100644 src/Python/PropertyManager.hh delete mode 100644 src/Python/Unittests/test_add_face.py delete mode 100644 src/Python/Unittests/test_boundary.py delete mode 100644 src/Python/Unittests/test_delete_face.py delete mode 100755 src/Python/Unittests/test_property.py delete mode 100644 src/Python/Unittests/test_python.py delete mode 100644 src/Python/Unittests/test_read_write_obj.py delete mode 100644 src/Python/Unittests/test_read_write_off.py delete mode 100644 src/Python/Unittests/test_read_write_om.py delete mode 100644 src/Python/Unittests/test_read_write_ply.py delete mode 100644 src/Python/Unittests/test_read_write_stl.py delete mode 100644 src/Python/Unittests/test_split_copy.py delete mode 100644 src/Python/Unittests/test_trimesh_circulator_current_halfedge_handle_replacement.py delete mode 100644 src/Python/Unittests/test_trimesh_circulator_face_edge.py delete mode 100644 src/Python/Unittests/test_trimesh_circulator_face_face.py delete mode 100644 src/Python/Unittests/test_trimesh_circulator_face_halfedge.py delete mode 100644 src/Python/Unittests/test_trimesh_circulator_face_vertex.py delete mode 100644 src/Python/Unittests/test_trimesh_circulator_halfedge_loop.py delete mode 100644 src/Python/Unittests/test_trimesh_circulator_vertex_edge.py delete mode 100644 src/Python/Unittests/test_trimesh_circulator_vertex_face.py delete mode 100644 src/Python/Unittests/test_trimesh_circulator_vertex_ihalfedge.py delete mode 100644 src/Python/Unittests/test_trimesh_circulator_vertex_ohalfedge.py delete mode 100644 src/Python/Unittests/test_trimesh_circulator_vertex_vertex.py delete mode 100644 src/Python/Unittests/test_trimesh_collapse.py delete mode 100644 src/Python/Unittests/test_trimesh_garbage_collection.py delete mode 100755 src/Python/Unittests/test_trimesh_iterators.py delete mode 100644 src/Python/Unittests/test_trimesh_normal_calculations.py delete mode 100644 src/Python/Unittests/test_trimesh_others.py delete mode 100644 src/Python/Unittests/test_vector_type.py delete mode 100644 src/Python/Vector.hh diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ff533be..47e75aca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,12 +129,6 @@ endif() add_subdirectory (Doc) -# ======================================================================== -# Include Python interface -# ======================================================================== - -add_subdirectory (src/Python) - # ======================================================================== # Bundle generation (Targets exist, now configure them) # ======================================================================== diff --git a/Doc/changelog.docu b/Doc/changelog.docu index d3021a7a..87d79dc8 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -11,6 +11,7 @@ Breaking changes
    • The minimal standard for C++ has been raised to C++11. Compilers not supporting C++11 or higher are no longer supported
    • +
    • Removed the python bindings from this project. They have migrated to a seperate project.
    Core diff --git a/README.md b/README.md index d8a82b67..657df304 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,9 @@ https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh.git The gitlab site can be found here: https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh +The python bindings can be found here: +https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python + ## Installing Unpack the tar-ball to a suitable place. diff --git a/src/Python/Bindings.cc b/src/Python/Bindings.cc deleted file mode 100644 index 61acd6f4..00000000 --- a/src/Python/Bindings.cc +++ /dev/null @@ -1,152 +0,0 @@ -#include "Python/Bindings.hh" -#include "Python/Vector.hh" -#include "Python/Mesh.hh" -#include "Python/PropertyManager.hh" -#include "Python/InputOutput.hh" -#include "Python/Decimater.hh" - -#include - -namespace OpenMesh { -namespace Python { - -/** - * Expose mesh items to %Python. - */ -void expose_items() { - class_("Vertex"); - class_("Halfedge"); - class_("Edge"); - class_("Face"); -} - -/** - * Expose item and property handles to %Python. - */ -void expose_handles() { - class_("BaseHandle", init >()) - .def("idx", &BaseHandle::idx) - .def("is_valid", &BaseHandle::is_valid) - .def("reset", &BaseHandle::reset) - .def("invalidate", &BaseHandle::invalidate) - .def(self == self) - .def(self != self) - .def(self < self) - ; - - class_ >("VertexHandle", init >()); - class_ >("HalfedgeHandle", init >()); - class_ >("EdgeHandle", init >()); - class_ >("FaceHandle", init >()); - - class_, bases >("BasePropHandle", init >()); - - class_, bases > >("VPropHandle", init >()) - .def(init&>()); - class_, bases > >("HPropHandle", init >()) - .def(init&>()); - class_, bases > >("EPropHandle", init >()) - .def(init&>()); - class_, bases > >("FPropHandle", init >()) - .def(init&>()); - class_, bases > >("MPropHandle", init >()) - .def(init&>()); -} - - -/** - * Expose the StatusBits enum and StatusInfo class to %Python. - */ -void expose_status_bits_and_info() { - using OpenMesh::Attributes::StatusBits; - using OpenMesh::Attributes::StatusInfo; - - enum_("StatusBits") - .value("DELETED", OpenMesh::Attributes::DELETED) - .value("LOCKED", OpenMesh::Attributes::LOCKED) - .value("SELECTED", OpenMesh::Attributes::SELECTED) - .value("HIDDEN", OpenMesh::Attributes::HIDDEN) - .value("FEATURE", OpenMesh::Attributes::FEATURE) - .value("TAGGED", OpenMesh::Attributes::TAGGED) - .value("TAGGED2", OpenMesh::Attributes::TAGGED2) - .value("FIXEDNONMANIFOLD", OpenMesh::Attributes::FIXEDNONMANIFOLD) - .value("UNUSED", OpenMesh::Attributes::UNUSED) - ; - - class_("StatusInfo") - .def("deleted", &StatusInfo::deleted) - .def("set_deleted", &StatusInfo::set_deleted) - .def("locked", &StatusInfo::locked) - .def("set_locked", &StatusInfo::set_locked) - .def("selected", &StatusInfo::selected) - .def("set_selected", &StatusInfo::set_selected) - .def("hidden", &StatusInfo::hidden) - .def("set_hidden", &StatusInfo::set_hidden) - .def("feature", &StatusInfo::feature) - .def("set_feature", &StatusInfo::set_feature) - .def("tagged", &StatusInfo::tagged) - .def("set_tagged", &StatusInfo::set_tagged) - .def("tagged2", &StatusInfo::tagged2) - .def("set_tagged2", &StatusInfo::set_tagged2) - .def("fixed_nonmanifold", &StatusInfo::fixed_nonmanifold) - .def("set_fixed_nonmanifold", &StatusInfo::set_fixed_nonmanifold) - .def("bits", &StatusInfo::bits) - .def("set_bits", &StatusInfo::set_bits) - .def("is_bit_set", &StatusInfo::is_bit_set) - .def("set_bit", &StatusInfo::set_bit) - .def("unset_bit", &StatusInfo::unset_bit) - .def("change_bit", &StatusInfo::change_bit) - ; -} - -BOOST_PYTHON_MODULE(openmesh) { - expose_items(); - expose_handles(); - expose_status_bits_and_info(); - - expose_vec("Vec2f"); - expose_vec("Vec3f"); - expose_vec("Vec4f"); - expose_vec("Vec2d"); - expose_vec("Vec3d"); - expose_vec("Vec4d"); - - expose_mesh("PolyMesh"); - expose_mesh("TriMesh"); - - expose_iterator("VertexIter"); - expose_iterator("HalfedgeIter"); - expose_iterator("EdgeIter"); - expose_iterator("FaceIter"); - - expose_circulator("VertexVertexIter"); - expose_circulator("VertexIHalfedgeIter"); - expose_circulator("VertexOHalfedgeIter"); - expose_circulator("VertexEdgeIter"); - expose_circulator("VertexFaceIter"); - - expose_circulator("FaceVertexIter"); - expose_circulator("FaceHalfedgeIter"); - expose_circulator("FaceEdgeIter"); - expose_circulator("FaceFaceIter"); - - expose_circulator("HalfedgeLoopIter"); - - typedef IteratorWrapperT VertexIterWrapper; - typedef IteratorWrapperT HalfedgeIterWrapper; - typedef IteratorWrapperT EdgeIterWrapper; - typedef IteratorWrapperT FaceIterWrapper; - - expose_property_manager, VertexHandle, VertexIterWrapper>("VPropertyManager"); - expose_property_manager, HalfedgeHandle, HalfedgeIterWrapper>("HPropertyManager"); - expose_property_manager, EdgeHandle, EdgeIterWrapper>("EPropertyManager"); - expose_property_manager, FaceHandle, FaceIterWrapper>("FPropertyManager"); - - expose_io(); - - expose_decimater("PolyMesh"); - expose_decimater("TriMesh"); -} - -} // namespace Python -} // namespace OpenMesh diff --git a/src/Python/Bindings.hh b/src/Python/Bindings.hh deleted file mode 100644 index 0d37cf5c..00000000 --- a/src/Python/Bindings.hh +++ /dev/null @@ -1,48 +0,0 @@ -/** @file */ - -#ifndef OPENMESH_PYTHON_BINDINGS_HH -#define OPENMESH_PYTHON_BINDINGS_HH - -#include -#include -#include -#include - -#include "OpenMesh/Core/IO/MeshIO.hh" -#include "OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh" -#include "OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh" - -using namespace boost::python; - -namespace OpenMesh { - -/** - * This namespace contains classes and functions that are used to expose - * %OpenMesh to %Python. - */ -namespace Python { - -/** - * Return value policy for functions that return references to objects that are - * managed by %OpenMesh. - */ -#define OPENMESH_PYTHON_DEFAULT_POLICY return_value_policy() - -struct MeshTraits : public OpenMesh::DefaultTraits { - /** Use double precision points */ - typedef OpenMesh::Vec3d Point; - - /** Use double precision normals */ - typedef OpenMesh::Vec3d Normal; - - /** Use RGBA colors */ - typedef OpenMesh::Vec4f Color; -}; - -typedef OpenMesh::TriMesh_ArrayKernelT TriMesh; -typedef OpenMesh::PolyMesh_ArrayKernelT PolyMesh; - -} // namespace OpenMesh -} // namespace Python - -#endif diff --git a/src/Python/CMakeLists.txt b/src/Python/CMakeLists.txt deleted file mode 100644 index cafb785b..00000000 --- a/src/Python/CMakeLists.txt +++ /dev/null @@ -1,215 +0,0 @@ -IF(NOT DEFINED OPENMESH_BUILD_PYTHON_BINDINGS) - SET(OPENMESH_BUILD_PYTHON_BINDINGS TRUE CACHE BOOL "Enable or disable building the Python Bindings.") -ENDIF() - -IF(NOT DEFINED OPENMESH_BUILD_PYTHON_UNIT_TESTS) - SET(OPENMESH_BUILD_PYTHON_UNIT_TESTS FALSE CACHE BOOL "Enable or disable building the Python unit tests.") -ENDIF() - -IF(NOT DEFINED OPENMESH_PYTHON_VERSION) - SET(OPENMESH_PYTHON_VERSION "2.7" CACHE STRING "Choose the Python version that is used to build the Python Bindings.") -ENDIF() - -IF(OPENMESH_BUILD_PYTHON_BINDINGS) - # Create log file - SET(PYTHONLOG "${CMAKE_CURRENT_BINARY_DIR}/PythonLog.txt") - FILE(WRITE ${PYTHONLOG} "") - - # Look for the python libs - MESSAGE(STATUS "Looking for PythonLibs") - FIND_PACKAGE(PythonLibs ${OPENMESH_PYTHON_VERSION} QUIET) - - IF(PYTHONLIBS_FOUND) - MESSAGE(STATUS "Looking for PythonLibs -- found") - - # Determine the name of the python component - STRING(REGEX MATCH "^[0-9]+\\.[0-9]+" PYTHON_VERSION_MAJOR_MINOR ${PYTHONLIBS_VERSION_STRING}) - STRING(REGEX REPLACE "\\." "" PYTHON_VERSION_MAJOR_MINOR ${PYTHON_VERSION_MAJOR_MINOR}) - STRING(REGEX MATCH "^[0-9]" PYTHON_VERSION_MAJOR ${PYTHON_VERSION_MAJOR_MINOR}) - - MESSAGE(STATUS "Looking for Boost Python") - - SET(BOOST_PYTHON_COMPONENT_NAMES "python-py${PYTHON_VERSION_MAJOR_MINOR}" "python${PYTHON_VERSION_MAJOR}" "python") - - FOREACH(NAME ${BOOST_PYTHON_COMPONENT_NAMES}) - IF(NOT Boost_FOUND) - FILE(APPEND ${PYTHONLOG} "Looking for component ${NAME}\n") - FIND_PACKAGE(Boost QUIET COMPONENTS ${NAME}) - ENDIF() - ENDFOREACH() - - FILE(APPEND ${PYTHONLOG} "\n") - - IF(Boost_FOUND) - MESSAGE(STATUS "Looking for Boost Python -- found") - MESSAGE(STATUS "Checking the Boost Python configuration") - - SET(CMAKE_TRY_COMPILE_CONFIGURATION "Release") - - TRY_COMPILE( - COMPILE_WORKS - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/Example/ - Example - CMAKE_FLAGS - "-DINCLUDE_DIRECTORIES:STRING=${PYTHON_INCLUDE_DIRS};${Boost_INCLUDE_DIRS}" - "-DLINK_DIRECTORIES:STRING=${Boost_LIBRARY_DIRS}" - "-DLINK_LIBRARIES:STRING=${PYTHON_LIBRARIES};${Boost_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT_TRY_COMPILE - ) - - FILE(APPEND ${PYTHONLOG} "INCLUDE_DIRECTORIES: ${PYTHON_INCLUDE_DIRS};${Boost_INCLUDE_DIRS}\n") - FILE(APPEND ${PYTHONLOG} "LINK_DIRECTORIES: ${Boost_LIBRARY_DIRS}\n") - FILE(APPEND ${PYTHONLOG} "LINK_LIBRARIES: ${PYTHON_LIBRARIES};${Boost_LIBRARIES}\n\n") - FILE(APPEND ${PYTHONLOG} "${OUTPUT_TRY_COMPILE}") - - IF(COMPILE_WORKS) - # Look for the python interpreter to check if the example works - - # strip version string of any characters (e.g. rc1 # '+') than 0-9 and . - STRING(REGEX REPLACE "(rc[0-9]+)|[^ 0-9 | \\.]" "" PYTHONLIBS_VERSION_STRING_STRIPPED ${PYTHONLIBS_VERSION_STRING}) - FIND_PACKAGE(PythonInterp ${PYTHONLIBS_VERSION_STRING_STRIPPED} QUIET) - - IF(PYTHONINTERP_FOUND) - - IF(MSVC) - SET(PYTHON_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_TRY_COMPILE_CONFIGURATION}") - ELSE() - SET(PYTHON_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}") - ENDIF() - - EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c "from example import *; greet(); planet = World()" - WORKING_DIRECTORY ${PYTHON_WORKING_DIR} - RESULT_VARIABLE PYTHON_WORKS - OUTPUT_QUIET - ERROR_QUIET - ) - - IF(PYTHON_WORKS EQUAL 0) - - ### EVERYTHING WORKS ### - - MESSAGE(STATUS "Checking the Boost Python configuration -- done") - - IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND ${Boost_VERSION} VERSION_LESS 105600) - MESSAGE("There are known issues with Clang and Boost Python 1.55 and below.") - MESSAGE("Please consider updating Boost Python.") - ENDIF() - - SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Build/python/) - FILE(MAKE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - - FILE(GLOB SOURCES *.cc *hh) - - INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ../) - LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) - - ADD_LIBRARY(openmesh SHARED ${SOURCES}) - - install(TARGETS openmesh DESTINATION ${ACG_PROJECT_LIBDIR}/python ) - - TARGET_LINK_LIBRARIES( - openmesh - OpenMeshCore - OpenMeshTools - ${Boost_LIBRARIES} - ${PYTHON_LIBRARIES} - ) - - SET_TARGET_PROPERTIES( - openmesh - PROPERTIES - PREFIX "" - DEBUG_POSTFIX "" - RELEASE_POSTFIX "" - ) - - IF(APPLE) - SET_TARGET_PROPERTIES(openmesh PROPERTIES SUFFIX ".so") - IF (NOT (CMAKE_MAJOR_VERSION LESS 3)) - SET_TARGET_PROPERTIES(openmesh PROPERTIES MACOSX_RPATH TRUE) - ENDIF() - ENDIF() - - IF(WIN32) - SET_TARGET_PROPERTIES(openmesh PROPERTIES SUFFIX ".pyd") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") - - SET(OUTPUTS openmesh.exp openmesh.lib openmesh.pyd) - - FOREACH(FILE ${OUTPUTS}) - ADD_CUSTOM_COMMAND( - TARGET openmesh POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${FILE} - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - ) - ENDFOREACH() - ENDIF() - - IF(OPENMESH_BUILD_PYTHON_UNIT_TESTS) - SET(UNITTEST_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Python-Unittests/) - - # Copy unit tests - FILE(GLOB UNITTESTS Unittests/*.py) - FOREACH(TEST ${UNITTESTS}) - FILE(COPY ${TEST} DESTINATION ${UNITTEST_OUTPUT_DIRECTORY}) - ENDFOREACH() - - # Copy test files - FILE(GLOB TESTFILES ${PROJECT_SOURCE_DIR}/src/Unittests/TestFiles/*(.off|.obj|.mtl|.stl|.ply|.om)) - FOREACH(FILE ${TESTFILES}) - FILE(COPY ${FILE} DESTINATION ${UNITTEST_OUTPUT_DIRECTORY}) - ENDFOREACH() - - # Copy library - IF(WIN32) - FOREACH(FILE ${OUTPUTS}) - ADD_CUSTOM_COMMAND( - TARGET openmesh POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${FILE} - ${UNITTEST_OUTPUT_DIRECTORY} - ) - ENDFOREACH() - ELSE() - ADD_CUSTOM_COMMAND( - TARGET openmesh POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_BINARY_DIR}/Build/python/openmesh.so - ${UNITTEST_OUTPUT_DIRECTORY} - ) - ENDIF() - - ADD_TEST( - NAME Python_tests - WORKING_DIRECTORY ${UNITTEST_OUTPUT_DIRECTORY} - COMMAND ${PYTHON_EXECUTABLE} -m unittest discover --verbose - ) - ENDIF() - - ELSE() - MESSAGE("Checking the Boost Python configuration failed!") - MESSAGE("Reason: An error occurred while running a small Boost Python test project.") - MESSAGE("Make sure that your Python and Boost Python libraries match.") - MESSAGE("Skipping Python Bindings.") - ENDIF() - ELSE() - MESSAGE("Checking the Boost Python configuration failed!") - MESSAGE("Reason: Python Interpreter ${PYTHONLIBS_VERSION_STRING} not found.") - MESSAGE("Skipping Python Bindings.") - ENDIF() - ELSE() - MESSAGE("Checking the Boost Python configuration failed!") - MESSAGE("Reason: Building a small Boost Python test project failed.") - MESSAGE("Make sure that your Python and Boost Python libraries match.") - MESSAGE("Skipping Python Bindings.") - ENDIF() - ELSE() - MESSAGE("Boost Python not found! Skipping Python Bindings.") - ENDIF() - ELSE() - MESSAGE("PythonLibs not found! Skipping Python Bindings.") - ENDIF() -ENDIF() diff --git a/src/Python/Circulator.hh b/src/Python/Circulator.hh deleted file mode 100644 index 5a11e4e2..00000000 --- a/src/Python/Circulator.hh +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef OPENMESH_PYTHON_CIRCULATOR_HH -#define OPENMESH_PYTHON_CIRCULATOR_HH - -#include "Python/Bindings.hh" - -namespace OpenMesh { -namespace Python { - -/** - * Wrapper for circulators. - * - * This class template is used to wrap circulators for %Python. It implements - * %Python's iterator protocol (the magic methods \_\_iter\_\_ and - * \_\_next\_\_). - * - * @tparam Circulator A circulator type. - */ -template -class CirculatorWrapperT { - public: - - /** - * Constructor - * - * @param _mesh The mesh that contains the items to iterate over. - * @param _center The handle to the center item. - */ - CirculatorWrapperT(PolyMesh& _mesh, CenterEntityHandle _center) : - circulator_(_mesh, _center) { - } - - /** - * Constructor - * - * @param _mesh The mesh that contains the items to iterate over. - * @param _center The handle to the center item. - */ - CirculatorWrapperT(TriMesh& _mesh, CenterEntityHandle _center) : - circulator_(_mesh, _center) { - } - - /** - * Implementation of %Python's \_\_iter\_\_ magic method. - * - * @return This circulator. - */ - CirculatorWrapperT iter() const { - return *this; - } - - /** - * Implementation of %Python's \_\_next\_\_ magic method. - * - * @return The next item. Raises a %Python StopIteration exception if - * there are no more items. - */ - typename Circulator::value_type next() { - if (circulator_.is_valid()) { - typename Circulator::value_type res = *circulator_; - ++circulator_; - return res; - } - else { - PyErr_SetString(PyExc_StopIteration, "No more data."); - boost::python::throw_error_already_set(); - } - return typename Circulator::value_type(); - } - - private: - Circulator circulator_; -}; - -/** - * Expose a circulator type to %Python. - * - * @tparam Circulator A circulator type. - * - * @param _name The name of the circulator type to be exposed. - * - * @note Circulators are wrapped by CirculatorWrapperT before they are exposed - * to %Python, i.e. they are not exposed directly. This means that circulators - * that are passed from %Python to C++ are instances of CirculatorWrapperT. - */ -template -void expose_circulator(const char *_name) { - class_ >(_name, init()) - .def(init()) - .def("__iter__", &CirculatorWrapperT::iter) - .def("__next__", &CirculatorWrapperT::next) - .def("next", &CirculatorWrapperT::next) - ; -} - -} // namespace OpenMesh -} // namespace Python - -#endif diff --git a/src/Python/Decimater.hh b/src/Python/Decimater.hh deleted file mode 100644 index c0825231..00000000 --- a/src/Python/Decimater.hh +++ /dev/null @@ -1,297 +0,0 @@ -#ifndef OPENMESH_PYTHON_DECIMATER_HH -#define OPENMESH_PYTHON_DECIMATER_HH - -#include "Python/Bindings.hh" -#include "OpenMesh/Tools/Decimater/ModBaseT.hh" -#include "OpenMesh/Tools/Decimater/ModAspectRatioT.hh" -#include "OpenMesh/Tools/Decimater/ModEdgeLengthT.hh" -#include "OpenMesh/Tools/Decimater/ModHausdorffT.hh" -#include "OpenMesh/Tools/Decimater/ModIndependentSetsT.hh" -#include "OpenMesh/Tools/Decimater/ModNormalDeviationT.hh" -#include "OpenMesh/Tools/Decimater/ModNormalFlippingT.hh" -#include "OpenMesh/Tools/Decimater/ModProgMeshT.hh" -#include "OpenMesh/Tools/Decimater/ModQuadricT.hh" -#include "OpenMesh/Tools/Decimater/ModRoundnessT.hh" -#include "OpenMesh/Tools/Decimater/DecimaterT.hh" - -#include - -namespace OpenMesh { -namespace Python { - -#define INIT_MESH_REF init()[with_custodian_and_ward<1,2>()] - -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(decimate_overloads, decimate, 0, 1) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(decimate_to_faces_overloads, decimate_to_faces, 0, 2) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(set_max_err_overloads, set_max_err, 1, 2) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(set_min_roundness_overloads, set_min_roundness, 1, 2) - - -template -void expose_module_handle(const char *_name) { - class_(_name) - .def("is_valid", &Handle::is_valid) - ; -} - -template -list infolist(Module& _self) { - const typename Module::InfoList& infos = _self.infolist(); - list res; - for (size_t i = 0; i < infos.size(); ++i) { - res.append(infos[i]); - } - return res; -} - -template -void expose_decimater(const char *_name) { - - typedef Decimater::ModBaseT ModBase; - typedef Decimater::ModAspectRatioT ModAspectRatio; - typedef Decimater::ModEdgeLengthT ModEdgeLength; - typedef Decimater::ModHausdorffT ModHausdorff; - typedef Decimater::ModIndependentSetsT ModIndependentSets; - typedef Decimater::ModNormalDeviationT ModNormalDeviation; - typedef Decimater::ModNormalFlippingT ModNormalFlipping; - typedef Decimater::ModProgMeshT ModProgMesh; - typedef Decimater::ModQuadricT ModQuadric; - typedef Decimater::ModRoundnessT ModRoundness; - - typedef Decimater::ModHandleT ModAspectRatioHandle; - typedef Decimater::ModHandleT ModEdgeLengthHandle; - typedef Decimater::ModHandleT ModHausdorffHandle; - typedef Decimater::ModHandleT ModIndependentSetsHandle; - typedef Decimater::ModHandleT ModNormalDeviationHandle; - typedef Decimater::ModHandleT ModNormalFlippingHandle; - typedef Decimater::ModHandleT ModProgMeshHandle; - typedef Decimater::ModHandleT ModQuadricHandle; - typedef Decimater::ModHandleT ModRoundnessHandle; - - typedef Decimater::BaseDecimaterT BaseDecimater; - typedef Decimater::DecimaterT Decimater; - - typedef typename ModProgMesh::Info Info; - typedef std::vector InfoList; - - bool (BaseDecimater::*add1)(ModAspectRatioHandle&) = &Decimater::add; - bool (BaseDecimater::*add2)(ModEdgeLengthHandle&) = &Decimater::add; - bool (BaseDecimater::*add3)(ModHausdorffHandle&) = &Decimater::add; - bool (BaseDecimater::*add4)(ModIndependentSetsHandle&) = &Decimater::add; - bool (BaseDecimater::*add5)(ModNormalDeviationHandle&) = &Decimater::add; - bool (BaseDecimater::*add6)(ModNormalFlippingHandle&) = &Decimater::add; - bool (BaseDecimater::*add7)(ModProgMeshHandle&) = &Decimater::add; - bool (BaseDecimater::*add8)(ModQuadricHandle&) = &Decimater::add; - bool (BaseDecimater::*add9)(ModRoundnessHandle&) = &Decimater::add; - - bool (BaseDecimater::*remove1)(ModAspectRatioHandle&) = &Decimater::remove; - bool (BaseDecimater::*remove2)(ModEdgeLengthHandle&) = &Decimater::remove; - bool (BaseDecimater::*remove3)(ModHausdorffHandle&) = &Decimater::remove; - bool (BaseDecimater::*remove4)(ModIndependentSetsHandle&) = &Decimater::remove; - bool (BaseDecimater::*remove5)(ModNormalDeviationHandle&) = &Decimater::remove; - bool (BaseDecimater::*remove6)(ModNormalFlippingHandle&) = &Decimater::remove; - bool (BaseDecimater::*remove7)(ModProgMeshHandle&) = &Decimater::remove; - bool (BaseDecimater::*remove8)(ModQuadricHandle&) = &Decimater::remove; - bool (BaseDecimater::*remove9)(ModRoundnessHandle&) = &Decimater::remove; - - ModAspectRatio& (BaseDecimater::*module1)(ModAspectRatioHandle&) = &Decimater::module; - ModEdgeLength& (BaseDecimater::*module2)(ModEdgeLengthHandle&) = &Decimater::module; - ModHausdorff& (BaseDecimater::*module3)(ModHausdorffHandle&) = &Decimater::module; - ModIndependentSets& (BaseDecimater::*module4)(ModIndependentSetsHandle&) = &Decimater::module; - ModNormalDeviation& (BaseDecimater::*module5)(ModNormalDeviationHandle&) = &Decimater::module; - ModNormalFlipping& (BaseDecimater::*module6)(ModNormalFlippingHandle&) = &Decimater::module; - ModProgMesh& (BaseDecimater::*module7)(ModProgMeshHandle&) = &Decimater::module; - ModQuadric& (BaseDecimater::*module8)(ModQuadricHandle&) = &Decimater::module; - ModRoundness& (BaseDecimater::*module9)(ModRoundnessHandle&) = &Decimater::module; - - // Decimater - // ---------------------------------------- - - char buffer[64]; - snprintf(buffer, sizeof buffer, "%s%s", _name, "Decimater"); - - class_(buffer, INIT_MESH_REF) - .def("decimate", &Decimater::decimate, decimate_overloads()) - .def("decimate_to", &Decimater::decimate_to) - .def("decimate_to_faces", &Decimater::decimate_to_faces, decimate_to_faces_overloads()) - - .def("initialize", &Decimater::initialize) - .def("is_initialized", &Decimater::is_initialized) - - .def("add", add1) - .def("add", add2) - .def("add", add3) - .def("add", add4) - .def("add", add5) - .def("add", add6) - .def("add", add7) - .def("add", add8) - .def("add", add9) - - .def("remove", remove1) - .def("remove", remove2) - .def("remove", remove3) - .def("remove", remove4) - .def("remove", remove5) - .def("remove", remove6) - .def("remove", remove7) - .def("remove", remove8) - .def("remove", remove9) - - .def("module", module1, return_value_policy()) - .def("module", module2, return_value_policy()) - .def("module", module3, return_value_policy()) - .def("module", module4, return_value_policy()) - .def("module", module5, return_value_policy()) - .def("module", module6, return_value_policy()) - .def("module", module7, return_value_policy()) - .def("module", module8, return_value_policy()) - .def("module", module9, return_value_policy()) - ; - - // ModBase - // ---------------------------------------- - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModBase"); - - class_(buffer, no_init) - .def("name", &ModBase::name, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("is_binary", &ModBase::is_binary) - .def("set_binary", &ModBase::set_binary) - .def("initialize", &ModBase::initialize) // TODO VIRTUAL - .def("collapse_priority", &ModBase::collapse_priority) // TODO VIRTUAL - .def("preprocess_collapse", &ModBase::preprocess_collapse) // TODO VIRTUAL - .def("postprocess_collapse", &ModBase::postprocess_collapse) // TODO VIRTUAL - .def("set_error_tolerance_factor", &ModBase::set_error_tolerance_factor) // TODO VIRTUAL - ; - - // ModAspectRatio - // ---------------------------------------- - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModAspectRatio"); - - class_, boost::noncopyable>(buffer, INIT_MESH_REF) - .def("aspect_ratio", &ModAspectRatio::aspect_ratio) - .def("set_aspect_ratio", &ModAspectRatio::set_aspect_ratio) - ; - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModAspectRatioHandle"); - expose_module_handle(buffer); - - // ModEdgeLength - // ---------------------------------------- - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModEdgeLength"); - - class_, boost::noncopyable>(buffer, INIT_MESH_REF) - .def("edge_length", &ModEdgeLength::edge_length) - .def("set_edge_length", &ModEdgeLength::set_edge_length) - ; - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModEdgeLengthHandle"); - expose_module_handle(buffer); - - // ModHausdorff - // ---------------------------------------- - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModHausdorff"); - - class_, boost::noncopyable>(buffer, INIT_MESH_REF) - .def("tolerance", &ModHausdorff::tolerance) - .def("set_tolerance", &ModHausdorff::set_tolerance) - ; - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModHausdorffHandle"); - expose_module_handle(buffer); - - // ModIndependentSets - // ---------------------------------------- - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModIndependentSets"); - - class_, boost::noncopyable>(buffer, INIT_MESH_REF); - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModIndependentSetsHandle"); - expose_module_handle(buffer); - - // ModNormalDeviation - // ---------------------------------------- - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModNormalDeviation"); - - class_, boost::noncopyable>(buffer, INIT_MESH_REF) - .def("normal_deviation", &ModNormalDeviation::normal_deviation) - .def("set_normal_deviation", &ModNormalDeviation::set_normal_deviation) - ; - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModNormalDeviationHandle"); - expose_module_handle(buffer); - - // ModNormalFlipping - // ---------------------------------------- - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModNormalFlipping"); - - class_, boost::noncopyable>(buffer, INIT_MESH_REF) - .def("max_normal_deviation", &ModNormalFlipping::max_normal_deviation) - .def("set_max_normal_deviation", &ModNormalFlipping::set_max_normal_deviation) - ; - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModNormalFlippingHandle"); - expose_module_handle(buffer); - - // ModProgMesh - // ---------------------------------------- - - class_("Info", no_init) - .def_readwrite("v0", &Info::v0) - .def_readwrite("v1", &Info::v1) - .def_readwrite("vl", &Info::vl) - .def_readwrite("vr", &Info::vr) - ; - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModProgMesh"); - - class_, boost::noncopyable>(buffer, INIT_MESH_REF) - .def("pmi", &infolist) - .def("infolist", &infolist) - .def("write", &ModProgMesh::write) - ; - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModProgMeshHandle"); - expose_module_handle(buffer); - - // ModQuadric - // ---------------------------------------- - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModQuadric"); - - class_, boost::noncopyable>(buffer, INIT_MESH_REF) - .def("set_max_err", &ModQuadric::set_max_err, set_max_err_overloads()) - .def("unset_max_err", &ModQuadric::unset_max_err) - .def("max_err", &ModQuadric::max_err) - ; - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModQuadricHandle"); - expose_module_handle(buffer); - - // ModRoundness - // ---------------------------------------- - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModRoundness"); - - class_, boost::noncopyable>(buffer, INIT_MESH_REF) - .def("set_min_angle", &ModRoundness::set_min_angle) - .def("set_min_roundness", &ModRoundness::set_min_roundness, set_min_roundness_overloads()) - .def("unset_min_roundness", &ModRoundness::unset_min_roundness) - .def("roundness", &ModRoundness::roundness) - ; - - snprintf(buffer, sizeof buffer, "%s%s", _name, "ModRoundnessHandle"); - expose_module_handle(buffer); -} - -} // namespace OpenMesh -} // namespace Python - -#endif diff --git a/src/Python/Example/CMakeLists.txt b/src/Python/Example/CMakeLists.txt deleted file mode 100644 index 03c278ef..00000000 --- a/src/Python/Example/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(Example) - -FILE(GLOB SOURCES *.cc *hh) - -INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES}) -LINK_DIRECTORIES(${LINK_DIRECTORIES}) - -ADD_LIBRARY(example SHARED ${SOURCES}) -TARGET_LINK_LIBRARIES(example ${LINK_LIBRARIES}) - -SET_TARGET_PROPERTIES( - example - PROPERTIES - PREFIX "" - DEBUG_POSTFIX "" - RELEASE_POSTFIX "" -) - -IF(APPLE) - SET_TARGET_PROPERTIES(example PROPERTIES SUFFIX ".so") - IF (NOT (CMAKE_MAJOR_VERSION LESS 3)) - SET_TARGET_PROPERTIES(example PROPERTIES MACOSX_RPATH TRUE) - ENDIF() -ENDIF() - -IF(WIN32) - SET_TARGET_PROPERTIES(example PROPERTIES SUFFIX ".pyd") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") -ENDIF() diff --git a/src/Python/Example/Example.cc b/src/Python/Example/Example.cc deleted file mode 100644 index ed1f4b81..00000000 --- a/src/Python/Example/Example.cc +++ /dev/null @@ -1,22 +0,0 @@ -#include - -char const * greet() { - return "hello, world"; -} - -struct World { - void set(std::string msg) { this->msg = msg; } - std::string greet() { return msg; } - std::string msg; -}; - -BOOST_PYTHON_MODULE(example) { - using namespace boost::python; - - def("greet", greet); - - class_("World") - .def("greet", &World::greet) - .def("set", &World::set) - ; -} diff --git a/src/Python/InputOutput.hh b/src/Python/InputOutput.hh deleted file mode 100644 index 054452c9..00000000 --- a/src/Python/InputOutput.hh +++ /dev/null @@ -1,115 +0,0 @@ -#ifndef OPENMESH_PYTHON_INPUTOUTPUT_HH -#define OPENMESH_PYTHON_INPUTOUTPUT_HH - -#include "Python/Bindings.hh" - -namespace OpenMesh { -namespace Python { - -const IO::Options::Flag FLAG_DEFAULT = IO::Options::Default; -const IO::Options::Flag FLAG_BINARY = IO::Options::Binary; -const IO::Options::Flag FLAG_MSB = IO::Options::MSB; -const IO::Options::Flag FLAG_LSB = IO::Options::LSB; -const IO::Options::Flag FLAG_SWAP = IO::Options::Swap; -const IO::Options::Flag FLAG_VERTEXNORMAL = IO::Options::VertexNormal; -const IO::Options::Flag FLAG_VERTEXCOLOR = IO::Options::VertexColor; -const IO::Options::Flag FLAG_VERTEXTEXCOORD = IO::Options::VertexTexCoord; -const IO::Options::Flag FLAG_EDGECOLOR = IO::Options::EdgeColor; -const IO::Options::Flag FLAG_FACENORMAL = IO::Options::FaceNormal; -const IO::Options::Flag FLAG_FACECOLOR = IO::Options::FaceColor; -const IO::Options::Flag FLAG_FACETEXCOORD = IO::Options::FaceTexCoord; -const IO::Options::Flag FLAG_COLORALPHA = IO::Options::ColorAlpha; -const IO::Options::Flag FLAG_COLORFLOAT = IO::Options::ColorFloat; - -BOOST_PYTHON_FUNCTION_OVERLOADS(read_mesh_overloads, IO::read_mesh, 3, 4) -BOOST_PYTHON_FUNCTION_OVERLOADS(write_mesh_overloads, IO::write_mesh, 2, 4) - -/** - * Expose the input/output functions and options to Python. - */ -void expose_io() { - - //====================================================================== - // Functions - //====================================================================== - - bool (*read_mesh_poly )(PolyMesh&, const std::string& ) = &IO::read_mesh; - bool (*read_mesh_poly_options)(PolyMesh&, const std::string&, IO::Options&, bool) = &IO::read_mesh; - bool (*read_mesh_tri )(TriMesh&, const std::string& ) = &IO::read_mesh; - bool (*read_mesh_tri_options )(TriMesh&, const std::string&, IO::Options&, bool) = &IO::read_mesh; - - bool (*write_mesh_poly)(const PolyMesh&, const std::string&, IO::Options, std::streamsize) = &IO::write_mesh; - bool (*write_mesh_tri )(const TriMesh&, const std::string&, IO::Options, std::streamsize) = &IO::write_mesh; - - def("read_mesh", read_mesh_poly); - def("read_mesh", read_mesh_poly_options, read_mesh_overloads()); - def("read_mesh", read_mesh_tri); - def("read_mesh", read_mesh_tri_options, read_mesh_overloads()); - - def("write_mesh", write_mesh_poly, write_mesh_overloads()); - def("write_mesh", write_mesh_tri, write_mesh_overloads()); - - //====================================================================== - // Options - //====================================================================== - - scope scope_options = class_("Options") - .def(init()) - .def("cleanup", &IO::Options::cleanup) - .def("clear", &IO::Options::clear) - .def("is_empty", &IO::Options::is_empty) - .def("check", &IO::Options::check) - .def("is_binary", &IO::Options::is_binary) - .def("vertex_has_normal", &IO::Options::vertex_has_normal) - .def("vertex_has_color", &IO::Options::vertex_has_color) - .def("vertex_has_texcoord", &IO::Options::vertex_has_texcoord) - .def("edge_has_color", &IO::Options::edge_has_color) - .def("face_has_normal", &IO::Options::face_has_normal) - .def("face_has_color", &IO::Options::face_has_color) - .def("face_has_texcoord", &IO::Options::face_has_texcoord) - .def("color_has_alpha", &IO::Options::color_has_alpha) - .def("color_is_float", &IO::Options::color_is_float) - - .def(self == self) - .def(self != self) - .def(self -= IO::Options::Flag()) - .def(self += IO::Options::Flag()) - - .def_readonly("Default", &FLAG_DEFAULT) - .def_readonly("Binary", &FLAG_BINARY) - .def_readonly("MSB", &FLAG_MSB) - .def_readonly("LSB", &FLAG_LSB) - .def_readonly("Swap", &FLAG_SWAP) - .def_readonly("VertexNormal", &FLAG_VERTEXNORMAL) - .def_readonly("VertexColor", &FLAG_VERTEXCOLOR) - .def_readonly("VertexTexCoord", &FLAG_VERTEXTEXCOORD) - .def_readonly("EdgeColor", &FLAG_EDGECOLOR) - .def_readonly("FaceNormal", &FLAG_FACENORMAL) - .def_readonly("FaceColor", &FLAG_FACECOLOR) - .def_readonly("FaceTexCoord", &FLAG_FACETEXCOORD) - .def_readonly("ColorAlpha", &FLAG_COLORALPHA) - .def_readonly("ColorFloat", &FLAG_COLORFLOAT) - ; - - enum_("Flag") - .value("Default", IO::Options::Default) - .value("Binary", IO::Options::Binary) - .value("MSB", IO::Options::MSB) - .value("LSB", IO::Options::LSB) - .value("Swap", IO::Options::Swap) - .value("VertexNormal", IO::Options::VertexNormal) - .value("VertexColor", IO::Options::VertexColor) - .value("VertexTexCoord", IO::Options::VertexTexCoord) - .value("EdgeColor", IO::Options::EdgeColor) - .value("FaceNormal", IO::Options::FaceNormal) - .value("FaceColor", IO::Options::FaceColor) - .value("FaceTexCoord", IO::Options::FaceTexCoord) - .value("ColorAlpha", IO::Options::ColorAlpha) - .value("ColorFloat", IO::Options::ColorFloat) - ; -} - -} // namespace OpenMesh -} // namespace Python - -#endif diff --git a/src/Python/Iterator.hh b/src/Python/Iterator.hh deleted file mode 100644 index 848653ad..00000000 --- a/src/Python/Iterator.hh +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef OPENMESH_PYTHON_ITERATOR_HH -#define OPENMESH_PYTHON_ITERATOR_HH - -#include "Python/Bindings.hh" - -namespace OpenMesh { -namespace Python { - -/** - * Wrapper for mesh item iterators. - * - * This class template is used to wrap mesh item iterators for %Python. It - * implements %Python's iterator protocol (the magic methods \_\_iter\_\_ and - * \_\_next\_\_). - * - * @tparam Iterator An iterator type. - * @tparam n_items A member function pointer that points to the mesh function - * that returns the number of items to iterate over (e.g. n_vertices). - */ -template -class IteratorWrapperT { - public: - - /** - * Constructor - * - * @param _mesh The mesh that contains the items to iterate over. - * @param _hnd The handle of the first item to iterate over. - * @param _skip Specifies if deleted/hidden elements are skipped. - */ - IteratorWrapperT(const PolyMesh& _mesh, typename Iterator::value_type _hnd, bool _skip = false) : - mesh_(_mesh), n_items_(n_items), - iterator_(_mesh, _hnd, _skip), - iterator_end_(_mesh, typename Iterator::value_type(int((_mesh.*n_items)()))) { - } - - /** - * Constructor - * - * @param _mesh The mesh that contains the items to iterate over. - * @param _hnd The handle of the first item to iterate over. - * @param _skip Specifies if deleted/hidden elements are skipped. - */ - IteratorWrapperT(const TriMesh& _mesh, typename Iterator::value_type _hnd, bool _skip = false) : - mesh_(_mesh), n_items_(n_items), - iterator_(_mesh, _hnd, _skip), - iterator_end_(_mesh, typename Iterator::value_type(int((_mesh.*n_items)()))) { - } - - /** - * Implementation of %Python's \_\_iter\_\_ magic method. - * - * @return This iterator. - */ - IteratorWrapperT iter() const { - return *this; - } - - /** - * Implementation of %Python's \_\_next\_\_ magic method. - * - * @return The next item. Raises a %Python StopIteration exception if - * there are no more items. - */ - typename Iterator::value_type next() { - if (iterator_ != iterator_end_) { - typename Iterator::value_type res = *iterator_; - ++iterator_; - return res; - } - else { - PyErr_SetString(PyExc_StopIteration, "No more data."); - boost::python::throw_error_already_set(); - } - return typename Iterator::value_type(); - } - - /** - * Implementation of %Python's \_\_len\_\_ magic method. - * - * @return The number of items in the mesh. - */ - unsigned int len() const { - return (mesh_.*n_items_)(); - } - - private: - const OpenMesh::PolyConnectivity& mesh_; - size_t (OpenMesh::ArrayKernel::*n_items_)() const; - Iterator iterator_; - Iterator iterator_end_; -}; - -/** - * Expose an iterator type to %Python. - * - * @tparam Iterator An iterator type. - * @tparam n_items A member function pointer that points to the mesh function - * that returns the number of items to iterate over (e.g. n_vertices). - * - * @param _name The name of the iterator type to be exposed. - * - * @note %Iterators are wrapped by IteratorWrapperT before they are exposed to - * %Python, i.e. they are not exposed directly. This means that iterators - * that are passed from %Python to C++ are instances of IteratorWrapperT. - */ -template -void expose_iterator(const char *_name) { - class_ >(_name, init >()) - .def(init >()) - .def("__iter__", &IteratorWrapperT::iter) - .def("__next__", &IteratorWrapperT::next) - .def("__len__", &IteratorWrapperT::len) - .def("next", &IteratorWrapperT::next) - ; -} - -} // namespace OpenMesh -} // namespace Python - -#endif diff --git a/src/Python/Mesh.hh b/src/Python/Mesh.hh deleted file mode 100644 index 257bd6cf..00000000 --- a/src/Python/Mesh.hh +++ /dev/null @@ -1,931 +0,0 @@ -#ifndef OPENMESH_PYTHON_MESH_HH -#define OPENMESH_PYTHON_MESH_HH - -#include "Python/Bindings.hh" -#include "Python/Iterator.hh" -#include "Python/Circulator.hh" - -#include - -namespace OpenMesh { -namespace Python { - -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(garbage_collection_overloads, garbage_collection, 0, 3) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(add_property_overloads, add_property, 1, 2) - -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(copy_all_properties_overloads, copy_all_properties, 2, 3) - -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(delete_vertex_overloads, delete_vertex, 1, 2) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(delete_edge_overloads, delete_edge, 1, 2) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(delete_face_overloads, delete_face, 1, 2) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(is_boundary_overloads, is_boundary, 1, 2) - -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(find_feature_edges_overloads, find_feature_edges, 0, 1) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(update_normal_overloads, update_normal, 1, 2) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(update_halfedge_normals_overloads, update_halfedge_normals, 0, 1) -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(calc_halfedge_normal_overloads, calc_halfedge_normal, 1, 2) - -/** - * Set the status of an item. - * - * @tparam Mesh A mesh type. - * @tparam PropHandle A handle type. - * - * @param _self The mesh instance that is to be used. - * @param _h The handle of the item whose status is to be set. - * @param _info The status to be set. - * - * Depending on @ref OPENMESH_PYTHON_DEFAULT_POLICY, Mesh::status may - * return by value instead of reference. This function ensures that the - * status of an item can be changed nonetheless. - */ -template -void set_status(Mesh& _self, IndexHandle _h, const OpenMesh::Attributes::StatusInfo& _info) { - _self.status(_h) = _info; -} - -/** - * Set the value of a property of an item. - * - * @tparam Mesh A mesh type. - * @tparam PropHandle A property handle type. - * @tparam IndexHandle The appropriate handle type. - * - * @param _self The mesh instance that is to be used. - * @param _ph The property that is to be set. - * @param _h The handle of the item whose property is to be set. - * @param _value The value to be set. - * - * Depending on @ref OPENMESH_PYTHON_DEFAULT_POLICY, Mesh::property may - * return by value instead of reference. This function ensures that the - * property value of an item can be changed nonetheless. - */ -template -void set_property(Mesh& _self, PropHandle _ph, IndexHandle _h, const object& _value) { - _self.property(_ph, _h) = _value; -} - -/** - * Set the value of a mesh property. - * - * @tparam Mesh A mesh type. - * @tparam PropHandle A property handle type. - * - * @param _self The mesh instance that is to be used. - * @param _ph The property that is to be set. - * @param _value The value to be set. - * - * Depending on @ref OPENMESH_PYTHON_DEFAULT_POLICY, Mesh::property may - * return by value instead of reference. This function ensures that the - * property value of an item can be changed nonetheless. - */ -template -void set_property(Mesh& _self, PropHandle _ph, const object& _value) { - _self.property(_ph) = _value; -} - -/** - * Thin wrapper for assign_connectivity. - * - * @tparam Mesh A mesh type. - * @tparam OtherMesh A mesh type. - * - * @param _self The mesh instance that is to be used. - * @param _other The mesh from which the connectivity is to be copied. - */ -template -void assign_connectivity(Mesh& _self, const OtherMesh& _other) { - _self.assign_connectivity(_other); -} - -/** - * Get an iterator. - */ -template -IteratorWrapperT get_iterator(Mesh& _self) { - return IteratorWrapperT(_self, typename Iterator::value_type(0)); -} - -/** - * Get a skipping iterator. - */ -template -IteratorWrapperT get_skipping_iterator(Mesh& _self) { - return IteratorWrapperT(_self, typename Iterator::value_type(0), true); -} - -/** - * Get a circulator. - * - * @tparam Mesh A Mesh type. - * @tparam Circulator A circulator type. - * @tparam CenterEntityHandle The appropriate handle type. - * - * @param _self The mesh instance that is to be used. - * @param _handle The handle of the item to circulate around. - */ -template -CirculatorWrapperT get_circulator(Mesh& _self, CenterEntityHandle _handle) { - return CirculatorWrapperT(_self, _handle); -} - -/** - * Garbage collection using lists instead of vectors to keep track of a set of - * handles. - * - * @tparam Mesh A Mesh type. - * - * @param _self The mesh instance that is to be used. - * @param _vh_to_update The list of vertex handles to be updated. - * @param _hh_to_update The list of halfedge handles to be updated. - * @param _fh_to_update The list of face handles to be updated. - * @param _v Remove deleted vertices? - * @param _e Remove deleted edges? - * @param _f Remove deleted faces? - */ -template -void garbage_collection(Mesh& _self, list& _vh_to_update, list& _hh_to_update, list& _fh_to_update, bool _v = true, bool _e = true, bool _f = true) { - // Convert list of handles to vector of pointers - stl_input_iterator vh_begin(_vh_to_update); - stl_input_iterator vh_end; - std::vector vh_vector; - vh_vector.insert(vh_vector.end(), vh_begin, vh_end); - - // Convert list of handles to vector of pointers - stl_input_iterator hh_begin(_hh_to_update); - stl_input_iterator hh_end; - std::vector hh_vector; - hh_vector.insert(hh_vector.end(), hh_begin, hh_end); - - // Convert list of handles to vector of pointers - stl_input_iterator fh_begin(_fh_to_update); - stl_input_iterator fh_end; - std::vector fh_vector; - fh_vector.insert(fh_vector.end(), fh_begin, fh_end); - - // Call garbage collection - _self.garbage_collection(vh_vector, hh_vector, fh_vector, _v, _e, _f); -} - -/** - * Add a new face from a %Python list of vertex handles. - * - * @tparam Mesh A Mesh type. - * - * @param _self The mesh instance that is to be used. - * @param _vhandles The list of vertex handles. - */ -template -FaceHandle add_face(Mesh& _self, const list& _vhandles) { - stl_input_iterator begin(_vhandles); - stl_input_iterator end; - - std::vector vector; - vector.insert(vector.end(), begin, end); - - return _self.add_face(vector); -} - -/** - * This function template is used to expose mesh member functions that are only - * available for a specific type of mesh (i.e. they are available for polygon - * meshes or triangle meshes, but not both). - * - * @tparam Class A boost::python::class type. - * - * @param _class The boost::python::class instance for which the member - * functions are to be defined. - */ -template -void expose_type_specific_functions(Class& _class) { - // See the template specializations below -} - -/** - * Function template specialization for polygon meshes. - */ -template <> -void expose_type_specific_functions(class_& _class) { - typedef PolyMesh::Scalar Scalar; - typedef PolyMesh::Point Point; - typedef PolyMesh::Normal Normal; - typedef PolyMesh::Color Color; - - FaceHandle (PolyMesh::*add_face_3_vh)(VertexHandle, VertexHandle, VertexHandle ) = &PolyMesh::add_face; - FaceHandle (PolyMesh::*add_face_4_vh)(VertexHandle, VertexHandle, VertexHandle, VertexHandle) = &PolyMesh::add_face; - FaceHandle (*add_face_list)(PolyMesh&, const list&) = &add_face; - - void (PolyMesh::*split_eh_pt)(EdgeHandle, const Point&) = &PolyMesh::split; - void (PolyMesh::*split_eh_vh)(EdgeHandle, VertexHandle) = &PolyMesh::split; - void (PolyMesh::*split_fh_pt)(FaceHandle, const Point&) = &PolyMesh::split; - void (PolyMesh::*split_fh_vh)(FaceHandle, VertexHandle) = &PolyMesh::split; - - Normal (PolyMesh::*calc_face_normal_pt)(const Point&, const Point&, const Point&) const = &PolyMesh::calc_face_normal; - - _class - .def("add_face", add_face_3_vh) - .def("add_face", add_face_4_vh) - .def("add_face", add_face_list) - - .def("split", split_eh_pt) - .def("split", split_eh_vh) - .def("split", split_fh_pt) - .def("split", split_fh_vh) - - .def("split_copy", &PolyMesh::split_copy) - - .def("calc_face_normal", calc_face_normal_pt) - - .def("insert_edge", &PolyMesh::insert_edge) - ; -} - -/** - * Function template specialization for triangle meshes. - */ -template <> -void expose_type_specific_functions(class_& _class) { - typedef TriMesh::Scalar Scalar; - typedef TriMesh::Point Point; - typedef TriMesh::Normal Normal; - typedef TriMesh::Color Color; - - FaceHandle (TriMesh::*add_face_3_vh)(VertexHandle, VertexHandle, VertexHandle) = &TriMesh::add_face; - FaceHandle (*add_face_list)(TriMesh&, const list&) = &add_face; - - VertexHandle (TriMesh::*split_eh_pt)(EdgeHandle, const Point&) = &TriMesh::split; - void (TriMesh::*split_eh_vh)(EdgeHandle, VertexHandle) = &TriMesh::split; - VertexHandle (TriMesh::*split_fh_pt)(FaceHandle, const Point&) = &TriMesh::split; - void (TriMesh::*split_fh_vh)(FaceHandle, VertexHandle) = &TriMesh::split; - - VertexHandle (TriMesh::*split_copy_eh_pt)(EdgeHandle, const Point&) = &TriMesh::split_copy; - void (TriMesh::*split_copy_eh_vh)(EdgeHandle, VertexHandle) = &TriMesh::split_copy; - VertexHandle (TriMesh::*split_copy_fh_pt)(FaceHandle, const Point&) = &TriMesh::split_copy; - void (TriMesh::*split_copy_fh_vh)(FaceHandle, VertexHandle) = &TriMesh::split_copy; - - HalfedgeHandle (TriMesh::*vertex_split_pt)(Point, VertexHandle, VertexHandle, VertexHandle) = &TriMesh::vertex_split; - HalfedgeHandle (TriMesh::*vertex_split_vh)(VertexHandle, VertexHandle, VertexHandle, VertexHandle) = &TriMesh::vertex_split; - - _class - .def("add_face", add_face_3_vh) - .def("add_face", add_face_list) - - .def("split", split_eh_pt) - .def("split", split_eh_vh) - .def("split", split_fh_pt) - .def("split", split_fh_vh) - - .def("split_copy", split_copy_eh_pt) - .def("split_copy", split_copy_eh_vh) - .def("split_copy", split_copy_fh_pt) - .def("split_copy", split_copy_fh_vh) - - .def("opposite_vh", &TriMesh::opposite_vh) - .def("opposite_he_opposite_vh", &TriMesh::opposite_he_opposite_vh) - - .def("vertex_split", vertex_split_pt) - .def("vertex_split", vertex_split_vh) - - .def("is_flip_ok", &TriMesh::is_flip_ok) - .def("flip", &TriMesh::flip) - ; -} - - -/** - * Expose a mesh type to %Python. - * - * @tparam Mesh A mesh type. - * - * @param _name The name of the mesh type to be exposed. - */ -template -void expose_mesh(const char *_name) { - using OpenMesh::Attributes::StatusInfo; - - typedef typename Mesh::Scalar Scalar; - typedef typename Mesh::Point Point; - typedef typename Mesh::Normal Normal; - typedef typename Mesh::Color Color; - - //====================================================================== - // KernelT Function Pointers - //====================================================================== - - // Get the i'th item - VertexHandle (Mesh::*vertex_handle_uint )(unsigned int) const = &Mesh::vertex_handle; - HalfedgeHandle (Mesh::*halfedge_handle_uint)(unsigned int) const = &Mesh::halfedge_handle; - EdgeHandle (Mesh::*edge_handle_uint )(unsigned int) const = &Mesh::edge_handle; - FaceHandle (Mesh::*face_handle_uint )(unsigned int) const = &Mesh::face_handle; - - // Delete items - void (Mesh::*garbage_collection_bools)(bool, bool, bool) = &Mesh::garbage_collection; - void (*garbage_collection_lists_bools)(Mesh&, list&, list&, list&, bool, bool, bool) = &garbage_collection; - - // Vertex connectivity - HalfedgeHandle (Mesh::*halfedge_handle_vh)(VertexHandle) const = &Mesh::halfedge_handle; - HalfedgeHandle (Mesh::*halfedge_handle_fh)(FaceHandle ) const = &Mesh::halfedge_handle; - - // Halfedge connectivity - FaceHandle (Mesh::*face_handle_hh )(HalfedgeHandle) const = &Mesh::face_handle; - HalfedgeHandle (Mesh::*prev_halfedge_handle_hh)(HalfedgeHandle) const = &Mesh::prev_halfedge_handle; - EdgeHandle (Mesh::*edge_handle_hh )(HalfedgeHandle) const = &Mesh::edge_handle; - - // Edge connectivity - HalfedgeHandle (Mesh::*halfedge_handle_eh_uint)(EdgeHandle, unsigned int) const = &Mesh::halfedge_handle; - - // Set halfedge - void (Mesh::*set_halfedge_handle_vh_hh)(VertexHandle, HalfedgeHandle) = &Mesh::set_halfedge_handle; - void (Mesh::*set_halfedge_handle_fh_hh)(FaceHandle, HalfedgeHandle ) = &Mesh::set_halfedge_handle; - - // Handle -> Item - const typename Mesh::Vertex& (Mesh::*vertex )(VertexHandle ) const = &Mesh::vertex; - const typename Mesh::Halfedge& (Mesh::*halfedge)(HalfedgeHandle) const = &Mesh::halfedge; - const typename Mesh::Edge& (Mesh::*edge )(EdgeHandle ) const = &Mesh::edge; - const typename Mesh::Face& (Mesh::*face )(FaceHandle ) const = &Mesh::face; - - // Item -> Handle - VertexHandle (Mesh::*handle_v)(const typename Mesh::Vertex& ) const = &Mesh::handle; - HalfedgeHandle (Mesh::*handle_h)(const typename Mesh::Halfedge&) const = &Mesh::handle; - EdgeHandle (Mesh::*handle_e)(const typename Mesh::Edge& ) const = &Mesh::handle; - FaceHandle (Mesh::*handle_f)(const typename Mesh::Face& ) const = &Mesh::handle; - - // Get value of a standard property (point, normal, color) - const typename Mesh::Point& (Mesh::*point_vh )(VertexHandle ) const = &Mesh::point; - const typename Mesh::Normal& (Mesh::*normal_vh)(VertexHandle ) const = &Mesh::normal; - const typename Mesh::Normal& (Mesh::*normal_hh)(HalfedgeHandle) const = &Mesh::normal; - const typename Mesh::Normal& (Mesh::*normal_fh)(FaceHandle ) const = &Mesh::normal; - const typename Mesh::Color& (Mesh::*color_vh )(VertexHandle ) const = &Mesh::color; - const typename Mesh::Color& (Mesh::*color_hh )(HalfedgeHandle) const = &Mesh::color; - const typename Mesh::Color& (Mesh::*color_eh )(EdgeHandle ) const = &Mesh::color; - const typename Mesh::Color& (Mesh::*color_fh )(FaceHandle ) const = &Mesh::color; - - // Get value of a standard property (texture coordinate) - const typename Mesh::TexCoord1D& (Mesh::*texcoord1D_vh)(VertexHandle ) const = &Mesh::texcoord1D; - const typename Mesh::TexCoord1D& (Mesh::*texcoord1D_hh)(HalfedgeHandle) const = &Mesh::texcoord1D; - const typename Mesh::TexCoord2D& (Mesh::*texcoord2D_vh)(VertexHandle ) const = &Mesh::texcoord2D; - const typename Mesh::TexCoord2D& (Mesh::*texcoord2D_hh)(HalfedgeHandle) const = &Mesh::texcoord2D; - const typename Mesh::TexCoord3D& (Mesh::*texcoord3D_vh)(VertexHandle ) const = &Mesh::texcoord3D; - const typename Mesh::TexCoord3D& (Mesh::*texcoord3D_hh)(HalfedgeHandle) const = &Mesh::texcoord3D; - - // Get value of a standard property (status) - const StatusInfo& (Mesh::*status_vh)(VertexHandle ) const = &Mesh::status; - const StatusInfo& (Mesh::*status_hh)(HalfedgeHandle) const = &Mesh::status; - const StatusInfo& (Mesh::*status_eh)(EdgeHandle ) const = &Mesh::status; - const StatusInfo& (Mesh::*status_fh)(FaceHandle ) const = &Mesh::status; - - // Set value of a standard property (point, normal, color) - void (Mesh::*set_normal_vh)(VertexHandle, const typename Mesh::Normal&) = &Mesh::set_normal; - void (Mesh::*set_normal_hh)(HalfedgeHandle, const typename Mesh::Normal&) = &Mesh::set_normal; - void (Mesh::*set_normal_fh)(FaceHandle, const typename Mesh::Normal&) = &Mesh::set_normal; - void (Mesh::*set_color_vh )(VertexHandle, const typename Mesh::Color& ) = &Mesh::set_color; - void (Mesh::*set_color_hh )(HalfedgeHandle, const typename Mesh::Color& ) = &Mesh::set_color; - void (Mesh::*set_color_eh )(EdgeHandle, const typename Mesh::Color& ) = &Mesh::set_color; - void (Mesh::*set_color_fh )(FaceHandle, const typename Mesh::Color& ) = &Mesh::set_color; - - // Set value of a standard property (texture coordinate) - void (Mesh::*set_texcoord1D_vh)(VertexHandle, const typename Mesh::TexCoord1D&) = &Mesh::set_texcoord1D; - void (Mesh::*set_texcoord1D_hh)(HalfedgeHandle, const typename Mesh::TexCoord1D&) = &Mesh::set_texcoord1D; - void (Mesh::*set_texcoord2D_vh)(VertexHandle, const typename Mesh::TexCoord2D&) = &Mesh::set_texcoord2D; - void (Mesh::*set_texcoord2D_hh)(HalfedgeHandle, const typename Mesh::TexCoord2D&) = &Mesh::set_texcoord2D; - void (Mesh::*set_texcoord3D_vh)(VertexHandle, const typename Mesh::TexCoord3D&) = &Mesh::set_texcoord3D; - void (Mesh::*set_texcoord3D_hh)(HalfedgeHandle, const typename Mesh::TexCoord3D&) = &Mesh::set_texcoord3D; - - // Set value of a standard property (status) - void (*set_status_vh)(Mesh&, VertexHandle, const StatusInfo&) = &set_status; - void (*set_status_hh)(Mesh&, HalfedgeHandle, const StatusInfo&) = &set_status; - void (*set_status_eh)(Mesh&, EdgeHandle, const StatusInfo&) = &set_status; - void (*set_status_fh)(Mesh&, FaceHandle, const StatusInfo&) = &set_status; - - // Property management - add property - void (Mesh::*add_property_vph)(VPropHandleT&, const std::string&) = &Mesh::add_property; - void (Mesh::*add_property_eph)(EPropHandleT&, const std::string&) = &Mesh::add_property; - void (Mesh::*add_property_hph)(HPropHandleT&, const std::string&) = &Mesh::add_property; - void (Mesh::*add_property_fph)(FPropHandleT&, const std::string&) = &Mesh::add_property; - void (Mesh::*add_property_mph)(MPropHandleT&, const std::string&) = &Mesh::add_property; - - // Property management - remove property - void (Mesh::*remove_property_vph)(VPropHandleT&) = &Mesh::remove_property; - void (Mesh::*remove_property_eph)(EPropHandleT&) = &Mesh::remove_property; - void (Mesh::*remove_property_hph)(HPropHandleT&) = &Mesh::remove_property; - void (Mesh::*remove_property_fph)(FPropHandleT&) = &Mesh::remove_property; - void (Mesh::*remove_property_mph)(MPropHandleT&) = &Mesh::remove_property; - - // Property management - get property by name - bool (Mesh::*get_property_handle_vph)(VPropHandleT&, const std::string&) const = &Mesh::get_property_handle; - bool (Mesh::*get_property_handle_eph)(EPropHandleT&, const std::string&) const = &Mesh::get_property_handle; - bool (Mesh::*get_property_handle_hph)(HPropHandleT&, const std::string&) const = &Mesh::get_property_handle; - bool (Mesh::*get_property_handle_fph)(FPropHandleT&, const std::string&) const = &Mesh::get_property_handle; - bool (Mesh::*get_property_handle_mph)(MPropHandleT&, const std::string&) const = &Mesh::get_property_handle; - - // Property management - get property value for an item - const object& (Mesh::*property_vertex )(VPropHandleT, VertexHandle ) const = &Mesh::property; - const object& (Mesh::*property_edge )(EPropHandleT, EdgeHandle ) const = &Mesh::property; - const object& (Mesh::*property_halfedge)(HPropHandleT, HalfedgeHandle) const = &Mesh::property; - const object& (Mesh::*property_face )(FPropHandleT, FaceHandle ) const = &Mesh::property; - const object& (Mesh::*property_mesh )(MPropHandleT ) const = &Mesh::property; - - // Property management - set property value for an item - void (*set_property_vertex )(Mesh&, VPropHandleT, VertexHandle, const object&) = &set_property; - void (*set_property_edge )(Mesh&, EPropHandleT, EdgeHandle, const object&) = &set_property; - void (*set_property_halfedge)(Mesh&, HPropHandleT, HalfedgeHandle, const object&) = &set_property; - void (*set_property_face )(Mesh&, FPropHandleT, FaceHandle, const object&) = &set_property; - void (*set_property_mesh )(Mesh&, MPropHandleT, const object&) = &set_property; - - // Low-level adding new items - VertexHandle (Mesh::*new_vertex_void )(void ) = &Mesh::new_vertex; - VertexHandle (Mesh::*new_vertex_point)(const typename Mesh::Point& ) = &Mesh::new_vertex; - FaceHandle (Mesh::*new_face_void )(void ) = &Mesh::new_face; - FaceHandle (Mesh::*new_face_face )(const typename Mesh::Face& ) = &Mesh::new_face; - - // Kernel item iterators - IteratorWrapperT (*vertices )(Mesh&) = &get_iterator; - IteratorWrapperT (*halfedges)(Mesh&) = &get_iterator; - IteratorWrapperT (*edges )(Mesh&) = &get_iterator; - IteratorWrapperT (*faces )(Mesh&) = &get_iterator; - - IteratorWrapperT (*svertices )(Mesh&) = &get_skipping_iterator; - IteratorWrapperT (*shalfedges)(Mesh&) = &get_skipping_iterator; - IteratorWrapperT (*sedges )(Mesh&) = &get_skipping_iterator; - IteratorWrapperT (*sfaces )(Mesh&) = &get_skipping_iterator; - - //====================================================================== - // BaseKernel Function Pointers - //====================================================================== - - // Copy property - void (Mesh::*copy_property_vprop)(VPropHandleT&, VertexHandle, VertexHandle ) = &Mesh::copy_property; - void (Mesh::*copy_property_hprop)(HPropHandleT, HalfedgeHandle, HalfedgeHandle) = &Mesh::copy_property; - void (Mesh::*copy_property_eprop)(EPropHandleT, EdgeHandle, EdgeHandle ) = &Mesh::copy_property; - void (Mesh::*copy_property_fprop)(FPropHandleT, FaceHandle, FaceHandle ) = &Mesh::copy_property; - - // Copy all properties - void (Mesh::*copy_all_properties_vh_vh_bool)(VertexHandle, VertexHandle, bool) = &Mesh::copy_all_properties; - void (Mesh::*copy_all_properties_hh_hh_bool)(HalfedgeHandle, HalfedgeHandle, bool) = &Mesh::copy_all_properties; - void (Mesh::*copy_all_properties_eh_eh_bool)(EdgeHandle, EdgeHandle, bool) = &Mesh::copy_all_properties; - void (Mesh::*copy_all_properties_fh_fh_bool)(FaceHandle, FaceHandle, bool) = &Mesh::copy_all_properties; - - //====================================================================== - // PolyConnectivity Function Pointers - //====================================================================== - - // Assign connectivity - void (*assign_connectivity_poly)(Mesh&, const PolyMesh&) = &assign_connectivity; - void (*assign_connectivity_tri )(Mesh&, const TriMesh& ) = &assign_connectivity; - - // Vertex and face valence - unsigned int (Mesh::*valence_vh)(VertexHandle) const = &Mesh::valence; - unsigned int (Mesh::*valence_fh)(FaceHandle ) const = &Mesh::valence; - - // Triangulate face or mesh - void (Mesh::*triangulate_fh )(FaceHandle) = &Mesh::triangulate; - void (Mesh::*triangulate_void)( ) = &Mesh::triangulate; - - // Deleting mesh items and other connectivity/topology modifications - void (Mesh::*delete_vertex)(VertexHandle, bool) = &Mesh::delete_vertex; - void (Mesh::*delete_edge )(EdgeHandle, bool) = &Mesh::delete_edge; - void (Mesh::*delete_face )(FaceHandle, bool) = &Mesh::delete_face; - - // Vertex and Face circulators - CirculatorWrapperT (*vv )(Mesh&, VertexHandle ) = &get_circulator; - CirculatorWrapperT (*vih)(Mesh&, VertexHandle ) = &get_circulator; - CirculatorWrapperT (*voh)(Mesh&, VertexHandle ) = &get_circulator; - CirculatorWrapperT (*ve )(Mesh&, VertexHandle ) = &get_circulator; - CirculatorWrapperT (*vf )(Mesh&, VertexHandle ) = &get_circulator; - CirculatorWrapperT (*fv )(Mesh&, FaceHandle ) = &get_circulator; - CirculatorWrapperT (*fh )(Mesh&, FaceHandle ) = &get_circulator; - CirculatorWrapperT (*fe )(Mesh&, FaceHandle ) = &get_circulator; - CirculatorWrapperT (*ff )(Mesh&, FaceHandle ) = &get_circulator; - CirculatorWrapperT (*hl )(Mesh&, HalfedgeHandle) = &get_circulator; - - // Boundary and manifold tests - bool (Mesh::*is_boundary_hh)(HalfedgeHandle ) const = &Mesh::is_boundary; - bool (Mesh::*is_boundary_eh)(EdgeHandle ) const = &Mesh::is_boundary; - bool (Mesh::*is_boundary_vh)(VertexHandle ) const = &Mesh::is_boundary; - bool (Mesh::*is_boundary_fh)(FaceHandle, bool) const = &Mesh::is_boundary; - - // Generic handle derefertiation - const typename Mesh::Vertex& (Mesh::*deref_vh)(VertexHandle ) const = &Mesh::deref; - const typename Mesh::Halfedge& (Mesh::*deref_hh)(HalfedgeHandle) const = &Mesh::deref; - const typename Mesh::Edge& (Mesh::*deref_eh)(EdgeHandle ) const = &Mesh::deref; - const typename Mesh::Face& (Mesh::*deref_fh)(FaceHandle ) const = &Mesh::deref; - - //====================================================================== - // PolyMeshT Function Pointers - //====================================================================== - - void (Mesh::*calc_edge_vector_eh_normal)(EdgeHandle, Normal&) const = &Mesh::calc_edge_vector; - void (Mesh::*calc_edge_vector_hh_normal)(HalfedgeHandle, Normal&) const = &Mesh::calc_edge_vector; - - Normal (Mesh::*calc_edge_vector_eh)(EdgeHandle ) const = &Mesh::calc_edge_vector; - Normal (Mesh::*calc_edge_vector_hh)(HalfedgeHandle) const = &Mesh::calc_edge_vector; - - Scalar (Mesh::*calc_edge_length_eh)(EdgeHandle ) const = &Mesh::calc_edge_length; - Scalar (Mesh::*calc_edge_length_hh)(HalfedgeHandle) const = &Mesh::calc_edge_length; - - Scalar (Mesh::*calc_edge_sqr_length_eh)(EdgeHandle ) const = &Mesh::calc_edge_sqr_length; - Scalar (Mesh::*calc_edge_sqr_length_hh)(HalfedgeHandle) const = &Mesh::calc_edge_sqr_length; - - Scalar (Mesh::*calc_dihedral_angle_fast_hh)(HalfedgeHandle) const = &Mesh::calc_dihedral_angle_fast; - Scalar (Mesh::*calc_dihedral_angle_fast_eh)(EdgeHandle ) const = &Mesh::calc_dihedral_angle_fast; - - Scalar (Mesh::*calc_dihedral_angle_hh)(HalfedgeHandle) const = &Mesh::calc_dihedral_angle; - Scalar (Mesh::*calc_dihedral_angle_eh)(EdgeHandle ) const = &Mesh::calc_dihedral_angle; - - unsigned int (Mesh::*find_feature_edges)(Scalar) = &Mesh::find_feature_edges; - - void (Mesh::*split_fh_vh)(FaceHandle, VertexHandle) = &Mesh::split; - void (Mesh::*split_eh_vh)(EdgeHandle, VertexHandle) = &Mesh::split; - - void (Mesh::*update_normal_fh)(FaceHandle ) = &Mesh::update_normal; - void (Mesh::*update_normal_hh)(HalfedgeHandle, double) = &Mesh::update_normal; - void (Mesh::*update_normal_vh)(VertexHandle ) = &Mesh::update_normal; - - void (Mesh::*update_halfedge_normals)(double) = &Mesh::update_halfedge_normals; - - Normal (Mesh::*calc_face_normal )(FaceHandle ) const = &Mesh::calc_face_normal; - Normal (Mesh::*calc_halfedge_normal)(HalfedgeHandle, double) const = &Mesh::calc_halfedge_normal; - - void (Mesh::*calc_face_centroid_fh_point)(FaceHandle, Point&) const = &Mesh::calc_face_centroid; - Point (Mesh::*calc_face_centroid_fh )(FaceHandle ) const = &Mesh::calc_face_centroid; - - //====================================================================== - // Mesh Type - //====================================================================== - - class_ class_mesh(_name); - - class_mesh - - //====================================================================== - // KernelT - //====================================================================== - - .def("reserve", &Mesh::reserve) - - .def("vertex", vertex, return_value_policy()) - .def("halfedge", halfedge, return_value_policy()) - .def("edge", edge, return_value_policy()) - .def("face", face, return_value_policy()) - - .def("handle", handle_v) - .def("handle", handle_h) - .def("handle", handle_e) - .def("handle", handle_f) - - .def("vertex_handle", vertex_handle_uint) - .def("halfedge_handle", halfedge_handle_uint) - .def("edge_handle", edge_handle_uint) - .def("face_handle", face_handle_uint) - - .def("clear", &Mesh::clear) - .def("clean", &Mesh::clean) - .def("garbage_collection", garbage_collection_bools, garbage_collection_overloads()) - .def("garbage_collection", garbage_collection_lists_bools) - - .def("n_vertices", &Mesh::n_vertices) - .def("n_halfedges", &Mesh::n_halfedges) - .def("n_edges", &Mesh::n_edges) - .def("n_faces", &Mesh::n_faces) - .def("vertices_empty", &Mesh::vertices_empty) - .def("halfedges_empty", &Mesh::halfedges_empty) - .def("edges_empty", &Mesh::edges_empty) - .def("faces_empty", &Mesh::faces_empty) - - .def("halfedge_handle", halfedge_handle_vh) - .def("set_halfedge_handle", set_halfedge_handle_vh_hh) - - .def("to_vertex_handle", &Mesh::to_vertex_handle) - .def("from_vertex_handle", &Mesh::from_vertex_handle) - .def("set_vertex_handle", &Mesh::set_vertex_handle) - .def("face_handle", face_handle_hh) - .def("set_face_handle", &Mesh::set_face_handle) - .def("next_halfedge_handle", &Mesh::next_halfedge_handle) - .def("set_next_halfedge_handle", &Mesh::set_next_halfedge_handle) - .def("prev_halfedge_handle", prev_halfedge_handle_hh) - .def("opposite_halfedge_handle", &Mesh::opposite_halfedge_handle) - .def("ccw_rotated_halfedge_handle", &Mesh::ccw_rotated_halfedge_handle) - .def("cw_rotated_halfedge_handle", &Mesh::cw_rotated_halfedge_handle) - .def("edge_handle", edge_handle_hh) - - .def("halfedge_handle", halfedge_handle_eh_uint) - - .def("halfedge_handle", halfedge_handle_fh) - .def("set_halfedge_handle", set_halfedge_handle_fh_hh) - - .def("point", point_vh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_point", &Mesh::set_point) - .def("normal", normal_vh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_normal", set_normal_vh) - .def("normal", normal_hh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_normal", set_normal_hh) - .def("color", color_vh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_color", set_color_vh) - .def("texcoord1D", texcoord1D_vh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_texcoord1D", set_texcoord1D_vh) - .def("texcoord2D", texcoord2D_vh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_texcoord2D", set_texcoord2D_vh) - .def("texcoord3D", texcoord3D_vh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_texcoord3D", set_texcoord3D_vh) - .def("texcoord1D", texcoord1D_hh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_texcoord1D", set_texcoord1D_hh) - .def("texcoord2D", texcoord2D_hh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_texcoord2D", set_texcoord2D_hh) - .def("texcoord3D", texcoord3D_hh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_texcoord3D", set_texcoord3D_hh) - .def("status", status_vh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_status", set_status_vh) - .def("status", status_hh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_status", set_status_hh) - .def("color", color_hh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_color", set_color_hh) - .def("color", color_eh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_color", set_color_eh) - .def("status", status_eh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_status", set_status_eh) - .def("normal", normal_fh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_normal", set_normal_fh) - .def("color", color_fh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_color", set_color_fh) - .def("status", status_fh, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("set_status", set_status_fh) - - .def("request_vertex_normals", &Mesh::request_vertex_normals) - .def("request_vertex_colors", &Mesh::request_vertex_colors) - .def("request_vertex_texcoords1D", &Mesh::request_vertex_texcoords1D) - .def("request_vertex_texcoords2D", &Mesh::request_vertex_texcoords2D) - .def("request_vertex_texcoords3D", &Mesh::request_vertex_texcoords3D) - .def("request_vertex_status", &Mesh::request_vertex_status) - .def("request_halfedge_status", &Mesh::request_halfedge_status) - .def("request_halfedge_normals", &Mesh::request_halfedge_normals) - .def("request_halfedge_colors", &Mesh::request_halfedge_colors) - .def("request_halfedge_texcoords1D", &Mesh::request_halfedge_texcoords1D) - .def("request_halfedge_texcoords2D", &Mesh::request_halfedge_texcoords2D) - .def("request_halfedge_texcoords3D", &Mesh::request_halfedge_texcoords3D) - .def("request_edge_status", &Mesh::request_edge_status) - .def("request_edge_colors", &Mesh::request_edge_colors) - .def("request_face_normals", &Mesh::request_face_normals) - .def("request_face_colors", &Mesh::request_face_colors) - .def("request_face_status", &Mesh::request_face_status) - .def("request_face_texture_index", &Mesh::request_face_texture_index) - - .def("release_vertex_normals", &Mesh::release_vertex_normals) - .def("release_vertex_colors", &Mesh::release_vertex_colors) - .def("release_vertex_texcoords1D", &Mesh::release_vertex_texcoords1D) - .def("release_vertex_texcoords2D", &Mesh::release_vertex_texcoords2D) - .def("release_vertex_texcoords3D", &Mesh::release_vertex_texcoords3D) - .def("release_vertex_status", &Mesh::release_vertex_status) - .def("release_halfedge_status", &Mesh::release_halfedge_status) - .def("release_halfedge_normals", &Mesh::release_halfedge_normals) - .def("release_halfedge_colors", &Mesh::release_halfedge_colors) - .def("release_halfedge_texcoords1D", &Mesh::release_halfedge_texcoords1D) - .def("release_halfedge_texcoords2D", &Mesh::release_halfedge_texcoords2D) - .def("release_halfedge_texcoords3D", &Mesh::release_halfedge_texcoords3D) - .def("release_edge_status", &Mesh::release_edge_status) - .def("release_edge_colors", &Mesh::release_edge_colors) - .def("release_face_normals", &Mesh::release_face_normals) - .def("release_face_colors", &Mesh::release_face_colors) - .def("release_face_status", &Mesh::release_face_status) - .def("release_face_texture_index", &Mesh::release_face_texture_index) - - .def("has_vertex_normals", &Mesh::has_vertex_normals) - .def("has_vertex_colors", &Mesh::has_vertex_colors) - .def("has_vertex_texcoords1D", &Mesh::has_vertex_texcoords1D) - .def("has_vertex_texcoords2D", &Mesh::has_vertex_texcoords2D) - .def("has_vertex_texcoords3D", &Mesh::has_vertex_texcoords3D) - .def("has_vertex_status", &Mesh::has_vertex_status) - .def("has_halfedge_status", &Mesh::has_halfedge_status) - .def("has_halfedge_normals", &Mesh::has_halfedge_normals) - .def("has_halfedge_colors", &Mesh::has_halfedge_colors) - .def("has_halfedge_texcoords1D", &Mesh::has_halfedge_texcoords1D) - .def("has_halfedge_texcoords2D", &Mesh::has_halfedge_texcoords2D) - .def("has_halfedge_texcoords3D", &Mesh::has_halfedge_texcoords3D) - .def("has_edge_status", &Mesh::has_edge_status) - .def("has_edge_colors", &Mesh::has_edge_colors) - .def("has_face_normals", &Mesh::has_face_normals) - .def("has_face_colors", &Mesh::has_face_colors) - .def("has_face_status", &Mesh::has_face_status) - .def("has_face_texture_index", &Mesh::has_face_texture_index) - - .def("add_property", add_property_vph, add_property_overloads()) - .def("add_property", add_property_eph, add_property_overloads()) - .def("add_property", add_property_hph, add_property_overloads()) - .def("add_property", add_property_fph, add_property_overloads()) - .def("add_property", add_property_mph, add_property_overloads()) - - .def("remove_property", remove_property_vph) - .def("remove_property", remove_property_eph) - .def("remove_property", remove_property_hph) - .def("remove_property", remove_property_fph) - .def("remove_property", remove_property_mph) - - .def("get_property_handle", get_property_handle_vph) - .def("get_property_handle", get_property_handle_eph) - .def("get_property_handle", get_property_handle_hph) - .def("get_property_handle", get_property_handle_fph) - .def("get_property_handle", get_property_handle_mph) - - .def("property", property_vertex, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("property", property_edge, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("property", property_halfedge, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("property", property_face, OPENMESH_PYTHON_DEFAULT_POLICY) - .def("property", property_mesh, OPENMESH_PYTHON_DEFAULT_POLICY) - - .def("set_property", set_property_vertex) - .def("set_property", set_property_edge) - .def("set_property", set_property_halfedge) - .def("set_property", set_property_face) - .def("set_property", set_property_mesh) - - .def("new_vertex", new_vertex_void) - .def("new_vertex", new_vertex_point) - .def("new_edge", &Mesh::new_edge) - .def("new_face", new_face_void) - .def("new_face", new_face_face) - - .def("vertices", vertices) - .def("halfedges", halfedges) - .def("edges", edges) - .def("faces", faces) - - .def("svertices", svertices) - .def("shalfedges", shalfedges) - .def("sedges", sedges) - .def("sfaces", sfaces) - - //====================================================================== - // BaseKernel - //====================================================================== - - .def("copy_property", copy_property_vprop) - .def("copy_property", copy_property_hprop) - .def("copy_property", copy_property_eprop) - .def("copy_property", copy_property_fprop) - - .def("copy_all_properties", copy_all_properties_vh_vh_bool, copy_all_properties_overloads()) - .def("copy_all_properties", copy_all_properties_hh_hh_bool, copy_all_properties_overloads()) - .def("copy_all_properties", copy_all_properties_eh_eh_bool, copy_all_properties_overloads()) - .def("copy_all_properties", copy_all_properties_fh_fh_bool, copy_all_properties_overloads()) - - //====================================================================== - // PolyConnectivity - //====================================================================== - - .def("assign_connectivity", assign_connectivity_poly) - .def("assign_connectivity", assign_connectivity_tri) - - .def("opposite_face_handle", &Mesh::opposite_face_handle) - .def("adjust_outgoing_halfedge", &Mesh::adjust_outgoing_halfedge) - .def("find_halfedge", &Mesh::find_halfedge) - .def("valence", valence_vh) - .def("valence", valence_fh) - .def("collapse", &Mesh::collapse) - .def("is_simple_link", &Mesh::is_simple_link) - .def("is_simply_connected", &Mesh::is_simply_connected) - .def("remove_edge", &Mesh::remove_edge) - .def("reinsert_edge", &Mesh::reinsert_edge) - .def("triangulate", triangulate_fh) - .def("triangulate", triangulate_void) - .def("split_edge", &Mesh::split_edge) - .def("split_edge_copy", &Mesh::split_edge_copy) - - .def("add_vertex", &Mesh::add_vertex) - - .def("is_collapse_ok", &Mesh::is_collapse_ok) - .def("delete_vertex", delete_vertex, delete_vertex_overloads()) - .def("delete_edge", delete_edge, delete_edge_overloads()) - .def("delete_face", delete_face, delete_face_overloads()) - - .def("vv", vv) - .def("vih", vih) - .def("voh", voh) - .def("ve", ve) - .def("vf", vf) - - .def("fv", fv) - .def("fh", fh) - .def("fe", fe) - .def("ff", ff) - - .def("hl", hl) - - .def("is_boundary", is_boundary_hh) - .def("is_boundary", is_boundary_eh) - .def("is_boundary", is_boundary_vh) - .def("is_boundary", is_boundary_fh, is_boundary_overloads()) - .def("is_manifold", &Mesh::is_manifold) - - .def("deref", deref_vh, return_value_policy()) - .def("deref", deref_hh, return_value_policy()) - .def("deref", deref_eh, return_value_policy()) - .def("deref", deref_fh, return_value_policy()) - - .def("is_triangles", &Mesh::is_triangles) - .staticmethod("is_triangles") - - .def_readonly("InvalidVertexHandle", &Mesh::InvalidVertexHandle) - .def_readonly("InvalidHalfedgeHandle", &Mesh::InvalidHalfedgeHandle) - .def_readonly("InvalidEdgeHandle", &Mesh::InvalidEdgeHandle) - .def_readonly("InvalidFaceHandle", &Mesh::InvalidFaceHandle) - - //====================================================================== - // PolyMeshT - //====================================================================== - - .def("add_vertex", &Mesh::add_vertex) - - .def("calc_edge_vector", calc_edge_vector_eh_normal) - .def("calc_edge_vector", calc_edge_vector_eh) - .def("calc_edge_vector", calc_edge_vector_hh_normal) - .def("calc_edge_vector", calc_edge_vector_hh) - - .def("calc_edge_length", calc_edge_length_eh) - .def("calc_edge_length", calc_edge_length_hh) - .def("calc_edge_sqr_length", calc_edge_sqr_length_eh) - .def("calc_edge_sqr_length", calc_edge_sqr_length_hh) - - .def("calc_sector_vectors", &Mesh::calc_sector_vectors) - .def("calc_sector_angle", &Mesh::calc_sector_angle) - .def("calc_sector_normal", &Mesh::calc_sector_normal) - .def("calc_sector_area", &Mesh::calc_sector_area) - - .def("calc_dihedral_angle_fast", calc_dihedral_angle_fast_hh) - .def("calc_dihedral_angle_fast", calc_dihedral_angle_fast_eh) - .def("calc_dihedral_angle", calc_dihedral_angle_hh) - .def("calc_dihedral_angle", calc_dihedral_angle_eh) - - .def("find_feature_edges", find_feature_edges, find_feature_edges_overloads()) - - .def("split", split_fh_vh) - .def("split", split_eh_vh) - - .def("update_normals", &Mesh::update_normals) - .def("update_normal", update_normal_fh) - .def("update_face_normals", &Mesh::update_face_normals) - - .def("calc_face_normal", calc_face_normal) - - .def("calc_face_centroid", calc_face_centroid_fh_point) - .def("calc_face_centroid", calc_face_centroid_fh) - - .def("update_normal", update_normal_hh, update_normal_overloads()) - .def("update_halfedge_normals", update_halfedge_normals, update_halfedge_normals_overloads()) - - .def("calc_halfedge_normal", calc_halfedge_normal, calc_halfedge_normal_overloads()) - - .def("is_estimated_feature_edge", &Mesh::is_estimated_feature_edge) - - .def("update_normal", update_normal_vh) - .def("update_vertex_normals", &Mesh::update_vertex_normals) - - .def("calc_vertex_normal", &Mesh::calc_vertex_normal) - .def("calc_vertex_normal_fast", &Mesh::calc_vertex_normal_fast) - .def("calc_vertex_normal_correct", &Mesh::calc_vertex_normal_correct) - .def("calc_vertex_normal_loop", &Mesh::calc_vertex_normal_loop) - - .def("is_polymesh", &Mesh::is_polymesh) - .staticmethod("is_polymesh") - - .def("is_trimesh", &Mesh::is_trimesh) - .staticmethod("is_trimesh") - ; - - expose_type_specific_functions(class_mesh); - - //====================================================================== - // Nested Types - //====================================================================== - - // Enter mesh scope - scope scope_mesh = class_mesh; - - // Point - const boost::python::type_info point_info = type_id(); - const converter::registration * point_registration = converter::registry::query(point_info); - scope_mesh.attr("Point") = handle<>(point_registration->m_class_object); - - // Normal - const boost::python::type_info normal_info = type_id(); - const converter::registration * normal_registration = converter::registry::query(normal_info); - scope_mesh.attr("Normal") = handle<>(normal_registration->m_class_object); - - // Color - const boost::python::type_info color_info = type_id(); - const converter::registration * color_registration = converter::registry::query(color_info); - scope_mesh.attr("Color") = handle<>(color_registration->m_class_object); - - // TexCoord2D - const boost::python::type_info texcoord2d_info = type_id(); - const converter::registration * texcoord2d_registration = converter::registry::query(texcoord2d_info); - scope_mesh.attr("TexCoord2D") = handle<>(texcoord2d_registration->m_class_object); - - // TexCoord3D - const boost::python::type_info texcoord3d_info = type_id(); - const converter::registration * texcoord3d_registration = converter::registry::query(texcoord3d_info); - scope_mesh.attr("TexCoord3D") = handle<>(texcoord3d_registration->m_class_object); -} - -} // namespace OpenMesh -} // namespace Python - -#endif diff --git a/src/Python/PropertyManager.hh b/src/Python/PropertyManager.hh deleted file mode 100644 index 3fe21f02..00000000 --- a/src/Python/PropertyManager.hh +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef OPENMESH_PYTHON_PROPERTYMANAGER_HH -#define OPENMESH_PYTHON_PROPERTYMANAGER_HH - -#include "Python/Bindings.hh" -#include "OpenMesh/Core/Utils/PropertyManager.hh" - -namespace OpenMesh { -namespace Python { - -BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(retain_overloads, retain, 0, 1) - -/** - * Implementation of %Python's \_\_getitem\_\_ magic method. - * - * @tparam PropertyManager A property manager type. - * @tparam IndexHandle The appropriate handle type. - * - * @param _self The property manager instance that is to be used. - * @param _handle The index of the property value to be returned. - * - * @return The requested property value. - */ -template -object propman_get_item(PropertyManager& _self, IndexHandle _handle) { - return _self[_handle]; -} - -/** - * Implementation of %Python's \_\_setitem\_\_ magic method. - * - * @tparam PropertyManager A property manager type. - * @tparam IndexHandle The appropriate handle type. - * - * @param _self The property manager instance that is to be used. - * @param _handle The index of the property value to be set. - * @param _value The property value to be set. - */ -template -void propman_set_item(PropertyManager& _self, IndexHandle _handle, object _value) { - _self[_handle] = _value; -} - -/** - * Conveniently set the property value for an entire range of mesh items - * using a %Python iterator. - * - * @tparam PropertyManager A property manager type. - * @tparam Iterator A %Python iterator type. - * - * @param _self The property manager instance that is to be used. - * @param _it An iterator that iterates over the items in the range. - * @param _value The value the range will be set to. - */ -template -void propman_set_range(PropertyManager& _self, Iterator _it, object _value) { - try { - while (true) { - _self[_it.next()] = _value; - } - } - catch (error_already_set exception) { - // This is expected behavior - PyErr_Clear(); - } -} - -/** - * Thin wrapper for propertyExists. - * - * @tparam PropertyManager A property manager type. - * @tparam Mesh A mesh type. - * - * @param _mesh The mesh that is used to check if the property exists. - * @param _propname The name of the property. - */ -template -bool property_exists(Mesh& _mesh, const char *_propname) { - return PropertyManager::propertyExists(_mesh, _propname); -} - -/** - * Expose a property manager type to %Python. - * - * This function template is used to expose property managers to %Python. The - * template parameters are used to instantiate the appropriate property manager - * type. - * - * @tparam PropHandle A property handle type (e.g. %VPropHandle\). - * @tparam IndexHandle The appropriate handle type (e.g. %VertexHandle for - * %VPropHandle\). - * @tparam Iterator A %Python iterator type. This type is used to instantiate - * the propman_set_range function. - * - * @param _name The name of the property manager type to be exposed. - */ -template -void expose_property_manager(const char *_name) { - // Convenience typedef - typedef PropertyManager PropertyManager; - - // Function pointers - void (PropertyManager::*retain)(bool) = &PropertyManager::retain; - - object (*getitem)(PropertyManager&, IndexHandle ) = &propman_get_item; - void (*setitem)(PropertyManager&, IndexHandle, object) = &propman_set_item; - - void (*set_range)(PropertyManager&, Iterator, object) = &propman_set_range; - - bool (*property_exists_poly)(PolyMesh&, const char *) = &property_exists; - bool (*property_exists_tri )(TriMesh&, const char *) = &property_exists; - - // Expose property manager - class_(_name) - .def(init >()[with_custodian_and_ward<1,2>()]) - .def(init >()[with_custodian_and_ward<1,2>()]) - - .def("swap", &PropertyManager::swap) - .def("is_valid", &PropertyManager::isValid) - - .def("__bool__", &PropertyManager::operator bool) - .def("__nonzero__", &PropertyManager::operator bool) - - .def("get_raw_property", &PropertyManager::getRawProperty, return_value_policy()) - .def("get_name", &PropertyManager::getName, return_value_policy()) - .def("get_mesh", &PropertyManager::getMesh, return_value_policy()) - - .def("retain", retain, retain_overloads()) - - .def("__getitem__", getitem) - .def("__setitem__", setitem) - - .def("set_range", set_range) - - .def("property_exists", property_exists_poly) - .def("property_exists", property_exists_tri) - .staticmethod("property_exists") - ; -} - -} // namespace OpenMesh -} // namespace Python - -#endif diff --git a/src/Python/Unittests/test_add_face.py b/src/Python/Unittests/test_add_face.py deleted file mode 100644 index f6a6fb20..00000000 --- a/src/Python/Unittests/test_add_face.py +++ /dev/null @@ -1,334 +0,0 @@ -import unittest -import openmesh - -class AddFace(unittest.TestCase): - - def test_add_triangles_to_trimesh(self): - self.mesh = openmesh.TriMesh() - self.vhandle = [] - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - - # Add two faces - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[0]) - - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - - self.mesh.add_face(face_vhandles) - - # Test setup: - # 1 === 2 - # | / | - # | / | - # | / | - # 0 === 3 - - # Check setup - self.assertEqual(self.mesh.n_vertices(), 4) - self.assertEqual(self.mesh.n_faces(), 2) - - def test_add_quad_to_trimesh(self): - self.mesh = openmesh.TriMesh() - self.vhandle = [] - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - - # Add two faces - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - - self.mesh.add_face(face_vhandles) - - # Test setup: - # 1 === 2 - # | / | - # | / | - # | / | - # 0 === 3 - - # Check setup - self.assertEqual(self.mesh.n_vertices(), 4) - self.assertEqual(self.mesh.n_faces(), 2) - - def test_create_triangle_mesh_cube(self): - self.mesh = openmesh.TriMesh() - self.vhandle = [] - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, -1))) - - # Add six faces to form a cube - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[6]) - face_vhandles.append(self.vhandle[5]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[4]) - face_vhandles.append(self.vhandle[5]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[5]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[6]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[6]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[6]) - face_vhandles.append(self.vhandle[7]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[7]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # - # 3 ======== 2 - # / /| - # / / | z - # 0 ======== 1 | | - # | | | | y - # | 7 | 6 | / - # | | / | / - # | |/ |/ - # 4 ======== 5 -------> x - - # Check setup - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_halfedges(), 36) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 12) - - def test_create_strange_config(self): - self.mesh = openmesh.TriMesh() - self.vhandle = [] - - # 2 x-----------x 1 - # \ / - # \ / - # \ / - # \ / - # \ / - # 0 x ---x 6 - # /|\ | - # / | \ | - # / | \ | - # / | \| - # x----x x - # 3 4 5 - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 2, 2))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(3, 3, 3))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(4, 4, 4))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(5, 5, 5))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(6, 6, 6))) - - self.mesh.add_face(self.vhandle[0], self.vhandle[1], self.vhandle[2]) - self.mesh.add_face(self.vhandle[0], self.vhandle[3], self.vhandle[4]) - self.mesh.add_face(self.vhandle[0], self.vhandle[5], self.vhandle[6]) - - # non-manifold! - invalid_fh = self.mesh.add_face(self.vhandle[3], self.vhandle[0], self.vhandle[4]) - - # Check setup - self.assertEqual(self.mesh.n_vertices(), 7) - self.assertEqual(self.mesh.n_faces(), 3) - self.assertEqual(invalid_fh, openmesh.TriMesh.InvalidFaceHandle) - - def test_add_quad_to_polymesh(self): - self.mesh = openmesh.PolyMesh() - self.vhandle = [] - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - - # Add one face - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - - self.mesh.add_face(face_vhandles) - - # Test setup: - # 1 === 2 - # | | - # | | - # | | - # 0 === 3 - - # Check setup - self.assertEqual(self.mesh.n_vertices(), 4) - self.assertEqual(self.mesh.n_faces(), 1) - - def test_create_poly_mesh_cube(self): - self.mesh = openmesh.PolyMesh() - self.vhandle = [] - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, -1))) - - # Add six faces to form a cube - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[6]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[4]) - face_vhandles.append(self.vhandle[5]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[6]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[6]) - face_vhandles.append(self.vhandle[7]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # - # 3 ======== 2 - # / /| - # / / | z - # 0 ======== 1 | | - # | | | | y - # | 7 | 6 | / - # | | / | / - # | |/ |/ - # 4 ======== 5 -------> x - - # Check setup - self.assertEqual(self.mesh.n_edges(), 12) - self.assertEqual(self.mesh.n_halfedges(), 24) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 6) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(AddFace) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_boundary.py b/src/Python/Unittests/test_boundary.py deleted file mode 100644 index fde5ea35..00000000 --- a/src/Python/Unittests/test_boundary.py +++ /dev/null @@ -1,86 +0,0 @@ -import unittest -import openmesh - -class BoundaryTriangleMesh(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - # Add some vertices - self.vhandle = [] - - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0,-1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2,-1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(3, 0, 0))) - - # Single point - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0,-2, 0))) - - # Add five faces - self.fhandle = [] - - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.fhandle.append(self.mesh.add_face(face_vhandles)) - - face_vhandles = [] - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[4]) - self.fhandle.append(self.mesh.add_face(face_vhandles)) - - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[1]) - self.fhandle.append(self.mesh.add_face(face_vhandles)) - - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[4]) - self.fhandle.append(self.mesh.add_face(face_vhandles)) - - face_vhandles = [] - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[4]) - self.fhandle.append(self.mesh.add_face(face_vhandles)) - - # Test setup: - # 0 ==== 2 - # |\ 0 /|\ - # | \ / | \ - # |2 1 3|4 5 - # | / \ | / - # |/ 1 \|/ - # 3 ==== 4 - # - # Vertex 6 single - - def test_boundary_vertex(self): - self.assertTrue (self.mesh.is_boundary(self.vhandle[0])) - self.assertFalse(self.mesh.is_boundary(self.vhandle[1])) - self.assertTrue (self.mesh.is_boundary(self.vhandle[2])) - self.assertTrue (self.mesh.is_boundary(self.vhandle[3])) - self.assertTrue (self.mesh.is_boundary(self.vhandle[4])) - self.assertTrue (self.mesh.is_boundary(self.vhandle[5])) - - self.assertTrue (self.mesh.is_boundary(self.vhandle[6])) - - def test_boundary_face(self): - self.assertTrue (self.mesh.is_boundary(self.fhandle[0])) - self.assertTrue (self.mesh.is_boundary(self.fhandle[1])) - self.assertTrue (self.mesh.is_boundary(self.fhandle[2])) - self.assertFalse(self.mesh.is_boundary(self.fhandle[3])) - self.assertTrue (self.mesh.is_boundary(self.fhandle[4])) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(BoundaryTriangleMesh) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_delete_face.py b/src/Python/Unittests/test_delete_face.py deleted file mode 100644 index 5359cfde..00000000 --- a/src/Python/Unittests/test_delete_face.py +++ /dev/null @@ -1,530 +0,0 @@ -import unittest -import openmesh - -class DeleteFaceTriangleMesh(unittest.TestCase): - - def test_delete_half_triangle_mesh_cube_no_edge_status(self): - self.mesh = openmesh.TriMesh() - self.vhandle = [] - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, -1))) - - # Add six faces to form a cube - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[6]) - face_vhandles.append(self.vhandle[5]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[4]) - face_vhandles.append(self.vhandle[5]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[5]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[6]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[6]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[6]) - face_vhandles.append(self.vhandle[7]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[7]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # - # 3 ======== 2 - # / /| - # / / | z - # 0 ======== 1 | | - # | | | | y - # | 7 | 6 | / - # | | / | / - # | |/ |/ - # 4 ======== 5 -------> x - - # Check setup - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_halfedges(), 36) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 12) - - # ===================================================== - # Now we delete half of the mesh - # ===================================================== - self.mesh.request_face_status() - self.mesh.request_vertex_status() - self.mesh.request_halfedge_status() - - n_face_to_delete = self.mesh.n_faces() / 2 - - # Check the variable - self.assertEqual(n_face_to_delete, 6) - - for i in range(int(n_face_to_delete)): - self.mesh.delete_face(self.mesh.face_handle(i)) - - # ===================================================== - # Check config afterwards - # ===================================================== - - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_halfedges(), 36) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 12) - - # ===================================================== - # Cleanup and recheck - # ===================================================== - - self.mesh.garbage_collection() - - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_halfedges(), 36) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 6) - - def test_delete_half_triangle_mesh_cube_with_edge_status(self): - self.mesh = openmesh.TriMesh() - self.vhandle = [] - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, -1))) - - # Add six faces to form a cube - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[6]) - face_vhandles.append(self.vhandle[5]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[4]) - face_vhandles.append(self.vhandle[5]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[5]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[6]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[6]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[6]) - face_vhandles.append(self.vhandle[7]) - self.mesh.add_face(face_vhandles) - - #======================= - - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[7]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # - # 3 ======== 2 - # / /| - # / / | z - # 0 ======== 1 | | - # | | | | y - # | 7 | 6 | / - # | | / | / - # | |/ |/ - # 4 ======== 5 -------> x - - # Check setup - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_halfedges(), 36) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 12) - - # ===================================================== - # Now we delete half of the mesh - # ===================================================== - self.mesh.request_face_status() - self.mesh.request_vertex_status() - self.mesh.request_edge_status() - self.mesh.request_halfedge_status() - - n_face_to_delete = self.mesh.n_faces() / 2 - - # Check the variable - self.assertEqual(n_face_to_delete, 6) - - for i in range(int(n_face_to_delete)): - self.mesh.delete_face(self.mesh.face_handle(i)) - - # ===================================================== - # Check config afterwards - # ===================================================== - - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_halfedges(), 36) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 12) - - # ===================================================== - # Cleanup and recheck - # ===================================================== - - self.mesh.garbage_collection() - - self.assertEqual(self.mesh.n_edges(), 13) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 6) - - def test_deletete_half_poly_mesh_cube_without_edge_status(self): - self.mesh = openmesh.PolyMesh() - self.vhandle = [] - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, -1))) - - # Add six faces to form a cube - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[6]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[4]) - face_vhandles.append(self.vhandle[5]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[6]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[6]) - face_vhandles.append(self.vhandle[7]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # - # 3 ======== 2 - # / /| - # / / | z - # 0 ======== 1 | | - # | | | | y - # | 7 | 6 | / - # | | / | / - # | |/ |/ - # 4 ======== 5 -------> x - - # Check setup - self.assertEqual(self.mesh.n_edges(), 12) - self.assertEqual(self.mesh.n_halfedges(), 24) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 6) - - # ===================================================== - # Now we delete half of the mesh - # ===================================================== - self.mesh.request_face_status() - self.mesh.request_vertex_status() - self.mesh.request_halfedge_status() - - n_face_to_delete = self.mesh.n_faces() / 2 - - # Check the variable - self.assertEqual(n_face_to_delete, 3) - - for i in range(int(n_face_to_delete)): - self.mesh.delete_face(self.mesh.face_handle(i)) - - # ===================================================== - # Check config afterwards - # ===================================================== - - self.assertEqual(self.mesh.n_edges(), 12) - self.assertEqual(self.mesh.n_halfedges(), 24) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 6) - - # ===================================================== - # Cleanup and recheck - # ===================================================== - - self.mesh.garbage_collection() - - self.assertEqual(self.mesh.n_edges(), 12) - self.assertEqual(self.mesh.n_halfedges(), 24) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 3) - - def test_deletete_half_poly_mesh_cube_with_edge_status(self): - self.mesh = openmesh.PolyMesh() - self.vhandle = [] - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, -1))) - - # Add six faces to form a cube - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[6]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[4]) - face_vhandles.append(self.vhandle[5]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[6]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[6]) - face_vhandles.append(self.vhandle[7]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[7]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # - # 3 ======== 2 - # / /| - # / / | z - # 0 ======== 1 | | - # | | | | y - # | 7 | 6 | / - # | | / | / - # | |/ |/ - # 4 ======== 5 -------> x - - # Check setup - self.assertEqual(self.mesh.n_edges(), 12) - self.assertEqual(self.mesh.n_halfedges(), 24) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 6) - - # ===================================================== - # Now we delete half of the mesh - # ===================================================== - self.mesh.request_face_status() - self.mesh.request_vertex_status() - self.mesh.request_edge_status() - self.mesh.request_halfedge_status() - - n_face_to_delete = self.mesh.n_faces() / 2 - - # Check the variable - self.assertEqual(n_face_to_delete, 3) - - for i in range(int(n_face_to_delete)): - self.mesh.delete_face(self.mesh.face_handle(i)) - - # ===================================================== - # Check config afterwards - # ===================================================== - - self.assertEqual(self.mesh.n_edges(), 12) - self.assertEqual(self.mesh.n_halfedges(), 24) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 6) - - # ===================================================== - # Cleanup and recheck - # ===================================================== - - self.mesh.garbage_collection() - - self.assertEqual(self.mesh.n_edges(), 10) - self.assertEqual(self.mesh.n_halfedges(), 20) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 3) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(DeleteFaceTriangleMesh) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_property.py b/src/Python/Unittests/test_property.py deleted file mode 100755 index 61d3cbd7..00000000 --- a/src/Python/Unittests/test_property.py +++ /dev/null @@ -1,289 +0,0 @@ -import unittest -import openmesh - -class Property(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - self.vhandle = [] - - def test_vertex_property_copy_properties_int(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - - # Add two faces - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[0]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # 1 === 2 - # | / | - # | / | - # | / | - # 0 === 3 - - # Check setup - self.assertEqual(self.mesh.n_vertices(), 4) - self.assertEqual(self.mesh.n_faces(), 2) - - # Add a vertex property - intHandle = openmesh.VPropHandle() - self.assertFalse(self.mesh.get_property_handle(intHandle, "intProp")) - self.mesh.add_property(intHandle, "intProp") - self.assertTrue(self.mesh.get_property_handle(intHandle, "intProp")) - - # Fill property - for vh in self.mesh.vertices(): - self.mesh.set_property(intHandle, vh, vh.idx()) - - # Check if property it is ok - v_it = self.mesh.vertices() - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 0) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 3) - - # Check vertex positions - v_it = self.mesh.vertices() - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 0) - self.assertEqual(self.mesh.point(vh)[1], 0) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 0) - self.assertEqual(self.mesh.point(vh)[1], 1) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 1) - self.assertEqual(self.mesh.point(vh)[1], 1) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 1) - self.assertEqual(self.mesh.point(vh)[1], 0) - self.assertEqual(self.mesh.point(vh)[2], 0) - - # Copy from vertex 1 to 0, with skipping build in properties - self.mesh.copy_all_properties(self.vhandle[1], self.vhandle[0]) - v_it = self.mesh.vertices() - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 0) - self.assertEqual(self.mesh.point(vh)[1], 0) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 0) - self.assertEqual(self.mesh.point(vh)[1], 1) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 1) - self.assertEqual(self.mesh.point(vh)[1], 1) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 1) - self.assertEqual(self.mesh.point(vh)[1], 0) - self.assertEqual(self.mesh.point(vh)[2], 0) - v_it = self.mesh.vertices() - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 3) - - # Copy from vertex 2 to 3, including build in properties - self.mesh.copy_all_properties(self.vhandle[2], self.vhandle[3], True) - v_it = self.mesh.vertices() - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 0) - self.assertEqual(self.mesh.point(vh)[1], 0) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 0) - self.assertEqual(self.mesh.point(vh)[1], 1) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 1) - self.assertEqual(self.mesh.point(vh)[1], 1) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 1) - self.assertEqual(self.mesh.point(vh)[1], 1) - self.assertEqual(self.mesh.point(vh)[2], 0) - v_it = self.mesh.vertices() - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) - - def test_check_status_properties_halfedge_edge_all_deleted(self): - self.mesh.request_vertex_status() - self.mesh.request_face_status() - self.mesh.request_halfedge_status() - self.mesh.request_edge_status() - - # Define positions - p1 = openmesh.Vec3d(0, 0, 0) - p2 = openmesh.Vec3d(0, 1, 0) - p3 = openmesh.Vec3d(1, 1, 0) - p4 = openmesh.Vec3d(0, 0, 1) - - # Add some vertices - vh1 = self.mesh.add_vertex(p1) - vh2 = self.mesh.add_vertex(p2) - vh3 = self.mesh.add_vertex(p3) - vh4 = self.mesh.add_vertex(p4) - - # Add some faces - f1 = self.mesh.add_face(vh1, vh3, vh2) - f2 = self.mesh.add_face(vh1, vh2, vh4) - f3 = self.mesh.add_face(vh2, vh3, vh4) - f4 = self.mesh.add_face(vh3, vh1, vh4) - - # Delete all faces - self.mesh.delete_face(f1) - self.mesh.delete_face(f2) - self.mesh.delete_face(f3) - self.mesh.delete_face(f4) - - for heh in self.mesh.halfedges(): - self.assertTrue(self.mesh.status(self.mesh.edge_handle(heh)).deleted()) - self.assertTrue(self.mesh.status(heh).deleted()) - - def test_copy_all_properties_vertex_after_remove_of_property(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - - # Add two faces - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[0]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # 1 === 2 - # | / | - # | / | - # | / | - # 0 === 3 - - # Check setup - self.assertEqual(self.mesh.n_vertices(), 4) - self.assertEqual(self.mesh.n_faces(), 2) - - # Add a double vertex property - doubleHandle = openmesh.VPropHandle() - self.assertFalse(self.mesh.get_property_handle(doubleHandle, "doubleProp")) - self.mesh.add_property(doubleHandle, "doubleProp") - self.assertTrue(self.mesh.get_property_handle(doubleHandle, "doubleProp")) - - # Add a int vertex property - intHandle = openmesh.VPropHandle() - self.assertFalse(self.mesh.get_property_handle(intHandle, "intProp")) - self.mesh.add_property(intHandle, "intProp") - self.assertTrue(self.mesh.get_property_handle(intHandle, "intProp")) - - # Now remove the double property again - self.mesh.remove_property(doubleHandle) - - # Fill int property - for vh in self.mesh.vertices(): - self.mesh.set_property(intHandle, vh, vh.idx()) - - # Check if property it is ok - v_it = self.mesh.vertices() - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 0) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 3) - - # Check vertex positions - v_it = self.mesh.vertices() - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 0) - self.assertEqual(self.mesh.point(vh)[1], 0) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 0) - self.assertEqual(self.mesh.point(vh)[1], 1) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 1) - self.assertEqual(self.mesh.point(vh)[1], 1) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 1) - self.assertEqual(self.mesh.point(vh)[1], 0) - self.assertEqual(self.mesh.point(vh)[2], 0) - - # Copy from vertex 1 to 0, with skipping build in properties - self.mesh.copy_all_properties(self.vhandle[1], self.vhandle[0]) - v_it = self.mesh.vertices() - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 0) - self.assertEqual(self.mesh.point(vh)[1], 0) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 0) - self.assertEqual(self.mesh.point(vh)[1], 1) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 1) - self.assertEqual(self.mesh.point(vh)[1], 1) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 1) - self.assertEqual(self.mesh.point(vh)[1], 0) - self.assertEqual(self.mesh.point(vh)[2], 0) - v_it = self.mesh.vertices() - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 3) - - # Copy from vertex 2 to 3, including build in properties - self.mesh.copy_all_properties(self.vhandle[2], self.vhandle[3], True) - v_it = self.mesh.vertices() - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 0) - self.assertEqual(self.mesh.point(vh)[1], 0) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 0) - self.assertEqual(self.mesh.point(vh)[1], 1) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 1) - self.assertEqual(self.mesh.point(vh)[1], 1) - self.assertEqual(self.mesh.point(vh)[2], 0) - vh = v_it.next() - self.assertEqual(self.mesh.point(vh)[0], 1) - self.assertEqual(self.mesh.point(vh)[1], 1) - self.assertEqual(self.mesh.point(vh)[2], 0) - v_it = self.mesh.vertices() - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 1) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) - self.assertEqual(self.mesh.property(intHandle, v_it.next()), 2) - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(Property) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_python.py b/src/Python/Unittests/test_python.py deleted file mode 100644 index f7d75492..00000000 --- a/src/Python/Unittests/test_python.py +++ /dev/null @@ -1,71 +0,0 @@ -import unittest -import openmesh - -class Python(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - # Add some vertices - self.vhandle = [] - - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0,-1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2,-1, 0))) - - # Add four faces using Python lists - vertex_list = [self.vhandle[0], self.vhandle[1], self.vhandle[2]] - self.mesh.add_face(vertex_list) - vertex_list = [self.vhandle[1], self.vhandle[3], self.vhandle[4]] - self.mesh.add_face(vertex_list) - vertex_list = [self.vhandle[0], self.vhandle[3], self.vhandle[1]] - self.mesh.add_face(vertex_list) - vertex_list = [self.vhandle[2], self.vhandle[1], self.vhandle[4]] - self.mesh.add_face(vertex_list) - - # Test setup: - # 0 ==== 2 - # |\ 0 /| - # | \ / | - # |2 1 3| - # | / \ | - # |/ 1 \| - # 3 ==== 4 - - def test_python_iterator(self): - # Iterate over all vertices - indices = [0, 1, 2, 3, 4] - for v, idx in zip(self.mesh.vertices(), indices): - self.assertEqual(v.idx(), idx) - - def test_python_circulator(self): - # Iterate around vertex 1 at the middle - indices = [4, 3, 0, 2] - for v, idx in zip(self.mesh.vv(self.vhandle[1]), indices): - self.assertEqual(v.idx(), idx) - - def test_property_manager(self): - # Check if vertex property exists - self.assertFalse(openmesh.VPropertyManager.property_exists(self.mesh, "prop")) - - # Create a new vertex property - propman = openmesh.VPropertyManager(self.mesh, "prop") - self.assertTrue(propman.property_exists(self.mesh, "prop")) - - # Check initial property values - for v in self.mesh.vertices(): - self.assertEqual(propman[v], None) - - # Set property values - propman.set_range(self.mesh.vertices(), 0.0) - - # Check again - for v in self.mesh.vertices(): - self.assertEqual(propman[v], 0.0) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(Python) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_read_write_obj.py b/src/Python/Unittests/test_read_write_obj.py deleted file mode 100644 index da2bfa41..00000000 --- a/src/Python/Unittests/test_read_write_obj.py +++ /dev/null @@ -1,229 +0,0 @@ -import unittest -import openmesh - -class ReadWriteOBJ(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - def test_load_simple_obj(self): - ok = openmesh.read_mesh(self.mesh, "cube-minimal.obj") - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - def test_load_simple_obj_check_halfedge_and_vertex_normals(self): - self.mesh.request_halfedge_normals() - self.mesh.request_vertex_normals() - - options = openmesh.Options() - options += openmesh.Options.VertexNormal - - file_name = "cube-minimal.obj" - - ok = openmesh.read_mesh(self.mesh, file_name, options) - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - self.assertEqual(self.mesh.n_halfedges(), 36) - - # ===================================================== - # Check vertex normals - # ===================================================== - - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(0))[0], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(0))[1], -1.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(0))[2], 0.0) - - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(3))[0], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(3))[1], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(3))[2], 1.0) - - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(4))[0], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(4))[1], -1.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(4))[2], 0.0) - - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(7))[0], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(7))[1], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(7))[2], 1.0) - - # ===================================================== - # Check halfedge normals - # ===================================================== - - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle( 0))[0], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle( 0))[1], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle( 0))[2], -1.0) - - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(10))[0], -1.0) - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(10))[1], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(10))[2], 0.0) - - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(19))[0], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(19))[1], 1.0) - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(19))[2], 0.0) - - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(24))[0], 1.0) - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(24))[1], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(24))[2], 0.0) - - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(30))[0], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(30))[1], -1.0) - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(30))[2], 0.0) - - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(35))[0], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(35))[1], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.halfedge_handle(35))[2], 1.0) - - self.mesh.release_vertex_normals() - self.mesh.release_halfedge_normals() - - def test_load_simple_obj_force_vertex_colors_although_not_available(self): - self.mesh.request_vertex_colors() - - file_name = "cube-minimal.obj" - - options = openmesh.Options() - options += openmesh.Options.VertexColor - - ok = openmesh.read_mesh(self.mesh, file_name, options) - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - self.assertEqual(self.mesh.n_halfedges(), 36) - - def test_load_simple_obj_check_texcoords(self): - self.mesh.request_halfedge_texcoords2D() - - options = openmesh.Options() - options += openmesh.Options.FaceTexCoord - - file_name = "cube-minimal-texCoords.obj" - - ok = openmesh.read_mesh(self.mesh, file_name, options) - - self.assertTrue(ok) - - self.assertEqual(self.mesh.texcoord2D(self.mesh.halfedge_handle( 0))[0], 1.0) - self.assertEqual(self.mesh.texcoord2D(self.mesh.halfedge_handle( 0))[1], 1.0) - - self.assertEqual(self.mesh.texcoord2D(self.mesh.halfedge_handle(10))[0], 3.0) - self.assertEqual(self.mesh.texcoord2D(self.mesh.halfedge_handle(10))[1], 3.0) - - self.assertEqual(self.mesh.texcoord2D(self.mesh.halfedge_handle(19))[0], 6.0) - self.assertEqual(self.mesh.texcoord2D(self.mesh.halfedge_handle(19))[1], 6.0) - - self.assertEqual(self.mesh.texcoord2D(self.mesh.halfedge_handle(24))[0], 7.0) - self.assertEqual(self.mesh.texcoord2D(self.mesh.halfedge_handle(24))[1], 7.0) - - self.assertEqual(self.mesh.texcoord2D(self.mesh.halfedge_handle(30))[0], 9.0) - self.assertEqual(self.mesh.texcoord2D(self.mesh.halfedge_handle(30))[1], 9.0) - - self.assertEqual(self.mesh.texcoord2D(self.mesh.halfedge_handle(35))[0], 12.0) - self.assertEqual(self.mesh.texcoord2D(self.mesh.halfedge_handle(35))[1], 12.0) - - self.mesh.release_halfedge_texcoords2D() - - def test_load_obj_with_material(self): - self.mesh.request_face_colors() - - options = openmesh.Options() - options += openmesh.Options.FaceColor - - file_name = "square_material.obj" - - ok = openmesh.read_mesh(self.mesh, file_name, options) - - self.assertTrue(ok) - - fh = self.mesh.face_handle(self.mesh.halfedge_handle(0)) - - self.assertTrue(fh.is_valid()) - - self.assertAlmostEqual(self.mesh.color(fh)[0], 0.5, 2) - self.assertAlmostEqual(self.mesh.color(fh)[1], 0.5, 2) - self.assertAlmostEqual(self.mesh.color(fh)[2], 0.5, 2) - - self.mesh.release_face_colors() - - def test_load_simple_obj_with_vertex_colors_after_vertices(self): - self.mesh.request_vertex_colors() - - options = openmesh.Options() - options += openmesh.Options.VertexColor - - file_name = "cube-minimal-vertex-colors-after-vertex-definition.obj" - - ok = openmesh.read_mesh(self.mesh, file_name, options) - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[2], 0.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[1], 1.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[0], 1.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[2], 0.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[0], 1.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[1], 1.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[2], 1.0) - - self.mesh.release_vertex_colors() - - def test_load_simple_obj_with_vertex_colors_as_vc_lines(self): - self.mesh.request_vertex_colors() - - options = openmesh.Options() - options += openmesh.Options.VertexColor - - file_name = "cube-minimal-vertex-colors-as-vc-lines.obj" - - ok = openmesh.read_mesh(self.mesh, file_name, options) - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[2], 0.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[1], 1.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[0], 1.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[2], 0.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[0], 1.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[1], 1.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[2], 1.0) - - self.mesh.release_vertex_colors() - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(ReadWriteOBJ) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_read_write_off.py b/src/Python/Unittests/test_read_write_off.py deleted file mode 100644 index a2d50b05..00000000 --- a/src/Python/Unittests/test_read_write_off.py +++ /dev/null @@ -1,163 +0,0 @@ -import unittest -import openmesh - -class ReadWriteOFF(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - def test_load_simple_off_file(self): - ok = openmesh.read_mesh(self.mesh, "cube1.off") - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 7526) - self.assertEqual(self.mesh.n_edges(), 22572) - self.assertEqual(self.mesh.n_faces(), 15048) - - def test_write_and_read_vertex_colors_to_and_from_off_file(self): - self.mesh.request_vertex_colors() - - self.mesh.add_vertex(openmesh.Vec3d(0, 0, 1)) - self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0)) - self.mesh.add_vertex(openmesh.Vec3d(0, 1, 1)) - self.mesh.add_vertex(openmesh.Vec3d(1, 0, 1)) - - # Using the default openmesh Python color type - testColor = openmesh.Vec4f(1.0, 0.5, 0.25, 1.0) - - # Setting colors (different from black) - for v in self.mesh.vertices(): - self.mesh.set_color(v, testColor) - - # Check if the colors are correctly set - count = 0 - for v in self.mesh.vertices(): - color = self.mesh.color(v) - if color[0] != testColor[0] or color[1] != testColor[1] or color[2] != testColor[2]: - count += 1 - - self.assertEqual(count, 0) - - options = openmesh.Options() - options += openmesh.Options.VertexColor - options += openmesh.Options.ColorFloat - - openmesh.write_mesh(self.mesh, "temp.off", options) - openmesh.read_mesh(self.mesh, "temp.off", options) - - # Check if vertices still have the same color - count = 0 - for v in self.mesh.vertices(): - color = self.mesh.color(v) - if color[0] != testColor[0] or color[1] != testColor[1] or color[2] != testColor[2]: - count += 1 - - self.assertEqual(count, 0) - - self.mesh.release_vertex_colors() - - def test_write_and_read_float_vertex_colors_to_and_from_off_file(self): - self.mesh.request_vertex_colors() - - options = openmesh.Options(openmesh.Options.VertexColor) - - ok = openmesh.read_mesh(self.mesh, "meshlab.ply", options) - - self.assertTrue(ok) - - options.clear() - options += openmesh.Options.VertexColor - options += openmesh.Options.ColorFloat - - # Write the mesh - ok = openmesh.write_mesh(self.mesh, "cube_floating.off", options) - self.assertTrue(ok) - ok = openmesh.read_mesh(self.mesh, "cube_floating.off", options) - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[2], 1.0) - - self.assertFalse(options.vertex_has_normal()) - self.assertFalse(options.vertex_has_texcoord()) - self.assertTrue(options.vertex_has_color()) - self.assertTrue(options.color_is_float()) - - self.mesh.release_vertex_colors() - - def test_write_and_read_binary_float_vertex_colors_to_and_from_off_file(self): - self.mesh.request_vertex_colors() - - options = openmesh.Options(openmesh.Options.VertexColor) - - ok = openmesh.read_mesh(self.mesh, "meshlab.ply", options) - - self.assertTrue(ok) - - options.clear() - options += openmesh.Options.VertexColor - options += openmesh.Options.Binary - options += openmesh.Options.ColorFloat - - # Write the mesh - ok = openmesh.write_mesh(self.mesh, "cube_floating_binary.off", options) - self.assertTrue(ok) - self.mesh.clear() - options.clear() - options += openmesh.Options.VertexColor - options += openmesh.Options.Binary - options += openmesh.Options.ColorFloat - ok = openmesh.read_mesh(self.mesh, "cube_floating_binary.off", options) - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[2], 1.0) - - self.assertFalse(options.vertex_has_normal()) - self.assertFalse(options.vertex_has_texcoord()) - self.assertFalse(options.face_has_color()) - self.assertTrue(options.vertex_has_color()) - self.assertTrue(options.color_is_float()) - self.assertTrue(options.is_binary()) - - self.mesh.release_vertex_colors() - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(ReadWriteOFF) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_read_write_om.py b/src/Python/Unittests/test_read_write_om.py deleted file mode 100644 index dc8887ec..00000000 --- a/src/Python/Unittests/test_read_write_om.py +++ /dev/null @@ -1,201 +0,0 @@ -import unittest -import openmesh -import os - -class ReadWriteOM(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - def test_load_simple_om_force_vertex_colors_although_not_available(self): - self.mesh.request_vertex_colors() - - file_name = "cube-minimal.om" - - options = openmesh.Options() - options += openmesh.Options.VertexColor - - ok = openmesh.read_mesh(self.mesh, file_name, options) - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - self.assertEqual(self.mesh.n_halfedges(), 36) - - self.assertFalse(options.vertex_has_normal()) - self.assertFalse(options.vertex_has_texcoord()) - self.assertFalse(options.vertex_has_color()) - - def test_load_simple_om_with_texcoords(self): - self.mesh.request_vertex_texcoords2D() - - options = openmesh.Options() - options += openmesh.Options.VertexTexCoord - - ok = openmesh.read_mesh(self.mesh, "cube-minimal-texCoords.om", options) - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(0))[0], 10.0) - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(0))[1], 10.0) - - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(2))[0], 6.0) - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(2))[1], 6.0) - - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(4))[0], 9.0) - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(4))[1], 9.0) - - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(7))[0], 12.0) - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(7))[1], 12.0) - - self.assertFalse(options.vertex_has_normal()) - self.assertTrue(options.vertex_has_texcoord()) - self.assertFalse(options.vertex_has_color()) - - self.mesh.release_vertex_texcoords2D() - - def test_load_simple_om_with_vertex_colors(self): - self.mesh.request_vertex_colors() - - options = openmesh.Options() - options += openmesh.Options.VertexColor - - ok = openmesh.read_mesh(self.mesh, "cube-minimal-vertexColors.om", options) - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[0], 1.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[2], 0.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[0], 1.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[2], 0.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[2], 1.0) - - self.assertFalse(options.vertex_has_normal()) - self.assertFalse(options.vertex_has_texcoord()) - self.assertTrue(options.vertex_has_color()) - - self.mesh.release_vertex_colors() - - def test_write_triangle(self): - filename = "triangle-minimal.om"; - - # Generate data - v1 = self.mesh.add_vertex(openmesh.Vec3d(1.0, 0.0, 0.0)) - v2 = self.mesh.add_vertex(openmesh.Vec3d(0.0, 1.0, 0.0)) - v3 = self.mesh.add_vertex(openmesh.Vec3d(0.0, 0.0, 1.0)) - self.mesh.add_face(v1, v2, v3) - - # Save - ok = openmesh.write_mesh(self.mesh, filename) - self.assertTrue(ok) - - # Reset - self.mesh.clear() - - # Load - ok = openmesh.read_mesh(self.mesh, filename) - self.assertTrue(ok) - - # Compare - self.assertEqual(self.mesh.n_vertices(), 3) - self.assertEqual(self.mesh.n_edges(), 3) - self.assertEqual(self.mesh.n_faces(), 1) - - self.assertEqual(self.mesh.point(v1), openmesh.Vec3d(1.0, 0.0, 0.0)) - self.assertEqual(self.mesh.point(v2), openmesh.Vec3d(0.0, 1.0, 0.0)) - self.assertEqual(self.mesh.point(v3), openmesh.Vec3d(0.0, 0.0, 1.0)) - - # Cleanup - os.remove(filename) - - def test_write_triangle_vertex_integer_color(self): - self.mesh.request_vertex_colors() - - options = openmesh.Options() - options += openmesh.Options.VertexColor - options += openmesh.Options.ColorFloat - - filename = "triangle-minimal-ColorsPerVertex.om" - - # Generate data - v1 = self.mesh.add_vertex(openmesh.Vec3d(1.0, 0.0, 0.0)) - v2 = self.mesh.add_vertex(openmesh.Vec3d(0.0, 1.0, 0.0)) - v3 = self.mesh.add_vertex(openmesh.Vec3d(0.0, 0.0, 1.0)) - self.mesh.add_face(v1, v2, v3) - - c1 = openmesh.Vec4f(0.00, 0.00, 0.50, 1.00) - c2 = openmesh.Vec4f(0.25, 0.00, 0.00, 1.00) - c3 = openmesh.Vec4f(0.00, 0.75, 0.00, 1.00) - - self.mesh.set_color(v1, c1) - self.mesh.set_color(v2, c2) - self.mesh.set_color(v3, c3) - - # Save - ok = openmesh.write_mesh(self.mesh, filename, options) - self.assertTrue(ok) - - self.mesh.release_vertex_colors() - - # Load - cmpMesh = openmesh.TriMesh() - cmpMesh.request_vertex_colors() - ok = openmesh.read_mesh(cmpMesh, filename, options) - self.assertTrue(ok) - - self.assertTrue(cmpMesh.has_vertex_colors()) - - # Compare - self.assertEqual(self.mesh.n_vertices(), 3) - self.assertEqual(self.mesh.n_edges(), 3) - self.assertEqual(self.mesh.n_faces(), 1) - - self.assertEqual(cmpMesh.point(v1), openmesh.Vec3d(1.0, 0.0, 0.0)) - self.assertEqual(cmpMesh.point(v2), openmesh.Vec3d(0.0, 1.0, 0.0)) - self.assertEqual(cmpMesh.point(v3), openmesh.Vec3d(0.0, 0.0, 1.0)) - - self.assertAlmostEqual(cmpMesh.color(v1)[0], c1[0], 2) - self.assertAlmostEqual(cmpMesh.color(v1)[1], c1[1], 2) - self.assertAlmostEqual(cmpMesh.color(v1)[2], c1[2], 2) - self.assertAlmostEqual(cmpMesh.color(v1)[3], c1[3], 2) - - self.assertAlmostEqual(cmpMesh.color(v2)[0], c2[0], 2) - self.assertAlmostEqual(cmpMesh.color(v2)[1], c2[1], 2) - self.assertAlmostEqual(cmpMesh.color(v2)[2], c2[2], 2) - self.assertAlmostEqual(cmpMesh.color(v2)[3], c2[3], 2) - - self.assertAlmostEqual(cmpMesh.color(v3)[0], c3[0], 2) - self.assertAlmostEqual(cmpMesh.color(v3)[1], c3[1], 2) - self.assertAlmostEqual(cmpMesh.color(v3)[2], c3[2], 2) - self.assertAlmostEqual(cmpMesh.color(v3)[3], c3[3], 2) - - # Clean up - cmpMesh.release_vertex_colors() - os.remove(filename) - - # TODO property tests - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(ReadWriteOM) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_read_write_ply.py b/src/Python/Unittests/test_read_write_ply.py deleted file mode 100644 index 7de00b1e..00000000 --- a/src/Python/Unittests/test_read_write_ply.py +++ /dev/null @@ -1,342 +0,0 @@ -import unittest -import openmesh - -class ReadWritePLY(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - def test_load_simple_point_ply_file_with_bad_encoding(self): - ok = openmesh.read_mesh(self.mesh, "pointCloudBadEncoding.ply") - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 10) - self.assertEqual(self.mesh.n_edges(), 0) - self.assertEqual(self.mesh.n_faces(), 0) - - def test_load_simple_point_ply_file_with_good_encoding(self): - ok = openmesh.read_mesh(self.mesh, "pointCloudGoodEncoding.ply") - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 10) - self.assertEqual(self.mesh.n_edges(), 0) - self.assertEqual(self.mesh.n_faces(), 0) - - def test_load_simple_ply(self): - ok = openmesh.read_mesh(self.mesh, "cube-minimal.ply") - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - def test_load_simple_ply_force_vertex_colors_although_not_available(self): - self.mesh.request_vertex_colors() - - file_name = "cube-minimal.ply" - - options = openmesh.Options() - options += openmesh.Options.VertexColor - - ok = openmesh.read_mesh(self.mesh, file_name, options) - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - self.assertEqual(self.mesh.n_halfedges(), 36) - - self.assertFalse(options.vertex_has_normal()) - self.assertFalse(options.vertex_has_texcoord()) - self.assertFalse(options.vertex_has_color()) - - def test_load_simple_ply_with_vertex_colors(self): - self.mesh.request_vertex_colors() - - file_name = "cube-minimal.ply" - - options = openmesh.Options() - options += openmesh.Options.VertexColor - - ok = openmesh.read_mesh(self.mesh, "cube-minimal-vertexColors.ply", options) - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[0], 1.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[2], 0.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[0], 1.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[2], 0.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[2], 1.0) - - self.assertFalse(options.vertex_has_normal()) - self.assertFalse(options.vertex_has_texcoord()) - self.assertTrue(options.vertex_has_color()) - - self.mesh.release_vertex_colors() - - def test_load_ply_from_mesh_lab_with_vertex_colors(self): - self.mesh.request_vertex_colors() - - options = openmesh.Options() - options += openmesh.Options.VertexColor - - ok = openmesh.read_mesh(self.mesh, "meshlab.ply", options) - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[2], 1.0) - - self.assertFalse(options.vertex_has_normal()) - self.assertFalse(options.vertex_has_texcoord()) - self.assertTrue(options.vertex_has_color()) - - self.mesh.release_vertex_colors() - - def test_write_and_read_binary_ply_with_vertex_colors(self): - self.mesh.request_vertex_colors() - - options = openmesh.Options() - options += openmesh.Options.VertexColor - - ok = openmesh.read_mesh(self.mesh, "meshlab.ply", options) - - self.assertTrue(ok) - - options += openmesh.Options.Binary - - ok = openmesh.write_mesh(self.mesh, "meshlab_binary.ply", options) - self.assertTrue(ok) - - self.mesh.clear - - ok = openmesh.read_mesh(self.mesh, "meshlab_binary.ply", options) - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[2], 1.0) - - self.assertFalse(options.vertex_has_normal()) - self.assertFalse(options.vertex_has_texcoord()) - self.assertTrue(options.vertex_has_color()) - - self.mesh.release_vertex_colors() - - def test_write_and_read_ply_with_float_vertex_colors(self): - self.mesh.request_vertex_colors() - - options = openmesh.Options() - options += openmesh.Options.VertexColor - - ok = openmesh.read_mesh(self.mesh, "meshlab.ply", options) - - self.assertTrue(ok) - - options += openmesh.Options.ColorFloat - - ok = openmesh.write_mesh(self.mesh, "meshlab_float.ply", options) - self.assertTrue(ok) - - self.mesh.clear - ok = openmesh.read_mesh(self.mesh, "meshlab_float.ply", options) - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[2], 1.0) - - self.assertFalse(options.vertex_has_normal()) - self.assertFalse(options.vertex_has_texcoord()) - self.assertTrue(options.vertex_has_color()) - self.assertTrue(options.color_is_float()) - - self.mesh.release_vertex_colors() - - def test_write_and_read_binary_ply_with_float_vertex_colors(self): - self.mesh.request_vertex_colors() - - options = openmesh.Options() - options += openmesh.Options.VertexColor - - ok = openmesh.read_mesh(self.mesh, "meshlab.ply", options) - - self.assertTrue(ok) - - options += openmesh.Options.ColorFloat - options += openmesh.Options.Binary - - ok = openmesh.write_mesh(self.mesh, "meshlab_binary_float.ply", options) - self.assertTrue(ok) - - self.mesh.clear - ok = openmesh.read_mesh(self.mesh, "meshlab_binary_float.ply", options) - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(0))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(3))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(4))[2], 1.0) - - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[0], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[1], 0.0) - self.assertEqual(self.mesh.color(self.mesh.vertex_handle(7))[2], 1.0) - - self.assertFalse(options.vertex_has_normal()) - self.assertFalse(options.vertex_has_texcoord()) - self.assertTrue(options.vertex_has_color()) - self.assertTrue(options.color_is_float()) - self.assertTrue(options.is_binary()) - - self.mesh.release_vertex_colors() - - def test_load_simple_ply_with_texcoords(self): - self.mesh.request_vertex_texcoords2D() - - options = openmesh.Options() - options += openmesh.Options.VertexTexCoord - - ok = openmesh.read_mesh(self.mesh, "cube-minimal-texCoords.ply", options) - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(0))[0], 10.0) - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(0))[1], 10.0) - - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(2))[0], 6.0) - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(2))[1], 6.0) - - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(4))[0], 9.0) - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(4))[1], 9.0) - - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(7))[0], 12.0) - self.assertEqual(self.mesh.texcoord2D(self.mesh.vertex_handle(7))[1], 12.0) - - self.assertFalse(options.vertex_has_normal()) - self.assertTrue(options.vertex_has_texcoord()) - self.assertFalse(options.vertex_has_color()) - - self.mesh.release_vertex_texcoords2D() - - def test_load_simple_ply_with_normals(self): - self.mesh.request_vertex_normals() - - options = openmesh.Options() - options += openmesh.Options.VertexNormal - - ok = openmesh.read_mesh(self.mesh, "cube-minimal-normals.ply", options) - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_faces(), 12) - - self.assertTrue(options.vertex_has_normal()) - self.assertFalse(options.vertex_has_texcoord()) - self.assertFalse(options.vertex_has_color()) - - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(0))[0], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(0))[1], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(0))[2], 1.0) - - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(3))[0], 1.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(3))[1], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(3))[2], 0.0) - - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(4))[0], 1.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(4))[1], 0.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(4))[2], 1.0) - - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(7))[0], 1.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(7))[1], 1.0) - self.assertEqual(self.mesh.normal(self.mesh.vertex_handle(7))[2], 2.0) - - self.mesh.release_vertex_normals() - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(ReadWritePLY) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_read_write_stl.py b/src/Python/Unittests/test_read_write_stl.py deleted file mode 100644 index b2ede2e0..00000000 --- a/src/Python/Unittests/test_read_write_stl.py +++ /dev/null @@ -1,75 +0,0 @@ -import unittest -import openmesh - -class ReadWriteSTL(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - def test_load_simple_stl_file(self): - ok = openmesh.read_mesh(self.mesh, "cube1.stl") - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 7526) - self.assertEqual(self.mesh.n_edges(), 22572) - self.assertEqual(self.mesh.n_faces(), 15048) - - def test_load_simple_stl_file_with_normals(self): - self.mesh.request_face_normals() - - options = openmesh.Options() - options += openmesh.Options.FaceNormal - - ok = openmesh.read_mesh(self.mesh, "cube1.stl", options) - - self.assertTrue(ok) - - self.assertAlmostEqual(self.mesh.normal(self.mesh.face_handle(0))[0], -0.038545) - self.assertAlmostEqual(self.mesh.normal(self.mesh.face_handle(0))[1], -0.004330) - self.assertAlmostEqual(self.mesh.normal(self.mesh.face_handle(0))[2], 0.999247) - - self.assertEqual(self.mesh.n_vertices(), 7526) - self.assertEqual(self.mesh.n_edges(), 22572) - self.assertEqual(self.mesh.n_faces(), 15048) - - self.mesh.release_face_normals() - - def test_load_simple_stl_binary_file(self): - ok = openmesh.read_mesh(self.mesh, "cube1Binary.stl") - - self.assertTrue(ok) - - self.assertEqual(self.mesh.n_vertices(), 7526) - self.assertEqual(self.mesh.n_edges(), 22572) - self.assertEqual(self.mesh.n_faces(), 15048) - - def test_load_simple_stl_binary_file_with_normals(self): - self.mesh.request_face_normals() - - options = openmesh.Options() - options += openmesh.Options.FaceNormal - options += openmesh.Options.Binary - - ok = openmesh.read_mesh(self.mesh, "cube1Binary.stl", options) - - self.assertTrue(ok) - - self.assertTrue(options.is_binary()) - self.assertTrue(options.face_has_normal()) - self.assertFalse(options.vertex_has_normal()) - - self.assertAlmostEqual(self.mesh.normal(self.mesh.face_handle(0))[0], -0.038545, 5) - self.assertAlmostEqual(self.mesh.normal(self.mesh.face_handle(0))[1], -0.004330, 5) - self.assertAlmostEqual(self.mesh.normal(self.mesh.face_handle(0))[2], 0.999247, 5) - - self.assertEqual(self.mesh.n_vertices(), 7526) - self.assertEqual(self.mesh.n_edges(), 22572) - self.assertEqual(self.mesh.n_faces(), 15048) - - self.mesh.release_face_normals() - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(ReadWriteSTL) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_split_copy.py b/src/Python/Unittests/test_split_copy.py deleted file mode 100644 index 0252f593..00000000 --- a/src/Python/Unittests/test_split_copy.py +++ /dev/null @@ -1,87 +0,0 @@ -import unittest -import openmesh - -class SplitCopy(unittest.TestCase): - - def test_split_copy_triangle_mesh(self): - self.mesh = openmesh.TriMesh() - self.vhandle = [] - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0.25, 0.25, 0))) - - # Add one face - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[0]) - - fh = self.mesh.add_face(face_vhandles) - - # Test setup: - # 1 === 2 - # | / - # | / - # | / - # 0 - - # Set property - fprop_int = openmesh.FPropHandle() - self.mesh.add_property(fprop_int) - self.mesh.set_property(fprop_int, fh, 999) - - # Split face with new vertex - self.mesh.split_copy(fh, self.vhandle[3]) - - # Check setup - for f in self.mesh.faces(): - self.assertEqual(self.mesh.property(fprop_int, f), 999) - - def test_split_copy_polymesh(self): - self.mesh = openmesh.PolyMesh() - self.vhandle = [] - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0.5, 0.5, 0))) - - # Add one face - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - - fh = self.mesh.add_face(face_vhandles) - - # Test setup: - # 1 === 2 - # | | - # | | - # | | - # 0 === 3 - - # Set property - fprop_int = openmesh.FPropHandle() - self.mesh.add_property(fprop_int) - self.mesh.set_property(fprop_int, fh, 999) - - # Split face with new vertex - self.mesh.split_copy(fh, self.vhandle[4]) - - # Check setup - for f in self.mesh.faces(): - self.assertEqual(self.mesh.property(fprop_int, f), 999) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(SplitCopy) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_trimesh_circulator_current_halfedge_handle_replacement.py b/src/Python/Unittests/test_trimesh_circulator_current_halfedge_handle_replacement.py deleted file mode 100644 index 8232c0ce..00000000 --- a/src/Python/Unittests/test_trimesh_circulator_current_halfedge_handle_replacement.py +++ /dev/null @@ -1,269 +0,0 @@ -import unittest -import openmesh - -class TrimeshCirculatorCurrentHalfedgeHandleReplacement(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - self.vhandle = [] - - def test_dereference(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, -1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, -1, 0))) - - # Add four faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[1]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # 0 ==== 2 - # |\ 0 /| - # | \ / | - # |2 1 3| - # | / \ | - # |/ 1 \| - # 3 ==== 4 - # Starting vertex is 1->4 - - # output from fh_it.current_halfedge_handle() - current_halfedge_handles = [4, 0, 2, 10, 6, 8, 1, 12, 7, 14, 3, 11] - - i = 0 - for f in self.mesh.faces(): - for he in self.mesh.fh(f): - self.assertEqual(he.idx(), current_halfedge_handles[i]) - i += 1 - - def test_vv_iter(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, -1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, -1, 0))) - - # Add four faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[1]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # 0 ==== 2 - # |\ 0 /| - # | \ / | - # |2 1 3| - # | / \ | - # |/ 1 \| - # 3 ==== 4 - # Starting vertex is 1->4 - - # output from vv_it.current_halfedge_handle() - current_halfedge_handles = [5, 0, 12, 11, 6, 1, 2, 15, 3, 4, 13, 7, 8, 9, 10, 14] - - eh0 = [] - eh1 = [] - - i = 0 - - for v in self.mesh.vertices(): - for vv in self.mesh.vv(v): - he = openmesh.HalfedgeHandle(current_halfedge_handles[i]) - eh0.append(self.mesh.edge_handle(he)) - i += 1 - for v in self.mesh.vertices(): - for he in self.mesh.voh(v): - eh1.append(self.mesh.edge_handle(he)) - - self.assertEqual(len(eh0), len(eh1)) - for i in range(len(eh0)): - self.assertEqual(eh0[i], eh1[i]) - - def test_fe_iter(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, -1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, -1, 0))) - - # Add four faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[1]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # 0 ==== 2 - # |\ 0 /| - # | \ / | - # |2 1 3| - # | / \ | - # |/ 1 \| - # 3 ==== 4 - # Starting vertex is 1->4 - - # output from fe_it.current_halfedge_handle() - current_halfedge_handles = [4, 0, 2, 10, 6, 8, 1, 12, 7, 14, 3, 11] - - heh0 = [] - heh1 = [] - - i = 0 - - for f in self.mesh.faces(): - for e in self.mesh.fe(f): - heh0.append(openmesh.HalfedgeHandle(current_halfedge_handles[i])) - i += 1 - for f in self.mesh.faces(): - for he in self.mesh.fh(f): - heh1.append(he) - - self.assertEqual(len(heh0), len(heh1)) - for i in range(len(heh0)): - self.assertEqual(heh0[i], heh1[i]) - - def test_vf_iter_boundary(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(3, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(4, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, -1, 0))) - - # Add three faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # - # 0 ------ 2 ------ 4 - # \ / \ / - # \ 0 / \ 1 / - # \ / \ / - # 1 ------- 3 - # \ / - # \ 2 / - # \ / - # \ / - # 5 - - # output from fe_it.current_halfedge_handle() - current_halfedge_handles = [0, 2, 12, 4, 6, 8, 16, 10, 14] - - fh0 = [] - fh1 = [] - - i = 0 - - for v in self.mesh.vertices(): - for f in self.mesh.vf(v): - he = openmesh.HalfedgeHandle(current_halfedge_handles[i]) - fh0.append(self.mesh.face_handle(he)) - i += 1 - for v in self.mesh.vertices(): - for f in self.mesh.vf(v): - fh1.append(f) - - self.assertEqual(len(fh0), len(fh1)) - for i in range(len(fh0)): - self.assertEqual(fh0[i], fh1[i]) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(TrimeshCirculatorCurrentHalfedgeHandleReplacement) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_trimesh_circulator_face_edge.py b/src/Python/Unittests/test_trimesh_circulator_face_edge.py deleted file mode 100644 index 91df16a7..00000000 --- a/src/Python/Unittests/test_trimesh_circulator_face_edge.py +++ /dev/null @@ -1,50 +0,0 @@ -import unittest -import openmesh - -class TriMeshCirculatorFaceEdge(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - # Add some vertices - self.vhandle = [] - - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(3, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(4, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2,-1, 0))) - - # Add four faces - self.mesh.add_face(self.vhandle[0], self.vhandle[1], self.vhandle[2]) - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[3]) - self.mesh.add_face(self.vhandle[2], self.vhandle[3], self.vhandle[4]) - self.mesh.add_face(self.vhandle[1], self.vhandle[5], self.vhandle[3]) - - ''' - Test setup: - 0 ------ 2 ------ 4 - \ / \ / - \ 0 / \ 2 / - \ / 1 \ / - 1 ------- 3 - \ / - \ 3 / - \ / - \ / - 5 - ''' - - def test_face_edge_iter_without_holes_increment(self): - # Iterate around face 1 at the middle - fe_it = openmesh.FaceEdgeIter(self.mesh, self.mesh.face_handle(1)) - self.assertEqual(fe_it.__next__().idx(), 4) - self.assertEqual(fe_it.__next__().idx(), 1) - self.assertEqual(fe_it.__next__().idx(), 3) - self.assertRaises(StopIteration, fe_it.__next__) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(TriMeshCirculatorFaceEdge) - unittest.TextTestRunner(verbosity=2).run(suite) \ No newline at end of file diff --git a/src/Python/Unittests/test_trimesh_circulator_face_face.py b/src/Python/Unittests/test_trimesh_circulator_face_face.py deleted file mode 100644 index 293c39c2..00000000 --- a/src/Python/Unittests/test_trimesh_circulator_face_face.py +++ /dev/null @@ -1,156 +0,0 @@ -import unittest -import openmesh - -class TrimeshCirculatorFaceFace(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - self.vhandle = [] - - def test_face_face_iter_with_holes(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(3, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(4, 1, 0))) - - # Add three faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # - # 0 ------ 2 ------ 4 - # \ / \ / - # \ 0 / \ 2 / - # \ / 1 \ / - # 1 ------- 3 - - ff_it = self.mesh.ff(self.mesh.face_handle(1)) - - self.assertEqual(ff_it.__next__().idx(), 2) - self.assertEqual(ff_it.__next__().idx(), 0) - self.assertRaises(StopIteration, ff_it.__next__) - - def test_face_face_iter_without_holes(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(3, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(4, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, -1, 0))) - - # Add four faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # - # 0 ------ 2 ------ 4 - # \ / \ / - # \ 0 / \ 2 / - # \ / 1 \ / - # 1 ------- 3 - # \ / - # \ 3 / - # \ / - # \ / - # 5 - - ff_it = self.mesh.ff(self.mesh.face_handle(1)) - - self.assertEqual(ff_it.__next__().idx(), 2) - self.assertEqual(ff_it.__next__().idx(), 0) - self.assertEqual(ff_it.__next__().idx(), 3) - self.assertRaises(StopIteration, ff_it.__next__) - - def test_face_face_iter_without_holes(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - - # Add two faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - fh1 = self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[2]) - fh2 = self.mesh.add_face(face_vhandles) - - # Test setup: - # - # 1 -------- 2 - # | f0 / | - # | / f1 | - # 0 -------- 3 - - # Check setup - self.assertEqual(self.mesh.n_vertices(), 4) - self.assertEqual(self.mesh.n_faces(), 2) - - face_iter = self.mesh.ff(fh1) - - # Get the face via the handle - faceHandle1 = face_iter.__next__() - face1 = self.mesh.face(faceHandle1) - - self.assertEqual(faceHandle1.idx(), 1) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(TrimeshCirculatorFaceFace) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_trimesh_circulator_face_halfedge.py b/src/Python/Unittests/test_trimesh_circulator_face_halfedge.py deleted file mode 100644 index 2da994ed..00000000 --- a/src/Python/Unittests/test_trimesh_circulator_face_halfedge.py +++ /dev/null @@ -1,50 +0,0 @@ -import unittest -import openmesh - -class TriMeshCirculatorFaceHalfEdge(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - # Add some vertices - self.vhandle = [] - - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(3, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(4, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2,-1, 0))) - - # Add four faces - self.mesh.add_face(self.vhandle[0], self.vhandle[1], self.vhandle[2]) - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[3]) - self.mesh.add_face(self.vhandle[2], self.vhandle[3], self.vhandle[4]) - self.mesh.add_face(self.vhandle[1], self.vhandle[5], self.vhandle[3]) - - ''' - Test setup: - 0 ------ 2 ------ 4 - \ / \ / - \ 0 / \ 2 / - \ / 1 \ / - 1 ------- 3 - \ / - \ 3 / - \ / - \ / - 5 - ''' - - def test_face_halfedge_iter_without_holes_increment(self): - # Iterate around face 1 at the middle - fh_it = openmesh.FaceHalfedgeIter(self.mesh, self.mesh.face_handle(1)) - self.assertEqual(fh_it.__next__().idx(), 8) - self.assertEqual(fh_it.__next__().idx(), 3) - self.assertEqual(fh_it.__next__().idx(), 6) - self.assertRaises(StopIteration, fh_it.__next__) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(TriMeshCirculatorFaceHalfEdge) - unittest.TextTestRunner(verbosity=2).run(suite) \ No newline at end of file diff --git a/src/Python/Unittests/test_trimesh_circulator_face_vertex.py b/src/Python/Unittests/test_trimesh_circulator_face_vertex.py deleted file mode 100644 index 68161bcf..00000000 --- a/src/Python/Unittests/test_trimesh_circulator_face_vertex.py +++ /dev/null @@ -1,48 +0,0 @@ -import unittest -import openmesh - -class TriMeshCirculatorFaceVertex(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - # Add some vertices - self.vhandle = [] - - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0,-1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2,-1, 0))) - - # Add four faces - self.fh0 = self.mesh.add_face(self.vhandle[0], self.vhandle[1], self.vhandle[2]) - self.mesh.add_face(self.vhandle[1], self.vhandle[3], self.vhandle[4]) - self.mesh.add_face(self.vhandle[0], self.vhandle[3], self.vhandle[1]) - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[4]) - - ''' - Test setup: - 0 ==== 2 - |\ 0 /| - | \ / | - |2 1 3| - | / \ | - |/ 1 \| - 3 ==== 4 - ''' - - def test_face_vertex_iter_without_increment(self): - self.assertEqual(self.fh0.idx(), 0) - - # Iterate around face 0 at the top - fv_it = openmesh.FaceVertexIter(self.mesh, self.fh0) - self.assertEqual(fv_it.__next__().idx(), 0) - self.assertEqual(fv_it.__next__().idx(), 1) - self.assertEqual(fv_it.__next__().idx(), 2) - self.assertRaises(StopIteration, fv_it.__next__) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(TriMeshCirculatorFaceVertex) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_trimesh_circulator_halfedge_loop.py b/src/Python/Unittests/test_trimesh_circulator_halfedge_loop.py deleted file mode 100644 index 794f7646..00000000 --- a/src/Python/Unittests/test_trimesh_circulator_halfedge_loop.py +++ /dev/null @@ -1,131 +0,0 @@ -import unittest -import openmesh - -class TrimeshCirculatorHalfedgeLoop(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - self.vhandle = [] - - def test_halfedge_loop_with_face(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(3, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(4, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, -1, 0))) - - # Add four faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # - # edge x => halfedge x/x+1 - # i.e. edge 0 => halfedge 0/1 - # - # 0 --4--- 2 ------ 4 - # \ / \ / - # 0 0 2 6 2 / - # \ / 1 \ / - # 1 ---8--- 3 - # \ / - # \ 3 / - # \ / - # \ / - # 5 - - # Circle around face 1 - hl_it = self.mesh.hl(self.mesh.halfedge_handle(3)) - - self.assertEqual(hl_it.__next__().idx(), 3) - self.assertEqual(hl_it.__next__().idx(), 6) - self.assertEqual(hl_it.__next__().idx(), 8) - self.assertRaises(StopIteration, hl_it.__next__) - - def test_halfedge_loop_without_face(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(3, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(4, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, -1, 0))) - - # Add three faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # - # H => hole (no face) - # fx => face #x - # edge 0 => halfedge 0/1 - # - # 0 --4--- 2 -10--- 4 - # \ / \ / - # 0 f0 2 6 f2 8 - # \ / H \ / - # 1 ---16---3 - # \ / - # 12 f3 14 - # \ / - # \ / - # 5 - - # Circle around the hole - hl_it = self.mesh.hl(self.mesh.halfedge_handle(3)) - - self.assertEqual(hl_it.__next__().idx(), 3) - self.assertEqual(hl_it.__next__().idx(), 17) - self.assertEqual(hl_it.__next__().idx(), 7) - self.assertRaises(StopIteration, hl_it.__next__) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(TrimeshCirculatorHalfedgeLoop) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_trimesh_circulator_vertex_edge.py b/src/Python/Unittests/test_trimesh_circulator_vertex_edge.py deleted file mode 100644 index 5792e472..00000000 --- a/src/Python/Unittests/test_trimesh_circulator_vertex_edge.py +++ /dev/null @@ -1,55 +0,0 @@ -import unittest -import openmesh - -class TriMeshCirculatorVertexEdge(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - # Add some vertices - self.vhandle = [] - - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0,-1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2,-1, 0))) - - # Add four faces - self.mesh.add_face(self.vhandle[0], self.vhandle[1], self.vhandle[2]) - self.mesh.add_face(self.vhandle[1], self.vhandle[3], self.vhandle[4]) - self.mesh.add_face(self.vhandle[0], self.vhandle[3], self.vhandle[1]) - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[4]) - - ''' - Test setup: - 0 ==== 2 - |\ 0 /| - | \ / | - |2 1 3| - | / \ | - |/ 1 \| - 3 ==== 4 - ''' - - def test_vertex_edge_iter_without_holes_increment(self): - # Iterate around vertex 1 at the middle - ve_it = openmesh.VertexEdgeIter(self.mesh, self.vhandle[1]) - self.assertEqual(ve_it.__next__().idx(), 5) - self.assertEqual(ve_it.__next__().idx(), 3) - self.assertEqual(ve_it.__next__().idx(), 0) - self.assertEqual(ve_it.__next__().idx(), 1) - self.assertRaises(StopIteration, ve_it.__next__) - - def test_vertex_edge_iter_boundary_increment(self): - # Iterate around vertex 2 at the boundary - ve_it = openmesh.VertexEdgeIter(self.mesh, self.vhandle[2]) - self.assertEqual(ve_it.__next__().idx(), 7) - self.assertEqual(ve_it.__next__().idx(), 1) - self.assertEqual(ve_it.__next__().idx(), 2) - self.assertRaises(StopIteration, ve_it.__next__) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(TriMeshCirculatorVertexEdge) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_trimesh_circulator_vertex_face.py b/src/Python/Unittests/test_trimesh_circulator_vertex_face.py deleted file mode 100644 index 4a58f0f7..00000000 --- a/src/Python/Unittests/test_trimesh_circulator_vertex_face.py +++ /dev/null @@ -1,93 +0,0 @@ -import unittest -import openmesh - -class TriMeshCirculatorVertexFace(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - # Add some vertices - self.vhandle = [] - - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0,-1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2,-1, 0))) - - def test_vertex_face_iter_with_holes_increment(self): - # Add two faces - self.mesh.add_face(self.vhandle[0], self.vhandle[1], self.vhandle[2]) - self.mesh.add_face(self.vhandle[1], self.vhandle[3], self.vhandle[4]) - - ''' - Test setup: - 0 ==== 2 - \ / - \ / - 1 - / \ - / \ - 3 ==== 4 - ''' - - # Iterate around vertex 1 at the middle (with holes in between) - vf_it = openmesh.VertexFaceIter(self.mesh, self.vhandle[1]) - self.assertEqual(vf_it.__next__().idx(), 0) - self.assertEqual(vf_it.__next__().idx(), 1) - self.assertRaises(StopIteration, vf_it.__next__) - - def test_vertex_face_iter_without_holes_increment(self): - # Add four faces - self.mesh.add_face(self.vhandle[0], self.vhandle[1], self.vhandle[2]) - self.mesh.add_face(self.vhandle[1], self.vhandle[3], self.vhandle[4]) - self.mesh.add_face(self.vhandle[0], self.vhandle[3], self.vhandle[1]) - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[4]) - - ''' - Test setup: - 0 ==== 2 - |\ 0 /| - | \ / | - |2 1 3| - | / \ | - |/ 1 \| - 3 ==== 4 - ''' - - # Iterate around vertex 1 at the middle (without holes in between) - vf_it = openmesh.VertexFaceIter(self.mesh, self.vhandle[1]) - self.assertEqual(vf_it.__next__().idx(), 3) - self.assertEqual(vf_it.__next__().idx(), 1) - self.assertEqual(vf_it.__next__().idx(), 2) - self.assertEqual(vf_it.__next__().idx(), 0) - self.assertRaises(StopIteration, vf_it.__next__) - - def test_vertex_face_iter_boundary_increment(self): - # Add four faces - self.mesh.add_face(self.vhandle[0], self.vhandle[1], self.vhandle[2]) - self.mesh.add_face(self.vhandle[1], self.vhandle[3], self.vhandle[4]) - self.mesh.add_face(self.vhandle[0], self.vhandle[3], self.vhandle[1]) - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[4]) - - ''' - Test setup: - 0 ==== 2 - |\ 0 /| - | \ / | - |2 1 3| - | / \ | - |/ 1 \| - 3 ==== 4 - ''' - - # Iterate around vertex 2 at the boundary (without holes in between) - vf_it = openmesh.VertexFaceIter(self.mesh, self.vhandle[2]) - self.assertEqual(vf_it.__next__().idx(), 3) - self.assertEqual(vf_it.__next__().idx(), 0) - self.assertRaises(StopIteration, vf_it.__next__) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(TriMeshCirculatorVertexFace) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_trimesh_circulator_vertex_ihalfedge.py b/src/Python/Unittests/test_trimesh_circulator_vertex_ihalfedge.py deleted file mode 100644 index 96b0950f..00000000 --- a/src/Python/Unittests/test_trimesh_circulator_vertex_ihalfedge.py +++ /dev/null @@ -1,80 +0,0 @@ -import unittest -import openmesh - -class TriMeshCirculatorVertexIHalfEdge(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - # Add some vertices - self.vhandle = [] - - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0,-1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2,-1, 0))) - - # Add four faces - self.mesh.add_face(self.vhandle[0], self.vhandle[1], self.vhandle[2]) - self.mesh.add_face(self.vhandle[1], self.vhandle[3], self.vhandle[4]) - self.mesh.add_face(self.vhandle[0], self.vhandle[3], self.vhandle[1]) - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[4]) - - ''' - Test setup: - 0 ==== 2 - |\ 0 /| - | \ / | - |2 1 3| - | / \ | - |/ 1 \| - 3 ==== 4 - Starting halfedge is 1->4 - ''' - - def test_vertex_incoming_halfedge_without_holes_increment(self): - # Iterate around vertex 1 at the middle - vih_it = openmesh.VertexIHalfedgeIter(self.mesh, self.vhandle[1]) - heh = vih_it.__next__() - self.assertEqual(heh.idx(), 10) - self.assertEqual(self.mesh.face_handle(heh).idx(), 1) - heh = vih_it.__next__() - self.assertEqual(heh.idx(), 7) - self.assertEqual(self.mesh.face_handle(heh).idx(), 2) - heh = vih_it.__next__() - self.assertEqual(heh.idx(), 0) - self.assertEqual(self.mesh.face_handle(heh).idx(), 0) - heh = vih_it.__next__() - self.assertEqual(heh.idx(), 3) - self.assertEqual(self.mesh.face_handle(heh).idx(), 3) - self.assertRaises(StopIteration, vih_it.__next__) - - def test_vertex_incoming_halfedge_boundary_increment(self): - # Iterate around vertex 2 at the boundary - vih_it = openmesh.VertexIHalfedgeIter(self.mesh, self.vhandle[2]) - heh = vih_it.__next__() - self.assertEqual(heh.idx(), 14) - self.assertEqual(self.mesh.face_handle(heh).idx(), 3) - heh = vih_it.__next__() - self.assertEqual(heh.idx(), 2) - self.assertEqual(self.mesh.face_handle(heh).idx(), 0) - heh = vih_it.__next__() - self.assertEqual(heh.idx(), 5) - self.assertEqual(self.mesh.face_handle(heh).idx(), -1) - self.assertRaises(StopIteration, vih_it.__next__) - - def test_vertex_incoming_halfedge_dereference_increment(self): - # Iterate around vertex 1 at the middle - vih_it = openmesh.VertexIHalfedgeIter(self.mesh, self.vhandle[1]) - heh = vih_it.__next__() - eh = self.mesh.edge_handle(heh) - vh = self.mesh.to_vertex_handle(heh) - self.assertEqual(heh.idx(), 10) - self.assertEqual(eh.idx(), 5) - self.assertEqual(vh.idx(), 1) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(TriMeshCirculatorVertexIHalfEdge) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_trimesh_circulator_vertex_ohalfedge.py b/src/Python/Unittests/test_trimesh_circulator_vertex_ohalfedge.py deleted file mode 100644 index 2d68a6be..00000000 --- a/src/Python/Unittests/test_trimesh_circulator_vertex_ohalfedge.py +++ /dev/null @@ -1,80 +0,0 @@ -import unittest -import openmesh - -class TriMeshCirculatorVertexOHalfEdge(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - # Add some vertices - self.vhandle = [] - - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0,-1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2,-1, 0))) - - # Add four faces - self.mesh.add_face(self.vhandle[0], self.vhandle[1], self.vhandle[2]) - self.mesh.add_face(self.vhandle[1], self.vhandle[3], self.vhandle[4]) - self.mesh.add_face(self.vhandle[0], self.vhandle[3], self.vhandle[1]) - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[4]) - - ''' - Test setup: - 0 ==== 2 - |\ 0 /| - | \ / | - |2 1 3| - | / \ | - |/ 1 \| - 3 ==== 4 - Starting halfedge is 1->4 - ''' - - def test_vertex_outgoing_halfedge_without_holes_increment(self): - # Iterate around vertex 1 at the middle - voh_it = openmesh.VertexOHalfedgeIter(self.mesh, self.vhandle[1]) - heh = voh_it.__next__() - self.assertEqual(heh.idx(), 11) - self.assertEqual(self.mesh.face_handle(heh).idx(), 3) - heh = voh_it.__next__() - self.assertEqual(heh.idx(), 6) - self.assertEqual(self.mesh.face_handle(heh).idx(), 1) - heh = voh_it.__next__() - self.assertEqual(heh.idx(), 1) - self.assertEqual(self.mesh.face_handle(heh).idx(), 2) - heh = voh_it.__next__() - self.assertEqual(heh.idx(), 2) - self.assertEqual(self.mesh.face_handle(heh).idx(), 0) - self.assertRaises(StopIteration, voh_it.__next__) - - def test_vertex_outgoing_halfedge_boundary_increment(self): - # Iterate around vertex 2 at the boundary - voh_it = openmesh.VertexOHalfedgeIter(self.mesh, self.vhandle[2]) - heh = voh_it.__next__() - self.assertEqual(heh.idx(), 15) - self.assertEqual(self.mesh.face_handle(heh).idx(), -1) - heh = voh_it.__next__() - self.assertEqual(heh.idx(), 3) - self.assertEqual(self.mesh.face_handle(heh).idx(), 3) - heh = voh_it.__next__() - self.assertEqual(heh.idx(), 4) - self.assertEqual(self.mesh.face_handle(heh).idx(), 0) - self.assertRaises(StopIteration, voh_it.__next__) - - def test_vertex_outgoing_halfedge_dereference_increment(self): - # Iterate around vertex 1 at the middle - voh_it = openmesh.VertexOHalfedgeIter(self.mesh, self.vhandle[1]) - heh = voh_it.__next__() - eh = self.mesh.edge_handle(heh) - vh = self.mesh.to_vertex_handle(heh) - self.assertEqual(heh.idx(), 11) - self.assertEqual(eh.idx(), 5) - self.assertEqual(vh.idx(), 4) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(TriMeshCirculatorVertexOHalfEdge) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_trimesh_circulator_vertex_vertex.py b/src/Python/Unittests/test_trimesh_circulator_vertex_vertex.py deleted file mode 100644 index c0d10d7d..00000000 --- a/src/Python/Unittests/test_trimesh_circulator_vertex_vertex.py +++ /dev/null @@ -1,56 +0,0 @@ -import unittest -import openmesh - -class TriMeshCirculatorVertexVertex(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - # Add some vertices - self.vhandle = [] - - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0,-1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2,-1, 0))) - - # Add four faces - self.mesh.add_face(self.vhandle[0], self.vhandle[1], self.vhandle[2]) - self.mesh.add_face(self.vhandle[1], self.vhandle[3], self.vhandle[4]) - self.mesh.add_face(self.vhandle[0], self.vhandle[3], self.vhandle[1]) - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[4]) - - ''' - Test setup: - 0 ==== 2 - |\ 0 /| - | \ / | - |2 1 3| - | / \ | - |/ 1 \| - 3 ==== 4 - Starting vertex is 1->4 - ''' - - def test_vertex_vertex_increment(self): - # Iterate around vertex 1 at the middle - vv_it = openmesh.VertexVertexIter(self.mesh, self.vhandle[1]) - self.assertEqual(vv_it.__next__().idx(), 4) - self.assertEqual(vv_it.__next__().idx(), 3) - self.assertEqual(vv_it.__next__().idx(), 0) - self.assertEqual(vv_it.__next__().idx(), 2) - self.assertRaises(StopIteration, vv_it.__next__) - - def test_vertex_vertex_boundary_increment(self): - # Iterate around vertex 2 at the boundary - vv_it = openmesh.VertexVertexIter(self.mesh, self.vhandle[2]) - self.assertEqual(vv_it.__next__().idx(), 4) - self.assertEqual(vv_it.__next__().idx(), 1) - self.assertEqual(vv_it.__next__().idx(), 0) - self.assertRaises(StopIteration, vv_it.__next__) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(TriMeshCirculatorVertexVertex) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_trimesh_collapse.py b/src/Python/Unittests/test_trimesh_collapse.py deleted file mode 100644 index 8c3a48c8..00000000 --- a/src/Python/Unittests/test_trimesh_collapse.py +++ /dev/null @@ -1,516 +0,0 @@ -import unittest -import openmesh - -class Collapse(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - self.vhandle = [] - - def test_collapse_quad_with_center(self): - - # 0--------1 - # |\ /| - # | \ / | - # | \ / | - # | 2 | - # | / \ | - # | / \ | - # 3--------4 - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 2, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(2, 2, 0))) - - # Add four faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[4]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[4]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - self.mesh.request_vertex_status() - self.mesh.request_edge_status() - self.mesh.request_face_status() - - # Get the halfedge - v2v1 = self.mesh.find_halfedge(self.vhandle[2], self.vhandle[1]) - - self.assertTrue(v2v1.is_valid()) - self.assertTrue(self.mesh.is_collapse_ok(v2v1)) - - # Execute it as a crash test - self.mesh.collapse(v2v1) - - def test_collapse_tetrahedron_complex(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - - # Add four faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[0]) - self.mesh.add_face(face_vhandles) - - self.mesh.request_vertex_status() - self.mesh.request_edge_status() - self.mesh.request_face_status() - - v0v1 = self.mesh.halfedge_handle(0) - v1v0 = self.mesh.opposite_halfedge_handle(v0v1) - - v1vL = self.mesh.next_halfedge_handle(v0v1) - vLv1 = self.mesh.opposite_halfedge_handle(v1vL) - vLv0 = self.mesh.next_halfedge_handle(v1vL) - v0vL = self.mesh.opposite_halfedge_handle(vLv0) - - vLvR = self.mesh.next_halfedge_handle(v0vL) - vRvL = self.mesh.opposite_halfedge_handle(vLvR) - - v0vR = self.mesh.next_halfedge_handle(v1v0) - vRv0 = self.mesh.opposite_halfedge_handle(v0vR) - vRv1 = self.mesh.next_halfedge_handle(v0vR) - v1vR = self.mesh.opposite_halfedge_handle(vRv1) - - v0 = self.mesh.from_vertex_handle(v0v1) - v1 = self.mesh.to_vertex_handle(v0v1) - vL = self.mesh.to_vertex_handle(self.mesh.next_halfedge_handle(v0v1)) - vR = self.mesh.to_vertex_handle(self.mesh.next_halfedge_handle(v1v0)) - - # =================================================================== - # Check preconditions - # =================================================================== - - self.assertTrue(self.mesh.is_collapse_ok(v0v1)) - self.assertTrue(self.mesh.is_collapse_ok(v1v0)) - - # Test the Vertex indices - self.assertEqual(v0.idx(), 0) - self.assertEqual(v1.idx(), 1) - self.assertEqual(vL.idx(), 2) - self.assertEqual(vR.idx(), 3) - - # Check the halfedges - self.assertEqual(v0v1.idx(), 0) - self.assertEqual(v1v0.idx(), 1) - - self.assertEqual(v1vL.idx(), 2) - self.assertEqual(vLv1.idx(), 3) - self.assertEqual(vLv0.idx(), 4) - self.assertEqual(v0vL.idx(), 5) - - self.assertEqual(vLvR.idx(), 6) - self.assertEqual(vRvL.idx(), 7) - - self.assertEqual(vRv0.idx(), 8) - self.assertEqual(v0vR.idx(), 9) - - self.assertEqual(v1vR.idx(), 10) - self.assertEqual(vRv1.idx(), 11) - - # =================================================================== - # Execute collapse - # =================================================================== - - self.mesh.collapse(v0v1) - - # =================================================================== - # Check configuration afterwards - # =================================================================== - - # Now the configuration should look like this: - # The numbers at the side denote the halfedges - # 1 - # / \ - # / \ - # // \\ - # 3/2 11\10 - # // \\ - # / 6--> \ - # 2 ----------- 3 - # <--7 - - self.assertEqual(self.mesh.n_faces(), 4) - - # Check if the right vertices got deleted - self.assertTrue(self.mesh.status(self.mesh.face_handle(0)).deleted()) - self.assertFalse(self.mesh.status(self.mesh.face_handle(1)).deleted()) - self.assertFalse(self.mesh.status(self.mesh.face_handle(2)).deleted()) - self.assertTrue(self.mesh.status(self.mesh.face_handle(3)).deleted()) - - # Check the vertices of the two remaining faces - fh_1 = self.mesh.face_handle(1) - fh_2 = self.mesh.face_handle(2) - - fv_it = self.mesh.fv(fh_1) - - self.assertTrue(fv_it.__next__().idx(), 1) - self.assertTrue(fv_it.__next__().idx(), 2) - self.assertTrue(fv_it.__next__().idx(), 3) - - fv_it = self.mesh.fv(fh_2) - - self.assertTrue(fv_it.__next__().idx(), 2) - self.assertTrue(fv_it.__next__().idx(), 1) - self.assertTrue(fv_it.__next__().idx(), 3) - - # Get the first halfedge of face 1 - fh_1_he = self.mesh.halfedge_handle(fh_1) - - self.assertEqual(fh_1_he.idx(), 11) - self.assertEqual(self.mesh.to_vertex_handle(fh_1_he).idx(), 1) - - next = self.mesh.next_halfedge_handle(fh_1_he) - self.assertEqual(next.idx(), 2) - self.assertEqual(self.mesh.to_vertex_handle(next).idx(), 2) - - next = self.mesh.next_halfedge_handle(next) - self.assertEqual(next.idx(), 6) - self.assertEqual(self.mesh.to_vertex_handle(next).idx(), 3) - - # Get the first halfedge of face 2 - fh_2_he = self.mesh.halfedge_handle(fh_2) - - self.assertEqual(fh_2_he.idx(), 7) - self.assertEqual(self.mesh.to_vertex_handle(fh_2_he).idx(), 2) - - next = self.mesh.next_halfedge_handle(fh_2_he) - self.assertEqual(next.idx(), 3) - self.assertEqual(self.mesh.to_vertex_handle(next).idx(), 1) - - next = self.mesh.next_halfedge_handle(next) - self.assertEqual(next.idx(), 10) - self.assertEqual(self.mesh.to_vertex_handle(next).idx(), 3) - - # Vertex 1 outgoing - voh_it = self.mesh.voh(self.mesh.vertex_handle(1)) - self.assertEqual(voh_it.__next__().idx(), 10) - self.assertEqual(voh_it.__next__().idx(), 2) - self.assertRaises(StopIteration, voh_it.__next__) - - # Vertex 2 outgoing - voh_it = self.mesh.voh(self.mesh.vertex_handle(2)) - self.assertEqual(voh_it.__next__().idx(), 3) - self.assertEqual(voh_it.__next__().idx(), 6) - self.assertRaises(StopIteration, voh_it.__next__) - - # Vertex 2 outgoing - voh_it = self.mesh.voh(self.mesh.vertex_handle(3)) - self.assertEqual(voh_it.__next__().idx(), 11) - self.assertEqual(voh_it.__next__().idx(), 7) - self.assertRaises(StopIteration, voh_it.__next__) - - # =================================================================== - # Cleanup - # =================================================================== - self.mesh.garbage_collection() - - # =================================================================== - # Check configuration afterwards - # =================================================================== - - # Now the configuration should look like this: - # The numbers at the side denote the halfedges - # 0 - # / \ - # / \ - # // \\ - # 4/5 0\1 - # // \\ - # / 3--> \ - # 2 ----------- 1 - # <--2 - - self.assertEqual(self.mesh.n_faces(), 2) - - # Check the vertices of the two remaining faces - fh_0 = self.mesh.face_handle(0) - fh_1 = self.mesh.face_handle(1) - - fv_it = self.mesh.fv(fh_0) - - self.assertEqual(fv_it.__next__().idx(), 2) - self.assertEqual(fv_it.__next__().idx(), 1) - self.assertEqual(fv_it.__next__().idx(), 0) - - fv_it = self.mesh.fv(fh_1) - - self.assertEqual(fv_it.__next__().idx(), 1) - self.assertEqual(fv_it.__next__().idx(), 2) - self.assertEqual(fv_it.__next__().idx(), 0) - - # Get the first halfedge of face 1 - fh_0_he = self.mesh.halfedge_handle(fh_0) - - self.assertEqual(fh_0_he.idx(), 5) - self.assertEqual(self.mesh.to_vertex_handle(fh_0_he).idx(), 2) - - next = self.mesh.next_halfedge_handle(fh_0_he) - self.assertEqual(next.idx(), 3) - self.assertEqual(self.mesh.to_vertex_handle(next).idx(), 1) - - next = self.mesh.next_halfedge_handle(next) - self.assertEqual(next.idx(), 0) - self.assertEqual(self.mesh.to_vertex_handle(next).idx(), 0) - - # Get the first halfedge of face 1 - fh_1_he = self.mesh.halfedge_handle(fh_1) - - self.assertEqual(fh_1_he.idx(), 1) - self.assertEqual(self.mesh.to_vertex_handle(fh_1_he).idx(), 1) - - next = self.mesh.next_halfedge_handle(fh_1_he) - self.assertEqual(next.idx(), 2) - self.assertEqual(self.mesh.to_vertex_handle(next).idx(), 2) - - next = self.mesh.next_halfedge_handle(next) - self.assertEqual(next.idx(), 4) - self.assertEqual(self.mesh.to_vertex_handle(next).idx(), 0) - - # Vertex 0 outgoing - voh_it = self.mesh.voh(self.mesh.vertex_handle(0)) - self.assertEqual(voh_it.__next__().idx(), 1) - self.assertEqual(voh_it.__next__().idx(), 5) - self.assertRaises(StopIteration, voh_it.__next__) - - # Vertex 1 outgoing - voh_it = self.mesh.voh(self.mesh.vertex_handle(1)) - self.assertEqual(voh_it.__next__().idx(), 0) - self.assertEqual(voh_it.__next__().idx(), 2) - self.assertRaises(StopIteration, voh_it.__next__) - - # Vertex 2 outgoing - voh_it = self.mesh.voh(self.mesh.vertex_handle(2)) - self.assertEqual(voh_it.__next__().idx(), 3) - self.assertEqual(voh_it.__next__().idx(), 4) - self.assertRaises(StopIteration, voh_it.__next__) - - self.assertFalse(self.mesh.is_collapse_ok(self.mesh.halfedge_handle(0))) - self.assertFalse(self.mesh.is_collapse_ok(self.mesh.halfedge_handle(1))) - self.assertFalse(self.mesh.is_collapse_ok(self.mesh.halfedge_handle(2))) - self.assertFalse(self.mesh.is_collapse_ok(self.mesh.halfedge_handle(3))) - self.assertFalse(self.mesh.is_collapse_ok(self.mesh.halfedge_handle(4))) - self.assertFalse(self.mesh.is_collapse_ok(self.mesh.halfedge_handle(5))) - - def test_collapse_tetrahedron(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 0, -1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 0, 0))) - - # Add six faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[4]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[4]) - face_vhandles.append(self.vhandle[0]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[4]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[0]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - self.mesh.request_vertex_status() - self.mesh.request_edge_status() - self.mesh.request_face_status() - - # ============================================= - # Collapse halfedge from 0 to 4 - # ============================================= - - heh_collapse1 = self.mesh.halfedge_handle(0) - - self.assertEqual(self.mesh.to_vertex_handle(heh_collapse1).idx(), 4) - self.assertEqual(self.mesh.from_vertex_handle(heh_collapse1).idx(), 0) - - self.assertTrue(self.mesh.is_collapse_ok(heh_collapse1)) - self.mesh.collapse(heh_collapse1) - - heh_collapse2 = self.mesh.halfedge_handle(2) - - self.assertEqual(self.mesh.to_vertex_handle(heh_collapse2).idx(), 2) - self.assertEqual(self.mesh.from_vertex_handle(heh_collapse2).idx(), 4) - - self.assertTrue(self.mesh.is_collapse_ok(heh_collapse2)) - self.mesh.collapse(heh_collapse2) - - heh_collapse3 = self.mesh.halfedge_handle(6) - - self.assertEqual(self.mesh.to_vertex_handle(heh_collapse3).idx(), 2) - self.assertEqual(self.mesh.from_vertex_handle(heh_collapse3).idx(), 3) - - self.assertFalse(self.mesh.is_collapse_ok(heh_collapse3)) - - def test_large_collapse_halfedge(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 2, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 0, -1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 2, -1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 3, 0, 0))) - - # Add six faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[1]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[5]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[4]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[4]) - face_vhandles.append(self.vhandle[6]) - self.mesh.add_face(face_vhandles) - - # Test setup: - # 0 ==== 2 - # / \ /|\ - # / \ / | \ - # 5 --- 1 | 6 - # \ / \ | / - # \ / \|/ - # 3 ==== 4 - - # Request the status bits - self.mesh.request_vertex_status() - self.mesh.request_edge_status() - self.mesh.request_face_status() - - # ============================================= - # Collapse halfedge from 1 to 4 - # ============================================= - - heh_collapse = openmesh.HalfedgeHandle() - - for he in self.mesh.halfedges(): - if self.mesh.from_vertex_handle(he).idx() == 1 and self.mesh.to_vertex_handle(he).idx() == 4: - heh_collapse = he - - # Check our halfedge - self.assertEqual(self.mesh.to_vertex_handle(heh_collapse).idx(), 4) - self.assertEqual(self.mesh.from_vertex_handle(heh_collapse).idx(), 1) - self.assertTrue(self.mesh.is_collapse_ok(heh_collapse)) - - # Remember the end vertices - vh_from = self.mesh.from_vertex_handle(heh_collapse) - vh_to = self.mesh.to_vertex_handle(heh_collapse) - - # Collapse it - self.mesh.collapse(heh_collapse) - - self.assertTrue(self.mesh.status(vh_from).deleted()) - self.assertFalse(self.mesh.status(vh_to).deleted()) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(Collapse) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_trimesh_garbage_collection.py b/src/Python/Unittests/test_trimesh_garbage_collection.py deleted file mode 100644 index 07c820b2..00000000 --- a/src/Python/Unittests/test_trimesh_garbage_collection.py +++ /dev/null @@ -1,168 +0,0 @@ -import unittest -import openmesh - -class TriMeshGarbageCollection(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - self.mesh.request_vertex_status() - self.mesh.request_edge_status() - self.mesh.request_halfedge_status() - self.mesh.request_face_status() - - # Add some vertices - self.vhandle = [] - - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, -1))) - - # Add six faces to form a cube - self.mesh.add_face(self.vhandle[0], self.vhandle[1], self.vhandle[3]) - self.mesh.add_face(self.vhandle[1], self.vhandle[2], self.vhandle[3]) - self.mesh.add_face(self.vhandle[7], self.vhandle[6], self.vhandle[5]) - self.mesh.add_face(self.vhandle[7], self.vhandle[5], self.vhandle[4]) - self.mesh.add_face(self.vhandle[1], self.vhandle[0], self.vhandle[4]) - self.mesh.add_face(self.vhandle[1], self.vhandle[4], self.vhandle[5]) - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[5]) - self.mesh.add_face(self.vhandle[2], self.vhandle[5], self.vhandle[6]) - self.mesh.add_face(self.vhandle[3], self.vhandle[2], self.vhandle[6]) - self.mesh.add_face(self.vhandle[3], self.vhandle[6], self.vhandle[7]) - self.mesh.add_face(self.vhandle[0], self.vhandle[3], self.vhandle[7]) - self.mesh.add_face(self.vhandle[0], self.vhandle[7], self.vhandle[4]) - - # Test setup: - # - # 3 ======== 2 - # / /| - # / / | z - # 0 ======== 1 | | - # | | | | y - # | 7 | 6 | / - # | | / | / - # | |/ |/ - # 4 ======== 5 -------> x - - def test_standard_garbage_collection(self): - # Check setup - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 12) - - self.mesh.delete_vertex(self.vhandle[0]) - - # Check setup - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 12) - - self.mesh.garbage_collection() - - # Check setup - self.assertEqual(self.mesh.n_vertices(), 7) - self.assertEqual(self.mesh.n_faces(), 8) - - def test_tracked_garbage_collection(self): - # Check setup - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 12) - - #================================================== - # Create lists containing the current handles - #================================================== - - vertexHandles = [] - for v in self.mesh.vertices(): - vertexHandles.append(v) - - halfedgeHandles = [] - for he in self.mesh.halfedges(): - halfedgeHandles.append(he) - - faceHandles = [] - for f in self.mesh.faces(): - faceHandles.append(f) - - # Deleting vertex 0 - self.mesh.delete_vertex(self.vhandle[0]) - - # Check setup - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 12) - - self.mesh.garbage_collection(vertexHandles, halfedgeHandles, faceHandles, True, True, True) - - # Check setup - self.assertEqual(self.mesh.n_vertices(), 7) - self.assertEqual(self.mesh.n_faces(), 8) - - # Check setup of vertices - self.assertEqual(vertexHandles[0].idx(), -1) - self.assertEqual(vertexHandles[1].idx(), 1) - self.assertEqual(vertexHandles[2].idx(), 2) - self.assertEqual(vertexHandles[3].idx(), 3) - self.assertEqual(vertexHandles[4].idx(), 4) - self.assertEqual(vertexHandles[5].idx(), 5) - self.assertEqual(vertexHandles[6].idx(), 6) - self.assertEqual(vertexHandles[7].idx(), 0) - - # Check setup of halfedge handles - self.assertEqual(halfedgeHandles[0 ].idx(), -1) - self.assertEqual(halfedgeHandles[1 ].idx(), -1) - self.assertEqual(halfedgeHandles[2 ].idx(), 2) - self.assertEqual(halfedgeHandles[3 ].idx(), 3) - self.assertEqual(halfedgeHandles[4 ].idx(), -1) - self.assertEqual(halfedgeHandles[5 ].idx(), -1) - self.assertEqual(halfedgeHandles[6 ].idx(), 6) - self.assertEqual(halfedgeHandles[7 ].idx(), 7) - self.assertEqual(halfedgeHandles[8 ].idx(), 8) - self.assertEqual(halfedgeHandles[9 ].idx(), 9) - self.assertEqual(halfedgeHandles[10].idx(), 10) - self.assertEqual(halfedgeHandles[11].idx(), 11) - self.assertEqual(halfedgeHandles[12].idx(), 12) - self.assertEqual(halfedgeHandles[13].idx(), 13) - self.assertEqual(halfedgeHandles[14].idx(), 14) - self.assertEqual(halfedgeHandles[15].idx(), 15) - self.assertEqual(halfedgeHandles[16].idx(), 16) - self.assertEqual(halfedgeHandles[17].idx(), 17) - self.assertEqual(halfedgeHandles[18].idx(), 18) - self.assertEqual(halfedgeHandles[19].idx(), 19) - self.assertEqual(halfedgeHandles[20].idx(), -1) - self.assertEqual(halfedgeHandles[21].idx(), -1) - self.assertEqual(halfedgeHandles[22].idx(), 22) - self.assertEqual(halfedgeHandles[23].idx(), 23) - self.assertEqual(halfedgeHandles[24].idx(), 24) - self.assertEqual(halfedgeHandles[25].idx(), 25) - self.assertEqual(halfedgeHandles[26].idx(), 26) - self.assertEqual(halfedgeHandles[27].idx(), 27) - self.assertEqual(halfedgeHandles[28].idx(), 20) - self.assertEqual(halfedgeHandles[29].idx(), 21) - self.assertEqual(halfedgeHandles[30].idx(), 4) - self.assertEqual(halfedgeHandles[31].idx(), 5) - self.assertEqual(halfedgeHandles[32].idx(), 0) - self.assertEqual(halfedgeHandles[33].idx(), 1) - self.assertEqual(halfedgeHandles[34].idx(), -1) - self.assertEqual(halfedgeHandles[35].idx(), -1) - - # Check setup of faces - self.assertEqual(faceHandles[0 ].idx(), -1) - self.assertEqual(faceHandles[1 ].idx(), 1) - self.assertEqual(faceHandles[2 ].idx(), 2) - self.assertEqual(faceHandles[3 ].idx(), 3) - self.assertEqual(faceHandles[4 ].idx(), -1) - self.assertEqual(faceHandles[5 ].idx(), 5) - self.assertEqual(faceHandles[6 ].idx(), 6) - self.assertEqual(faceHandles[7 ].idx(), 7) - self.assertEqual(faceHandles[8 ].idx(), 4) - self.assertEqual(faceHandles[9 ].idx(), 0) - self.assertEqual(faceHandles[10].idx(), -1) - self.assertEqual(faceHandles[11].idx(), -1) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(TriMeshGarbageCollection) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_trimesh_iterators.py b/src/Python/Unittests/test_trimesh_iterators.py deleted file mode 100755 index 6bd48c35..00000000 --- a/src/Python/Unittests/test_trimesh_iterators.py +++ /dev/null @@ -1,396 +0,0 @@ -import unittest -import openmesh - -class TriMeshIterators(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - self.vhandle = [] - - def test_vertex_iter(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - - # Add two faces - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[0]) - self.mesh.add_face(self.vhandle[2], self.vhandle[0], self.vhandle[3]) - - # Test setup: - # 1 === 2 - # | / | - # | / | - # | / | - # 0 === 3 - - v_it = self.mesh.vertices() - - self.assertEqual(v_it.__next__().idx(), 0) - self.assertEqual(v_it.__next__().idx(), 1) - self.assertEqual(v_it.__next__().idx(), 2) - self.assertEqual(v_it.__next__().idx(), 3) - - self.assertRaises(StopIteration, v_it.__next__) - - def test_vertex_iter_start_position(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - - # Add two faces - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[0]) - self.mesh.add_face(self.vhandle[2], self.vhandle[0], self.vhandle[3]) - - # Test setup: - # 1 === 2 - # | / | - # | / | - # | / | - # 0 === 3 - - v_it = openmesh.VertexIter(self.mesh, self.mesh.vertex_handle(2)) - - self.assertEqual(v_it.__next__().idx(), 2) - self.assertEqual(v_it.__next__().idx(), 3) - - self.assertRaises(StopIteration, v_it.__next__) - - def test_edge_iter(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - - # Add two faces - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[0]) - self.mesh.add_face(self.vhandle[2], self.vhandle[0], self.vhandle[3]) - - # Test setup: - # 1 === 2 - # | / | - # | / | - # | / | - # 0 === 3 - - e_it = self.mesh.edges() - - e = e_it.__next__() - self.assertEqual(e.idx(), 0) - - he = self.mesh.halfedge_handle(e, 0) - self.assertEqual(self.mesh.to_vertex_handle(he).idx(), 1) - self.assertEqual(self.mesh.from_vertex_handle(he).idx(), 2) - he = self.mesh.halfedge_handle(e, 1) - self.assertEqual(self.mesh.to_vertex_handle(he).idx(), 2) - self.assertEqual(self.mesh.from_vertex_handle(he).idx(), 1) - - e = e_it.__next__() - self.assertEqual(e.idx(), 1) - - he = self.mesh.halfedge_handle(e, 0) - self.assertEqual(self.mesh.to_vertex_handle(he).idx(), 0) - self.assertEqual(self.mesh.from_vertex_handle(he).idx(), 1) - he = self.mesh.halfedge_handle(e, 1) - self.assertEqual(self.mesh.to_vertex_handle(he).idx(), 1) - self.assertEqual(self.mesh.from_vertex_handle(he).idx(), 0) - - e = e_it.__next__() - self.assertEqual(e.idx(), 2) - - he = self.mesh.halfedge_handle(e, 0) - self.assertEqual(self.mesh.to_vertex_handle(he).idx(), 2) - self.assertEqual(self.mesh.from_vertex_handle(he).idx(), 0) - he = self.mesh.halfedge_handle(e, 1) - self.assertEqual(self.mesh.to_vertex_handle(he).idx(), 0) - self.assertEqual(self.mesh.from_vertex_handle(he).idx(), 2) - - e = e_it.__next__() - self.assertEqual(e.idx(), 3) - - he = self.mesh.halfedge_handle(e, 0) - self.assertEqual(self.mesh.to_vertex_handle(he).idx(), 3) - self.assertEqual(self.mesh.from_vertex_handle(he).idx(), 0) - he = self.mesh.halfedge_handle(e, 1) - self.assertEqual(self.mesh.to_vertex_handle(he).idx(), 0) - self.assertEqual(self.mesh.from_vertex_handle(he).idx(), 3) - - e = e_it.__next__() - self.assertEqual(e.idx(), 4) - - he = self.mesh.halfedge_handle(e, 0) - self.assertEqual(self.mesh.to_vertex_handle(he).idx(), 2) - self.assertEqual(self.mesh.from_vertex_handle(he).idx(), 3) - he = self.mesh.halfedge_handle(e, 1) - self.assertEqual(self.mesh.to_vertex_handle(he).idx(), 3) - self.assertEqual(self.mesh.from_vertex_handle(he).idx(), 2) - - def test_halfedge_iter_skipping(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, -1))) - - # Add six faces to form a cube - self.mesh.add_face(self.vhandle[0], self.vhandle[1], self.vhandle[3]) - self.mesh.add_face(self.vhandle[1], self.vhandle[2], self.vhandle[3]) - self.mesh.add_face(self.vhandle[7], self.vhandle[6], self.vhandle[5]) - self.mesh.add_face(self.vhandle[7], self.vhandle[5], self.vhandle[4]) - self.mesh.add_face(self.vhandle[1], self.vhandle[0], self.vhandle[4]) - self.mesh.add_face(self.vhandle[1], self.vhandle[4], self.vhandle[5]) - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[5]) - self.mesh.add_face(self.vhandle[2], self.vhandle[5], self.vhandle[6]) - self.mesh.add_face(self.vhandle[3], self.vhandle[2], self.vhandle[6]) - self.mesh.add_face(self.vhandle[3], self.vhandle[6], self.vhandle[7]) - self.mesh.add_face(self.vhandle[0], self.vhandle[3], self.vhandle[7]) - self.mesh.add_face(self.vhandle[0], self.vhandle[7], self.vhandle[4]) - - # Test setup: - # - # 3 ======== 2 - # / /| - # / / | z - # 0 ======== 1 | | - # | | | | y - # | 7 | 6 | / - # | | / | / - # | |/ |/ - # 4 ======== 5 -------> x - - # Check setup - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_halfedges(), 36) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 12) - - # Run over all halfedges - heCounter = 0 - - self.mesh.request_face_status() - self.mesh.request_vertex_status() - self.mesh.request_halfedge_status() - - # Get second edge - eh = self.mesh.edge_handle(2) - - # Delete one edge - self.mesh.delete_edge(eh) - - # Check setup ( No garbage collection, so nothing should change!) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_halfedges(), 36) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 12) - - # ===================================================== - # Check skipping iterator - # ===================================================== - - ok_4 = True - ok_5 = True - - count = 0 - - for he in self.mesh.shalfedges(): - if he.idx() == 4: - ok_4 = False - if he.idx() == 5: - ok_5 = False - count += 1 - - self.assertEqual(count, 34) - self.assertTrue(ok_4) - self.assertTrue(ok_5) - - # ===================================================== - # Check non skipping iterator - # ===================================================== - - ok_4 = False - ok_5 = False - - count = 0 - - for he in self.mesh.halfedges(): - if he.idx() == 4: - ok_4 = True - if he.idx() == 5: - ok_5 = True - count += 1 - - self.assertEqual(count, 36) - self.assertTrue(ok_4) - self.assertTrue(ok_5) - - def test_halfedge_iter_skipping_low_level(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, 1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, -1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d( 1, 1, -1))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(-1, 1, -1))) - - # Add six faces to form a cube - self.mesh.add_face(self.vhandle[0], self.vhandle[1], self.vhandle[3]) - self.mesh.add_face(self.vhandle[1], self.vhandle[2], self.vhandle[3]) - self.mesh.add_face(self.vhandle[7], self.vhandle[6], self.vhandle[5]) - self.mesh.add_face(self.vhandle[7], self.vhandle[5], self.vhandle[4]) - self.mesh.add_face(self.vhandle[1], self.vhandle[0], self.vhandle[4]) - self.mesh.add_face(self.vhandle[1], self.vhandle[4], self.vhandle[5]) - self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[5]) - self.mesh.add_face(self.vhandle[2], self.vhandle[5], self.vhandle[6]) - self.mesh.add_face(self.vhandle[3], self.vhandle[2], self.vhandle[6]) - self.mesh.add_face(self.vhandle[3], self.vhandle[6], self.vhandle[7]) - self.mesh.add_face(self.vhandle[0], self.vhandle[3], self.vhandle[7]) - self.mesh.add_face(self.vhandle[0], self.vhandle[7], self.vhandle[4]) - - # Test setup: - # - # 3 ======== 2 - # / /| - # / / | z - # 0 ======== 1 | | - # | | | | y - # | 7 | 6 | / - # | | / | / - # | |/ |/ - # 4 ======== 5 -------> x - - # Check setup - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_halfedges(), 36) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 12) - - # Run over all halfedges - heCounter = 0 - - self.mesh.request_face_status() - self.mesh.request_vertex_status() - self.mesh.request_halfedge_status() - - # Get second edge - eh = self.mesh.edge_handle(2) - - # Delete one edge - self.mesh.delete_edge(eh) - - # Check setup ( No garbage collection, so nothing should change!) - self.assertEqual(self.mesh.n_edges(), 18) - self.assertEqual(self.mesh.n_halfedges(), 36) - self.assertEqual(self.mesh.n_vertices(), 8) - self.assertEqual(self.mesh.n_faces(), 12) - - # ===================================================== - # Try to add low level edge with invalid incidents and - # check skipping iterator - # ===================================================== - - # Add a low level edge without handles - eh_test = self.mesh.edge_handle(self.mesh.new_edge(openmesh.VertexHandle(), openmesh.VertexHandle())) - - count = 0 - found_4 = False - found_5 = False - found_36 = False - found_37 = False - - for he in self.mesh.shalfedges(): - if he.idx() == 4: - found_4 = True - if he.idx() == 5: - found_5 = True - if he.idx() == 36: - found_36 = True - if he.idx() == 37: - found_37 = True - count += 1 - - self.assertEqual(count, 36) - self.assertFalse(found_4) - self.assertFalse(found_5) - self.assertTrue(found_36) - self.assertTrue(found_37) - - # ===================================================== - # Try to delete one edge with invalid incidents and - # check skipping iterator - # ===================================================== - - # Delete one edge and recheck (Halfedges 4 and 5) - self.mesh.delete_edge(eh_test) - - count = 0 - found_4 = False - found_5 = False - found_36 = False - found_37 = False - - for he in self.mesh.shalfedges(): - if he.idx() == 4: - found_4 = True - if he.idx() == 5: - found_5 = True - if he.idx() == 36: - found_36 = True - if he.idx() == 37: - found_37 = True - count += 1 - - self.assertEqual(count, 34) - self.assertFalse(found_4) - self.assertFalse(found_5) - self.assertFalse(found_36) - self.assertFalse(found_37) - - def test_face_iter_empty_mesh_one_deleted_face(self): - # Request delete_face capability - self.mesh.request_vertex_status() - self.mesh.request_edge_status() - self.mesh.request_face_status() - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - - # Add one face - fh = self.mesh.add_face(self.vhandle[2], self.vhandle[1], self.vhandle[0]) - - is_delete_isolated_vertex = False - self.mesh.delete_face(fh, is_delete_isolated_vertex) - - # Test setup: - # 1 === 2 - # | / - # | / - # | / - # 0 - - # Normal iterators - f_it = self.mesh.faces() - - self.assertEqual(f_it.__next__().idx(), 0) - self.assertRaises(StopIteration, f_it.__next__) - - # Same with skipping iterators - f_it = self.mesh.sfaces() - - self.assertRaises(StopIteration, f_it.__next__) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(TriMeshIterators) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_trimesh_normal_calculations.py b/src/Python/Unittests/test_trimesh_normal_calculations.py deleted file mode 100644 index 68c8a7dc..00000000 --- a/src/Python/Unittests/test_trimesh_normal_calculations.py +++ /dev/null @@ -1,103 +0,0 @@ -import unittest -import openmesh - -class Normals(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - - # Add some vertices - self.vhandle = [] - - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 1))) - - # Add four faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[0]) - self.mesh.add_face(face_vhandles) - - def test_normal_calculations(self): - # Check one Request only vertex normals - # Face normals are required for vertex and halfedge normals, so - # that prevent access to non existing properties are in place - - self.mesh.request_vertex_normals() - self.mesh.request_halfedge_normals() - - # Check blocks - self.mesh.update_normals() - - # Request required face normals - self.mesh.request_face_normals() - - # Automatically compute all normals - # As only vertex normals are requested and no face normals, this will compute nothing. - self.mesh.update_normals() - - # Face normals alone - self.mesh.update_face_normals() - - # Vertex normals alone (require valid face normals) - self.mesh.update_vertex_normals() - - # Halfedge normals alone (require valid face normals) - self.mesh.update_halfedge_normals() - - def test_calc_vertex_normal_fast(self): - self.mesh.request_vertex_normals() - self.mesh.request_halfedge_normals() - self.mesh.request_face_normals() - - normal = openmesh.Vec3d() - - self.mesh.calc_vertex_normal_fast(self.vhandle[2], normal) - - def test_calc_vertex_normal_correct(self): - self.mesh.request_vertex_normals() - self.mesh.request_halfedge_normals() - self.mesh.request_face_normals() - - normal = openmesh.Vec3d() - - self.mesh.calc_vertex_normal_correct(self.vhandle[2], normal) - - def test_calc_vertex_normal_loop(self): - self.mesh.request_vertex_normals() - self.mesh.request_halfedge_normals() - self.mesh.request_face_normals() - - normal = openmesh.Vec3d() - - self.mesh.calc_vertex_normal_loop(self.vhandle[2], normal) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(Normals) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_trimesh_others.py b/src/Python/Unittests/test_trimesh_others.py deleted file mode 100644 index bd559195..00000000 --- a/src/Python/Unittests/test_trimesh_others.py +++ /dev/null @@ -1,129 +0,0 @@ -import unittest -import openmesh - -from math import pi, fabs - -class Others(unittest.TestCase): - - def setUp(self): - self.mesh = openmesh.TriMesh() - self.vhandle = [] - - def test_is_estimated_feature_edge(self): - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 1))) - - # Add four faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[3]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[0]) - self.mesh.add_face(face_vhandles) - - # =============================================== - # Setup complete - # =============================================== - - - # Check one Request only vertex normals - # Face normals are required for vertex and halfedge normals, so - # that prevent access to non existing properties are in place - - self.mesh.request_vertex_normals() - self.mesh.request_halfedge_normals() - self.mesh.request_face_normals() - - # Automatically compute all normals - # As only vertex normals are requested and no face normals, this will compute nothing. - self.mesh.update_normals() - - he = self.mesh.halfedges().__next__() - - self.assertTrue(self.mesh.is_estimated_feature_edge(he, 0.0)) - self.assertTrue(self.mesh.is_estimated_feature_edge(he, 0.125 * pi)) - self.assertTrue(self.mesh.is_estimated_feature_edge(he, 0.250 * pi)) - self.assertTrue(self.mesh.is_estimated_feature_edge(he, 0.375 * pi)) - self.assertTrue(self.mesh.is_estimated_feature_edge(he, 0.500 * pi)) - self.assertFalse(self.mesh.is_estimated_feature_edge(he, 0.625 * pi)) - self.assertFalse(self.mesh.is_estimated_feature_edge(he, 0.750 * pi)) - self.assertFalse(self.mesh.is_estimated_feature_edge(he, 0.875 * pi)) - self.assertFalse(self.mesh.is_estimated_feature_edge(he, 1.000 * pi)) - - def test_is_estimated_feature_edge(self): - # Test setup: - # 1 -- 2 - # | / | - # | / | - # 0 -- 3 - - # Add some vertices - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 0, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(0, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 1, 0))) - self.vhandle.append(self.mesh.add_vertex(openmesh.Vec3d(1, 0, 0))) - - # Add two faces - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[1]) - face_vhandles.append(self.vhandle[2]) - self.mesh.add_face(face_vhandles) - - face_vhandles = [] - - face_vhandles.append(self.vhandle[0]) - face_vhandles.append(self.vhandle[2]) - face_vhandles.append(self.vhandle[3]) - self.mesh.add_face(face_vhandles) - - # =============================================== - # Setup complete - # =============================================== - - he = self.mesh.halfedge_handle(4) - - self.assertEqual(self.mesh.to_vertex_handle(he).idx(), 0) - self.assertEqual(self.mesh.from_vertex_handle(he).idx(), 2) - self.assertEqual(self.mesh.edge_handle(he).idx(), 2) - - eh = self.mesh.edge_handle(he) - self.assertEqual(self.mesh.calc_dihedral_angle(eh), 0.0) - - # Modify point - tmp = (openmesh.Vec3d(0.0, 0.0, -1.0) + openmesh.Vec3d(1.0, 1.0, -1.0)) * 0.5 - self.mesh.set_point(self.vhandle[2], tmp) - - difference = fabs(1.36944 - self.mesh.calc_dihedral_angle(eh)) - - self.assertTrue(difference < 0.00001) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(Others) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Unittests/test_vector_type.py b/src/Python/Unittests/test_vector_type.py deleted file mode 100644 index 795d3fef..00000000 --- a/src/Python/Unittests/test_vector_type.py +++ /dev/null @@ -1,46 +0,0 @@ -import unittest -import openmesh - -class VectorTest(unittest.TestCase): - - def test_compute_triangle_surface_with_cross_product(self): - # vec1 - # y - # | - # | - # | - # x------>x vec2 - - vec1 = openmesh.Vec3d(0.0, 1.0, 0.0) - vec2 = openmesh.Vec3d(1.0, 0.0, 0.0) - - area = 0.5 * openmesh.cross(vec1, vec2).norm() - self.assertEqual(area, 0.5) - - area = 0.5 * (vec1 % vec2).norm() - self.assertEqual(area, 0.5) - - def test_equality_operator_vec3d(self): - vec1 = openmesh.Vec3d(0.0, 1.0, 0.0) - vec2 = openmesh.Vec3d(1.0, 0.0, 0.0) - vec3 = openmesh.Vec3d(1.0, 0.0, 0.0) - - self.assertFalse(vec1==vec2) - self.assertTrue(vec3==vec2) - - def test_equality_operator_vec3f(self): - vec1 = openmesh.Vec3f(0.0, 1.0, 0.0) - vec2 = openmesh.Vec3f(1.0, 0.0, 0.0) - vec3 = openmesh.Vec3f(1.0, 0.0, 0.0) - - self.assertFalse(vec1==vec2) - self.assertTrue(vec3==vec2) - - def test_abs_test(self): - vec1 = openmesh.Vec3d(0.5, 0.5, -0.5) - self.assertEqual(vec1.l8_norm(), 0.5) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(VectorTest) - unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/src/Python/Vector.hh b/src/Python/Vector.hh deleted file mode 100644 index 1aa38519..00000000 --- a/src/Python/Vector.hh +++ /dev/null @@ -1,193 +0,0 @@ -#ifndef OPENMESH_PYTHON_VECTOR_HH -#define OPENMESH_PYTHON_VECTOR_HH - -#include "Python/Bindings.hh" - -namespace OpenMesh { -namespace Python { - -template -void set_item(Vector& _vec, int _index, Scalar _value) { - if (_index < 0) { - _index += _vec.size(); - } - - if ((size_t)_index < _vec.size()) { - _vec[_index] = _value; - } - else { - PyErr_SetString(PyExc_IndexError, "Index out of range."); - throw_error_already_set(); - } -} - -template -Scalar get_item(Vector& _vec, int _index) { - if (_index < 0) { - _index += _vec.size(); - } - - if ((size_t)_index < _vec.size()) { - return _vec[_index]; - } - else { - PyErr_SetString(PyExc_IndexError, "Index out of range."); - throw_error_already_set(); - } - - return 0.0; -} - -namespace { -template -struct Factory { - typedef OpenMesh::VectorT Vector2; - typedef OpenMesh::VectorT Vector3; - typedef OpenMesh::VectorT Vector4; - - static Vector2 *vec2_default() { - return new Vector2(Scalar(), Scalar()); - } - static Vector2 *vec2_user_defined(const Scalar& _v0, const Scalar& _v1) { - return new Vector2(_v0, _v1); - } - static Vector3 *vec3_default() { - return new Vector3(Scalar(), Scalar(), Scalar()); - } - static Vector3 *vec3_user_defined(const Scalar& _v0, const Scalar& _v1, const Scalar& _v2) { - return new Vector3(_v0, _v1, _v2); - } - static Vector4 *vec4_default() { - return new Vector4(Scalar(), Scalar(), Scalar(), Scalar()); - } - static Vector4 *vec4_user_defined(const Scalar& _v0, const Scalar& _v1, const Scalar& _v2, const Scalar& _v3) { - return new Vector4(_v0, _v1, _v2, _v3); - } -}; -} - -template -void defInitMod(class_< OpenMesh::VectorT > &classVector) { - classVector - .def("__init__", make_constructor(&Factory::vec2_default)) - .def("__init__", make_constructor(&Factory::vec2_user_defined)) - ; -} - -template -void defInitMod(class_< OpenMesh::VectorT > &classVector) { - Vector (Vector::*cross)(const Vector&) const = &Vector::operator%; - classVector - .def("__init__", make_constructor(&Factory::vec3_default)) - .def("__init__", make_constructor(&Factory::vec3_user_defined)) - .def("__mod__", cross) - ; - def("cross", cross); -} - -template -void defInitMod(class_< OpenMesh::VectorT > &classVector) { - classVector - .def("__init__", make_constructor(&Factory::vec4_default)) - .def("__init__", make_constructor(&Factory::vec4_user_defined)) - ; -} - -/** - * Expose a vector type to %Python. - * - * This function template is used to expose vectors to %Python. The template - * parameters are used to instantiate the appropriate vector type. - * - * @tparam Scalar A scalar type. - * @tparam N The dimension of the vector. - * - * @param _name The name of the vector type to be exposed. - * - * @note N must be either 2, 3 or 4. - */ -template -void expose_vec(const char *_name) { - typedef OpenMesh::VectorT Vector; - - Scalar (Vector::*min_void)() const = &Vector::min; - Scalar (Vector::*max_void)() const = &Vector::max; - - Vector (Vector::*max_vector)(const Vector&) const = &Vector::max; - Vector (Vector::*min_vector)(const Vector&) const = &Vector::min; - - Scalar (Vector::*dot )(const Vector&) const = &Vector::operator|; - Scalar (Vector::*norm )(void ) const = &Vector::norm; - Scalar (Vector::*length )(void ) const = &Vector::length; - Scalar (Vector::*sqrnorm )(void ) const = &Vector::sqrnorm; - Vector& (Vector::*normalize )(void ) = &Vector::normalize; - Vector& (Vector::*normalize_cond)(void ) = &Vector::normalize_cond; - -#if (_MSC_VER >= 1800 || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)) && !defined(OPENMESH_VECTOR_LEGACY) - Vector (Vector::*normalized)() const = &Vector::normalized; -#else - const Vector (Vector::*normalized)() const = &Vector::normalized; -#endif - - class_ classVector = class_(_name); - - classVector - .def("__setitem__", &set_item) - .def("__getitem__", &get_item) - .def(self == self) - .def(self != self) - .def(self *= Scalar()) - .def(self /= Scalar()) - .def(self * Scalar()) - .def(Scalar() * self) - .def(self / Scalar()) - .def(self *= self) - .def(self /= self) - .def(self -= self) - .def(self += self) - .def(self * self) - .def(self / self) - .def(self + self) - .def(self - self) - .def(-self) - .def(self | self) - .def("vectorize", &Vector::vectorize, return_internal_reference<>()) - .def(self < self) - - .def("dot", dot) - .def("norm", norm) - .def("length", length) - .def("sqrnorm", sqrnorm) - .def("normalized", normalized) - .def("normalize", normalize, return_internal_reference<>()) - .def("normalize_cond", normalize_cond, return_internal_reference<>()) - - .def("l1_norm", &Vector::l1_norm) - .def("l8_norm", &Vector::l8_norm) - - .def("max", max_void) - .def("max_abs", &Vector::max_abs) - .def("min", min_void) - .def("min_abs", &Vector::min_abs) - .def("mean", &Vector::mean) - .def("mean_abs", &Vector::mean_abs) - .def("minimize", &Vector::minimize, return_internal_reference<>()) - .def("minimized", &Vector::minimized) - .def("maximize", &Vector::maximize, return_internal_reference<>()) - .def("maximized", &Vector::maximized) - .def("min", min_vector) - .def("max", max_vector) - - .def("size", &Vector::size) - .staticmethod("size") - .def("vectorized", &Vector::vectorized) - .staticmethod("vectorized") - ; - - defInitMod(classVector); -} - -} // namespace OpenMesh -} // namespace Python - -#endif \ No newline at end of file From 42a5eec858304be380eddd93b72a646c4065e521 Mon Sep 17 00:00:00 2001 From: Isaak Lim Date: Wed, 21 Mar 2018 16:21:36 +0100 Subject: [PATCH 026/118] adjust CI scripts for removed python bindings --- CI/ci-linux.sh | 88 ++------------------------------------------- CI/ci-mac.sh | 97 ++------------------------------------------------ 2 files changed, 4 insertions(+), 181 deletions(-) diff --git a/CI/ci-linux.sh b/CI/ci-linux.sh index f7632198..84283cae 100755 --- a/CI/ci-linux.sh +++ b/CI/ci-linux.sh @@ -76,7 +76,7 @@ fi cd build-release-$BUILDPATH-Vector-Checks -cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_BINDINGS=OFF $OPTIONS ../ +cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../ #build it make $MAKE_OPTIONS @@ -99,51 +99,6 @@ cd Unittests cd .. cd .. -echo -e "${OUTPUT}" -echo "" -echo "======================================================================" -echo "Building Release version with vectorchecks disabled for python tests" -echo "======================================================================" -echo -e "${NC}" - -if [ ! -d build-release-$BUILDPATH ]; then - mkdir build-release-$BUILDPATH -fi - -cd build-release-$BUILDPATH - -cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=ON -DBUILD_APPS=OFF $OPTIONS ../ - -#build it -make $MAKE_OPTIONS - -echo -e "${OUTPUT}" -echo "" -echo "======================================================================" -echo "Running Python unittests Release version " -echo "======================================================================" -echo -e "${NC}" - -if [ "$LANGUAGE" == "C++11" ] || [ "$COMPILER" == "gcc" ] ; then - - # Execute Python unittests - cd Python-Unittests - - python -m unittest discover -v - - cd .. - -else - echo -e "${WARNING}" - echo "WARNING! Python unittests disabled !!" - echo -e "${NC}" -fi - - -cd .. - - - echo -e "${OUTPUT}" echo "" echo "======================================================================" @@ -158,7 +113,7 @@ fi cd build-debug-$BUILDPATH-Vector-Checks -cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_BINDINGS=OFF $OPTIONS ../ +cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../ #build it make $MAKE_OPTIONS @@ -181,42 +136,3 @@ cd Unittests cd .. cd .. - -echo -e "${OUTPUT}" -echo "" -echo "======================================================================" -echo "Building Debug version with vectorchecks disabled for python tests" -echo "======================================================================" -echo -e "${NC}" - -if [ ! -d build-debug-$BUILDPATH ]; then - mkdir build-debug-$BUILDPATH -fi - -cd build-debug-$BUILDPATH - -cmake -DCMAKE_BUILD_TYPE=DEBUG -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=ON -DBUILD_APPS=OFF $OPTIONS ../ - -#build it -make $MAKE_OPTIONS - -echo -e "${OUTPUT}" -echo "" -echo "======================================================================" -echo "Running Python unittests Debug version " -echo "======================================================================" -echo -e "${NC}" - -if [ "$LANGUAGE" == "C++11" ] || [ "$COMPILER" == "gcc" ] ; then - - # Execute Python unittests - cd Python-Unittests - - python -m unittest discover -v -else - - echo -e "${WARNING}" - echo "WARNING! Python unittests disabled !!" - echo -e "${NC}" - -fi diff --git a/CI/ci-mac.sh b/CI/ci-mac.sh index 9dd14577..2aeae642 100755 --- a/CI/ci-mac.sh +++ b/CI/ci-mac.sh @@ -58,7 +58,7 @@ fi cd build-release-$BUILDPATH-Vector-Checks -cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=OFF $OPTIONS ../ +cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../ #build it make @@ -81,53 +81,6 @@ cd Unittests cd .. cd .. -echo -e "${OUTPUT}" -echo "" -echo "======================================================================" -echo "Building Release version with vectorchecks disabled for python tests" -echo "======================================================================" -echo -e "${NC}" - -if [ ! -d build-release-$BUILDPATH ]; then - mkdir build-release-$BUILDPATH -fi - -cd build-release-$BUILDPATH - -cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=ON -DBUILD_APPS=OFF -DCPACK_BINARY_DRAGNDROP=ON $OPTIONS ../ - -#build it -make - -echo -e "${OUTPUT}" -echo "" -echo "======================================================================" -echo "Running Python unittests Release version " -echo "======================================================================" -echo -e "${NC}" - - -if [ "$LANGUAGE" == "C++11" ]; then - - # Execute Python unittests - cd Python-Unittests - - rm -f openmesh.so - cp ../Build/python/openmesh.so . - python -m unittest discover -v - - cd .. - -else - echo -e "${WARNING}" - echo "WARNING! Python unittests disabled for clang on Mac with c++98 !!" - echo -e "${NC}" -fi - -cd .. - - - echo -e "${OUTPUT}" echo "" echo "======================================================================" @@ -142,7 +95,7 @@ fi cd build-debug-$BUILDPATH-Vector-Checks -cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=OFF $OPTIONS ../ +cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../ #build it make @@ -166,52 +119,6 @@ cd Unittests cd .. cd .. -echo -e "${OUTPUT}" -echo "" -echo "======================================================================" -echo "Building Debug version with vectorchecks disabled for python tests" -echo "======================================================================" -echo -e "${NC}" - -if [ ! -d build-debug-$BUILDPATH ]; then - mkdir build-debug-$BUILDPATH -fi - -cd build-debug-$BUILDPATH - -cmake -DCMAKE_BUILD_TYPE=DEBUG -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=ON -DBUILD_APPS=OFF $OPTIONS ../ - -#build it -make - -echo -e "${OUTPUT}" -echo "" -echo "======================================================================" -echo "Running Python unittests Debug version " -echo "======================================================================" -echo -e "${NC}" - -if [ "$LANGUAGE" == "C++11" ]; then - - # Execute Python unittests - cd Python-Unittests - - rm -f openmesh.so - cp ../Build/python/openmesh.so . - python -m unittest discover -v - - cd .. - -else - - echo -e "${WARNING}" - echo "WARNING! Python unittests disabled for clang on Mac with c++98 !!" - echo -e "${NC}" - -fi - -cd .. - echo -e "${OUTPUT}" echo "" echo "======================================================================" From a3afc2d7289705028601317aaee1ea53a0a0840a Mon Sep 17 00:00:00 2001 From: Isaak Lim Date: Wed, 21 Mar 2018 16:24:28 +0100 Subject: [PATCH 027/118] remove python bindings references from Docs --- Doc/Examples/python_tutorial.py | 158 ------------------ Doc/mainpage.docu | 8 - Doc/python_tutorial.docu | 288 -------------------------------- 3 files changed, 454 deletions(-) delete mode 100644 Doc/Examples/python_tutorial.py delete mode 100644 Doc/python_tutorial.docu diff --git a/Doc/Examples/python_tutorial.py b/Doc/Examples/python_tutorial.py deleted file mode 100644 index c43420cf..00000000 --- a/Doc/Examples/python_tutorial.py +++ /dev/null @@ -1,158 +0,0 @@ -################################################## -# Getting Started -################################################## - -from openmesh import * - -mesh = TriMesh() - - -################################################## -# Adding Items to a Mesh -################################################## - -# add a a couple of vertices to the mesh -vh0 = mesh.add_vertex(TriMesh.Point(0, 1, 0)) -vh1 = mesh.add_vertex(TriMesh.Point(1, 0, 0)) -vh2 = mesh.add_vertex(TriMesh.Point(2, 1, 0)) -vh3 = mesh.add_vertex(TriMesh.Point(0,-1, 0)) -vh4 = mesh.add_vertex(TriMesh.Point(2,-1, 0)) - -# add a couple of faces to the mesh -fh0 = mesh.add_face(vh0, vh1, vh2) -fh1 = mesh.add_face(vh1, vh3, vh4) -fh2 = mesh.add_face(vh0, vh3, vh1) - -# add another face to the mesh, this time using a list -vh_list = [vh2, vh1, vh4] -fh3 = mesh.add_face(vh_list) - -# 0 ==== 2 -# |\ 0 /| -# | \ / | -# |2 1 3| -# | / \ | -# |/ 1 \| -# 3 ==== 4 - - -################################################## -# Iterators -################################################## - -# iterate over all vertices -for vh in mesh.vertices(): - print vh.idx() - -# iterate over all halfedges -for heh in mesh.halfedges(): - print heh.idx() - -# iterate over all edges -for eh in mesh.edges(): - print eh.idx() - -# iterate over all faces -for fh in mesh.faces(): - print fh.idx() - - -################################################## -# Circulators -################################################## - -# iterate over all neighboring vertices -for vh in mesh.vv(vh1): - print vh.idx() - -# iterate over all incoming halfedges -for heh in mesh.vih(vh1): - print heh.idx() - -# iterate over all outgoing halfedges -for heh in mesh.voh(vh1): - print heh.idx() - -# iterate over all adjacent edges -for eh in mesh.ve(vh1): - print eh.idx() - -# iterate over all adjacent faces -for fh in mesh.vf(vh1): - print fh.idx() - -# iterate over the face's vertices -for vh in mesh.fv(fh0): - print vh.idx() - -# iterate over the face's halfedges -for heh in mesh.fh(fh0): - print heh.idx() - -# iterate over the face's edges -for eh in mesh.fe(fh0): - print eh.idx() - -# iterate over all edge-neighboring faces -for fh in mesh.ff(fh0): - print fh.idx() - - -################################################## -# Properties -################################################## - -prop_handle = VPropHandle() -mesh.add_property(prop_handle, "cogs") - -for vh in mesh.vertices(): - cog = TriMesh.Point(0,0,0) - valence = 0 - for neighbor in mesh.vv(vh): - cog += mesh.point(neighbor) - valence += 1 - mesh.set_property(prop_handle, vh, cog / valence) - -mesh.remove_property(prop_handle) - - -################################################## -# Property Managers -################################################## - -prop_man = VPropertyManager(mesh, "cogs") - -prop_man.set_range(mesh.vertices(), TriMesh.Point(0,0,0)) - -for vh in mesh.vertices(): - valence = 0 - for neighbor in mesh.vv(vh): - prop_man[vh] += mesh.point(neighbor) - valence += 1 - prop_man[vh] /= valence - - -################################################## -# I/O -################################################## - -mesh = TriMesh() - -read_mesh(mesh, "bunny.obj") -# modify mesh ... -write_mesh(mesh, "bunny.obj") - - -mesh = TriMesh() -mesh.request_halfedge_normals() -mesh.request_vertex_normals() - -options = Options() -options += Options.VertexNormal - -result = read_mesh(mesh, "bunny.obj", options) - -if result: - print "everything worked" -else: - print "something went wrong" diff --git a/Doc/mainpage.docu b/Doc/mainpage.docu index ad8fa8e9..75d4663c 100644 --- a/Doc/mainpage.docu +++ b/Doc/mainpage.docu @@ -87,14 +87,6 @@ repeatedly replacing each vertex' position by the center of gravity

    -\section python_and_om OpenMesh Python interface -OpenMesh itself is written in C++. We also provide a python interface -to use OpenMesh. A detailed description of the interface can be found -in the following tutorial: -\li \subpage python_tutorial - -

    - \subpage additional_information \li \ref mesh_first_to_read diff --git a/Doc/python_tutorial.docu b/Doc/python_tutorial.docu deleted file mode 100644 index 8649d4f9..00000000 --- a/Doc/python_tutorial.docu +++ /dev/null @@ -1,288 +0,0 @@ -/** \page python_tutorial Python Tutorial - -This tutorial will introduce the basic concepts behind the %OpenMesh Python -Bindings. We will cover the following topics: - -\li How to build the Python Bindings -\li How to create an empty mesh -\li How to add vertices and faces to a mesh -\li How to navigate on a mesh using iterators and circulators -\li How to add and remove custom properties -\li How to read and write meshes from files - -In addition, we will briefly discuss some of the differences between the Python -Bindings and the original C++ implementation of %OpenMesh. - - - -\section python_build Building the Python Bindings - -The Python Bindings depend on the following libraries: - -\li Python (2.7 or later) -\li Boost Python (1.54.0 or later) - -\note Make sure that your Boost Python and Python versions match, i.e. that -Boost Python was linked against the correct Python version. - -The Python Bindings are automatically built with %OpenMesh. The generated files are written to the -Build/python subdirectory of the build tree. For more information on how to build %OpenMesh see -\ref compiling. - -If CMake does not find your Python installation (or finds the wrong one) you can -explicitly specify an installation by setting the following variables: - -\verbatim -PYTHON_LIBRARY - Path to the python library -PYTHON_INCLUDE_DIR - Path to where Python.h is found -\endverbatim - -Similarly, if CMake does not find your Boost Python installation, set the -following variables: - -\verbatim -BOOST_ROOT - Preferred installation prefix -BOOST_INCLUDEDIR - Preferred include directory e.g. /include -BOOST_LIBRARYDIR - Preferred library directory e.g. /lib -\endverbatim - - - -\section python_start Getting Started - -To use the %OpenMesh Python Bindings we first need to import the openmesh module: - -\dontinclude python_tutorial.py -\skipline from - -The module provides two mesh classes: One for polygonal meshes (PolyMesh) and -one for triangle meshes (TriMesh). You should use triangle meshes whenever -possible, since they are usually more efficient. In addition, some algorithms -are only implemented for triangle meshes while triangle meshes inherit the full -functionality of polygonal meshes. - -The following code creates a new triangle mesh: - -\skipline mesh - - - -\section python_add Adding Items to a Mesh - -We can add a new vertex to the mesh by calling the add_vertex() member function. -This function gets a coordinate and returns a handle to the newly inserted -vertex. - -\skipline vh0 -\until vh4 - -To add a new face to the mesh we have to call add_face(). This function gets the -handles of the vertices that make up the new face and returns a handle to the -newly inserted face: - -\skipline fh0 -\until fh2 - -We can also use a Python list to add a face to the mesh: - -\skipline vh_list -\until fh3 - - - -\section python_iterators Iterators and Circulators - -Now that we have added a couple of vertices to the mesh, we can iterate over -them and print out their indices: - -\skipline for -\until vh.idx() - -We can also iterate over halfedges, edges and faces by calling mesh.halfedges(), -mesh.edges() and mesh.faces() respectively: - -\skipline iterate -\until fh.idx() - -To iterate over the items adjacent to another item we can use one of the -circulator functions. For example, to iterate over the vertices adjacent to -another vertex we can call mesh.vv() and pass the handle of the center vertex: - -\skipline for -\until vh.idx() - -We can also iterate over the adjacent halfedges, edges and faces: - -\skipline iterate -\until fh.idx() - -To iterate over the items adjacent to a face we can use the following functions: - -\skipline iterate -\until fh.idx() - - - -\section python_props Properties - -%OpenMesh allows us to dynamically add custom properties to a mesh. We can add -properties to vertices, halfedges, edges, faces and the mesh itself. To -add a property to a mesh (and later access its value) we have to use a property -handle of the appropriate type: - -\li VPropHandle (for vertex properties) -\li HPropHandle (for halfedge properties) -\li EPropHandle (for edge properties) -\li FPropHandle (for face properties) -\li MPropHandle (for mesh properties) - -The following code shows how to add a vertex property to a mesh: - -\skipline prop_handle -\until mesh - -The second parameter of the function add_property() is optional. The parameter -is used to specify a name for the new property. This name can later be used -to retrieve a handle to the property using the get_property_handle() member -function. - -Now that we have added a vertex property to the mesh we can set and get its -value. Here we will use the property to store the center of gravity of each -vertex' neighborhood: - -\skipline for -\until mesh.set_property - -Properties use Python's type system. This means that we can use the same -property to store values of different types (e.g. store both strings and -integers using the same vertex property). Properties are initialized to the -Python built-in constant None. - -To remove a property we have to call remove_property() with the appropriate -property handle: - -\skipline mesh.remove_property - - - -\section python_propman Property Managers - -Another way to add and remove a property is to use a property manager. A -Property manager encapsulates a property and manages its lifecycle. A Property -manager also provides a number of convenience functions to access the enclosed -property. - -There are four different types of property managers. One for each type of mesh -item: - -\li VPropertyManager (for vertex properties) -\li HPropertyManager (for halfedge properties) -\li EPropertyManager (for edge properties) -\li FPropertyManager (for face properties) - -Property managers automatically add a new property to a mesh when they are -initialized. Thus the following code not only creates a new vertex property -manager, but also adds a new vertex property to the mesh: - -\skipline prop_man - -Property managers allow us to conveniently set the property value for an entire -range of mesh items: - -\skipline prop_man - -They also allow us to use the subscript operator to set and get property values. -Here we will once again use a property to store the center of gravity of each -vertex' neighborhood: - -\skipline for -\until prop_man[vh] /= valence - -Properties that are encapsulated by a property manager are automatically removed -from the mesh when the property manager goes out of scope (i.e. the property -manager is garbage collected). - - - -\section python_io Read and write meshes from files - -You can read and write meshes from files using the read_mesh() and write_mesh() -functions: - -\skipline mesh -\until write_mesh(mesh, "bunny.obj") - -The file type is automatically deduced from the file extension. %OpenMesh -currently supports four file types: .off, .obj, .stl and .om - -The behaviour of the I/O functions can be controlled by passing an instance of -the Options class to either read_mesh() or write_mesh(). The class controls the -behaviour of the I/O functions by means of enabled/disabled bits in a bitset: - -\skipline mesh -\until print "something went wrong" - -Other available option bits include: - --# mode bits - control binary reading/writing - - Options.Binary - - Options.MSB - - Options.LSB - - Options.Swap (MSB|LSB) --# property bits - controls which standard properties to read/write - - Options.VertexNormal - - Options.VertexTexCoord - - Options.VertexColor - - Options.FaceNormal - - Options.FaceColor - - Options.ColorAlpha - - Options.ColorFloat - -\note You have to pass an instance of the Options class to the I/O functions, -i.e. you cannot directly pass one of the option bits. For example, directly -passing Options.Binary to either one of the functions will cause an error. - -When reading a file the options are used as hints, i.e. depending on the format -we can help the reader to interpret the data correctly. - -\note If you want to read a property from a file the property must have been -requested prior to reading the file. - -When writing the mesh the mode bits control whether to use the binary variant of -the respective file format and the desired byte-ordering. - - - -\section python_examples Additional Code Examples - -You can use our unit tests to learn more about the %OpenMesh Python Bindings. -They are located in the src/Python/Unittests subdirectory. - - - -\section python_cpp Python and C++ - -The interface of the Python Bindings is to a large extent identical to the -interface of the original C++ implementation of %OpenMesh. You should therefore -be able to use the C++ documentation as a reference for the Python Bindings. In -particular, the classes KernelT, PolyMeshT and TriMeshT provide a good overview -of the available mesh member functions. That being said, there are a number of -small differences. For example, whenever the C++ implementation returns a -reference to an object that is managed by %OpenMesh, the Python Bindings will -return a copy of that object. This is due to the fact that Python does not have -a language feature that is analogous to C++ references. One example of such a -function is the point() member function of the PolyMesh and TriMesh classes. -Unlike its C++ counterpart, the function does not return a reference to the -requested point. It instead returns a copy of the point. This implies that you -have to use the set_point() member function to change the value of a point. The -same applies to the following functions: normal(), color(), property(), -status(), etc. - - - -
    The complete source looks like this: - -\include python_tutorial.py - - -**/ From 072f599c65d45b91d0dacb704dd5b8bd02193124 Mon Sep 17 00:00:00 2001 From: Isaak Lim Date: Wed, 21 Mar 2018 17:35:49 +0100 Subject: [PATCH 028/118] fix package creation test for mac CI job --- CI/ci-mac.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/CI/ci-mac.sh b/CI/ci-mac.sh index 2aeae642..a804012d 100755 --- a/CI/ci-mac.sh +++ b/CI/ci-mac.sh @@ -126,10 +126,15 @@ echo "Package creation (DMG and tarball)" echo "======================================================================" echo -e "${NC}" + +if [ ! -d build-release-$BUILDPATH ]; then + mkdir build-release-$BUILDPATH +fi + cd build-release-$BUILDPATH -cp ../build-debug-$BUILDPATH/Build/lib/* ./Build/lib/ -cmake . + +cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_APPS=OFF -DCPACK_BINARY_DRAGNDROP=ON $OPTIONS ../ + +#build it +make make package - - - From f5bc55004a6789c42a952e22c2ab17dba089c040 Mon Sep 17 00:00:00 2001 From: Janis Born Date: Thu, 22 Mar 2018 14:56:35 +0100 Subject: [PATCH 029/118] don't return invalid iterators for empty element ranges --- src/OpenMesh/Core/Mesh/IteratorsT.hh | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/OpenMesh/Core/Mesh/IteratorsT.hh b/src/OpenMesh/Core/Mesh/IteratorsT.hh index 38df6ecf..6d2c92bc 100644 --- a/src/OpenMesh/Core/Mesh/IteratorsT.hh +++ b/src/OpenMesh/Core/Mesh/IteratorsT.hh @@ -109,9 +109,6 @@ class GenericIteratorT { : mesh_(&_mesh), hnd_(_hnd), skip_bits_(0) { if (_skip) enable_skipping(); - - // Set vertex handle invalid if the mesh contains no vertex - if((mesh_->*PrimitiveCountMember)() == 0) hnd_ = value_handle(-1); } /// Standard dereferencing operator. From ea44e02eaa7b252c2214981ece4165bbe532e5f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 23 Mar 2018 11:20:01 +0100 Subject: [PATCH 030/118] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 657df304..bb8a508c 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh.git The gitlab site can be found here: https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh -The python bindings can be found here: +The python bindings can be found here: https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python ## Installing From bd3ec6a988d0d1349510bae112bb1bedb1fcecf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 23 Mar 2018 11:20:19 +0100 Subject: [PATCH 031/118] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bb8a508c..11bb04ce 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh.git The gitlab site can be found here: https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh -The python bindings can be found here: +The python bindings can be found here: https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python ## Installing From 76e33791e0ccd50fd23b33bcaff367136377098e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 5 Apr 2018 09:08:44 +0200 Subject: [PATCH 032/118] Fixed some cppcheck warnings --- Doc/Tutorial/04-stl_algorithms/smooth_algo.hh | 2 +- src/OpenMesh/Apps/Decimating/CmdOption.hh | 2 +- .../Apps/Decimating/DecimaterViewerWidget.hh | 2 +- src/OpenMesh/Apps/QtViewer/MeshViewerWidget.hh | 2 +- .../Client/VDPMClientViewerWidget.cc | 10 ++++------ .../Streaming/Client/VDPMClientViewerWidget.cc | 10 ++++------ src/OpenMesh/Core/IO/reader/PLYReader.cc | 2 +- src/OpenMesh/Core/IO/reader/STLReader.cc | 2 +- src/OpenMesh/Core/IO/writer/OMWriter.cc | 2 +- src/OpenMesh/Core/IO/writer/STLWriter.cc | 16 ++++++++-------- src/OpenMesh/Examples/Tutorial04/smooth_algo.hh | 2 +- src/Unittests/unittests_decimater.cc | 2 +- src/Unittests/unittests_mc_decimater.cc | 2 +- src/Unittests/unittests_mixed_decimater.cc | 2 +- src/Unittests/unittests_tutorials.cc | 2 +- 15 files changed, 28 insertions(+), 32 deletions(-) diff --git a/Doc/Tutorial/04-stl_algorithms/smooth_algo.hh b/Doc/Tutorial/04-stl_algorithms/smooth_algo.hh index b39fd82f..968cbd7b 100644 --- a/Doc/Tutorial/04-stl_algorithms/smooth_algo.hh +++ b/Doc/Tutorial/04-stl_algorithms/smooth_algo.hh @@ -13,7 +13,7 @@ public: public: // construct with a given mesh - SmootherT(Mesh& _mesh) + explicit SmootherT(Mesh& _mesh) : mesh_(_mesh) { mesh_.add_property( cog_ ); diff --git a/src/OpenMesh/Apps/Decimating/CmdOption.hh b/src/OpenMesh/Apps/Decimating/CmdOption.hh index 7a0d19b0..bbab79f4 100644 --- a/src/OpenMesh/Apps/Decimating/CmdOption.hh +++ b/src/OpenMesh/Apps/Decimating/CmdOption.hh @@ -56,7 +56,7 @@ public: typedef T value_type; - CmdOption(const T& _val) : val_(_val), valid_(true), enabled_(false) { } + explicit CmdOption(const T& _val) : val_(_val), valid_(true), enabled_(false) { } CmdOption() : val_(T()),valid_(false), enabled_(false) { } // has been set and has a value diff --git a/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh b/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh index c3caec9a..bb908a61 100644 --- a/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh +++ b/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh @@ -123,7 +123,7 @@ public: /// default constructor - DecimaterViewerWidget(QWidget* _parent=0) + explicit DecimaterViewerWidget(QWidget* _parent=0) : MeshViewerWidget(_parent), animate_(false), timer_(0), diff --git a/src/OpenMesh/Apps/QtViewer/MeshViewerWidget.hh b/src/OpenMesh/Apps/QtViewer/MeshViewerWidget.hh index 6addb705..7c8c1cd4 100644 --- a/src/OpenMesh/Apps/QtViewer/MeshViewerWidget.hh +++ b/src/OpenMesh/Apps/QtViewer/MeshViewerWidget.hh @@ -82,7 +82,7 @@ class MeshViewerWidget : public MeshViewerWidgetT Q_OBJECT public: /// default constructor - MeshViewerWidget(QWidget* parent=0) : MeshViewerWidgetT(parent) + explicit MeshViewerWidget(QWidget* parent=0) : MeshViewerWidgetT(parent) {} OpenMesh::IO::Options& options() { return _options; } const OpenMesh::IO::Options& options() const { return _options; } diff --git a/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Client/VDPMClientViewerWidget.cc b/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Client/VDPMClientViewerWidget.cc index 7ce0864b..c328a872 100644 --- a/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Client/VDPMClientViewerWidget.cc +++ b/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Client/VDPMClientViewerWidget.cc @@ -139,17 +139,15 @@ void VDPMClientViewerWidget::mesh_coloring() vEnd(mesh_.vertices_end()); VHierarchyNodeHandle node_handle; - float ratio; - unsigned char r, g, b; for (; vIt!=vEnd; ++vIt) { node_handle = mesh_.data(*vIt).vhierarchy_node_handle(); - ratio = vhierarchy_.node(node_handle).ratio(); + const float ratio = vhierarchy_.node(node_handle).ratio(); - r = (unsigned char) ((1.0f - ratio) * myYellow[0] + ratio * myBlue[0]); - g = (unsigned char) ((1.0f - ratio) * myYellow[1] + ratio * myBlue[1]); - b = (unsigned char) ((1.0f - ratio) * myYellow[2] + ratio * myBlue[2]); + const unsigned char r = (unsigned char) ((1.0f - ratio) * myYellow[0] + ratio * myBlue[0]); + const unsigned char g = (unsigned char) ((1.0f - ratio) * myYellow[1] + ratio * myBlue[1]); + const unsigned char b = (unsigned char) ((1.0f - ratio) * myYellow[2] + ratio * myBlue[2]); mesh_.set_color(*vIt, OpenMesh::Vec3uc(r,g,b)); } diff --git a/src/OpenMesh/Apps/Unsupported/Streaming/Client/VDPMClientViewerWidget.cc b/src/OpenMesh/Apps/Unsupported/Streaming/Client/VDPMClientViewerWidget.cc index 29439336..0503f456 100644 --- a/src/OpenMesh/Apps/Unsupported/Streaming/Client/VDPMClientViewerWidget.cc +++ b/src/OpenMesh/Apps/Unsupported/Streaming/Client/VDPMClientViewerWidget.cc @@ -138,17 +138,15 @@ void VDPMClientViewerWidget::mesh_coloring() vEnd(mesh_.vertices_end()); VHierarchyNodeHandle node_handle; - float ratio; - unsigned char r, g, b; for (; vIt!=vEnd; ++vIt) { node_handle = mesh_.data(*vIt).vhierarchy_node_handle(); - ratio = vhierarchy_.node(node_handle).ratio(); + const float ratio = vhierarchy_.node(node_handle).ratio(); - r = (unsigned char) ((1.0f - ratio) * myYellow[0] + ratio * myBlue[0]); - g = (unsigned char) ((1.0f - ratio) * myYellow[1] + ratio * myBlue[1]); - b = (unsigned char) ((1.0f - ratio) * myYellow[2] + ratio * myBlue[2]); + const unsigned char r = (unsigned char) ((1.0f - ratio) * myYellow[0] + ratio * myBlue[0]); + const unsigned char g = (unsigned char) ((1.0f - ratio) * myYellow[1] + ratio * myBlue[1]); + const unsigned char b = (unsigned char) ((1.0f - ratio) * myYellow[2] + ratio * myBlue[2]); mesh_.set_color(*vIt, OpenMesh::Vec3uc(r,g,b)); } diff --git a/src/OpenMesh/Core/IO/reader/PLYReader.cc b/src/OpenMesh/Core/IO/reader/PLYReader.cc index 107fafa7..618f347d 100644 --- a/src/OpenMesh/Core/IO/reader/PLYReader.cc +++ b/src/OpenMesh/Core/IO/reader/PLYReader.cc @@ -1062,7 +1062,7 @@ std::string get_property_name(std::string _string1, std::string _string2) { //----------------------------------------------------------------------------- -_PLYReader_::ValueType get_property_type(std::string _string1, std::string _string2) { +_PLYReader_::ValueType get_property_type(std::string& _string1, std::string& _string2) { if (_string1 == "float32" || _string2 == "float32") diff --git a/src/OpenMesh/Core/IO/reader/STLReader.cc b/src/OpenMesh/Core/IO/reader/STLReader.cc index 6dd8569b..b3c5af0a 100644 --- a/src/OpenMesh/Core/IO/reader/STLReader.cc +++ b/src/OpenMesh/Core/IO/reader/STLReader.cc @@ -176,7 +176,7 @@ class CmpVec { public: - CmpVec(float _eps=FLT_MIN) : eps_(_eps) {} + explicit CmpVec(float _eps=FLT_MIN) : eps_(_eps) {} bool operator()( const Vec3f& _v0, const Vec3f& _v1 ) const { diff --git a/src/OpenMesh/Core/IO/writer/OMWriter.cc b/src/OpenMesh/Core/IO/writer/OMWriter.cc index 964a5ebc..81f26043 100644 --- a/src/OpenMesh/Core/IO/writer/OMWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OMWriter.cc @@ -163,7 +163,7 @@ _OMWriter_::write(std::ostream& _os, BaseExporter& _be, Options _opt, std::strea #ifndef DOXY_IGNORE_THIS template struct Enabler { - Enabler( T& obj ) : obj_(obj) + explicit Enabler( T& obj ) : obj_(obj) {} ~Enabler() { obj_.enable(); } diff --git a/src/OpenMesh/Core/IO/writer/STLWriter.cc b/src/OpenMesh/Core/IO/writer/STLWriter.cc index 503fa03b..54e8f702 100644 --- a/src/OpenMesh/Core/IO/writer/STLWriter.cc +++ b/src/OpenMesh/Core/IO/writer/STLWriter.cc @@ -158,7 +158,7 @@ write_stla(const std::string& _filename, BaseExporter& _be, Options /* _opt */) - int i, nF(int(_be.n_faces())), nV; + int i, nF(int(_be.n_faces())); Vec3f a, b, c, n; std::vector vhandles; FaceHandle fh; @@ -172,7 +172,7 @@ write_stla(const std::string& _filename, BaseExporter& _be, Options /* _opt */) for (i=0; i vhandles; FaceHandle fh; @@ -226,7 +226,7 @@ write_stla(std::ostream& _out, BaseExporter& _be, Options /* _opt */, std::strea for (i=0; i vhandles; FaceHandle fh; @@ -294,7 +294,7 @@ write_stlb(const std::string& _filename, BaseExporter& _be, Options /* _opt */) for (i=0; i vhandles; FaceHandle fh; @@ -366,7 +366,7 @@ write_stlb(std::ostream& _out, BaseExporter& _be, Options /* _opt */, std::strea for (i=0; i Date: Thu, 5 Apr 2018 09:33:56 +0200 Subject: [PATCH 033/118] More cppcheck fixes --- .../VDProgMesh/mkbalancedpm/mkbalancedpm.cc | 2 +- .../Subdivider/Adaptive/Composite/RulesT.hh | 36 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc b/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc index 6fa32743..a73a672b 100644 --- a/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc +++ b/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc @@ -89,7 +89,7 @@ public: public: /// Constructor - ModBalancerT( D &_dec ) + explicit ModBalancerT( D &_dec ) : BaseModQ( _dec ), max_level_(0), n_roots_(0), n_vertices_(0) { diff --git a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.hh b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.hh index 6068ac5c..75d29817 100644 --- a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.hh +++ b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.hh @@ -104,7 +104,7 @@ public: typedef RuleInterfaceT Inherited; - Tvv3(M& _mesh) : Inherited(_mesh) { Base::set_subdiv_type(3); }; + explicit Tvv3(M& _mesh) : Inherited(_mesh) { Base::set_subdiv_type(3); }; void raise(typename M::FaceHandle& _fh, state_t _target_state); void raise(typename M::VertexHandle& _vh, state_t _target_state); @@ -129,7 +129,7 @@ public: typedef RuleInterfaceT Inherited; - Tvv4(M& _mesh) : Inherited(_mesh) { Base::set_subdiv_type(4); }; + explicit Tvv4(M& _mesh) : Inherited(_mesh) { Base::set_subdiv_type(4); }; void raise(typename M::FaceHandle& _fh, state_t _target_state); void raise(typename M::VertexHandle& _vh, state_t _target_state); @@ -157,7 +157,7 @@ private: public: typedef RuleInterfaceT Inherited; - VF(M& _mesh) : Inherited(_mesh) {} + explicit VF(M& _mesh) : Inherited(_mesh) {} void raise(typename M::FaceHandle& _fh, state_t _target_state); MIPS_WARN_WA(Edge) @@ -179,7 +179,7 @@ private: public: typedef RuleInterfaceT Inherited; - FF(M& _mesh) : Inherited(_mesh) {} + explicit FF(M& _mesh) : Inherited(_mesh) {} void raise(typename M::FaceHandle& _fh, state_t _target_state); MIPS_WARN_WA(Vertex) // avoid warning @@ -201,7 +201,7 @@ private: public: typedef RuleInterfaceT Inherited; - FFc(M& _mesh) : Inherited(_mesh) {} + explicit FFc(M& _mesh) : Inherited(_mesh) {} void raise(typename M::FaceHandle& _fh, state_t _target_state); MIPS_WARN_WA(Vertex) // avoid warning @@ -223,7 +223,7 @@ private: public: typedef RuleInterfaceT Inherited; - FV(M& _mesh) : Inherited(_mesh) {} + explicit FV(M& _mesh) : Inherited(_mesh) {} void raise(typename M::VertexHandle& _vh, state_t _target_state); MIPS_WARN_WA(Face) // avoid warning @@ -245,7 +245,7 @@ private: public: typedef RuleInterfaceT Inherited; - FVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); } + explicit FVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); } void raise(typename M::VertexHandle& _vh, state_t _target_state); MIPS_WARN_WA(Face) // avoid warning @@ -282,7 +282,7 @@ public: typedef RuleInterfaceT Inherited; - VV(M& _mesh) : Inherited(_mesh) {} + explicit VV(M& _mesh) : Inherited(_mesh) {} void raise(typename M::VertexHandle& _vh, state_t _target_state); MIPS_WARN_WA(Face) // avoid warning @@ -304,7 +304,7 @@ private: public: typedef RuleInterfaceT Inherited; - VVc(M& _mesh) : Inherited(_mesh) {} + explicit VVc(M& _mesh) : Inherited(_mesh) {} void raise(typename M::VertexHandle& _vh, state_t _target_state); MIPS_WARN_WA(Face) // avoid warning @@ -326,7 +326,7 @@ private: public: typedef RuleInterfaceT Inherited; - VE(M& _mesh) : Inherited(_mesh) {} + explicit VE(M& _mesh) : Inherited(_mesh) {} void raise(typename M::EdgeHandle& _eh, state_t _target_state); MIPS_WARN_WA(Face ) // avoid warning @@ -348,7 +348,7 @@ private: public: typedef RuleInterfaceT Inherited; - VdE(M& _mesh) : Inherited(_mesh) {} + explicit VdE(M& _mesh) : Inherited(_mesh) {} void raise(typename M::EdgeHandle& _eh, state_t _target_state); MIPS_WARN_WA(Face ) // avoid warning @@ -370,7 +370,7 @@ private: public: typedef RuleInterfaceT Inherited; - VdEc(M& _mesh) : Inherited(_mesh) {} + explicit VdEc(M& _mesh) : Inherited(_mesh) {} void raise(typename M::EdgeHandle& _eh, state_t _target_state); MIPS_WARN_WA(Face ) // avoid warning @@ -392,7 +392,7 @@ private: public: typedef RuleInterfaceT Inherited; - EV(M& _mesh) : Inherited(_mesh) {} + explicit EV(M& _mesh) : Inherited(_mesh) {} void raise(typename M::VertexHandle& _vh, state_t _target_state); MIPS_WARN_WA(Face) // avoid warning @@ -415,7 +415,7 @@ public: typedef RuleInterfaceT Inherited; - EVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); } + explicit EVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); } void raise(typename M::VertexHandle& _vh, state_t _target_state); MIPS_WARN_WA(Face) // avoid warning @@ -451,7 +451,7 @@ private: public: typedef RuleInterfaceT Inherited; - EF(M& _mesh) : Inherited(_mesh) {} + explicit EF(M& _mesh) : Inherited(_mesh) {} void raise(typename M::FaceHandle& _fh, state_t _target_state); MIPS_WARN_WA(Edge ) // avoid warning @@ -473,7 +473,7 @@ private: public: typedef RuleInterfaceT Inherited; - FE(M& _mesh) : Inherited(_mesh) {} + explicit FE(M& _mesh) : Inherited(_mesh) {} void raise(typename M::EdgeHandle& _eh, state_t _target_state); MIPS_WARN_WA(Face ) // avoid warning @@ -495,7 +495,7 @@ private: public: typedef RuleInterfaceT Inherited; - EdE(M& _mesh) : Inherited(_mesh) {} + explicit EdE(M& _mesh) : Inherited(_mesh) {} void raise(typename M::EdgeHandle& _eh, state_t _target_state); MIPS_WARN_WA(Face ) // avoid warning @@ -517,7 +517,7 @@ private: public: typedef RuleInterfaceT Inherited; - EdEc(M& _mesh) : Inherited(_mesh) {} + explicit EdEc(M& _mesh) : Inherited(_mesh) {} void raise(typename M::EdgeHandle& _eh, state_t _target_state); MIPS_WARN_WA(Face ) // avoid warning From 7765cef65a6928ec64fb68bd38e4a78d2522871c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 5 Apr 2018 09:44:30 +0200 Subject: [PATCH 034/118] Fixed remaining cppcheck warnings and set max warnings to 0 --- CI/ci-cppcheck.sh | 4 ++-- .../Apps/Unsupported/Streaming-qt4/Server/ServerSideVDPM.hh | 2 +- .../Apps/Unsupported/Streaming/Server/ServerSideVDPM.hh | 2 +- src/OpenMesh/Core/IO/writer/OMWriter.cc | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CI/ci-cppcheck.sh b/CI/ci-cppcheck.sh index 43bc9824..ec39f140 100755 --- a/CI/ci-cppcheck.sh +++ b/CI/ci-cppcheck.sh @@ -18,7 +18,7 @@ echo -e "${NC}" echo "Please Wait ..." # Run cppcheck and output into file -cppcheck --enable=all . -I src -i Doc/ --force --suppress=unusedFunction --suppress=missingIncludeSystem --quiet -Umin -Umax -UBMPOSTFIX -DOPENMESHDLLEXPORT="" &> cppcheck.log +cppcheck --enable=all . --force --suppress=unusedFunction --suppress=missingIncludeSystem --quiet -Umin -Umax -UCTIME -UBMPOSTFIX -DOPENMESHDLLEXPORT="" -UPRIVATE_NODE_TYPESYSTEM_SOURCE -USO_NODE_ABSTRACT_SOURCE -USO_NODE_SOURCE -UCLOCK_REALTIME_HR -i src/OpenMesh/Apps/Unsupported/ -i Doc/ &> cppcheck.log echo -e "${OUTPUT}" echo "==============================================================================" @@ -38,7 +38,7 @@ echo "CPPCHECK Summary" echo "==============================================================================" echo -e "${NC}" -MAX_COUNT=6 +MAX_COUNT=0 if [ $COUNT -gt $MAX_COUNT ]; then echo -e ${WARNING} diff --git a/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Server/ServerSideVDPM.hh b/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Server/ServerSideVDPM.hh index 7f05ac66..68804485 100644 --- a/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Server/ServerSideVDPM.hh +++ b/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Server/ServerSideVDPM.hh @@ -77,7 +77,7 @@ private: public: - ServerSideVDPM() { clear(); } + ServerSideVDPM() :name_(""),tree_id_bits_(0) { clear(); } void clear(); const char* name() const { return name_; } diff --git a/src/OpenMesh/Apps/Unsupported/Streaming/Server/ServerSideVDPM.hh b/src/OpenMesh/Apps/Unsupported/Streaming/Server/ServerSideVDPM.hh index 5f2b66e5..f20bda74 100644 --- a/src/OpenMesh/Apps/Unsupported/Streaming/Server/ServerSideVDPM.hh +++ b/src/OpenMesh/Apps/Unsupported/Streaming/Server/ServerSideVDPM.hh @@ -76,7 +76,7 @@ private: public: - ServerSideVDPM() { clear(); } + ServerSideVDPM(): name_(""),tree_id_bits_(0) { clear(); } void clear(); const char* name() const { return name_; } diff --git a/src/OpenMesh/Core/IO/writer/OMWriter.cc b/src/OpenMesh/Core/IO/writer/OMWriter.cc index 81f26043..9c32282f 100644 --- a/src/OpenMesh/Core/IO/writer/OMWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OMWriter.cc @@ -302,7 +302,8 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be, for (i=0, nF=header.n_faces_; i Date: Thu, 5 Apr 2018 11:03:02 +0200 Subject: [PATCH 035/118] Updated changelog --- Doc/changelog.docu | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 87d79dc8..7f5242ec 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -26,6 +26,7 @@
  • Boost range support (Thanks to Bastian Pranzas for the patch)
  • Made the face and edge split operations that copy properties also copy builtin properties
  • calc_sector_angle: Check for real division by zero not with epsilon that was way to large
  • +
  • Don't return invalid iterators for empty element ranges
  • Utils From 018652e5a45646a18dc3e37c5f8366bf33e10385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 5 Apr 2018 14:09:47 +0200 Subject: [PATCH 036/118] Only Issue Warning if compile Order for MeshIO.hh is violated. Remove Check if errors are reported. --- src/OpenMesh/Core/IO/MeshIO.hh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/OpenMesh/Core/IO/MeshIO.hh b/src/OpenMesh/Core/IO/MeshIO.hh index f63acbf1..49b6f640 100644 --- a/src/OpenMesh/Core/IO/MeshIO.hh +++ b/src/OpenMesh/Core/IO/MeshIO.hh @@ -55,11 +55,24 @@ // -------------------- system settings #include + // -------------------- check include order #if defined (OPENMESH_TRIMESH_ARRAY_KERNEL_HH) || \ defined (OPENMESH_POLYMESH_ARRAY_KERNEL_HH) -# error "Include MeshIO.hh before including a mesh type!" + + // Issue warning if MeshIO was not included before Mesh Type + // Nobody knows why this order was enforced. + // If somebody encounters an error resulting from a wrong order, please report it to the OpenMesh developers. + // If we don't here about any errors, this check will be removed + // @TODO: Remove after reasonable time + #ifdef WIN32 + #pragma message("MeshIO.hh was included after Mesh Type. You may ignore this warning. Please report errors resulting ifrom this order to the developers!") + #else + #warning "MeshIO.hh was included after Mesh Type. You may ignore this warning. Please report errors resulting from this order to the developers!" + #endif + #endif + // -------------------- OpenMesh #include #include From 8396dceab1bc522368546889a3c750239061eadf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 5 Apr 2018 16:00:17 +0200 Subject: [PATCH 037/118] Fixed compiler warnings in unittests --- src/Unittests/unittests_split_edge_copy.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Unittests/unittests_split_edge_copy.cc b/src/Unittests/unittests_split_edge_copy.cc index cb64e28f..f92bfa54 100644 --- a/src/Unittests/unittests_split_edge_copy.cc +++ b/src/Unittests/unittests_split_edge_copy.cc @@ -99,7 +99,7 @@ TEST_F(OpenMeshSplitEdgeCopyTriangleMesh, SplitEdgeCopyTriangleMesh) { EXPECT_EQ(999, mesh_.property(eprop_int, eh0)) << "Different Property value"; EXPECT_TRUE(mesh_.status(eh0).tagged()) << "Different internal property value"; - EXPECT_EQ(mesh_.valence(fh), 3) << "Face of TriMesh has valence other than 3"; + EXPECT_EQ(3u, mesh_.valence(fh)) << "Face of TriMesh has valence other than 3"; } /* splits an edge that has a property in a poly mesh with split_edge_copy @@ -219,7 +219,7 @@ TEST_F(OpenMeshSplitEdgeCopyTriangleMesh, SplitEdgeCopyFacePropertiesTriangleMes for (auto fh : mesh_.faces()) { - EXPECT_EQ(mesh_.valence(fh), 3); + EXPECT_EQ(3u, mesh_.valence(fh)); } // Check setup From 5e7493b3a930e0acf6f72f1439ebb8ac24cde6ff Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Thu, 12 Apr 2018 11:11:55 +0200 Subject: [PATCH 038/118] Altered PolyMesh template to work with Eigen's Vectors --- src/OpenMesh/Core/Mesh/PolyMeshT.cc | 24 +++++++++++++----------- src/OpenMesh/Core/Mesh/PolyMeshT.hh | 12 ++++++------ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/OpenMesh/Core/Mesh/PolyMeshT.cc b/src/OpenMesh/Core/Mesh/PolyMeshT.cc index 827306dc..bb88a68b 100644 --- a/src/OpenMesh/Core/Mesh/PolyMeshT.cc +++ b/src/OpenMesh/Core/Mesh/PolyMeshT.cc @@ -144,13 +144,13 @@ PolyMeshT::calc_face_normal_impl(FaceHandle _fh, PointIs3DTag) const n[2] += static_cast(a[0] * b[1]); } - const typename vector_traits::value_type norm = n.length(); + const typename vector_traits::value_type length = norm(n); // The expression ((n *= (1.0/norm)),n) is used because the OpenSG // vector class does not return self after component-wise // self-multiplication with a scalar!!! - return (norm != typename vector_traits::value_type(0)) - ? ((n *= (typename vector_traits::value_type(1)/norm)), n) + return (length != typename vector_traits::value_type(0)) + ? ((n *= (typename vector_traits::value_type(1)/length)), n) : Normal(0, 0, 0); } @@ -194,20 +194,22 @@ calc_face_normal_impl(const Point& _p0, Normal p1p2(vector_cast(_p2)); p1p2 -= vector_cast(_p1); Normal n = cross(p1p2, p1p0); - typename vector_traits::value_type norm = n.length(); + typename vector_traits::value_type length = norm(n); // The expression ((n *= (1.0/norm)),n) is used because the OpenSG // vector class does not return self after component-wise // self-multiplication with a scalar!!! - return (norm != typename vector_traits::value_type(0)) ? ((n *= (typename vector_traits::value_type(1)/norm)),n) : Normal(0,0,0); + return (length != typename vector_traits::value_type(0)) + ? ((n *= (typename vector_traits::value_type(1)/length)),n) + : Normal(0,0,0); #else Point p1p0 = _p0; p1p0 -= _p1; Point p1p2 = _p2; p1p2 -= _p1; Normal n = vector_cast(cross(p1p2, p1p0)); - typename vector_traits::value_type norm = n.length(); + typename vector_traits::value_type length = norm(n); - return (norm != 0.0) ? n *= (1.0/norm) : Normal(0,0,0); + return (length != 0.0) ? n *= (1.0/length) : Normal(0,0,0); #endif } @@ -331,7 +333,7 @@ calc_halfedge_normal(HalfedgeHandle _heh, const double _feature_angle) const for(unsigned int i=0; i void PolyMeshT:: calc_vertex_normal_fast(VertexHandle _vh, Normal& _n) const { - _n.vectorize(0.0); + vectorize(_n, 0.0); for (ConstVertexFaceIter vf_it = this->cvf_iter(_vh); vf_it.is_valid(); ++vf_it) _n += this->normal(*vf_it); } diff --git a/src/OpenMesh/Core/Mesh/PolyMeshT.hh b/src/OpenMesh/Core/Mesh/PolyMeshT.hh index b29ea40e..3aaa2279 100644 --- a/src/OpenMesh/Core/Mesh/PolyMeshT.hh +++ b/src/OpenMesh/Core/Mesh/PolyMeshT.hh @@ -406,7 +406,7 @@ public: { Normal edge_vec; calc_edge_vector(_heh, edge_vec); - return edge_vec.sqrnorm(); + return sqrnorm(edge_vec); } /** Calculates the midpoint of the halfedge _heh, defined by the positions of @@ -444,7 +444,7 @@ public: { Normal v0, v1; calc_sector_vectors(_in_heh, v0, v1); - Scalar denom = v0.norm()*v1.norm(); + Scalar denom = length(v0)*length(v1); if ( denom == Scalar(0)) { return 0; @@ -470,7 +470,7 @@ public: Normal in_vec, out_vec; calc_edge_vector(_in_heh, in_vec); calc_edge_vector(next_halfedge_handle(_in_heh), out_vec); - Scalar denom = in_vec.norm()*out_vec.norm(); + Scalar denom = length(in_vec)*length(out_vec); if (is_zero(denom)) { _cos_a = 1; @@ -479,7 +479,7 @@ public: else { _cos_a = dot(in_vec, out_vec)/denom; - _sin_a = cross(in_vec, out_vec).norm()/denom; + _sin_a = length(cross(in_vec, out_vec))/denom; } } */ @@ -499,7 +499,7 @@ public: { Normal sector_normal; calc_sector_normal(_in_heh, sector_normal); - return sector_normal.norm()/2; + return length(sector_normal)/2; } /** calculates the dihedral angle on the halfedge _heh @@ -539,7 +539,7 @@ public: calc_sector_normal(_heh, n0); calc_sector_normal(this->opposite_halfedge_handle(_heh), n1); calc_edge_vector(_heh, he); - Scalar denom = n0.norm()*n1.norm(); + Scalar denom = length(n0)*length(n1); if (denom == Scalar(0)) { return 0; From 57e2e0743271328ddb76fc7cca95f730e0806e45 Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Thu, 12 Apr 2018 11:30:12 +0200 Subject: [PATCH 039/118] Implemented necessary free functions for OpenMesh Vectors --- src/OpenMesh/Core/Geometry/Vector11T.hh | 28 +++++++++++++++++++++++++ src/OpenMesh/Core/Mesh/PolyMeshT.hh | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/OpenMesh/Core/Geometry/Vector11T.hh b/src/OpenMesh/Core/Geometry/Vector11T.hh index c9d918ba..c820008d 100644 --- a/src/OpenMesh/Core/Geometry/Vector11T.hh +++ b/src/OpenMesh/Core/Geometry/Vector11T.hh @@ -718,6 +718,34 @@ noexcept(noexcept(_v1.swap(_v2))) { _v1.swap(_v2); } +/// \relates OpenMesh::VectorT +/// non-member norm +template +Scalar norm(const VectorT& _v) { + return _v.norm(); +} + +/// \relates OpenMesh::VectorT +/// non-member sqrnorm +template +Scalar sqrnorm(const VectorT& _v) { + return _v.sqrnorm(); +} +/// \relates OpenMesh::VectorT +/// non-member vectorize +template +VectorT& vectorize(VectorT& _v, OtherScalar const& _val) { + return _v.vectorize(_val); +} + +/// \relates OpenMesh::VectorT +/// non-member normalize +template +VectorT& normalize(VectorT& _v) { + return _v.normalize(); +} + + //== TYPEDEFS ================================================================= /** 1-byte signed vector */ diff --git a/src/OpenMesh/Core/Mesh/PolyMeshT.hh b/src/OpenMesh/Core/Mesh/PolyMeshT.hh index 3aaa2279..90def28f 100644 --- a/src/OpenMesh/Core/Mesh/PolyMeshT.hh +++ b/src/OpenMesh/Core/Mesh/PolyMeshT.hh @@ -539,7 +539,7 @@ public: calc_sector_normal(_heh, n0); calc_sector_normal(this->opposite_halfedge_handle(_heh), n1); calc_edge_vector(_heh, he); - Scalar denom = length(n0)*length(n1); + Scalar denom = norm(n0)*norm(n1); if (denom == Scalar(0)) { return 0; From 377562d11a6ab666d3ce0c5ea1b9e272a771a483 Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Thu, 12 Apr 2018 15:16:50 +0200 Subject: [PATCH 040/118] Fixed last occurences of non-free-function usage (at least as far as covered by the tests). --- src/OpenMesh/Core/Geometry/Vector11T.hh | 13 +++++++++++++ src/OpenMesh/Core/Mesh/PolyMeshT.cc | 10 +++++----- src/OpenMesh/Core/Mesh/TriMeshT.hh | 6 +++--- src/OpenMesh/Core/Utils/vector_cast.hh | 1 - .../Tools/Smoother/JacobiLaplaceSmootherT.cc | 2 +- src/OpenMesh/Tools/Smoother/SmootherT.cc | 6 +++--- .../Tools/Subdivider/Uniform/CatmullClarkT.cc | 2 +- 7 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/OpenMesh/Core/Geometry/Vector11T.hh b/src/OpenMesh/Core/Geometry/Vector11T.hh index c820008d..b9113a6a 100644 --- a/src/OpenMesh/Core/Geometry/Vector11T.hh +++ b/src/OpenMesh/Core/Geometry/Vector11T.hh @@ -745,6 +745,19 @@ VectorT& normalize(VectorT& _v) { return _v.normalize(); } +/// \relates OpenMesh::VectorT +/// non-member maximize +template +VectorT& maximize(VectorT& _v1, VectorT& _v2) { + return _v1.maximize(_v2); +} + +/// \relates OpenMesh::VectorT +/// non-member minimize +template +VectorT& minimize(VectorT& _v1, VectorT& _v2) { + return _v1.minimize(_v2); +} //== TYPEDEFS ================================================================= diff --git a/src/OpenMesh/Core/Mesh/PolyMeshT.cc b/src/OpenMesh/Core/Mesh/PolyMeshT.cc index bb88a68b..64fc9914 100644 --- a/src/OpenMesh/Core/Mesh/PolyMeshT.cc +++ b/src/OpenMesh/Core/Mesh/PolyMeshT.cc @@ -139,9 +139,9 @@ PolyMeshT::calc_face_normal_impl(FaceHandle _fh, PointIs3DTag) const // Due to traits, the value types of normals and points can be different. // Therefore we cast them here. - n[0] += static_cast(a[1] * b[2]); - n[1] += static_cast(a[2] * b[0]); - n[2] += static_cast(a[0] * b[1]); + n[0] += static_cast::value_type>(a[1] * b[2]); + n[1] += static_cast::value_type>(a[2] * b[0]); + n[2] += static_cast::value_type>(a[0] * b[1]); } const typename vector_traits::value_type length = norm(n); @@ -228,7 +228,7 @@ PolyMeshT:: calc_face_centroid(FaceHandle _fh) const { Point _pt; - _pt.vectorize(0); + vectorize(_pt, 0); Scalar valence = 0.0; for (ConstFaceVertexIter cfv_it = this->cfv_iter(_fh); cfv_it.is_valid(); ++cfv_it, valence += 1.0) { @@ -401,7 +401,7 @@ template void PolyMeshT:: calc_vertex_normal_correct(VertexHandle _vh, Normal& _n) const { - _n.vectorize(0.0); + vectorize(_n, 0.0); ConstVertexIHalfedgeIter cvih_it = this->cvih_iter(_vh); if (! cvih_it.is_valid() ) {//don't crash on isolated vertices diff --git a/src/OpenMesh/Core/Mesh/TriMeshT.hh b/src/OpenMesh/Core/Mesh/TriMeshT.hh index 6ff32f3c..1865f30c 100644 --- a/src/OpenMesh/Core/Mesh/TriMeshT.hh +++ b/src/OpenMesh/Core/Mesh/TriMeshT.hh @@ -359,9 +359,9 @@ public: VertexHandle p2 = this->to_vertex_handle(he2); // Calculate midpoint coordinates - const Point new0 = (this->point(p0) + this->point(p2)) * static_cast< typename Point::value_type >(0.5); - const Point new1 = (this->point(p0) + this->point(p1)) * static_cast< typename Point::value_type >(0.5); - const Point new2 = (this->point(p1) + this->point(p2)) * static_cast< typename Point::value_type >(0.5); + const Point new0 = (this->point(p0) + this->point(p2)) * static_cast::value_type >(0.5); + const Point new1 = (this->point(p0) + this->point(p1)) * static_cast::value_type >(0.5); + const Point new2 = (this->point(p1) + this->point(p2)) * static_cast::value_type >(0.5); // Add vertices at midpoint coordinates VertexHandle v0 = this->add_vertex(new0); diff --git a/src/OpenMesh/Core/Utils/vector_cast.hh b/src/OpenMesh/Core/Utils/vector_cast.hh index 94f991a5..39fca197 100644 --- a/src/OpenMesh/Core/Utils/vector_cast.hh +++ b/src/OpenMesh/Core/Utils/vector_cast.hh @@ -95,7 +95,6 @@ inline void vector_cast( const src_t & /*_src*/, dst_t & /*_dst*/, GenProg::Int2 { } - template inline void vector_copy( const src_t &_src, dst_t &_dst, GenProg::Int2Type ) { diff --git a/src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.cc b/src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.cc index 62fa98c1..f038006f 100644 --- a/src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.cc +++ b/src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.cc @@ -181,7 +181,7 @@ compute_new_positions_C1() if (diag) uu *= static_cast(1.0) / diag; // damping - uu *= static_cast(0.25); + uu *= static_cast::value_type>(0.25); // store new position p = vector_cast(Base::mesh_.point(*v_it)); diff --git a/src/OpenMesh/Tools/Smoother/SmootherT.cc b/src/OpenMesh/Tools/Smoother/SmootherT.cc index 2bb44bd0..c727aeba 100644 --- a/src/OpenMesh/Tools/Smoother/SmootherT.cc +++ b/src/OpenMesh/Tools/Smoother/SmootherT.cc @@ -263,13 +263,13 @@ set_relative_local_error(Scalar _err) bb_min = bb_max = mesh_.point(*v_it); for (++v_it; v_it!=v_end; ++v_it) { - bb_min.minimize(mesh_.point(*v_it)); - bb_max.maximize(mesh_.point(*v_it)); + minimize(bb_min, mesh_.point(*v_it)); + maximize(bb_max, mesh_.point(*v_it)); } // abs. error = rel. error * bounding-diagonal - set_absolute_local_error(_err * (bb_max-bb_min).norm()); + set_absolute_local_error(norm(_err * (bb_max-bb_min))); } } diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc b/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc index 712ddb51..1813c2fe 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc +++ b/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.cc @@ -346,7 +346,7 @@ CatmullClarkT::update_vertex( MeshType& _m, const VertexHandl for ( ve_itr = _m.ve_iter( _vh); ve_itr.is_valid(); ++ve_itr) if ( _m.is_boundary( *ve_itr)) pos += _m.property( ep_pos_, *ve_itr); - pos /= static_cast(3.0); + pos /= static_cast::value_type>(3.0); } else // inner vertex { From 5a2f426d8c0700c82637e1fcbc8a823892a5f07e Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Thu, 12 Apr 2018 15:18:11 +0200 Subject: [PATCH 041/118] Unittests now use the Point/Normal types related to the mesh type, instead of relying on them being OpenMesh vectors. --- .../unittests_normal_calculations.cc | 6 +-- src/Unittests/unittests_trimesh_others.cc | 3 +- src/Unittests/unittests_tutorials.cc | 38 +++++++++---------- src/Unittests/unittests_vdpm.cc | 2 +- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/Unittests/unittests_normal_calculations.cc b/src/Unittests/unittests_normal_calculations.cc index 07342a67..30d350f0 100644 --- a/src/Unittests/unittests_normal_calculations.cc +++ b/src/Unittests/unittests_normal_calculations.cc @@ -247,7 +247,7 @@ TEST_F(OpenMeshNormals, NormalCalculations_calc_vertex_normal_fast) { mesh_.request_face_normals(); - OpenMesh::Vec3f normal; + Mesh::Normal normal; mesh_.calc_vertex_normal_fast(vhandle[2],normal); @@ -304,7 +304,7 @@ TEST_F(OpenMeshNormals, NormalCalculations_calc_vertex_normal_correct) { mesh_.request_halfedge_normals(); mesh_.request_face_normals(); - OpenMesh::Vec3f normal; + Mesh::Normal normal; mesh_.calc_vertex_normal_correct(vhandle[2],normal); @@ -361,7 +361,7 @@ TEST_F(OpenMeshNormals, NormalCalculations_calc_vertex_normal_loop) { mesh_.request_halfedge_normals(); mesh_.request_face_normals(); - OpenMesh::Vec3f normal; + Mesh::Normal normal; mesh_.calc_vertex_normal_loop(vhandle[2],normal); diff --git a/src/Unittests/unittests_trimesh_others.cc b/src/Unittests/unittests_trimesh_others.cc index a9aaebd1..e7fb2d20 100644 --- a/src/Unittests/unittests_trimesh_others.cc +++ b/src/Unittests/unittests_trimesh_others.cc @@ -164,7 +164,8 @@ TEST_F(OpenMeshOthers, CalcDihedralAngre ) { EXPECT_EQ( 0.0 , mesh_.calc_dihedral_angle(eh) ) << "Wrong Dihedral angle!" << std::endl; // Modify point - Mesh::Point tmp = ( Mesh::Point(0.0, 0.0, -1.0) + Mesh::Point(1.0, 1.0, -1.0) ) * static_cast(0.5); + Mesh::Point tmp = ( Mesh::Point(0.0, 0.0, -1.0) + Mesh::Point(1.0, 1.0, -1.0) ) + * static_cast::value_type>(0.5); mesh_.point(vhandle[2]) = tmp; double difference = fabs( 1.36944 - mesh_.calc_dihedral_angle(eh) ); diff --git a/src/Unittests/unittests_tutorials.cc b/src/Unittests/unittests_tutorials.cc index 4a7ac5ba..0dd69201 100644 --- a/src/Unittests/unittests_tutorials.cc +++ b/src/Unittests/unittests_tutorials.cc @@ -622,14 +622,14 @@ TEST_F(OpenMeshTutorials, deleting_geometry_elements) { MyMeshWithStatus::VertexHandle vhandle[8]; MyMeshWithStatus::FaceHandle fhandle[6]; - vhandle[0] = mesh.add_vertex(MyMesh::Point(-1, -1, 1)); - vhandle[1] = mesh.add_vertex(MyMesh::Point( 1, -1, 1)); - vhandle[2] = mesh.add_vertex(MyMesh::Point( 1, 1, 1)); - vhandle[3] = mesh.add_vertex(MyMesh::Point(-1, 1, 1)); - vhandle[4] = mesh.add_vertex(MyMesh::Point(-1, -1, -1)); - vhandle[5] = mesh.add_vertex(MyMesh::Point( 1, -1, -1)); - vhandle[6] = mesh.add_vertex(MyMesh::Point( 1, 1, -1)); - vhandle[7] = mesh.add_vertex(MyMesh::Point(-1, 1, -1)); + vhandle[0] = mesh.add_vertex(Mesh::Point(-1, -1, 1)); + vhandle[1] = mesh.add_vertex(Mesh::Point( 1, -1, 1)); + vhandle[2] = mesh.add_vertex(Mesh::Point( 1, 1, 1)); + vhandle[3] = mesh.add_vertex(Mesh::Point(-1, 1, 1)); + vhandle[4] = mesh.add_vertex(Mesh::Point(-1, -1, -1)); + vhandle[5] = mesh.add_vertex(Mesh::Point( 1, -1, -1)); + vhandle[6] = mesh.add_vertex(Mesh::Point( 1, 1, -1)); + vhandle[7] = mesh.add_vertex(Mesh::Point(-1, 1, -1)); // generate (quadrilateral) faces std::vector tmp_face_vhandles; @@ -807,10 +807,10 @@ TEST_F(OpenMeshTutorials, flipping_edges) { Mesh mesh; // Add some vertices Mesh::VertexHandle vhandle[4]; - vhandle[0] = mesh.add_vertex(MyMesh::Point(0, 0, 0)); - vhandle[1] = mesh.add_vertex(MyMesh::Point(0, 1, 0)); - vhandle[2] = mesh.add_vertex(MyMesh::Point(1, 1, 0)); - vhandle[3] = mesh.add_vertex(MyMesh::Point(1, 0, 0)); + vhandle[0] = mesh.add_vertex(Mesh::Point(0, 0, 0)); + vhandle[1] = mesh.add_vertex(Mesh::Point(0, 1, 0)); + vhandle[2] = mesh.add_vertex(Mesh::Point(1, 1, 0)); + vhandle[3] = mesh.add_vertex(Mesh::Point(1, 0, 0)); // Add two faces std::vector face_vhandles; face_vhandles.push_back(vhandle[2]); @@ -846,13 +846,13 @@ TEST_F(OpenMeshTutorials, collapsing_edges) { mesh.request_edge_status(); // Add some vertices as in the illustration above PolyMesh::VertexHandle vhandle[7]; - vhandle[0] = mesh.add_vertex(MyMesh::Point(-1, 1, 0)); - vhandle[1] = mesh.add_vertex(MyMesh::Point(-1, 3, 0)); - vhandle[2] = mesh.add_vertex(MyMesh::Point(0, 0, 0)); - vhandle[3] = mesh.add_vertex(MyMesh::Point(0, 2, 0)); - vhandle[4] = mesh.add_vertex(MyMesh::Point(0, 4, 0)); - vhandle[5] = mesh.add_vertex(MyMesh::Point(1, 1, 0)); - vhandle[6] = mesh.add_vertex(MyMesh::Point(1, 3, 0)); + vhandle[0] = mesh.add_vertex(PolyMesh::Point(-1, 1, 0)); + vhandle[1] = mesh.add_vertex(PolyMesh::Point(-1, 3, 0)); + vhandle[2] = mesh.add_vertex(PolyMesh::Point(0, 0, 0)); + vhandle[3] = mesh.add_vertex(PolyMesh::Point(0, 2, 0)); + vhandle[4] = mesh.add_vertex(PolyMesh::Point(0, 4, 0)); + vhandle[5] = mesh.add_vertex(PolyMesh::Point(1, 1, 0)); + vhandle[6] = mesh.add_vertex(PolyMesh::Point(1, 3, 0)); // Add three quad faces std::vector face_vhandles; face_vhandles.push_back(vhandle[1]); diff --git a/src/Unittests/unittests_vdpm.cc b/src/Unittests/unittests_vdpm.cc index 46a8110d..f037ca58 100644 --- a/src/Unittests/unittests_vdpm.cc +++ b/src/Unittests/unittests_vdpm.cc @@ -185,7 +185,7 @@ LoadInfo open_progresult_mesh(const std::string& _filename) OpenMesh::IO::restore(ifs, vr, swap); PMInfo pminfo; - pminfo.p0 = p; + pminfo.p0 = OpenMesh::vector_cast(p); pminfo.v0 = result.mesh.add_vertex(p); pminfo.v1 = Mesh::VertexHandle(v1); pminfo.vl = Mesh::VertexHandle(vl); From f12ca3fefe142e5a34085c4cee363d2e93b74fd9 Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Thu, 12 Apr 2018 15:19:53 +0200 Subject: [PATCH 042/118] Added a minimal vector type that makes the OpenMesh tests pass. --- src/Unittests/CMakeLists.txt | 17 +- src/Unittests/unittests_common.hh | 5 + .../unittests_common_customtraits.hh | 145 ++++++++++++++++++ 3 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 src/Unittests/unittests_common_customtraits.hh diff --git a/src/Unittests/CMakeLists.txt b/src/Unittests/CMakeLists.txt index a6ea5e7b..a8b02724 100644 --- a/src/Unittests/CMakeLists.txt +++ b/src/Unittests/CMakeLists.txt @@ -30,22 +30,28 @@ if ( OPENMESH_BUILD_UNIT_TESTS ) FILE(GLOB UNITTEST_SRC *.cc) # Create unittest executable acg_add_executable(unittests ${UNITTEST_SRC}) + acg_add_executable(unittests_customvec ${UNITTEST_SRC}) + target_compile_definitions(unittests_customvec PRIVATE TEST_CUSTOM_TRAITS) # For the unittest we don't want the install rpath as set by acg_add_executable - set_target_properties ( unittests PROPERTIES BUILD_WITH_INSTALL_RPATH 0 ) + set_target_properties ( unittests PROPERTIES BUILD_WITH_INSTALL_RPATH 0 ) + set_target_properties ( unittests_customvec PROPERTIES BUILD_WITH_INSTALL_RPATH 0 ) # Set output directory to ${BINARY_DIR}/Unittests set (OUTPUT_DIR "${CMAKE_BINARY_DIR}/Unittests") set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}) + set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}) foreach(CONFIG ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER ${CONFIG} UPCONFIG) set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR}) + set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}) endforeach() if ( NOT WIN32) # Link against all necessary libraries target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread) + target_link_libraries(unittests_customvec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread) @@ -56,6 +62,7 @@ if ( OPENMESH_BUILD_UNIT_TESTS ) endif() target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) + target_link_libraries(unittests_customvec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) endif() @@ -63,9 +70,11 @@ if ( OPENMESH_BUILD_UNIT_TESTS ) if ( NOT WIN32 ) # Set compiler flags set_target_properties(unittests PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long") + set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long") else() # Set compiler flags set_target_properties(unittests PROPERTIES COMPILE_FLAGS "" ) + set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long") endif() @@ -80,10 +89,16 @@ if ( OPENMESH_BUILD_UNIT_TESTS ) "$" "${CMAKE_BINARY_DIR}/Unittests/$" COMMENT "Copying OpenMesh targets to unittests directory") + add_custom_command(TARGET unittests_customvec POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy + "$" + "${CMAKE_BINARY_DIR}/Unittests/$" + COMMENT "Copying OpenMesh targets to unittests directory") endforeach(TAR) endif() acg_copy_after_build(unittests ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/) + acg_copy_after_build(unittests_customvec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/) add_test(NAME AllTestsIn_OpenMesh_tests WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests") diff --git a/src/Unittests/unittests_common.hh b/src/Unittests/unittests_common.hh index cbabb9cb..0d095701 100644 --- a/src/Unittests/unittests_common.hh +++ b/src/Unittests/unittests_common.hh @@ -7,8 +7,13 @@ #include #include +#ifdef TEST_CUSTOM_TRAITS +#include +#else struct CustomTraits : public OpenMesh::DefaultTraits { }; +#endif + typedef OpenMesh::TriMesh_ArrayKernelT Mesh; diff --git a/src/Unittests/unittests_common_customtraits.hh b/src/Unittests/unittests_common_customtraits.hh new file mode 100644 index 00000000..a53f724d --- /dev/null +++ b/src/Unittests/unittests_common_customtraits.hh @@ -0,0 +1,145 @@ +#ifndef UNITTESTS_COMMON_DUMMYTRAITS +#define UNITTESTS_COMMON_DUMMYTRAITS +#include +#include + +namespace Custom { + +/// A Vector class with the absolute minimum of built-in methods to test the +/// interface expected from Vectors used in Traits +template class Vec { + public: + // Constructor with DIM components + template ::type, + typename = typename std::enable_if< + are_convertible_to::value>::type> + constexpr Vec(T v, Ts... vs) + : data{{static_cast(v), static_cast(vs)...}} { + static_assert(sizeof...(Ts)+1 == DIM, + "Invalid number of components specified in constructor."); + static_assert(are_convertible_to::value, + "Not all components are convertible to Scalar."); + } + + constexpr Vec() = default; + constexpr Vec(Vec const &) = default; + + float &operator[](int i) { return data[i]; } + float operator[](int i) const { return data[i]; } + + private: + std::array data; +}; + +template bool operator==(Vec const &lhs, Vec const &rhs) { + for (int i = 0; i < DIM; i++) + if (lhs[i] != rhs[i]) return false; + return true; +} + +template +Vec operator+(Vec const &lhs, Vec const &rhs) { + Vec result; + for (int i = 0; i < DIM; i++) + result[i] = lhs[i] + rhs[i]; + return result; +} + +template +Vec operator-(Vec const &lhs, Vec const &rhs) { + Vec result; + for (int i = 0; i < DIM; i++) + result[i] = lhs[i] - rhs[i]; + return result; +} + +template Vec operator*(Vec const &lhs, float rhs) { + Vec result; + for (int i = 0; i < DIM; i++) + result[i] = lhs[i] * rhs; + return result; +} + +template Vec operator*(float lhs, Vec const &rhs) { + return rhs * lhs; +} + +template Vec operator/(Vec const &lhs, float rhs) { + Vec result; + for (int i = 0; i < DIM; i++) + result[i] = lhs[i] / rhs; + return result; +} + +template Vec &operator+=(Vec &lhs, Vec const &rhs) { + return lhs = lhs + rhs; +} +template Vec &operator-=(Vec &lhs, Vec const &rhs) { + return lhs = lhs - rhs; +} +template Vec &operator*=(Vec &lhs, float rhs) { + return lhs = lhs * rhs; +} +template Vec &operator/=(Vec &lhs, float rhs) { + return lhs = lhs / rhs; +} + +template float norm(Vec const &v) { + float sum = 0.0f; + for (int i = 0; i < DIM; i++) + sum += v[i] * v[i]; + return std::sqrt(sum); +} + +template Vec &normalize(Vec &v) { return v /= norm(v); } +template Vec &vectorize(Vec &v, float val) { + for (int i = 0; i < DIM; i++) + v[i] = val; + return v; +} + +template Vec &minimize(Vec &v1, Vec const &v2) { + for (int i = 0; i < DIM; i++) + v1[i] = std::min(v1[i], v2[i]); + return v1; +} + +template Vec &maximize(Vec &v1, Vec const &v2) { + for (int i = 0; i < DIM; i++) + v1[i] = std::max(v1[i], v2[i]); + return v1; +} + +template float dot(Vec const &v1, Vec const &v2) { + float sum = 0.f; + for (int i = 0; i < DIM; i++) + sum += v1[i] * v2[i]; + return sum; +} + +inline Vec<3> cross(Vec<3> const &v1, Vec<3> const &v2) { + return {v1[1] * v2[2] - v1[2] * v2[1], // + v1[2] * v2[0] - v1[0] * v2[2], // + v1[0] * v2[1] - v1[1] * v2[0]}; +} +} + +namespace OpenMesh { +template struct vector_traits> { + using vector_type = Custom::Vec; + using value_type = float; + static const size_t size_ = DIM; + static size_t size() { return size_; } +}; +} + +struct CustomTraits : public OpenMesh::DefaultTraits { + typedef Custom::Vec<3> Point; + typedef Custom::Vec<3> Normal; + + typedef Custom::Vec<2> TexCoord2D; + typedef Custom::Vec<3> TexCoord3D; +}; + +#endif // UNITTESTS_COMMON_DUMMYTRAITS From 4eab053275e3b11f0b46d9df9b7869eb07be553e Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Thu, 12 Apr 2018 16:07:41 +0200 Subject: [PATCH 043/118] Added free functions for non-C++11 Vectors --- src/OpenMesh/Core/Geometry/VectorT.hh | 39 ++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/OpenMesh/Core/Geometry/VectorT.hh b/src/OpenMesh/Core/Geometry/VectorT.hh index d8c8f2b1..be8610f3 100644 --- a/src/OpenMesh/Core/Geometry/VectorT.hh +++ b/src/OpenMesh/Core/Geometry/VectorT.hh @@ -264,7 +264,6 @@ dot(const VectorT& _v1, const VectorT& _v2) { return (_v1 | _v2); } - /// \relates OpenMesh::VectorT /// symmetric version of the cross product template @@ -273,8 +272,46 @@ cross(const VectorT& _v1, const VectorT& _v2) { return (_v1 % _v2); } +/// \relates OpenMesh::VectorT +/// non-member norm +template +Scalar norm(const VectorT& _v) { + return _v.norm(); +} +/// \relates OpenMesh::VectorT +/// non-member sqrnorm +template +Scalar sqrnorm(const VectorT& _v) { + return _v.sqrnorm(); +} +/// \relates OpenMesh::VectorT +/// non-member vectorize +template +VectorT& vectorize(VectorT& _v, OtherScalar const& _val) { + return _v.vectorize(_val); +} +/// \relates OpenMesh::VectorT +/// non-member normalize +template +VectorT& normalize(VectorT& _v) { + return _v.normalize(); +} + +/// \relates OpenMesh::VectorT +/// non-member maximize +template +VectorT& maximize(VectorT& _v1, VectorT& _v2) { + return _v1.maximize(_v2); +} + +/// \relates OpenMesh::VectorT +/// non-member minimize +template +VectorT& minimize(VectorT& _v1, VectorT& _v2) { + return _v1.minimize(_v2); +} //== TYPEDEFS ================================================================= From dc4243f928b2a686d4f6f4ca5a9c199b01f36d09 Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Thu, 12 Apr 2018 17:53:54 +0200 Subject: [PATCH 044/118] Now builds on VS 2013 --- src/Unittests/CMakeLists.txt | 3 +-- .../unittests_common_customtraits.hh | 22 +++++++------------ src/Unittests/unittests_trimesh_others.cc | 2 +- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/Unittests/CMakeLists.txt b/src/Unittests/CMakeLists.txt index a8b02724..3843175f 100644 --- a/src/Unittests/CMakeLists.txt +++ b/src/Unittests/CMakeLists.txt @@ -74,8 +74,7 @@ if ( OPENMESH_BUILD_UNIT_TESTS ) else() # Set compiler flags set_target_properties(unittests PROPERTIES COMPILE_FLAGS "" ) - set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long") - + set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "" ) endif() if ( OPENMESH_BUILD_SHARED ) diff --git a/src/Unittests/unittests_common_customtraits.hh b/src/Unittests/unittests_common_customtraits.hh index a53f724d..bb3ec8f8 100644 --- a/src/Unittests/unittests_common_customtraits.hh +++ b/src/Unittests/unittests_common_customtraits.hh @@ -2,6 +2,7 @@ #define UNITTESTS_COMMON_DUMMYTRAITS #include #include +#include namespace Custom { @@ -10,20 +11,13 @@ namespace Custom { template class Vec { public: // Constructor with DIM components - template ::type, - typename = typename std::enable_if< - are_convertible_to::value>::type> - constexpr Vec(T v, Ts... vs) - : data{{static_cast(v), static_cast(vs)...}} { - static_assert(sizeof...(Ts)+1 == DIM, - "Invalid number of components specified in constructor."); - static_assert(are_convertible_to::value, - "Not all components are convertible to Scalar."); - } - - constexpr Vec() = default; - constexpr Vec(Vec const &) = default; + Vec(float x) : data({ x }) {} + Vec(float x, float y) : data({ x, y }) {} + Vec(float x, float y, float z) : data({ x, y, z }) {} + Vec(float x, float y, float z, float w) : data({ x, y, z, w }) {} + + Vec() = default; + Vec(Vec const &) = default; float &operator[](int i) { return data[i]; } float operator[](int i) const { return data[i]; } diff --git a/src/Unittests/unittests_trimesh_others.cc b/src/Unittests/unittests_trimesh_others.cc index e7fb2d20..5a771021 100644 --- a/src/Unittests/unittests_trimesh_others.cc +++ b/src/Unittests/unittests_trimesh_others.cc @@ -165,7 +165,7 @@ TEST_F(OpenMeshOthers, CalcDihedralAngre ) { // Modify point Mesh::Point tmp = ( Mesh::Point(0.0, 0.0, -1.0) + Mesh::Point(1.0, 1.0, -1.0) ) - * static_cast::value_type>(0.5); + * static_cast::value_type>(0.5); mesh_.point(vhandle[2]) = tmp; double difference = fabs( 1.36944 - mesh_.calc_dihedral_angle(eh) ); From b135803c865ccde58e82adb5a0fc8712fa16e3ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 16 Apr 2018 10:03:10 +0200 Subject: [PATCH 045/118] Removed unary_function from hash --- src/OpenMesh/Core/Mesh/Handles.hh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/OpenMesh/Core/Mesh/Handles.hh b/src/OpenMesh/Core/Mesh/Handles.hh index 6cbb8ac4..68ac1d7e 100644 --- a/src/OpenMesh/Core/Mesh/Handles.hh +++ b/src/OpenMesh/Core/Mesh/Handles.hh @@ -165,8 +165,9 @@ namespace std { template <> struct hash - : public std::unary_function { + typedef OpenMesh::BaseHandle argument_type; + typedef std::size_t result_type; std::size_t operator()(const OpenMesh::BaseHandle& h) const { @@ -176,8 +177,9 @@ struct hash template <> struct hash - : public std::unary_function { + typedef OpenMesh::VertexHandle argument_type; + typedef std::size_t result_type; std::size_t operator()(const OpenMesh::VertexHandle& h) const { @@ -187,9 +189,11 @@ struct hash template <> struct hash - : public std::unary_function { + typedef OpenMesh::HalfedgeHandle argument_type; + typedef std::size_t result_type; + std::size_t operator()(const OpenMesh::HalfedgeHandle& h) const { return h.idx(); @@ -198,9 +202,11 @@ struct hash template <> struct hash - : public std::unary_function { + typedef OpenMesh::EdgeHandle argument_type; + typedef std::size_t result_type; + std::size_t operator()(const OpenMesh::EdgeHandle& h) const { return h.idx(); @@ -209,9 +215,11 @@ struct hash template <> struct hash - : public std::unary_function { + typedef OpenMesh::FaceHandle argument_type; + typedef std::size_t result_type; + std::size_t operator()(const OpenMesh::FaceHandle& h) const { return h.idx(); From 7bb868b2bef21598645b0aa8cb9e49a9683b238e Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Mon, 16 Apr 2018 13:15:45 +0200 Subject: [PATCH 046/118] Replaced usage of length() by norm() to avoid forcing both to be implemented --- src/OpenMesh/Core/Mesh/PolyMeshT.hh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OpenMesh/Core/Mesh/PolyMeshT.hh b/src/OpenMesh/Core/Mesh/PolyMeshT.hh index 90def28f..31796fb8 100644 --- a/src/OpenMesh/Core/Mesh/PolyMeshT.hh +++ b/src/OpenMesh/Core/Mesh/PolyMeshT.hh @@ -444,7 +444,7 @@ public: { Normal v0, v1; calc_sector_vectors(_in_heh, v0, v1); - Scalar denom = length(v0)*length(v1); + Scalar denom = norm(v0)*norm(v1); if ( denom == Scalar(0)) { return 0; @@ -470,7 +470,7 @@ public: Normal in_vec, out_vec; calc_edge_vector(_in_heh, in_vec); calc_edge_vector(next_halfedge_handle(_in_heh), out_vec); - Scalar denom = length(in_vec)*length(out_vec); + Scalar denom = norm(in_vec)*norm(out_vec); if (is_zero(denom)) { _cos_a = 1; @@ -479,7 +479,7 @@ public: else { _cos_a = dot(in_vec, out_vec)/denom; - _sin_a = length(cross(in_vec, out_vec))/denom; + _sin_a = norm(cross(in_vec, out_vec))/denom; } } */ @@ -499,7 +499,7 @@ public: { Normal sector_normal; calc_sector_normal(_in_heh, sector_normal); - return length(sector_normal)/2; + return norm(sector_normal)/2; } /** calculates the dihedral angle on the halfedge _heh From da002408f9048ea2db5ec9b77d90b5e28b35cb11 Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Mon, 16 Apr 2018 13:18:57 +0200 Subject: [PATCH 047/118] Corrected point type in unittest --- src/Unittests/unittests_tutorials.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Unittests/unittests_tutorials.cc b/src/Unittests/unittests_tutorials.cc index 0dd69201..6ec4b36a 100644 --- a/src/Unittests/unittests_tutorials.cc +++ b/src/Unittests/unittests_tutorials.cc @@ -622,14 +622,14 @@ TEST_F(OpenMeshTutorials, deleting_geometry_elements) { MyMeshWithStatus::VertexHandle vhandle[8]; MyMeshWithStatus::FaceHandle fhandle[6]; - vhandle[0] = mesh.add_vertex(Mesh::Point(-1, -1, 1)); - vhandle[1] = mesh.add_vertex(Mesh::Point( 1, -1, 1)); - vhandle[2] = mesh.add_vertex(Mesh::Point( 1, 1, 1)); - vhandle[3] = mesh.add_vertex(Mesh::Point(-1, 1, 1)); - vhandle[4] = mesh.add_vertex(Mesh::Point(-1, -1, -1)); - vhandle[5] = mesh.add_vertex(Mesh::Point( 1, -1, -1)); - vhandle[6] = mesh.add_vertex(Mesh::Point( 1, 1, -1)); - vhandle[7] = mesh.add_vertex(Mesh::Point(-1, 1, -1)); + vhandle[0] = mesh.add_vertex(MyMeshWithStatus::Point(-1, -1, 1)); + vhandle[1] = mesh.add_vertex(MyMeshWithStatus::Point( 1, -1, 1)); + vhandle[2] = mesh.add_vertex(MyMeshWithStatus::Point( 1, 1, 1)); + vhandle[3] = mesh.add_vertex(MyMeshWithStatus::Point(-1, 1, 1)); + vhandle[4] = mesh.add_vertex(MyMeshWithStatus::Point(-1, -1, -1)); + vhandle[5] = mesh.add_vertex(MyMeshWithStatus::Point( 1, -1, -1)); + vhandle[6] = mesh.add_vertex(MyMeshWithStatus::Point( 1, 1, -1)); + vhandle[7] = mesh.add_vertex(MyMeshWithStatus::Point(-1, 1, -1)); // generate (quadrilateral) faces std::vector tmp_face_vhandles; From 74350f54de749c14d466bbb6e75c77fe0342107b Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Mon, 16 Apr 2018 13:21:54 +0200 Subject: [PATCH 048/118] Proper spacing between methods --- src/OpenMesh/Core/Geometry/VectorT.hh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/OpenMesh/Core/Geometry/VectorT.hh b/src/OpenMesh/Core/Geometry/VectorT.hh index be8610f3..3384332a 100644 --- a/src/OpenMesh/Core/Geometry/VectorT.hh +++ b/src/OpenMesh/Core/Geometry/VectorT.hh @@ -264,6 +264,7 @@ dot(const VectorT& _v1, const VectorT& _v2) { return (_v1 | _v2); } + /// \relates OpenMesh::VectorT /// symmetric version of the cross product template @@ -272,6 +273,7 @@ cross(const VectorT& _v1, const VectorT& _v2) { return (_v1 % _v2); } + /// \relates OpenMesh::VectorT /// non-member norm template @@ -279,12 +281,15 @@ Scalar norm(const VectorT& _v) { return _v.norm(); } + /// \relates OpenMesh::VectorT /// non-member sqrnorm template Scalar sqrnorm(const VectorT& _v) { return _v.sqrnorm(); } + + /// \relates OpenMesh::VectorT /// non-member vectorize template @@ -292,6 +297,7 @@ VectorT& vectorize(VectorT& _v, OtherScalar const& _va return _v.vectorize(_val); } + /// \relates OpenMesh::VectorT /// non-member normalize template @@ -299,6 +305,7 @@ VectorT& normalize(VectorT& _v) { return _v.normalize(); } + /// \relates OpenMesh::VectorT /// non-member maximize template @@ -306,6 +313,7 @@ VectorT& maximize(VectorT& _v1, VectorT& return _v1.maximize(_v2); } + /// \relates OpenMesh::VectorT /// non-member minimize template @@ -313,6 +321,7 @@ VectorT& minimize(VectorT& _v1, VectorT& return _v1.minimize(_v2); } + //== TYPEDEFS ================================================================= /** 1-byte signed vector */ From f1a565e0b6a7b110b2a6b52470ff3df29087669f Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Mon, 16 Apr 2018 13:24:57 +0200 Subject: [PATCH 049/118] Now running unittests for custom vectors in CI --- CI/Windows.bat | 4 ++++ CI/ci-linux.sh | 4 ++++ CI/ci-mac.sh | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/CI/Windows.bat b/CI/Windows.bat index b5402dd2..22eca890 100644 --- a/CI/Windows.bat +++ b/CI/Windows.bat @@ -103,6 +103,8 @@ cd unittests unittests.exe --gtest_output=xml +unittests_customvec.exe --gtest_output=xml + cd .. cd .. @@ -129,6 +131,8 @@ cd unittests unittests.exe --gtest_output=xml +unittests_customvec.exe --gtest_output=xml + IF %errorlevel% NEQ 0 exit /b %errorlevel% cd .. diff --git a/CI/ci-linux.sh b/CI/ci-linux.sh index 84283cae..1fd5da31 100755 --- a/CI/ci-linux.sh +++ b/CI/ci-linux.sh @@ -96,6 +96,8 @@ cd Unittests #execute tests ./unittests --gtest_color=yes --gtest_output=xml +./unittests_customvec --gtest_color=yes --gtest_output=xml + cd .. cd .. @@ -134,5 +136,7 @@ cd Unittests #execute tests ./unittests --gtest_color=yes --gtest_output=xml +./unittests_customvec --gtest_color=yes --gtest_output=xml + cd .. cd .. diff --git a/CI/ci-mac.sh b/CI/ci-mac.sh index a804012d..3ceb48f3 100755 --- a/CI/ci-mac.sh +++ b/CI/ci-mac.sh @@ -78,6 +78,8 @@ cd Unittests #execute tests ./unittests --gtest_color=yes --gtest_output=xml +./unittests_customvec --gtest_color=yes --gtest_output=xml + cd .. cd .. @@ -116,6 +118,8 @@ cd Unittests #execute tests ./unittests --gtest_color=yes --gtest_output=xml +./unittests_customvec --gtest_color=yes --gtest_output=xml + cd .. cd .. From 1f0ecef421ad92f2fe865a35d50cecedcdc2c648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 16 Apr 2018 13:30:55 +0200 Subject: [PATCH 050/118] First VS2017 try --- .gitlab-ci.yml | 105 +++++++++++++++++++++++++++++++++++++++++++++++++ CI/Windows.bat | 14 +++++++ 2 files changed, 119 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d24c8c1f..0a83240f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,6 +44,111 @@ cppcheck: paths: - cppcheck.log + +#VS2015-64-bit-shared-apps: +# variables: +# BUILD_PLATFORM: "VS2015" +# ARCHITECTURE: "x64" +# SHARED: "TRUE" +# APPS: "ON" +# script: "CI\\Windows.bat" +# tags: +# - VS2015 +# artifacts: +# paths: +# - build-release/*.exe + +VS2017-64-bit-shared-no-apps: + variables: + BUILD_PLATFORM: "VS2017" + ARCHITECTURE: "x64" + SHARED: "TRUE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2017 + artifacts: + paths: + - build-release/*.exe + +#VS2015-32-bit-shared-apps: +# variables: +# BUILD_PLATFORM: "VS2015" +# ARCHITECTURE: "x32" +# SHARED: "TRUE" +# APPS: "ON" +# script: "CI\\Windows.bat" +# tags: +# - VS2015 +# artifacts: +# paths: +# - build-release/*.exe + +VS2017-32-bit-shared-no-apps: + variables: + BUILD_PLATFORM: "VS2017" + ARCHITECTURE: "x32" + SHARED: "TRUE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2017 + artifacts: + paths: + - build-release/*.exe + +#VS2015-64-bit-static-apps: +# variables: +# BUILD_PLATFORM: "VS2015" +# ARCHITECTURE: "x64" +# SHARED: "FALSE" +# APPS: "ON" +# script: "CI\\Windows.bat" +# tags: +# - VS2015 +# artifacts: +# paths: +# - build-release/*.exe + +VS2017-64-bit-static-no-apps: + variables: + BUILD_PLATFORM: "VS2017" + ARCHITECTURE: "x64" + SHARED: "FALSE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2017 + artifacts: + paths: + - build-release/*.exe + +#VS2015-32-bit-static-apps: +# variables: +# BUILD_PLATFORM: "VS2015" +# ARCHITECTURE: "x32" +# SHARED: "FALSE" +# APPS: "ON" +# script: "CI\\Windows.bat" +# tags: +# - VS2015 +# artifacts: +# paths: +# - build-release/*.exe + +VS2017-32-bit-static-no-apps: + variables: + BUILD_PLATFORM: "VS2017" + ARCHITECTURE: "x32" + SHARED: "FALSE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2017 + artifacts: + paths: + - build-release/*.exe + VS2015-64-bit-shared-apps: variables: BUILD_PLATFORM: "VS2015" diff --git a/CI/Windows.bat b/CI/Windows.bat index b5402dd2..e7e9a187 100644 --- a/CI/Windows.bat +++ b/CI/Windows.bat @@ -69,6 +69,20 @@ IF "%BUILD_PLATFORM%" == "VS2015" ( ) +IF "%BUILD_PLATFORM%" == "VS2017" ( + set LIBPATH=E:\libs\VS2017 + set GTESTVERSION=gtest-1.7.0 + set GENERATOR=Visual Studio 15%ARCH_VS% + set VS_PATH="C:\Program Files (x86)\Microsoft Visual Studio 15.0\Common7\IDE\devenv.com" + + set QT_VERSION= + IF "%ARCHITECTURE%" == "x64" ( + set QT_INSTALL_PATH=E:\Qt\Qt5.10.1\5.10.1\msvc2017_64 + set QT_BASE_CONFIG=-DQT5_INSTALL_PATH=E:\Qt\Qt5.10.1\5.10.1\msvc2017_64 + ) + +) + IF "%APPS%" == "ON" ( set STRING_APPS= From 2884ef83eb33c6acfb3809f3c8f0a1a94f2b5d3f Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Mon, 16 Apr 2018 13:32:14 +0200 Subject: [PATCH 051/118] Fixed wrong mesh type used in unittest --- src/Unittests/unittests_tutorials.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Unittests/unittests_tutorials.cc b/src/Unittests/unittests_tutorials.cc index 6ec4b36a..768cf485 100644 --- a/src/Unittests/unittests_tutorials.cc +++ b/src/Unittests/unittests_tutorials.cc @@ -619,20 +619,20 @@ TEST_F(OpenMeshTutorials, deleting_geometry_elements) { mesh.request_vertex_status(); // generate vertices - MyMeshWithStatus::VertexHandle vhandle[8]; - MyMeshWithStatus::FaceHandle fhandle[6]; + Mesh::VertexHandle vhandle[8]; + Mesh::FaceHandle fhandle[6]; - vhandle[0] = mesh.add_vertex(MyMeshWithStatus::Point(-1, -1, 1)); - vhandle[1] = mesh.add_vertex(MyMeshWithStatus::Point( 1, -1, 1)); - vhandle[2] = mesh.add_vertex(MyMeshWithStatus::Point( 1, 1, 1)); - vhandle[3] = mesh.add_vertex(MyMeshWithStatus::Point(-1, 1, 1)); - vhandle[4] = mesh.add_vertex(MyMeshWithStatus::Point(-1, -1, -1)); - vhandle[5] = mesh.add_vertex(MyMeshWithStatus::Point( 1, -1, -1)); - vhandle[6] = mesh.add_vertex(MyMeshWithStatus::Point( 1, 1, -1)); - vhandle[7] = mesh.add_vertex(MyMeshWithStatus::Point(-1, 1, -1)); + vhandle[0] = mesh.add_vertex(Mesh::Point(-1, -1, 1)); + vhandle[1] = mesh.add_vertex(Mesh::Point( 1, -1, 1)); + vhandle[2] = mesh.add_vertex(Mesh::Point( 1, 1, 1)); + vhandle[3] = mesh.add_vertex(Mesh::Point(-1, 1, 1)); + vhandle[4] = mesh.add_vertex(Mesh::Point(-1, -1, -1)); + vhandle[5] = mesh.add_vertex(Mesh::Point( 1, -1, -1)); + vhandle[6] = mesh.add_vertex(Mesh::Point( 1, 1, -1)); + vhandle[7] = mesh.add_vertex(Mesh::Point(-1, 1, -1)); // generate (quadrilateral) faces - std::vector tmp_face_vhandles; + std::vector tmp_face_vhandles; tmp_face_vhandles.clear(); tmp_face_vhandles.push_back(vhandle[0]); tmp_face_vhandles.push_back(vhandle[1]); From ad767006c5d714aa67cede3ecd10ba9b6f67de02 Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Mon, 16 Apr 2018 13:43:27 +0200 Subject: [PATCH 052/118] CI output now mentions when the minimal vector type is used. --- CI/ci-linux.sh | 14 ++++++++++++++ CI/ci-mac.sh | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/CI/ci-linux.sh b/CI/ci-linux.sh index 1fd5da31..b3d28017 100755 --- a/CI/ci-linux.sh +++ b/CI/ci-linux.sh @@ -96,6 +96,13 @@ cd Unittests #execute tests ./unittests --gtest_color=yes --gtest_output=xml +echo -e "${OUTPUT}" +echo "" +echo "======================================================================" +echo "Running unittests Release version with custom vector type" +echo "======================================================================" +echo -e "${NC}" + ./unittests_customvec --gtest_color=yes --gtest_output=xml cd .. @@ -136,6 +143,13 @@ cd Unittests #execute tests ./unittests --gtest_color=yes --gtest_output=xml +echo -e "${OUTPUT}" +echo "" +echo "======================================================================" +echo "Running unittests Debug version with custom vector type" +echo "======================================================================" +echo -e "${NC}" + ./unittests_customvec --gtest_color=yes --gtest_output=xml cd .. diff --git a/CI/ci-mac.sh b/CI/ci-mac.sh index 3ceb48f3..5b7ecd94 100755 --- a/CI/ci-mac.sh +++ b/CI/ci-mac.sh @@ -78,6 +78,13 @@ cd Unittests #execute tests ./unittests --gtest_color=yes --gtest_output=xml +echo -e "${OUTPUT}" +echo "" +echo "======================================================================" +echo "Running unittests Release version with minimal vector type" +echo "======================================================================" +echo -e "${NC}" + ./unittests_customvec --gtest_color=yes --gtest_output=xml cd .. @@ -118,6 +125,13 @@ cd Unittests #execute tests ./unittests --gtest_color=yes --gtest_output=xml +echo -e "${OUTPUT}" +echo "" +echo "======================================================================" +echo "Running unittests Debug version with minimal vector type" +echo "======================================================================" +echo -e "${NC}" + ./unittests_customvec --gtest_color=yes --gtest_output=xml cd .. From 1480e6dcaea29d9ea63947dc31bb640ed9d8e3b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 16 Apr 2018 13:54:19 +0200 Subject: [PATCH 053/118] Typo? --- .gitlab-ci.yml | 100 +++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 48 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0a83240f..91676213 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,18 +45,58 @@ cppcheck: - cppcheck.log -#VS2015-64-bit-shared-apps: -# variables: -# BUILD_PLATFORM: "VS2015" -# ARCHITECTURE: "x64" -# SHARED: "TRUE" -# APPS: "ON" -# script: "CI\\Windows.bat" -# tags: -# - VS2015 -# artifacts: -# paths: -# - build-release/*.exe +.VS2015-64-bit-shared-apps: + variables: + BUILD_PLATFORM: "VS2015" + ARCHITECTURE: "x64" + SHARED: "TRUE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2015 + artifacts: + paths: + - build-release/*.exe + +.VS2015-32-bit-shared-apps: + variables: + BUILD_PLATFORM: "VS2015" + ARCHITECTURE: "x32" + SHARED: "TRUE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2015 + artifacts: + paths: + - build-release/*.exe + +.VS2015-64-bit-static-apps: + variables: + BUILD_PLATFORM: "VS2015" + ARCHITECTURE: "x64" + SHARED: "FALSE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2015 + artifacts: + paths: + - build-release/*.exe + +.VS2015-32-bit-static-apps: + variables: + BUILD_PLATFORM: "VS2015" + ARCHITECTURE: "x32" + SHARED: "FALSE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2015 + artifacts: + paths: + - build-release/*.exe + VS2017-64-bit-shared-no-apps: variables: @@ -71,18 +111,6 @@ VS2017-64-bit-shared-no-apps: paths: - build-release/*.exe -#VS2015-32-bit-shared-apps: -# variables: -# BUILD_PLATFORM: "VS2015" -# ARCHITECTURE: "x32" -# SHARED: "TRUE" -# APPS: "ON" -# script: "CI\\Windows.bat" -# tags: -# - VS2015 -# artifacts: -# paths: -# - build-release/*.exe VS2017-32-bit-shared-no-apps: variables: @@ -97,18 +125,6 @@ VS2017-32-bit-shared-no-apps: paths: - build-release/*.exe -#VS2015-64-bit-static-apps: -# variables: -# BUILD_PLATFORM: "VS2015" -# ARCHITECTURE: "x64" -# SHARED: "FALSE" -# APPS: "ON" -# script: "CI\\Windows.bat" -# tags: -# - VS2015 -# artifacts: -# paths: -# - build-release/*.exe VS2017-64-bit-static-no-apps: variables: @@ -123,18 +139,6 @@ VS2017-64-bit-static-no-apps: paths: - build-release/*.exe -#VS2015-32-bit-static-apps: -# variables: -# BUILD_PLATFORM: "VS2015" -# ARCHITECTURE: "x32" -# SHARED: "FALSE" -# APPS: "ON" -# script: "CI\\Windows.bat" -# tags: -# - VS2015 -# artifacts: -# paths: -# - build-release/*.exe VS2017-32-bit-static-no-apps: variables: From 5c3eacbdada2e474d7e7da36163977050fcf3f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 16 Apr 2018 13:56:54 +0200 Subject: [PATCH 054/118] Next --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 91676213..4aa8cd01 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,7 @@ macos-c++11: - Apple artifacts: paths: - - build-release-cpp11/*.dmg + - build-release-cpp11/*.dmg - build-release-cpp11/*.tar.gz macos-c++98: @@ -69,8 +69,8 @@ cppcheck: - VS2015 artifacts: paths: - - build-release/*.exe - + - build-release/*.exe + .VS2015-64-bit-static-apps: variables: BUILD_PLATFORM: "VS2015" @@ -82,7 +82,7 @@ cppcheck: - VS2015 artifacts: paths: - - build-release/*.exe + - build-release/*.exe .VS2015-32-bit-static-apps: variables: From 62f6799a35a85021a8cd3ded712a8c9aa53e3c17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 16 Apr 2018 13:58:56 +0200 Subject: [PATCH 055/118] Tab removed --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4aa8cd01..98da1d13 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,7 @@ macos-c++11: - Apple artifacts: paths: - - build-release-cpp11/*.dmg + - build-release-cpp11/*.dmg - build-release-cpp11/*.tar.gz macos-c++98: From c7295b312b7a0112bba63e0b44eb4768a33b507c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 16 Apr 2018 13:59:45 +0200 Subject: [PATCH 056/118] And another tab --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 98da1d13..19066b4a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,7 +69,7 @@ cppcheck: - VS2015 artifacts: paths: - - build-release/*.exe + - build-release/*.exe .VS2015-64-bit-static-apps: variables: @@ -82,7 +82,7 @@ cppcheck: - VS2015 artifacts: paths: - - build-release/*.exe + - build-release/*.exe .VS2015-32-bit-static-apps: variables: From 75f1c75c31706a5f309c09390736bea9c898cb0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 16 Apr 2018 14:00:59 +0200 Subject: [PATCH 057/118] Last Tab? --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 19066b4a..54f4532f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -166,6 +166,7 @@ VS2015-64-bit-shared-apps: paths: - build-release/*.exe + VS2015-64-bit-shared-no-apps: variables: BUILD_PLATFORM: "VS2015" From e34c472e3994fe96c41b3dd1f0f1d5dd48f9fc16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 16 Apr 2018 14:01:45 +0200 Subject: [PATCH 058/118] Missed one --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 54f4532f..1e31a4d6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -153,6 +153,7 @@ VS2017-32-bit-static-no-apps: paths: - build-release/*.exe + VS2015-64-bit-shared-apps: variables: BUILD_PLATFORM: "VS2015" From 6ee66e8c84d8360c4177bec5b44b7bf2ed9c65b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 16 Apr 2018 14:04:13 +0200 Subject: [PATCH 059/118] Update .gitlab-ci.yml From 714eda4d7ae8cd780f120a89ed6b54bd49265930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 16 Apr 2018 14:04:48 +0200 Subject: [PATCH 060/118] Update .gitlab-ci.yml --- .gitlab-ci.yml | Bin 6925 -> 2860 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e31a4d6536bdd904bac71015fb1c50b879d3ba0..a0c4b912c89c6a5cad245d28a551749675dafd5f 100644 GIT binary patch literal 2860 zcmZoXF7x|s>Bdu!mR;!hdtzx<^~OySG6nkku17~T9eOnHP0ZAl4~pM!y>?u?Yqpc} zccp2X?~a`S333AkuPxZHWBG0gnZon?u6N6<)5_)Ozta`5e7Ce><8h|nZ!5O0(9zR; zcl2b`Ja)U^aXLjiR&G(UFVak!_a>(mD9Etycbsk(H#gAInaedc0u70V8Im?SoJXMcp#L-`Bu=v@G+qBG9RifKKJgoce6_HuYOYw>7hFm^U zuaoY&t(diaZq}@vy{jH&?u^?Y%AsR?n$ghDx5)jTzE}F z1enizJk9}!j96EB#-U@kwq0AWF=X52xTtkE=4YPHS-LuLBg}2p-#1o*q{?sZSi4DV zb>+2{%TC`~r#5@)YsP@4!!{d)MV|PC>TbC{L6D8#sPO<=!ciNyE!jy?qi%l))R+fGMqQL~30$_m;uNZEJxA8Yq8F zLu7w=G4l6K97t;Jw><5f)>ZdPam4!*?D0-kmcg6Aa9D&rE(Sv(@VX6B2&m)AG6)~Z z?EqyNLkC?&P_af{9Bo~lR7hkT!7L)V{H&c#Aa5d49i*VfpEq&W2(hq|4Oc!YKr00B z<)gc}OPl+!3JzyJ!eJ5iI4Z-Pk7^0zqdO$zqjKB@bveO;8iz&L^AVw-!&8}-qg6ey z!V_!BfX_z+^AW;F#N;DFafBxyAuNK_ad`6)zMvzRj}WPjh>znms)*0J%{OG>yOeaQ)Oi>t!t=nJU1c-=3u*8@; zQ(hEF;yw4=a}N*)V~FqW>h+ERK!ig#ARSQajqb4vJ$Jj?o6#CL7=s=gRHK6kaw0Yu z00_oxgkfM0ZJqPW#KTG#qJI=G)BKxgnrEXaT_%erTL|QFZ4mY&Auf8AC8sbk-5~I6 zx)=(H`yFADW-LHtoqlEMTkc$M1w-4jQDj3L1ois;dvmpM;xNP`2ntQ-w_zOOd;D0C zu%q}ggegGT_?lA~=+N`p z{vl2u0JEp=bkJwNB}Z*OT@2DmlgTW*KqozaVHb`B_4@kaZdd-V$Xp_F3OV_II-x?n z&^+6FJ40?Y)FZbV3B21z&N(NDxcJ(f54+>p?UAk$x{&nSfSzd2h$YiL(fih~Mt?h1 zuNuh@hm|$omeV{(pVz!H^uh`#Yk1nwrv<=skXOI590;3!sS30u!Qk+D2_zjr8GK<0 z+y?x2v z{H&8_flAN*mQv@dUJBL)#&-(5YALA2E>Q`Wf#*7qaD5?iVFys_`YM4dV_gcnHr9__ zKP!BR?l0tCm+N0f{$;MO7`!(26W6yO*St#Jg>_$Qe7akG9{Ke}UkY9q?|HZH`xpkh vrRPR#wz1%Ey*Ktr4+u6WB6dj6j^4bpt*n*L_G*~PXWLhY{VVz^Avyj4t<~oi From 171dd799cd7c11543195df0fbfe1ff25cd58ecaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 16 Apr 2018 14:08:53 +0200 Subject: [PATCH 061/118] Trying to fix yml --- .gitlab-ci.yml | Bin 2860 -> 6916 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a0c4b912c89c6a5cad245d28a551749675dafd5f..4615a062979fc6530778f1b8cef0b5a332783058 100644 GIT binary patch literal 6916 zcmd^EU6YzH6n!qgBI9Fs!dB6>>znms)*0J%{OG>yOeaQ)Oi>t!t=nJU1c-=3u*8@; zQ(hEF!aeuga}O8?V~FqW>h+ERK!ig#ARSQajqb4vJ$Jj?o6#CL7=s=gRHK6kaw0Yu z00_oxgkfM0ZJqPW#KTG#qBn|{Y5q+#&9l*zE|W!*Ed=toHVFHX5Es45l2e$NZV-4j zT?~c9{f;n6GZrASPQSABEqAWBf}!o%D6%0Af_nY_y}8;raTwwe1cj#a+b|CCJ$@`m z*in2L!W5uve9g1*u@O8ziU_Z5{G%W^eu-wVn8tItJ1pS&j$s()*IDC3y#*hdaOn~l ztx;&NAPRyw-9J(2qNQi2x&O2njr-pwKKpSgsC@Pl>Y%I@YJ2u81g?yA zDeMv*P>%KD!dLkqBxeD-$-m71s!LwA0m!k>+dkL4O5TNaUkY6}?|J0c7kw#s-KsAz zKkMXOpwhd)rPTSVmx6VH@tp#%S_*2hOH{&T;JFSYTwjP>*a6hKzDnTASeL@CjrC*K z&kA3n`wO|(<@%SAf0^qm2Ct3%#Pu!6HLsF)VcnM+pYB$lM}B?Lmx9;Dd*1E)K8C?= q>ABIGZ7ld(?~Q%Z1A+~Th#k_iqkrDnR@TaAdo|4Dv+b+H{?#9k73Pot literal 2860 zcmZoXF7x|s>Bdu!mR;!hdtzx<^~OySG6nkku17~T9eOnHP0ZAl4~pM!y>?u?Yqpc} zccp2X?~a`S333AkuPxZHWBG0gnZon?u6N6<)5_)Ozta`5e7Ce><8h|nZ!5O0(9zR; zcl2b`Ja)U^aXLjiR&G(UFVak!_a>(mD9Etycbsk(H#gAInaedc0u70V8Im?SoJXMcp#L-`Bu=v@G+qBG9RifKKJgoce6_HuYOYw>7hFm^U zuaoY&t(diaZq}@vy{jH&?u^?Y%AsR?n$ghDx5)jTzE}F z1enizJk9}!j96EB#-U@kwq0AWF=X52xTtkE=4YPHS-LuLBg}2p-#1o*q{?sZSi4DV zb>+2{%TC`~r#5@)YsP@4!!{d)MV|PC>TbC{L6D8#sPO<=!ciNyE!jy?qi%l))R+fGMqQL~30$_m;uNZEJxA8Yq8F zLu7w=G4l6K97t;Jw><5f)>ZdPam4!*?D0-kmcg6Aa9D&rE(Sv(@VX6B2&m)AG6)~Z z?EqyNLkC?&P_af{9Bo~lR7hkT!7L)V{H&c#Aa5d49i*VfpEq&W2(hq|4Oc!YKr00B z<)gc}OPl+!3JzyJ!eJ5iI4Z-Pk7^0zqdO$zqjKB@bveO;8iz&L^AVw-!&8}-qg6ey z!V_!BfX_z+^AW;F#N;DFafBxyAuNK_ad`6)zMvzRj}WPjh Date: Mon, 16 Apr 2018 14:11:12 +0200 Subject: [PATCH 062/118] Trying to fix yml --- .gitlab-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4615a062..df974a87 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -152,8 +152,7 @@ VS2017-32-bit-static-no-apps: artifacts: paths: - build-release/*.exe - - + VS2015-64-bit-shared-apps: variables: BUILD_PLATFORM: "VS2015" From 77555753e34a049feb5446c966743de9dfef2abd Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Mon, 16 Apr 2018 16:18:59 +0200 Subject: [PATCH 063/118] Made customvec tests known to CMake --- src/Unittests/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Unittests/CMakeLists.txt b/src/Unittests/CMakeLists.txt index 3843175f..037a207a 100644 --- a/src/Unittests/CMakeLists.txt +++ b/src/Unittests/CMakeLists.txt @@ -100,6 +100,7 @@ if ( OPENMESH_BUILD_UNIT_TESTS ) acg_copy_after_build(unittests_customvec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/) add_test(NAME AllTestsIn_OpenMesh_tests WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests") + add_test(NAME AllTestsIn_OpenMesh_tests_with_minimal_vector WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests_customvec") else(GTEST_FOUND) message(STATUS "Google testing framework was not found, unittests disabled.") From 83336373f19dc010c0f84e5b148959a34b2fd5f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 17 Apr 2018 08:15:37 +0200 Subject: [PATCH 064/118] Fixed VS2017 compiler path --- CI/Windows.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Windows.bat b/CI/Windows.bat index e7e9a187..7e9d9d12 100644 --- a/CI/Windows.bat +++ b/CI/Windows.bat @@ -73,7 +73,7 @@ IF "%BUILD_PLATFORM%" == "VS2017" ( set LIBPATH=E:\libs\VS2017 set GTESTVERSION=gtest-1.7.0 set GENERATOR=Visual Studio 15%ARCH_VS% - set VS_PATH="C:\Program Files (x86)\Microsoft Visual Studio 15.0\Common7\IDE\devenv.com" + set VS_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.com" set QT_VERSION= IF "%ARCHITECTURE%" == "x64" ( From 144a78fef47dd29e08ddadfdb7cef53052e890eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 17 Apr 2018 09:27:03 +0200 Subject: [PATCH 065/118] Added links to prebuild binaries --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 11bb04ce..7a9da4b6 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,14 @@ https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh The python bindings can be found here: https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python +## Download Binaries + +### Windows +* [VS2017 32-bit shared no apps ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-32-bit-shared-no-apps) +* [VS2017 64-bit shared no apps ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-64-bit-shared-no-apps) +* [VS2017 32-bit static no apps ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-32-bit-static-no-apps) +* [VS2017 64-bit static no apps ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-64-bit-static-no-apps) + ## Installing Unpack the tar-ball to a suitable place. From d1d045f7cd36595782a0a06d609d6839f2e72b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 17 Apr 2018 09:45:41 +0200 Subject: [PATCH 066/118] Added Download links for artifacts --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7a9da4b6..d55fd316 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,14 @@ https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python ## Download Binaries ### Windows -* [VS2017 32-bit shared no apps ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-32-bit-shared-no-apps) -* [VS2017 64-bit shared no apps ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-64-bit-shared-no-apps) -* [VS2017 32-bit static no apps ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-32-bit-static-no-apps) -* [VS2017 64-bit static no apps ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-64-bit-static-no-apps) + +| VS Version: | 2017 | 2015 | 2013 | +| -------- | -------- |-------- |-------- | +| 64-Bit shared, no apps | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-64-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2015-64-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2013-64-bit-shared-no-apps) | +| 32-Bit shared, no apps | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-32-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2015-32-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2013-32-bit-shared-no-apps) | +| 64-Bit static, no apps | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-64-bit-static-no-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2015-64-bit-static-no-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2013-64-bit-static-no-apps) | +| 32-Bit static, no apps | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-32-bit-static-no-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2015-32-bit-static-no-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2013-32-bit-static-no-apps) | + ## Installing Unpack the tar-ball to a suitable place. From 05c370c1669c8d8d4d91de589824a65b5d83c1e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 17 Apr 2018 09:54:37 +0200 Subject: [PATCH 067/118] Fixed Links and added Badge --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d55fd316..a0976010 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # OpenMesh, 7.0 +[![](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/badges/master/pipeline.svg)](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/commits/master) + ## Getting OpenMesh All Documentation, binaries and original source code are available at www.openmesh.org @@ -19,10 +21,10 @@ https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python | VS Version: | 2017 | 2015 | 2013 | | -------- | -------- |-------- |-------- | -| 64-Bit shared, no apps | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-64-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2015-64-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2013-64-bit-shared-no-apps) | -| 32-Bit shared, no apps | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-32-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2015-32-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2013-32-bit-shared-no-apps) | -| 64-Bit static, no apps | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-64-bit-static-no-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2015-64-bit-static-no-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2013-64-bit-static-no-apps) | -| 32-Bit static, no apps | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2017-32-bit-static-no-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2015-32-bit-static-no-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/rel?job=test:VS2013-32-bit-static-no-apps) | +| 64-Bit shared, no apps | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-64-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-64-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-64-bit-shared-no-apps) | +| 32-Bit shared, no apps | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-32-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-32-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-32-bit-shared-no-apps) | +| 64-Bit static, no apps | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-64-bit-static-no-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-64-bit-static-no-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-64-bit-static-no-apps) | +| 32-Bit static, no apps | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-32-bit-static-no-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-32-bit-static-no-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-32-bit-static-no-apps) | ## Installing From c953148718e04e8a3956771fc9007acfa0593c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 17 Apr 2018 09:59:53 +0200 Subject: [PATCH 068/118] Update README.md --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a0976010..80a4ccae 100644 --- a/README.md +++ b/README.md @@ -19,14 +19,17 @@ https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python ### Windows -| VS Version: | 2017 | 2015 | 2013 | +| Visual Studio Version: | 2017 | 2015 | 2013 | | -------- | -------- |-------- |-------- | +| 64-Bit shared, with apps | - | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-64-bit-shared-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-64-bit-shared-apps) | +| 32-Bit shared, with apps | - | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-32-bit-shared-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-32-bit-shared-apps) | +| 64-Bit static, with apps | - | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-64-bit-static-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-64-bit-static-apps) | +| 32-Bit static, with apps | - | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-32-bit-static-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-32-bit-static-apps) | | 64-Bit shared, no apps | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-64-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-64-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-64-bit-shared-no-apps) | | 32-Bit shared, no apps | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-32-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-32-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-32-bit-shared-no-apps) | | 64-Bit static, no apps | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-64-bit-static-no-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-64-bit-static-no-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-64-bit-static-no-apps) | | 32-Bit static, no apps | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-32-bit-static-no-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-32-bit-static-no-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-32-bit-static-no-apps) | - ## Installing Unpack the tar-ball to a suitable place. From 0441ba5fa81543c848fe33a7bd0cc71fc75fcd4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 18 Apr 2018 08:41:17 +0200 Subject: [PATCH 069/118] Work around ptr_fun deprecation (Thanks to Andreas Fabri for the patch) --- src/OpenMesh/Core/IO/reader/BaseReader.hh | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/OpenMesh/Core/IO/reader/BaseReader.hh b/src/OpenMesh/Core/IO/reader/BaseReader.hh index d1eddfc9..2ed5c35d 100644 --- a/src/OpenMesh/Core/IO/reader/BaseReader.hh +++ b/src/OpenMesh/Core/IO/reader/BaseReader.hh @@ -156,7 +156,16 @@ protected: * @return trimmed string */ static inline std::string &left_trim(std::string &_string) { - _string.erase(_string.begin(), std::find_if(_string.begin(), _string.end(), std::not1(std::ptr_fun(std::isspace)))); + + // Find out if the compiler supports CXX11 + #if ( __cplusplus >= 201103L || _MSVC_LANG >= 201103L ) + // as with CXX11 we can use lambda expressions + _string.erase(_string.begin(), std::find_if(_string.begin(), _string.end(), [](int i)->int { return ! std::isspace(i); })); + #else + // we do what we did before + _string.erase(_string.begin(), std::find_if(_string.begin(), _string.end(), std::not1(std::ptr_fun(std::isspace)))); + #endif + return _string; } @@ -168,7 +177,19 @@ static inline std::string &left_trim(std::string &_string) { * @return trimmed string */ static inline std::string &right_trim(std::string &_string) { - _string.erase(std::find_if(_string.rbegin(), _string.rend(), std::not1(std::ptr_fun(std::isspace))).base(), _string.end()); +#error "Apply the same fix here" + + // Find out if the compiler supports CXX11 + #if ( __cplusplus >= 201103L || _MSVC_LANG >= 201103L ) + // as with CXX11 we can use lambda expressions + _string.erase(std::find_if(_string.rbegin(), _string.rend(), [](int i)->int { return ! std::isspace(i); } ).base(), _string.end()); + #else + // we do what we did before + _string.erase(std::find_if(_string.rbegin(), _string.rend(), std::not1(std::ptr_fun(std::isspace))).base(), _string.end()); + #endif + + + return _string; } From f308270716e28b4ea0bb4d1c292904e4e13e4ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 18 Apr 2018 08:41:41 +0200 Subject: [PATCH 070/118] Work around ptr_fun deprecation (Thanks to Andreas Fabri for the patch) --- src/OpenMesh/Core/IO/reader/BaseReader.hh | 1 - 1 file changed, 1 deletion(-) diff --git a/src/OpenMesh/Core/IO/reader/BaseReader.hh b/src/OpenMesh/Core/IO/reader/BaseReader.hh index 2ed5c35d..463b9c72 100644 --- a/src/OpenMesh/Core/IO/reader/BaseReader.hh +++ b/src/OpenMesh/Core/IO/reader/BaseReader.hh @@ -177,7 +177,6 @@ static inline std::string &left_trim(std::string &_string) { * @return trimmed string */ static inline std::string &right_trim(std::string &_string) { -#error "Apply the same fix here" // Find out if the compiler supports CXX11 #if ( __cplusplus >= 201103L || _MSVC_LANG >= 201103L ) From 801a569871f501e2f29e2168b6dbfcc22e09b4d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 18 Apr 2018 09:26:41 +0200 Subject: [PATCH 071/118] Enabled 64-bit app builds --- .gitlab-ci.yml | 53 +++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index df974a87..72839651 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,20 +44,6 @@ cppcheck: paths: - cppcheck.log - -.VS2015-64-bit-shared-apps: - variables: - BUILD_PLATFORM: "VS2015" - ARCHITECTURE: "x64" - SHARED: "TRUE" - APPS: "ON" - script: "CI\\Windows.bat" - tags: - - VS2015 - artifacts: - paths: - - build-release/*.exe - .VS2015-32-bit-shared-apps: variables: BUILD_PLATFORM: "VS2015" @@ -71,18 +57,6 @@ cppcheck: paths: - build-release/*.exe -.VS2015-64-bit-static-apps: - variables: - BUILD_PLATFORM: "VS2015" - ARCHITECTURE: "x64" - SHARED: "FALSE" - APPS: "ON" - script: "CI\\Windows.bat" - tags: - - VS2015 - artifacts: - paths: - - build-release/*.exe .VS2015-32-bit-static-apps: variables: @@ -98,6 +72,33 @@ cppcheck: - build-release/*.exe +VS2017-64-bit-shared-apps: + variables: + BUILD_PLATFORM: "VS2017" + ARCHITECTURE: "x64" + SHARED: "TRUE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2017 + artifacts: + paths: + - build-release/*.exe + +VS2017-64-bit-static-apps: + variables: + BUILD_PLATFORM: "VS2017" + ARCHITECTURE: "x64" + SHARED: "FALSE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2017 + artifacts: + paths: + - build-release/*.exe + + VS2017-64-bit-shared-no-apps: variables: BUILD_PLATFORM: "VS2017" From b72efdf8835cfe149d56d442ba54c48603d99aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 18 Apr 2018 10:49:28 +0200 Subject: [PATCH 072/118] Show directory content for unittests --- CI/Windows.bat | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CI/Windows.bat b/CI/Windows.bat index 22eca890..826d83f0 100644 --- a/CI/Windows.bat +++ b/CI/Windows.bat @@ -129,6 +129,8 @@ IF "%SHARED%" == "TRUE" ( cd unittests +dir + unittests.exe --gtest_output=xml unittests_customvec.exe --gtest_output=xml From a01811fce9266bf3ad6a07fc4997ba4d63789733 Mon Sep 17 00:00:00 2001 From: schultz Date: Wed, 18 Apr 2018 12:24:21 +0200 Subject: [PATCH 073/118] fix RUNTIME_OUTPUT_DIRECTORY was not set properly in CMake for unittests_customvec --- src/Unittests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Unittests/CMakeLists.txt b/src/Unittests/CMakeLists.txt index 037a207a..ab128f5e 100644 --- a/src/Unittests/CMakeLists.txt +++ b/src/Unittests/CMakeLists.txt @@ -44,7 +44,7 @@ if ( OPENMESH_BUILD_UNIT_TESTS ) foreach(CONFIG ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER ${CONFIG} UPCONFIG) set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR}) - set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}) + set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR}) endforeach() From 2312a9e437d1c2fd2a529251162f25fbe3874d2a Mon Sep 17 00:00:00 2001 From: Christian Mattes Date: Wed, 18 Apr 2018 12:35:23 +0200 Subject: [PATCH 074/118] Removed ci-cppcheck.sh ci-doc.sh ci-linux.sh ci-mac.sh Windows.bat command used for debugging CI --- CI/Windows.bat | 2 -- 1 file changed, 2 deletions(-) diff --git a/CI/Windows.bat b/CI/Windows.bat index 826d83f0..22eca890 100644 --- a/CI/Windows.bat +++ b/CI/Windows.bat @@ -129,8 +129,6 @@ IF "%SHARED%" == "TRUE" ( cd unittests -dir - unittests.exe --gtest_output=xml unittests_customvec.exe --gtest_output=xml From d1fdd45c4bee4195730cdb0e79a50a098ce2187f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 18 Apr 2018 14:55:39 +0200 Subject: [PATCH 075/118] Updated for release preparation --- Doc/changelog.docu | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 7f5242ec..5feaf07f 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -6,7 +6,7 @@ -7.0 (?/?/?) +7.0 (2018/04/19) Breaking changes
      @@ -20,6 +20,7 @@
    • make all negative handles invalid, not just -1
    • Several warnings fixed (Including the checked iterators)
    • split_copy and split_edge_copy operations now also copy internal properties.
    • +
    • copy face properties in split_copy(EdgeHandle, VertexHandle)
    • fix halfedge indices in OpenMeshTrimeshCirculatorHalfedgeLoop CWAndCCWCheck
    • Fix wrong behaviour of HalfedgeLoopIterators by changing the template parameter
    • Added 1-4 triangle split funtion(splits all edges at Midpoints)
    • @@ -27,6 +28,9 @@
    • Made the face and edge split operations that copy properties also copy builtin properties
    • calc_sector_angle: Check for real division by zero not with epsilon that was way to large
    • Don't return invalid iterators for empty element ranges
    • +
    • Mark halfedges as deleted after collapse
    • +
    • Let default range-based for skip deleted elements and add a version that includes deleted elements
    • +
    • Moved length() by norm() to external functions. This allows us to support other vector types instead of Vec3d (e.g. via Eigen)
    Utils @@ -75,14 +79,10 @@
  • Added unittest for split_edge_copy operations on Tri and PolyMeshes
  • -Python -
      -
    • fix the stripping of the python libs version string
    • -
    - General
    • Updated Logo
    • +
    • Only Issue Warning if compile Order for MeshIO.hh is violated. Check will be removed if no errors are reported.
    From ab07fbb70e5ebb33e8a239932f16efe4d912f213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 19 Apr 2018 12:58:13 +0200 Subject: [PATCH 076/118] - Removed old qmake .pro files (Unmaintained for a long time) --- .qmake.cache | 15 ------- OpenMesh.pro | 18 -------- .../Decimating/DecimaterGui/DecimaterGui.pro | 24 ---------- .../commandlineDecimater.pro | 19 -------- src/OpenMesh/Apps/QtViewer/QtViewer.pro | 19 -------- src/OpenMesh/Apps/Smoothing/Smoothing.pro | 21 --------- .../SubdividerGui/SubdividerGui.pro | 21 --------- .../commandlineAdaptiveSubdivider.pro | 15 ------- .../commandlineSubdivider.pro | 15 ------- .../Apps/VDProgMesh/Analyzer/Analyzer.pro | 26 ----------- .../VDProgMesh/Synthesizer/Synthesizer.pro | 27 ----------- .../VDProgMesh/mkbalancedpm/mkbalancedpm.pro | 26 ----------- src/OpenMesh/Apps/mconvert/mconvert.pro | 22 --------- src/OpenMesh/Core/Core.pro | 43 ------------------ src/OpenMesh/Examples/Examples.pro | 12 ----- .../Examples/Tutorial01/Tutorial01.pro | 19 -------- .../Examples/Tutorial02/Tutorial02.pro | 19 -------- .../Examples/Tutorial03/Tutorial03.pro | 19 -------- .../Examples/Tutorial04/Tutorial04.pro | 19 -------- .../Examples/Tutorial05/Tutorial05.pro | 19 -------- .../Examples/Tutorial06/Tutorial06.pro | 19 -------- .../Examples/Tutorial07/Tutorial07.pro | 19 -------- .../Examples/Tutorial08/Tutorial08.pro | 19 -------- .../Examples/Tutorial09/Tutorial09.pro | 19 -------- .../Examples/Tutorial10/Tutorial10.pro | 19 -------- src/OpenMesh/Tools/Tools.pro | 45 ------------------- 26 files changed, 558 deletions(-) delete mode 100644 .qmake.cache delete mode 100644 OpenMesh.pro delete mode 100644 src/OpenMesh/Apps/Decimating/DecimaterGui/DecimaterGui.pro delete mode 100644 src/OpenMesh/Apps/Decimating/commandlineDecimater/commandlineDecimater.pro delete mode 100644 src/OpenMesh/Apps/QtViewer/QtViewer.pro delete mode 100644 src/OpenMesh/Apps/Smoothing/Smoothing.pro delete mode 100644 src/OpenMesh/Apps/Subdivider/SubdividerGui/SubdividerGui.pro delete mode 100644 src/OpenMesh/Apps/Subdivider/commandlineAdaptiveSubdivider/commandlineAdaptiveSubdivider.pro delete mode 100644 src/OpenMesh/Apps/Subdivider/commandlineSubdivider/commandlineSubdivider.pro delete mode 100644 src/OpenMesh/Apps/VDProgMesh/Analyzer/Analyzer.pro delete mode 100644 src/OpenMesh/Apps/VDProgMesh/Synthesizer/Synthesizer.pro delete mode 100644 src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.pro delete mode 100644 src/OpenMesh/Apps/mconvert/mconvert.pro delete mode 100644 src/OpenMesh/Core/Core.pro delete mode 100644 src/OpenMesh/Examples/Examples.pro delete mode 100644 src/OpenMesh/Examples/Tutorial01/Tutorial01.pro delete mode 100644 src/OpenMesh/Examples/Tutorial02/Tutorial02.pro delete mode 100644 src/OpenMesh/Examples/Tutorial03/Tutorial03.pro delete mode 100644 src/OpenMesh/Examples/Tutorial04/Tutorial04.pro delete mode 100644 src/OpenMesh/Examples/Tutorial05/Tutorial05.pro delete mode 100644 src/OpenMesh/Examples/Tutorial06/Tutorial06.pro delete mode 100644 src/OpenMesh/Examples/Tutorial07/Tutorial07.pro delete mode 100644 src/OpenMesh/Examples/Tutorial08/Tutorial08.pro delete mode 100644 src/OpenMesh/Examples/Tutorial09/Tutorial09.pro delete mode 100644 src/OpenMesh/Examples/Tutorial10/Tutorial10.pro delete mode 100644 src/OpenMesh/Tools/Tools.pro diff --git a/.qmake.cache b/.qmake.cache deleted file mode 100644 index 20cb5b30..00000000 --- a/.qmake.cache +++ /dev/null @@ -1,15 +0,0 @@ -unix { - TOPDIR = $$system( pwd )/ -} - -win32 { - TOPDIR = $$system( cd )/ -} - -#use next qmake.cache if it exists -exists(../.qmake.cache) { - include( ../.qmake.cache ) -} - -include( qmake/all.include ) - diff --git a/OpenMesh.pro b/OpenMesh.pro deleted file mode 100644 index f5e14c46..00000000 --- a/OpenMesh.pro +++ /dev/null @@ -1,18 +0,0 @@ -contains( OPENFLIPPER , OpenFlipper ){ - include( $$TOPDIR/qmake/all.include ) -} else { - include( $$TOPDIR/OpenMesh/qmake/all.include ) -} - -Subdirs() - -addSubdirs( src/OpenMesh/Core ) -addSubdirs( src/OpenMesh/Tools , src/OpenMesh/Core ) -addSubdirs( src/OpenMesh/Apps/commandlineDecimater , src/OpenMesh/Core src/OpenMesh/Tools) -addSubdirs( src/OpenMesh/Apps/Decimating/DecimaterGui , src/OpenMesh/Core src/OpenMesh/Tools) -addSubdirs( src/OpenMesh/Apps/mconvert , src/OpenMesh/Core src/OpenMesh/Tools) -addSubdirs( src/OpenMesh/Apps/QtViewer , src/OpenMesh/Core src/OpenMesh/Tools) -addSubdirs( src/OpenMesh/Apps/Smoothing , src/OpenMesh/Core src/OpenMesh/Tools) -addSubdirs( src/OpenMesh/Apps/Subdivider/commandlineSubdivider , src/OpenMesh/Core src/OpenMesh/Tools) -addSubdirs( src/OpenMesh/Apps/Subdivider/commandlineAdaptiveSubdivider , src/OpenMesh/Core src/OpenMesh/Tools) -addSubdirs( src/OpenMesh/Apps/Subdivider/SubdividerGui , src/OpenMesh/Core src/OpenMesh/Tools) diff --git a/src/OpenMesh/Apps/Decimating/DecimaterGui/DecimaterGui.pro b/src/OpenMesh/Apps/Decimating/DecimaterGui/DecimaterGui.pro deleted file mode 100644 index 68862d4b..00000000 --- a/src/OpenMesh/Apps/Decimating/DecimaterGui/DecimaterGui.pro +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -Application() - -INCLUDEPATH += ../../.. - -Application() -glew() -glut() -openmesh() - -DIRECTORIES = ../../QtViewer ../ - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += ../../QtViewer/QGLViewerWidget.cc ../../QtViewer/MeshViewerWidgetT.cc ../DecimaterViewerWidget.cc -SOURCES += ../decimaterviewer.cc - - -################################################################################ diff --git a/src/OpenMesh/Apps/Decimating/commandlineDecimater/commandlineDecimater.pro b/src/OpenMesh/Apps/Decimating/commandlineDecimater/commandlineDecimater.pro deleted file mode 100644 index bf863090..00000000 --- a/src/OpenMesh/Apps/Decimating/commandlineDecimater/commandlineDecimater.pro +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -glew() -glut() -openmesh() - -DIRECTORIES = .. - -# Input -SOURCES += ../decimater.cc - -################################################################################ diff --git a/src/OpenMesh/Apps/QtViewer/QtViewer.pro b/src/OpenMesh/Apps/QtViewer/QtViewer.pro deleted file mode 100644 index 42fd4ecc..00000000 --- a/src/OpenMesh/Apps/QtViewer/QtViewer.pro +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -Application() -glew() -glut() -openmesh() - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Apps/Smoothing/Smoothing.pro b/src/OpenMesh/Apps/Smoothing/Smoothing.pro deleted file mode 100644 index d6400e88..00000000 --- a/src/OpenMesh/Apps/Smoothing/Smoothing.pro +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -glew() -glut() -openmesh() - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Apps/Subdivider/SubdividerGui/SubdividerGui.pro b/src/OpenMesh/Apps/Subdivider/SubdividerGui/SubdividerGui.pro deleted file mode 100644 index 27d05e10..00000000 --- a/src/OpenMesh/Apps/Subdivider/SubdividerGui/SubdividerGui.pro +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -glew() -glut() -openmesh() - -DIRECTORIES = .. ../../QtViewer - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += ../../QtViewer/QGLViewerWidget.cc ../../QtViewer/MeshViewerWidgetT.cc ../SubdivideWidget.cc -SOURCES += ../qtsubdivider.cc - -################################################################################ diff --git a/src/OpenMesh/Apps/Subdivider/commandlineAdaptiveSubdivider/commandlineAdaptiveSubdivider.pro b/src/OpenMesh/Apps/Subdivider/commandlineAdaptiveSubdivider/commandlineAdaptiveSubdivider.pro deleted file mode 100644 index 88bae140..00000000 --- a/src/OpenMesh/Apps/Subdivider/commandlineAdaptiveSubdivider/commandlineAdaptiveSubdivider.pro +++ /dev/null @@ -1,15 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -openmesh() - -# Input -SOURCES += ../adaptive_subdivider.cc - -################################################################################ diff --git a/src/OpenMesh/Apps/Subdivider/commandlineSubdivider/commandlineSubdivider.pro b/src/OpenMesh/Apps/Subdivider/commandlineSubdivider/commandlineSubdivider.pro deleted file mode 100644 index f4d941f7..00000000 --- a/src/OpenMesh/Apps/Subdivider/commandlineSubdivider/commandlineSubdivider.pro +++ /dev/null @@ -1,15 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -openmesh() - -# Input -SOURCES += ../subdivider.cc - -################################################################################ diff --git a/src/OpenMesh/Apps/VDProgMesh/Analyzer/Analyzer.pro b/src/OpenMesh/Apps/VDProgMesh/Analyzer/Analyzer.pro deleted file mode 100644 index b93a0cbb..00000000 --- a/src/OpenMesh/Apps/VDProgMesh/Analyzer/Analyzer.pro +++ /dev/null @@ -1,26 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../../.. - -CONFIG += glew glut - -Application() - -LIBS += -Wl,-rpath=$${TOPDIR}/OpenMesh/Core/lib/$${BUILDDIRECTORY} -lCore -LIBS += -Wl,-rpath=$${TOPDIR}/OpenMesh/Tools/lib/$${BUILDDIRECTORY} -lTools -LIBS += -lglut -QMAKE_LIBDIR += $${TOPDIR}/OpenMesh/Core/lib/$${BUILDDIRECTORY} -QMAKE_LIBDIR += $${TOPDIR}/OpenMesh/Tools/lib/$${BUILDDIRECTORY} - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Apps/VDProgMesh/Synthesizer/Synthesizer.pro b/src/OpenMesh/Apps/VDProgMesh/Synthesizer/Synthesizer.pro deleted file mode 100644 index dad78ae1..00000000 --- a/src/OpenMesh/Apps/VDProgMesh/Synthesizer/Synthesizer.pro +++ /dev/null @@ -1,27 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../../.. - -CONFIG += glew glut - -Application() - -LIBS += -Wl,-rpath=$${TOPDIR}/OpenMesh/Core/lib/$${BUILDDIRECTORY} -lCore -LIBS += -Wl,-rpath=$${TOPDIR}/OpenMesh/Tools/lib/$${BUILDDIRECTORY} -lTools -LIBS += -lglut -QMAKE_LIBDIR += $${TOPDIR}/OpenMesh/Core/lib/$${BUILDDIRECTORY} -QMAKE_LIBDIR += $${TOPDIR}/OpenMesh/Tools/lib/$${BUILDDIRECTORY} - -DIRECTORIES = . ../../QtViewer - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -SOURCES -= ../../QtViewer/meshviewer.cc -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.pro b/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.pro deleted file mode 100644 index b93a0cbb..00000000 --- a/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.pro +++ /dev/null @@ -1,26 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../../.. - -CONFIG += glew glut - -Application() - -LIBS += -Wl,-rpath=$${TOPDIR}/OpenMesh/Core/lib/$${BUILDDIRECTORY} -lCore -LIBS += -Wl,-rpath=$${TOPDIR}/OpenMesh/Tools/lib/$${BUILDDIRECTORY} -lTools -LIBS += -lglut -QMAKE_LIBDIR += $${TOPDIR}/OpenMesh/Core/lib/$${BUILDDIRECTORY} -QMAKE_LIBDIR += $${TOPDIR}/OpenMesh/Tools/lib/$${BUILDDIRECTORY} - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Apps/mconvert/mconvert.pro b/src/OpenMesh/Apps/mconvert/mconvert.pro deleted file mode 100644 index 69592799..00000000 --- a/src/OpenMesh/Apps/mconvert/mconvert.pro +++ /dev/null @@ -1,22 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -Application() - -INCLUDEPATH += ../../.. - -glew() -glut() -openmesh() - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Core/Core.pro b/src/OpenMesh/Core/Core.pro deleted file mode 100644 index e7101ba3..00000000 --- a/src/OpenMesh/Core/Core.pro +++ /dev/null @@ -1,43 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -Library() - -contains( OPENFLIPPER , OpenFlipper ){ - DESTDIR = $${TOPDIR}/OpenMesh/lib -} else { - DESTDIR = $${TOPDIR}/lib -} - - -DIRECTORIES = . Geometry IO IO/exporter IO/importer IO/reader IO/writer \ - Mesh Mesh/gen System Utils - -INCLUDEPATH += ../.. - -CONFIG( debug, debug|release ){ - TARGET = OpenMeshCored -} else { - TARGET = OpenMeshCore -} - -win32 { - DEFINES += _USE_MATH_DEFINES NOMINMAX - CONFIG += static -} - -macx { - # Set library binary header to the correct path - QMAKE_LFLAGS_SONAME = -install_name$${LITERAL_WHITESPACE}$${DESTDIR}/ - export(QMAKE_LFLAGS_SONAME) -} - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Examples/Examples.pro b/src/OpenMesh/Examples/Examples.pro deleted file mode 100644 index 556c16f6..00000000 --- a/src/OpenMesh/Examples/Examples.pro +++ /dev/null @@ -1,12 +0,0 @@ -Subdirs() - -addSubdirs( Tutorial01 ) -addSubdirs( Tutorial02 ) -addSubdirs( Tutorial03 ) -addSubdirs( Tutorial04 ) -addSubdirs( Tutorial05 ) -addSubdirs( Tutorial06 ) -addSubdirs( Tutorial07 ) -addSubdirs( Tutorial08 ) -addSubdirs( Tutorial09 ) -addSubdirs( Tutorial10 ) diff --git a/src/OpenMesh/Examples/Tutorial01/Tutorial01.pro b/src/OpenMesh/Examples/Tutorial01/Tutorial01.pro deleted file mode 100644 index 5d626522..00000000 --- a/src/OpenMesh/Examples/Tutorial01/Tutorial01.pro +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -openmesh() - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Examples/Tutorial02/Tutorial02.pro b/src/OpenMesh/Examples/Tutorial02/Tutorial02.pro deleted file mode 100644 index 5d626522..00000000 --- a/src/OpenMesh/Examples/Tutorial02/Tutorial02.pro +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -openmesh() - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Examples/Tutorial03/Tutorial03.pro b/src/OpenMesh/Examples/Tutorial03/Tutorial03.pro deleted file mode 100644 index 5d626522..00000000 --- a/src/OpenMesh/Examples/Tutorial03/Tutorial03.pro +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -openmesh() - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Examples/Tutorial04/Tutorial04.pro b/src/OpenMesh/Examples/Tutorial04/Tutorial04.pro deleted file mode 100644 index 5d626522..00000000 --- a/src/OpenMesh/Examples/Tutorial04/Tutorial04.pro +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -openmesh() - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Examples/Tutorial05/Tutorial05.pro b/src/OpenMesh/Examples/Tutorial05/Tutorial05.pro deleted file mode 100644 index 5d626522..00000000 --- a/src/OpenMesh/Examples/Tutorial05/Tutorial05.pro +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -openmesh() - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Examples/Tutorial06/Tutorial06.pro b/src/OpenMesh/Examples/Tutorial06/Tutorial06.pro deleted file mode 100644 index 5d626522..00000000 --- a/src/OpenMesh/Examples/Tutorial06/Tutorial06.pro +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -openmesh() - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Examples/Tutorial07/Tutorial07.pro b/src/OpenMesh/Examples/Tutorial07/Tutorial07.pro deleted file mode 100644 index 5d626522..00000000 --- a/src/OpenMesh/Examples/Tutorial07/Tutorial07.pro +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -openmesh() - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Examples/Tutorial08/Tutorial08.pro b/src/OpenMesh/Examples/Tutorial08/Tutorial08.pro deleted file mode 100644 index 5d626522..00000000 --- a/src/OpenMesh/Examples/Tutorial08/Tutorial08.pro +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -openmesh() - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Examples/Tutorial09/Tutorial09.pro b/src/OpenMesh/Examples/Tutorial09/Tutorial09.pro deleted file mode 100644 index 5d626522..00000000 --- a/src/OpenMesh/Examples/Tutorial09/Tutorial09.pro +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -openmesh() - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Examples/Tutorial10/Tutorial10.pro b/src/OpenMesh/Examples/Tutorial10/Tutorial10.pro deleted file mode 100644 index 5d626522..00000000 --- a/src/OpenMesh/Examples/Tutorial10/Tutorial10.pro +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -INCLUDEPATH += ../../.. - -Application() -openmesh() - -DIRECTORIES = . - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - -################################################################################ diff --git a/src/OpenMesh/Tools/Tools.pro b/src/OpenMesh/Tools/Tools.pro deleted file mode 100644 index 50933420..00000000 --- a/src/OpenMesh/Tools/Tools.pro +++ /dev/null @@ -1,45 +0,0 @@ -################################################################################ -# -################################################################################ - -include( $$TOPDIR/qmake/all.include ) - -Library() - -contains( OPENFLIPPER , OpenFlipper ){ - DESTDIR = $${TOPDIR}/OpenMesh/lib -} else { - DESTDIR = $${TOPDIR}/lib -} - -DIRECTORIES = . Decimater Smoother Subdivider/Adaptive/Composite \ - Subdivider/Uniform/Composite Subdivider/Uniform \ - Utils - -INCLUDEPATH += ../.. - -CONFIG( debug, debug|release ){ - TARGET = OpenMeshToolsd -} else { - TARGET = OpenMeshTools -} - -win32 { - DEFINES += _USE_MATH_DEFINES NOMINMAX - CONFIG += static -} - -macx { - # Set library binary header to the correct path - QMAKE_LFLAGS_SONAME = -install_name$${LITERAL_WHITESPACE}$${DESTDIR}/ - export(QMAKE_LFLAGS_SONAME) -} - -# Input -HEADERS += $$getFilesFromDir($$DIRECTORIES,*.hh) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.c) -SOURCES += $$getFilesFromDir($$DIRECTORIES,*.cc) -FORMS += $$getFilesFromDir($$DIRECTORIES,*.ui) - - -################################################################################ From d097d916e50ba5dcd4382de91857ee9944b4cb80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 19 Apr 2018 12:59:45 +0200 Subject: [PATCH 077/118] Updated to 7.1 release candidate version --- Doc/changelog.docu | 15 ++++++++++++++- VERSION | 4 ++-- cmake/FindOpenMesh.cmake | 2 ++ src/OpenMesh/Core/System/config.h | 6 +----- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 5feaf07f..88dc44a5 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -6,6 +6,19 @@ + +7.1 (?/?/?) + + +General +
      +
    • Remove old qmake project files. Unmaintained for a very long time
    • +
    + + + + + 7.0 (2018/04/19) Breaking changes @@ -62,7 +75,7 @@
  • BaseExporter: Added accessor functions for HalfEdgeHandles and faceTexCoords to base exporter and exporter template.
  • OBJ Writer: Fail if vertex color export was requested (Thanks to Manuel Massing)
  • OBJ Writer: Added functionality to store FaceTexCoords to objwriter
  • -
  • OBJ Writer: Applied fix for bad or missing vertex tex coords (Thanks to Gero Müller for the patch)
  • > +
  • OBJ Writer: Applied fix for bad or missing vertex tex coords (Thanks to Gero Müller for the patch)
  • OBJ Writer: Fix vertex texture coordinates export in OBJ writer
  • OBJ Loader: range check for vertex colors and normals in OBJ loader
  • OBJ Loader: fixed handling of negative indices in OBJ loader
  • diff --git a/VERSION b/VERSION index 7028d24e..965f7b0e 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ -VERSION=7.0 +VERSION=7.1 MAJOR=7 -MINOR=0 +MINOR=1 PATCH=0 ID=OPENMESH diff --git a/cmake/FindOpenMesh.cmake b/cmake/FindOpenMesh.cmake index 693b1517..5893b084 100644 --- a/cmake/FindOpenMesh.cmake +++ b/cmake/FindOpenMesh.cmake @@ -63,6 +63,7 @@ IF (NOT OPENMESH_FOUND) "${CMAKE_SOURCE_DIR}/OpenMesh/src/OpenMesh" "${CMAKE_SOURCE_DIR}/libs_required/OpenMesh/src/OpenMesh" "${CMAKE_SOURCE_DIR}/../OpenMesh/src/OpenMesh" + "C:/Program Files/OpenMesh 7.1" "C:/Program Files/OpenMesh 7.0" "C:/Program Files/OpenMesh 6.3" "C:/Program Files/OpenMesh 6.2" @@ -82,6 +83,7 @@ IF (NOT OPENMESH_FOUND) "C:/Program Files/OpenMesh 2.4.1" "C:/Program Files/OpenMesh 2.4" "C:/Program Files/OpenMesh 2.0/include" + "C:/libs/OpenMesh 7.1" "C:/libs/OpenMesh 7.0" "C:/libs/OpenMesh 6.3" "C:/libs/OpenMesh 6.2" diff --git a/src/OpenMesh/Core/System/config.h b/src/OpenMesh/Core/System/config.h index e0d436e3..65c0b3e2 100644 --- a/src/OpenMesh/Core/System/config.h +++ b/src/OpenMesh/Core/System/config.h @@ -65,11 +65,7 @@ // ---------------------------------------------------------------------------- -#define OM_VERSION 0x70000 -//#define OM_VERSION 0x60300 - -// only defined, if it is a beta version -//#define OM_VERSION_BETA 4 +#define OM_VERSION 0x70100 #define OM_GET_VER ((OM_VERSION & 0xf0000) >> 16) #define OM_GET_MAJ ((OM_VERSION & 0x0ff00) >> 8) From dcc6b433f9025d319149ba39b837e5c16df47ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 19 Apr 2018 13:00:14 +0200 Subject: [PATCH 078/118] Removed qmake directory --- qmake/all.include | 134 -------------------------------- qmake/architecture.include | 87 --------------------- qmake/compiler.include | 18 ----- qmake/functions.include | 76 ------------------ qmake/packages/packages.Darwin | 38 --------- qmake/packages/packages.Linux | 71 ----------------- qmake/packages/packages.Windows | 77 ------------------ qmake/targets.include | 126 ------------------------------ 8 files changed, 627 deletions(-) delete mode 100644 qmake/all.include delete mode 100644 qmake/architecture.include delete mode 100644 qmake/compiler.include delete mode 100644 qmake/functions.include delete mode 100644 qmake/packages/packages.Darwin delete mode 100644 qmake/packages/packages.Linux delete mode 100644 qmake/packages/packages.Windows delete mode 100644 qmake/targets.include diff --git a/qmake/all.include b/qmake/all.include deleted file mode 100644 index 551272e3..00000000 --- a/qmake/all.include +++ /dev/null @@ -1,134 +0,0 @@ - -################################################################################ -# This is a library -################################################################################ - - -################################################################################ -# Needed Qt packages and build plugin -################################################################################ - -CONFIG += qt uitools opengl thread debug_and_release - -QT += opengl - -################################################################################ -# Add toplevel directory to include path -# TOPDIR has to be specified in a .qmake.cache file in your projects toplevel -# directory -################################################################################ -INCLUDEPATH = $$quote( $$TOPDIR/src ) -DEPENDPATH = $$quote( $${TOPDIR}/src ) - -################################################################################ -# Define header Extension -# This will also override the header extension for uic output -# ( Do not change to += otherwise uic output will end with .h ! ) -################################################################################ -QMAKE_EXT_H = .hh .h - -################################################################################ -# Architecture detection -################################################################################ -include( architecture.include ) - -################################################################################ -# Helper functions -################################################################################ -include( functions.include ) - -################################################################################ -# Custom settings for compiler flags and similar -################################################################################ -include( compiler.include) - -################################################################################ -# Extra target definitions -################################################################################ -include( targets.include ) - -################################################################################ -# Global package definitions -################################################################################ -include( packages/packages.$${SYSTEMTYPE} ) - -################################################################################ -# Local package definitions -# These lines will include a file from a .qmake directory inside your home. -# this file will overwrite existing setting -################################################################################ - -unix { - HOME=$$system(echo ~) -} -#else { - #message( TODO : Define Home in Windows ) -#} - -exists( $${HOME}/.qmake/config.$${SYSTEMTYPE} ) { - include( $${HOME}/.qmake/config.$${SYSTEMTYPE} ) -} - -################################################################################ -# Set standard build directories -# ( Everything generated while compiling will go # into a per architecture -# directory ) -################################################################################ -OBJECTS_DIR = tmp/$$BUILDDIRECTORY -MOC_DIR = tmp/$$BUILDDIRECTORY -UI_DIR = tmp/$$BUILDDIRECTORY - -################################################################################ -# type definitions -################################################################################ - -defineTest(Library) { - unix{ - TEMPLATE = lib - contains( OPERATING_SYSTEM, Darwin) { - CONFIG -= static - export(CONFIG) - } - } - win32 { - TEMPLATE = vclib - } - export(TEMPLATE) - DESTDIR = lib/$$BUILDDIRECTORY - export(DESTDIR) - defineTargets() - UI_DIR = include - export(UI_DIR) -} - -defineTest(Application) { - unix { - TEMPLATE = app - } - win32 { - TEMPLATE = vcapp - } - macx { - CONFIG -= app_bundle - export( CONFIG ) - } - export(TEMPLATE) - DESTDIR = $$BUILDDIRECTORY - export(DESTDIR) - defineTargets() -} - - -defineTest(Subdirs) { - unix { - TEMPLATE = subdirs - } - win32 { - TEMPLATE = vcsubdirs - } - export(TEMPLATE) - CONFIG += ordered - export(CONFIG) - defineTargets() -} - diff --git a/qmake/architecture.include b/qmake/architecture.include deleted file mode 100644 index 369ff027..00000000 --- a/qmake/architecture.include +++ /dev/null @@ -1,87 +0,0 @@ - -################################################################################ -# Architecture detection -# The following Variables are defined by this include: -# OPERATING_SYSTEM : Debian / Fedora / Windows -# ARCHITECTURE : 32 / 64 -# MODE : Debug / Release -# BUILDDIRECTORY : Concat of all above variables sesparated by underscores e.g. Debian_64_debug -################################################################################ - -unix { - - OPERATING_SYSTEM = UNKNOWN_OS - - exists( /etc/lsb-release ) { - OPERATING_SYSTEM = Ubuntu - } - - - exists( /etc/debian_version ) | exists( /etc/debian_release ) { - OPERATING_SYSTEM = Debian - } - - exists( /etc/fedora-release ) { - OPERATING_SYSTEM = Fedora - } - - exists( /etc/gentoo-release ) { - OPERATING_SYSTEM = Gentoo - } - - exists( /etc/lfs-release ) { - OPERATING_SYSTEM = Linux_From_Scratch - } - - exists( /etc/mandrake-release ) | exists( /etc/mandrakelinux-release ) { - OPERATING_SYSTEM = Mandrake - } - - exists( /etc/mandriva-release ) { - OPERATING_SYSTEM = Mandriva - } - - exists( /etc/redhat-release ) | exists( /etc/redhat_version ) { - OPERATING_SYSTEM = Redhat - } - - exists( /etc/SuSE-release ) | exists( /etc/novell-release ) { - OPERATING_SYSTEM = SuSE - } - - TEST_DARWIN = $$system(uname -s) - contains( TEST_DARWIN, Darwin) { - OPERATING_SYSTEM = Darwin - DEFINES += ARCH_DARWIN - export(DEFINES) - } - - HARDWARE_PLATFORM = $$system(uname -a) - contains( HARDWARE_PLATFORM, x86_64 ) { - # 64-bit Linux - ARCHITECTURE = 64 - } else { - # 32-bit Linux - ARCHITECTURE = 32 - } - - contains(TEST_DARWIN, Darwin) { - SYSTEMTYPE = Darwin - } else { - SYSTEMTYPE = Linux - } -} - -win32 { - OPERATING_SYSTEM = Windows - ARCHITECTURE = 32 - SYSTEMTYPE = Windows -} - -CONFIG( debug, debug|release ){ - MODE = Debug -} else { - MODE = Release -} - -BUILDDIRECTORY = $${OPERATING_SYSTEM}_$${ARCHITECTURE}_$${MODE} diff --git a/qmake/compiler.include b/qmake/compiler.include deleted file mode 100644 index 88a4b8be..00000000 --- a/qmake/compiler.include +++ /dev/null @@ -1,18 +0,0 @@ -################################################################################ -# Custom settings for compiler flags and similar -################################################################################ - -unix { - QMAKE_CC = gcc-4.3 - QMAKE_CXX = g++-4.3 - macx { - QMAKE_CC = gcc-4.0 - QMAKE_CXX = g++-4.0 - } - - QMAKE_CFLAGS_RELEASE = -O3 -DINCLUDE_TEMPLATES -W -Wall -Wno-unused -DNDEBUG - QMAKE_CXXFLAGS_RELEASE = -O3 -DINCLUDE_TEMPLATES -ftemplate-depth-100 -W -Wall -Wno-unused -DNDEBUG - QMAKE_CFLAGS_DEBUG = -g -DINCLUDE_TEMPLATES -W -Wall -Wno-unused -DDEBUG - QMAKE_CXXFLAGS_DEBUG = -g -DINCLUDE_TEMPLATES -ftemplate-depth-100 -W -Wall -Wno-unused -DDEBUG -} - diff --git a/qmake/functions.include b/qmake/functions.include deleted file mode 100644 index 5e5771c6..00000000 --- a/qmake/functions.include +++ /dev/null @@ -1,76 +0,0 @@ - -################################################################################ -# functions collecting all headers in the directory -################################################################################ - -# getFilesFromDir( directory, pattern ) -# returns a list of all files matching pattern in directory -defineReplace(getFilesFromDir) { - dirs = $$1 - pattern = $$2 - - files = - - for(dir, dirs) { - found = $$files( $${dir}/$${pattern} ) - files += $$found - } - - return( $$files ) -} - -# addSubdirs(subdirs,deps): Adds directories to the project that depend on -# other directories -defineTest( addSubdirs ) { - for(subdirs, 1) { - entries = $$files($$subdirs) - for(entry, entries) { - name = $$replace(entry, [/\\\\], _) - name = $$replace(name, - , _) - SUBDIRS += $$name - eval ($${name}.subdir = $$entry) - for(dep, 2): { - tempval = $$replace(dep, [/\\\\], _) - eval ($${name}.depends += $$replace(tempval, - , _) ) - } - export ($${name}.subdir) - export ($${name}.depends) - } - } - export (SUBDIRS) -} - -# given a list of paths and a libname this function checks if the lib is there -# adds the path and returns true if found otherwise false -defineTest( addLib ) { - dirs = $$1 - name = $$2 - - # check for the library - for(dir , dirs) { - check = $${dir}/lib$${name}.so - - # Found, so use it - exists( $$check ) { - LIBS *= -L$${dir} -l$$name - export(LIBS) - return(true) - } - } - - return(false) -} - - -defineReplace( getCurrentDir ) { - DIR = '' - unix { - DIR = $$system( pwd ) - } - - win32 { - DIR = $$system( cd ) - } - - return( $$DIR ) -} diff --git a/qmake/packages/packages.Darwin b/qmake/packages/packages.Darwin deleted file mode 100644 index 874f67af..00000000 --- a/qmake/packages/packages.Darwin +++ /dev/null @@ -1,38 +0,0 @@ - -################################################################################ -# INCLUDE Packages -################################################################################ - -defineTest( qt ) { - QT += opengl network script sql - export(QT) -} - -defineTest( glew ) { - INCLUDEPATH *= /sw/include/GL - export(INCLUDEPATH) - LIBS *= -L/opt/local/lib/ -lGLEW - export(LIBS) -} - -defineTest( glut ) { - INCLUDEPATH *= /System/Library/Frameworks/GLUT.framework/Headers - export(INCLUDEPATH) - LIBS *= -framework GLUT - export(LIBS) -} - -defineTest( openmesh ) { - QMAKE_LIBDIR += $${TOPDIR}/lib - QMAKE_LIBDIR += $${TOPDIR}/lib - - CONFIG( debug, debug|release ){ - LIBS += -lOpenMeshToolsd - LIBS += -lOpenMeshCored - } else { - LIBS += -lOpenMeshTools - LIBS += -lOpenMeshCore - } - export(QMAKE_LIBDIR) - export(LIBS) -} diff --git a/qmake/packages/packages.Linux b/qmake/packages/packages.Linux deleted file mode 100644 index a71bf22f..00000000 --- a/qmake/packages/packages.Linux +++ /dev/null @@ -1,71 +0,0 @@ - -################################################################################ -# INCLUDE Packages -################################################################################ - -defineTest( qt ) { - CONFIG *= uitools - export(CONFIG) - QT += opengl network script sql - export(QT) -} - -defineTest( qwt ) { - INCLUDEPATH *= /usr/include/qwt-qt4/ - export(INCLUDEPATH) - LIBS *= -L/usr/lib/ -lqwt-qt4 - export(LIBS) -} - -defineTest( glew ) { - INCLUDEPATH *= /usr/include/GL - export(INCLUDEPATH) - LIBS *= -L/usr/lib -lGLEW - export(LIBS) -} - -defineTest( glut ) { - INCLUDEPATH *=$${ACG}/OpenGL/include - export(INCLUDEPATH) - LIBS *= -L/usr/X11R6/lib -lglut - export(LIBS) -} - -defineTest( openmesh ) { - QMAKE_LIBDIR += $${TOPDIR}/lib/ - QMAKE_LIBDIR += $${TOPDIR}/lib/ - - CONFIG( debug, debug|release ){ - LIBS+= -Wl,-rpath=$${TOPDIR}/lib -lOpenMeshCored - LIBS+= -Wl,-rpath=$${TOPDIR}/lib -lOpenMeshToolsd - } else { - LIBS+= -Wl,-rpath=$${TOPDIR}/lib -lOpenMeshCore - LIBS+= -Wl,-rpath=$${TOPDIR}/lib -lOpenMeshTools - } - - export(QMAKE_LIBDIR) - export(LIBS) -} - -defineTest( openmp ) { - - addLib( /usr/lib/gcc/x86_64-linux-gnu/4.3 /usr/lib, gomp ) { - - QMAKE_CXXFLAGS_RELEASE += -fopenmp - QMAKE_CXXFLAGS_DEBUG += -fopenmp - QMAKE_CFLAGS_RELEASE += -fopenmp - QMAKE_CFLAGS_DEBUG += -fopenmp - QMAKE_LFLAGS_DEBUG += -fopenmp - QMAKE_LFLAGS_RELEASE += -fopenmp - - export(QMAKE_CXXFLAGS_RELEASE) - export(QMAKE_CFLAGS_RELEASE) - export(QMAKE_CXXFLAGS_DEBUG) - export(QMAKE_CFLAGS_DEBUG) - export(QMAKE_LFLAGS_DEBUG) - export(QMAKE_LFLAGS_RELEASE) - } else { - message("Unable to find OpenMP lib for linking. OpenMP support will be disabled!!") - } - -} diff --git a/qmake/packages/packages.Windows b/qmake/packages/packages.Windows deleted file mode 100644 index a397be34..00000000 --- a/qmake/packages/packages.Windows +++ /dev/null @@ -1,77 +0,0 @@ - -################################################################################ -# INCLUDE Packages -################################################################################ - - -defineTest( glew ) { - - ####################################### - ## Enter here the correct path to GLEW - ####################################### - - GLEW_PATH = c:\libs\glew - - ####################################### - - !exists ( $${GLEW_PATH} ) { - error (ERROR: GLEW not found or wrong path entry in OpenMesh\qmake\packages\packages.Windows! Please adjust it to your path!) - } - INCLUDEPATH *= $${GLEW_PATH}\include - export(INCLUDEPATH) - LIBS *= -L$${GLEW_PATH}\lib -lglew32 - export(LIBS) -} - -defineTest( qt ) { - CONFIG *= uitools - export(CONFIG) - QT += opengl network script sql - export(QT) -} - -defineTest( glut ) { - - ####################################### - ## Enter here the correct path to GLUT - ####################################### - - GLUT_PATH = c:\libs\glut-3.7 - - ######################################## - - !exists ( $${GLUT_PATH} ) { - error (ERROR: GLUT not found or wrong path entry in OpenMesh\qmake\packages\packages.Windows! Please adjust it to your path!) - } - INCLUDEPATH *= $${GLUT_PATH}\include - export(INCLUDEPATH) - LIBS *= -L$${GLUT_PATH}\lib -lglut32 - export(LIBS) -} - -defineTest( openmp ) { - QMAKE_CXXFLAGS_DEBUG += /openmp - QMAKE_CXXFLAGS_RELEASE += /openmp - export(QMAKE_CXXFLAGS_DEBUG) - export(QMAKE_CXXFLAGS_RELEASE) -} - -defineTest( openmesh ) { - DEFINES += _USE_MATH_DEFINES NOMINMAX - - QMAKE_LIBDIR += $${TOPDIR}/lib/ - QMAKE_LIBDIR += $${TOPDIR}/lib/ - - CONFIG( debug, debug|release ){ - LIBS+= -L$${TOPDIR}/lib -lOpenMeshCored - LIBS+= -L$${TOPDIR}/lib -lOpenMeshToolsd - } else { - LIBS+= -L$${TOPDIR}/lib -lOpenMeshCore - LIBS+= -L$${TOPDIR}/lib -lOpenMeshTools - } - - export(DEFINES) - export(QMAKE_LIBDIR) - export(LIBS) -} - diff --git a/qmake/targets.include b/qmake/targets.include deleted file mode 100644 index 57da389c..00000000 --- a/qmake/targets.include +++ /dev/null @@ -1,126 +0,0 @@ -################################################################################ -# Custom targets -################################################################################ - -defineTest( defineTargets ) { - - # internal target ... Use allclean instead! - # cleanDirs target called by subAllclean. - # removes all lib tmp and Builddirectories created by these qmake scripts - !contains( QMAKE_EXTRA_TARGETS , cleanDirs) { - # Remove temp dirs when doing allclean - cleanDirs.target = cleanDirs - cleanDirs.commands = rm -rf tmp - - contains( TEMPLATE, app ) { - cleanDirs.commands += ; rm -rf $${BUILDDIRECTORY} - } - - - contains( TEMPLATE, lib ) { - cleanDirs.commands += ; rm -rf lib - } - - export(cleanDirs.target) - export(cleanDirs.commands) - export(cleanDirs.depends) - export(cleanDirs.CONFIG) - - QMAKE_EXTRA_TARGETS += cleanDirs - export(QMAKE_EXTRA_TARGETS) - } - - # internal target ... Use allclean instead! - # main local subAllclean target called by allclean (see below) - # this one calls - # 1. clean to remove temporary files created - # 2. cleanDirs to remove all tmp and lib directories created by qmake - # 3. distclean to remove the rest - !contains( QMAKE_EXTRA_TARGETS , subAllclean) { - # Remove temp dirs when doing allclean - subAllclean.target = subAllclean - subAllclean.depends = clean cleanDirs distclean - - export(subAllclean.target) - export(subAllclean.depends) - - QMAKE_EXTRA_TARGETS += subAllclean - export(QMAKE_EXTRA_TARGETS) - } - - - # basic allclean target, will cleate a recursive target calling subAllclean in the subdirectories makefiles - !contains( QMAKE_EXTRA_TARGETS , allclean) { - allclean.target = allclean - allclean.CONFIG = recursive - allclean.recurse_target = subAllclean - - export(allclean.target) - export(allclean.CONFIG) - export(allclean.recurse_target) - - QMAKE_EXTRA_TARGETS += allclean - export(QMAKE_EXTRA_TARGETS) - } - - !contains( QMAKE_EXTRA_TARGETS , plugindoc ) { - exists ( Documentation ) { - plugindoc.target = plugindoc - PLUGINNAME = $$getCurrentDir() - PLUGINNAME = $$section( PLUGINNAME, "/" ,-1, -1) - - unix { - plugindoc.commands += rm -rf $${TOPDIR}/OpenFlipper/Docs/User/$$PLUGINNAME ; - plugindoc.commands += mkdir $${TOPDIR}/OpenFlipper/Docs/User/$$PLUGINNAME ; - plugindoc.commands += cp Documentation/*.html $${TOPDIR}/OpenFlipper/Docs/User/$$PLUGINNAME ; - exists ( Documentation/pics ) { - plugindoc.commands += cp -r Documentation/pics $${TOPDIR}/OpenFlipper/Docs/User/$$PLUGINNAME ; - } - } - - win32 { - message(Documentaion copy not supported on windows platform) - #plugindoc.commands += rmdir /s $${TOPDIR}/OpenFlipper/Docs/User/$$PLUGINNAME ; - #plugindoc.commands += mkdir $${TOPDIR}/OpenFlipper/Docs/User/$$PLUGINNAME ; - #plugindoc.commands += xcopy /f Documentation/*.html $${TOPDIR}/OpenFlipper/Docs/User/$$PLUGINNAME ; - #exists ( Documentation/pics ) { - # plugindoc.commands += xcopy /f /s Documentation/pics $${TOPDIR}/OpenFlipper/Docs/User/$$PLUGINNAME ; - #} - } - - export(plugindoc.target) - export(plugindoc.commands) - export(plugindoc.depends) - - QMAKE_EXTRA_TARGETS += plugindoc - export(QMAKE_EXTRA_TARGETS) - } - } - - -} - -# target for libraries -# this target will copy all headers to an include subdirectory -# You have to call this after you defined evertything else for your library. -# Otherwise this target doesnt know about the required headers. - -defineTest( installs ) { - - !contains( INSTALLS , includes ) { - contains( TEMPLATE, lib ) { - - includes.path = include/ - includes.extra = cp -f --parents $${HEADERS} include/ - - export(includes.path) - export(includes.extra) - - INSTALLS *= includes - export(INSTALLS) - } - } -} - - - From ad6eab8bee3dc1191f356de568eb095643fcbd45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 8 May 2018 15:33:26 +0200 Subject: [PATCH 079/118] Fixed clang warning --- src/Unittests/unittests_common_customtraits.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Unittests/unittests_common_customtraits.hh b/src/Unittests/unittests_common_customtraits.hh index bb3ec8f8..8bcdd918 100644 --- a/src/Unittests/unittests_common_customtraits.hh +++ b/src/Unittests/unittests_common_customtraits.hh @@ -13,7 +13,7 @@ template class Vec { // Constructor with DIM components Vec(float x) : data({ x }) {} Vec(float x, float y) : data({ x, y }) {} - Vec(float x, float y, float z) : data({ x, y, z }) {} + Vec(float x, float y, float z) : data({{ x, y, z }}) {} Vec(float x, float y, float z, float w) : data({ x, y, z, w }) {} Vec() = default; From 2b49ddfae0bc4df46891df23fd6bc4b008e69a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 23 May 2018 13:01:00 +0200 Subject: [PATCH 080/118] Updated cmake finders and gitlab file to support apps on VS2017 --- .gitlab-ci.yml | 17 ++++++++++------- cmake/FindGLEW.cmake | 12 ++++++++++-- cmake/FindGLUT.cmake | 23 ++++++++++++++++++++--- cmake/FindGoogleTest.cmake | 27 ++++++++++++++++----------- 4 files changed, 56 insertions(+), 23 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 72839651..62d94510 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,29 +44,30 @@ cppcheck: paths: - cppcheck.log -.VS2015-32-bit-shared-apps: +VS2017-32-bit-shared-apps: variables: - BUILD_PLATFORM: "VS2015" + BUILD_PLATFORM: "VS2017" ARCHITECTURE: "x32" SHARED: "TRUE" APPS: "ON" script: "CI\\Windows.bat" tags: - - VS2015 + - VS2017 + - Qt5101 artifacts: paths: - build-release/*.exe - -.VS2015-32-bit-static-apps: +VS2017-32-bit-static-apps: variables: - BUILD_PLATFORM: "VS2015" + BUILD_PLATFORM: "VS2017" ARCHITECTURE: "x32" SHARED: "FALSE" APPS: "ON" script: "CI\\Windows.bat" tags: - - VS2015 + - VS2017 + - Qt5101 artifacts: paths: - build-release/*.exe @@ -81,6 +82,7 @@ VS2017-64-bit-shared-apps: script: "CI\\Windows.bat" tags: - VS2017 + - Qt5101 artifacts: paths: - build-release/*.exe @@ -94,6 +96,7 @@ VS2017-64-bit-static-apps: script: "CI\\Windows.bat" tags: - VS2017 + - Qt5101 artifacts: paths: - build-release/*.exe diff --git a/cmake/FindGLEW.cmake b/cmake/FindGLEW.cmake index ff2d6a23..c7151187 100644 --- a/cmake/FindGLEW.cmake +++ b/cmake/FindGLEW.cmake @@ -32,6 +32,10 @@ if( WIN32 ) SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x64/") elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*" ) SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x32/") + elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15.*Win64" ) + SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2017/x64/") + elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15.*" ) + SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2017/x32/") endif() if( MSVC80 ) @@ -45,7 +49,9 @@ if( WIN32 ) PATHS "${CMAKE_WINDOWS_LIBS_DIR}/glew/include" "${CMAKE_WINDOWS_LIBS_DIR}/glew-1.6.0/include" ${COMPILER_PATH}/PlatformSDK/Include - "${VS_SEARCH_PATH}glew-1.10.0/include") + "${VS_SEARCH_PATH}glew-2.0.0/include" + "${VS_SEARCH_PATH}glew-1.10.0/include" + "${VS_SEARCH_PATH}glew-1.13.0/include") SET( GLEW_NAMES glew32 ) FIND_LIBRARY( GLEW_LIBRARY @@ -53,7 +59,9 @@ if( WIN32 ) PATHS "${CMAKE_WINDOWS_LIBS_DIR}/glew/lib" "${CMAKE_WINDOWS_LIBS_DIR}/glew-1.6.0/lib" ${COMPILER_PATH}/PlatformSDK/Lib - "${VS_SEARCH_PATH}glew-1.10.0/lib" ) + "${VS_SEARCH_PATH}glew-2.0.0/lib" + "${VS_SEARCH_PATH}glew-1.10.0/lib" + "${VS_SEARCH_PATH}glew-1.13.0/lib" ) else( WIN32 ) FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h GL/wglew.h diff --git a/cmake/FindGLUT.cmake b/cmake/FindGLUT.cmake index f3a99dfc..faece669 100644 --- a/cmake/FindGLUT.cmake +++ b/cmake/FindGLUT.cmake @@ -40,6 +40,10 @@ IF (WIN32) SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x64/") elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*" ) SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x32/") + elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15.*Win64" ) + SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2017/x64/") + elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15.*" ) + SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2017/x32/") endif() @@ -49,7 +53,17 @@ IF (WIN32) "${VS_SEARCH_PATH}/freeglut-3.0.0/include" "${VS_SEARCH_PATH}/freeglut-2.8.1/include" ) - FIND_LIBRARY( GLUT_glut_LIBRARY NAMES glut32 glut freeglut + FIND_LIBRARY( GLUT_release_LIBRARY NAMES glut32 glut freeglut + PATHS + ${OPENGL_LIBRARY_DIR} + ${GLUT_ROOT_PATH}/Release + "${CMAKE_WINDOWS_LIBS_DIR}/glut-3.7/lib" + "${VS_SEARCH_PATH}/freeglut-3.0.0/lib" + "${VS_SEARCH_PATH}/freeglut-2.8.1/lib" + ) + GET_FILENAME_COMPONENT( GLUT_LIBRARY_DIR ${GLUT_release_LIBRARY} PATH ) + + FIND_LIBRARY( GLUT_debug_LIBRARY NAMES glut32d glutd freeglutd PATHS ${OPENGL_LIBRARY_DIR} ${GLUT_ROOT_PATH}/Release @@ -58,7 +72,7 @@ IF (WIN32) "${VS_SEARCH_PATH}/freeglut-2.8.1/lib" ) - GET_FILENAME_COMPONENT( GLUT_LIBRARY_DIR ${GLUT_glut_LIBRARY} PATH ) + set(GLUT_glut_LIBRARY optimized ${GLUT_release_LIBRARY} debug ${GLUT_debug_LIBRARY}) ELSE (WIN32) @@ -99,9 +113,12 @@ ENDIF (WIN32) SET( GLUT_FOUND "NO" ) IF(GLUT_INCLUDE_DIR) IF(GLUT_glut_LIBRARY) - + # Is -lXi and -lXmu required on all platforms that have it? + # If not, we need some way to figure out what platform we are on. SET( GLUT_LIBRARIES ${GLUT_glut_LIBRARY} + ${GLUT_Xmu_LIBRARY} + ${GLUT_Xi_LIBRARY} ${GLUT_cocoa_LIBRARY} ) SET( GLUT_FOUND "YES" ) diff --git a/cmake/FindGoogleTest.cmake b/cmake/FindGoogleTest.cmake index 6918c7d9..15c22cd6 100644 --- a/cmake/FindGoogleTest.cmake +++ b/cmake/FindGoogleTest.cmake @@ -59,7 +59,7 @@ else(GTEST_INCLUDE_DIRS AND GTEST_LIBRARIES AND GTEST_MAIN_LIBRARIES) /ACG/acgdev/gcc-x86_64/gtest/lib /opt/local/lib /usr/local/lib - /usr/lib + /usr/include "C:/libs/win32/gtest/lib" NO_DEFAULT_PATH ) find_library(_GTEST_MAIN_LIBRARY gtest_main @@ -70,7 +70,7 @@ else(GTEST_INCLUDE_DIRS AND GTEST_LIBRARIES AND GTEST_MAIN_LIBRARIES) /ACG/acgdev/gcc-x86_64/gtest/lib /opt/local/lib /usr/local/lib - /usr/lib + /usr/include "C:/libs/win32/gtest/lib" NO_DEFAULT_PATH ) @@ -84,24 +84,29 @@ else(GTEST_INCLUDE_DIRS AND GTEST_LIBRARIES AND GTEST_MAIN_LIBRARIES) set(GTEST_INCLUDE_DIRS ${_GTEST_INCLUDE_DIR} CACHE PATH "Include directories for Google Test framework") - if ( NOT WIN32 ) + if ( NOT WIN32 ) set(GTEST_LIBRARIES ${_GTEST_LIBRARY} CACHE FILEPATH "Libraries to link for Google Test framework") set(GTEST_MAIN_LIBRARIES ${_GTEST_MAIN_LIBRARY} CACHE FILEPATH "Libraries to link for Google Test automatic main() definition") - else() - set(GTEST_LIBRARIES "optimized;gtest;debug;gtestd" CACHE FILEPATH + set(GTEST_MAIN_LIBRARY ${_GTEST_MAIN_LIBRARY} CACHE FILEPATH + "Libraries to link for Google Test automatic main() definition") + else() + set(GTEST_LIBRARIES "optimized;gtest;debug;gtestd" CACHE FILEPATH "Libraries to link for Google Test framework") set(GTEST_MAIN_LIBRARIES "optimized;gtest_main;debug;gtest_maind" CACHE FILEPATH "Libraries to link for Google Test automatic main() definition") - endif() + set(GTEST_MAIN_LIBRARY "optimized;gtest_main;debug;gtest_maind" CACHE FILEPATH + "Libraries to link for Google Test automatic main() definition") + endif() - # Macro required to use google test with vs2012 - if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" ) - add_definitions(-D_VARIADIC_MAX=10) - endif() + # Macro required to use google test with vs2012 + if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" ) + add_definitions(-D_VARIADIC_MAX=10) + endif() - + set(GTEST_LIBRARY ${_GTEST_LIBRARY} CACHE FILEPATH + "GTest Libraries") set(GTEST_LIBRARY_DIR ${_GTEST_LIBRARY_DIR} CACHE FILEPATH "Library dir containing Google Test libraries") mark_as_advanced(GTEST_INCLUDE_DIRS GTEST_LIBRARIES GTEST_MAIN_LIBRARIES GTEST_LIBRARY_DIR ) From 2bbbcc689752fd88b0957e9a5a802a825585334f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 23 May 2018 13:28:25 +0200 Subject: [PATCH 081/118] Use Qt5 files from OpenFlipper --- CI/Windows.bat | 4 - CMakeLists.txt | 1 + cmake/ACGCommon.cmake | 424 ++---------------------------------------- cmake/ACGQt.cmake | 396 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 417 insertions(+), 408 deletions(-) create mode 100644 cmake/ACGQt.cmake diff --git a/CI/Windows.bat b/CI/Windows.bat index 7e9d9d12..6173f1fe 100644 --- a/CI/Windows.bat +++ b/CI/Windows.bat @@ -21,7 +21,6 @@ IF "%BUILD_PLATFORM%" == "VS2012" ( set GTESTVERSION=gtest-1.6.0 set GENERATOR=Visual Studio 11%ARCH_VS% set VS_PATH="C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.com" - set QT_VERSION= IF "%ARCHITECTURE%" == "x64" ( set QT_INSTALL_PATH=E:\Qt\4.8.5-vs2012-%STRING_ARCH%\ set QT_BASE_CONFIG=-DQT_QMAKE_EXECUTABLE=E:\Qt\4.8.5-vs2012-%STRING_ARCH%\bin\qmake.exe @@ -38,7 +37,6 @@ IF "%BUILD_PLATFORM%" == "VS2013" ( set GTESTVERSION=gtest-1.6.0 set GENERATOR=Visual Studio 12%ARCH_VS% set VS_PATH="C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.com" - set QT_VERSION= IF "%ARCHITECTURE%" == "x64" ( set QT_INSTALL_PATH=E:\Qt\Qt5.3.1-vs2013-%STRING_ARCH%\5.3\msvc2013_64_opengl set QT_BASE_CONFIG=-DQT5_INSTALL_PATH=E:\Qt\Qt5.3.1-vs2013-%STRING_ARCH%\5.3\msvc2013_64_opengl @@ -56,7 +54,6 @@ IF "%BUILD_PLATFORM%" == "VS2015" ( set GENERATOR=Visual Studio 14%ARCH_VS% set VS_PATH="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com" - set QT_VERSION= IF "%ARCHITECTURE%" == "x64" ( set QT_INSTALL_PATH=E:\Qt\Qt5.6.0-vs2015-%STRING_ARCH%\5.6\msvc2015_64 set QT_BASE_CONFIG=-DQT5_INSTALL_PATH=E:\Qt\Qt5.6.0-vs2015-%STRING_ARCH%\5.6\msvc2015_64 @@ -75,7 +72,6 @@ IF "%BUILD_PLATFORM%" == "VS2017" ( set GENERATOR=Visual Studio 15%ARCH_VS% set VS_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.com" - set QT_VERSION= IF "%ARCHITECTURE%" == "x64" ( set QT_INSTALL_PATH=E:\Qt\Qt5.10.1\5.10.1\msvc2017_64 set QT_BASE_CONFIG=-DQT5_INSTALL_PATH=E:\Qt\Qt5.10.1\5.10.1\msvc2017_64 diff --git a/CMakeLists.txt b/CMakeLists.txt index 47e75aca..fec71a5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,7 @@ if(${PROJECT_NAME} MATCHES "OpenMesh") endif() include (ACGOutput) +include(ACGQt) # ======================================================================== # Definitions diff --git a/cmake/ACGCommon.cmake b/cmake/ACGCommon.cmake index c7220b82..2f0ecd2a 100644 --- a/cmake/ACGCommon.cmake +++ b/cmake/ACGCommon.cmake @@ -3,10 +3,10 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.cmake) endif () # prevent build in source directory -if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") - message (SEND_ERROR "Building in the source directory is not supported.") - message (FATAL_ERROR "Please remove the created \"CMakeCache.txt\" file, the \"CMakeFiles\" directory and create a build directory and call \"${CMAKE_COMMAND} \".") -endif ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") + if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") + message (SEND_ERROR "Building in the source directory is not supported.") + message (FATAL_ERROR "Please remove the created \"CMakeCache.txt\" file, the \"CMakeFiles\" directory and create a build directory and call \"${CMAKE_COMMAND} \".") + endif ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") # allow only Debug and Release builds set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "") @@ -132,7 +132,7 @@ macro (acg_set_target_props target) #BUILD_WITH_INSTALL_RPATH 1 SKIP_BUILD_RPATH 0 ) - endif(NOT (CMAKE_MAJOR_VERSION LESS 3)) + endif(NOT (CMAKE_MAJOR_VERSION LESS 3) ) elseif (NOT APPLE) set_target_properties ( @@ -152,155 +152,6 @@ include (ACGCompiler) # define INCLUDE_TEMPLATES for everything we build add_definitions (-DINCLUDE_TEMPLATES) -#unset cached qt variables which are set by all qt versions. version is the major number of the qt version (e.g. 4 or 5, not 4.8) -macro (acg_unset_qt_shared_variables version) - if (ACG_INTERNAL_QT_LAST_VERSION) - if (NOT ${ACG_INTERNAL_QT_LAST_VERSION} EQUAL ${version}) - unset(QT_BINARY_DIR) - unset(QT_PLUGINS_DIR) - unset(ACG_INTERNAL_QT_LAST_VERSION) - endif() - endif() - set (ACG_INTERNAL_QT_LAST_VERSION "${version}" CACHE INTERNAL "Qt Version, which was used on the last time") -endmacro() - -# look for selected qt dependencies -macro (acg_qt4) - if (NOT QT4_FOUND) - acg_unset_qt_shared_variables(4) - find_package (Qt4 COMPONENTS QtCore QtGui ${ARGN}) - - set (QT_USE_QTOPENGL 1) - set (QT_USE_QTNETWORK 1) - set (QT_USE_QTSCRIPT 1) - set (QT_USE_QTSQL 1) - set (QT_USE_QTXML 1) - set (QT_USE_QTXMLPATTERNS 1) - set (QT_USE_QTHELP 1) - set (QT_USE_QTWEBKIT 1) - set (QT_USE_QTUITOOLS 1) - - include (${QT_USE_FILE}) - endif () -endmacro () - -macro (acg_qt5) - - if(POLICY CMP0020) - # Automatically link Qt executables to qtmain target on Windows - cmake_policy(SET CMP0020 NEW) - endif(POLICY CMP0020) - #if (NOT QT5_FOUND) - - #set (QT_MIN_VERSION ${ARGN}) - - #try to find qt5 automatically - #for custom installation of qt5, dont use any of these variables - set (QT5_INSTALL_PATH "" CACHE PATH "Path to Qt5 directory which contains lib and include folder") - if (EXISTS "${QT5_INSTALL_PATH}") - set (CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${QT5_INSTALL_PATH}") - set (QT5_INSTALL_PATH_EXISTS TRUE) - endif() - - - - find_package (Qt5Core QUIET) - - #find WINDOWS_SDK to avoid qt error. This must be done BEFORE Qt5Widgets is searched - if (Qt5Core_FOUND AND WIN32) - string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${Qt5Core_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${Qt5Core_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${Qt5Core_VERSION_STRING}") - - if ( (QT_VERSION_MAJOR EQUAL 5) AND (QT_VERSION_MINOR LESS 3 OR ( QT_VERSION_MINOR EQUAL 3 AND QT_VERSION_PATCH EQUAL 0 )) ) # for all Qt version > 5.0.0 and < 5.3.1 - #glu32.lib is needed by qt5 opengl version. it cannot find it by itself so we help qt - #this block has to be executed, before Qt5Gui is searched, otherwise we will end up with the (not so useful) QT5 error message - set(WINDOWS_SDK_LIBS "COULD_NOT_FOUND" CACHE PATH "Path to the latest windows sdk libs which includes glu32.lib. Used by Qt5.") - if (EXISTS "${WINDOWS_SDK_LIBS}\\glu32.lib") - set (CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${WINDOWS_SDK_LIBS}") - elseif(QT5_INSTALL_PATH_EXISTS) #trying to install qt5. notify about missing sdk before the qt message comes - message(FATAL_ERROR "Could not find glu32.lib. This is necessary for QT5 OpenGL version for windows, spleace specify glu32.lib in WINDOWS_SDK_LIB or install Qt version >= 5.3.1") - endif() - endif() - endif(Qt5Core_FOUND AND WIN32) - - find_package (Qt5Gui QUIET) - find_package (Qt5OpenGL QUIET) - - - if (Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5OpenGL_FOUND) - set (QT5_FOUND TRUE) - endif() - - if (QT5_FOUND) - acg_unset_qt_shared_variables(5) - - #set plugin dir - list(GET Qt5Gui_PLUGINS 0 _plugin) - if (_plugin) - get_target_property(_plugin_full ${_plugin} LOCATION) - get_filename_component(_plugin_dir ${_plugin_full} PATH) - set (QT_PLUGINS_DIR "${_plugin_dir}/../" CACHE PATH "Path to the qt plugin directory") - elseif(QT5_INSTALL_PATH_EXISTS) - set (QT_PLUGINS_DIR "${QT5_INSTALL_PATH}/plugins/" CACHE PATH "Path to the qt plugin directory") - elseif() - set (QT_PLUGINS_DIR "QT_PLUGIN_DIR_NOT_FOUND" CACHE PATH "Path to the qt plugin directory") - endif(_plugin) - - #set binary dir for fixupbundle - if(QT5_INSTALL_PATH_EXISTS) - set(_QT_BINARY_DIR "${QT5_INSTALL_PATH}/bin") - else() - get_target_property(_QT_BINARY_DIR ${Qt5Widgets_UIC_EXECUTABLE} LOCATION) - get_filename_component(_QT_BINARY_DIR ${_QT_BINARY_DIR} PATH) - endif(QT5_INSTALL_PATH_EXISTS) - - set (QT_BINARY_DIR "${_QT_BINARY_DIR}" CACHE PATH "Qt5 binary Directory") - mark_as_advanced(QT_BINARY_DIR) - - set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - - include_directories(${Qt5Core_INCLUDE_DIRS}) - include_directories(${Qt5Gui_INCLUDE_DIRS}) - include_directories(${Qt5OpenGL_INCLUDE_DIRS}) - add_definitions(${Qt5Core_DEFINITIONS}) - add_definitions(${Qt5Gui_DEFINITIONS}) - add_definitions(${Qt5OpenGL_DEFINITIONS}) - - if ( NOT MSVC ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") - endif() - - set (QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES} - ${Qt5Gui_LIBRARIES} ${Qt5OpenGL_LIBRARIES}) - - if (MSVC) - set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Core_QTMAIN_LIBRARIES}) - endif() - - #add_definitions(-DQT_NO_OPENGL) - - #adding QT_NO_DEBUG to all release modes. - # Note: for multi generators like msvc you cannot set this definition depending of - # the current build type, because it may change in the future inside the ide and not via cmake - if (MSVC_IDE) - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") - - set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") - set(CMAKE_CXX_FLAGS_MINSITEREL "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") - - set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") - else(MSVC_IDE) - if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - add_definitions(-DQT_NO_DEBUG) - endif() - endif(MSVC_IDE) - - endif () -endmacro () - # unsets the given variable macro (acg_unset var) set (${var} "" CACHE INTERNAL "") @@ -314,14 +165,14 @@ endmacro () # test for OpenMP macro (acg_openmp) if (NOT OPENMP_NOTFOUND) - find_package(OpenMP) - if (OPENMP_FOUND) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") - add_definitions(-DUSE_OPENMP) + find_package(OpenMP) + if (OPENMP_FOUND) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + add_definitions(-DUSE_OPENMP) else () set (OPENMP_NOTFOUND 1) - endif () + endif() endif () endmacro () @@ -380,192 +231,11 @@ macro (acg_drop_templates list) endforeach () endmacro () -# generate moc targets for sources in list -macro (acg_qt4_automoc moc_SRCS) - qt4_get_moc_flags (_moc_INCS) - - set (_matching_FILES ) - foreach (_current_FILE ${ARGN}) - - get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE) - # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. - # here. this is required to make bouic work correctly: - # we need to add generated .cpp files to the sources (to compile them), - # but we cannot let automoc handle them, as the .cpp files don't exist yet when - # cmake is run for the very first time on them -> however the .cpp files might - # exist at a later run. at that time we need to skip them, so that we don't add two - # different rules for the same moc file - get_source_file_property (_skip ${_abs_FILE} SKIP_AUTOMOC) - - if ( NOT _skip AND EXISTS ${_abs_FILE} ) - - file (READ ${_abs_FILE} _contents) - - get_filename_component (_abs_PATH ${_abs_FILE} PATH) - - string (REGEX MATCHALL "Q_OBJECT" _match "${_contents}") - if (_match) - get_filename_component (_basename ${_current_FILE} NAME_WE) - set (_header ${_abs_FILE}) - set (_moc ${CMAKE_CURRENT_BINARY_DIR}/moc_${_basename}.cpp) - - add_custom_command (OUTPUT ${_moc} - COMMAND ${QT_MOC_EXECUTABLE} - ARGS ${_moc_INCS} ${_header} -o ${_moc} - DEPENDS ${_header} - ) - - add_file_dependencies (${_abs_FILE} ${_moc}) - set (${moc_SRCS} ${${moc_SRCS}} ${_moc}) - - endif () - endif () - endforeach () -endmacro () - -# generate moc targets for sources in list -macro (acg_qt5_automoc moc_SRCS) - qt5_get_moc_flags (_moc_INCS) - - list(REMOVE_DUPLICATES _moc_INCS) - - set (_matching_FILES ) - foreach (_current_FILE ${ARGN}) - - get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE) - # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. - # here. this is required to make bouic work correctly: - # we need to add generated .cpp files to the sources (to compile them), - # but we cannot let automoc handle them, as the .cpp files don't exist yet when - # cmake is run for the very first time on them -> however the .cpp files might - # exist at a later run. at that time we need to skip them, so that we don't add two - # different rules for the same moc file - get_source_file_property (_skip ${_abs_FILE} SKIP_AUTOMOC) - - if ( NOT _skip AND EXISTS ${_abs_FILE} ) - - file (READ ${_abs_FILE} _contents) - - get_filename_component (_abs_PATH ${_abs_FILE} PATH) - - string (REGEX MATCHALL "Q_OBJECT" _match "${_contents}") - if (_match) - get_filename_component (_basename ${_current_FILE} NAME_WE) - set (_header ${_abs_FILE}) - set (_moc ${CMAKE_CURRENT_BINARY_DIR}/moc_${_basename}.cpp) - - add_custom_command (OUTPUT ${_moc} - COMMAND ${QT_MOC_EXECUTABLE} - ARGS ${_moc_INCS} ${_header} -o ${_moc} - DEPENDS ${_header} - ) - - add_file_dependencies (${_abs_FILE} ${_moc}) - set (${moc_SRCS} ${${moc_SRCS}} ${_moc}) - - endif () - endif () - endforeach () -endmacro () - -# generate uic targets for sources in list -macro (acg_qt4_autouic uic_SRCS) - - set (_matching_FILES ) - foreach (_current_FILE ${ARGN}) - - get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE) - - if ( EXISTS ${_abs_FILE} ) - - file (READ ${_abs_FILE} _contents) - - get_filename_component (_abs_PATH ${_abs_FILE} PATH) - - get_filename_component (_basename ${_current_FILE} NAME_WE) - string (REGEX REPLACE "Ui$" "" _cbasename ${_basename}) - set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.hh) - set (_header ${_basename}.hh) - set (_source ${_abs_PATH}/${_cbasename}.cc) - - add_custom_command (OUTPUT ${_outfile} - COMMAND ${QT_UIC_EXECUTABLE} - ARGS -o ${_outfile} ${_abs_FILE} - DEPENDS ${_abs_FILE}) - - add_file_dependencies (${_source} ${_outfile}) - set (${uic_SRCS} ${${uic_SRCS}} ${_outfile}) - - endif () - endforeach () -endmacro () - -# generate uic targets for sources in list -macro (acg_qt5_autouic uic_SRCS) - - set (_matching_FILES ) - foreach (_current_FILE ${ARGN}) - - get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE) - - if ( EXISTS ${_abs_FILE} ) - - file (READ ${_abs_FILE} _contents) - - get_filename_component (_abs_PATH ${_abs_FILE} PATH) - - get_filename_component (_basename ${_current_FILE} NAME_WE) - string (REGEX REPLACE "Ui$" "" _cbasename ${_basename}) - set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.hh) - set (_header ${_basename}.hh) - set (_source ${_abs_PATH}/${_cbasename}.cc) - - add_custom_command (OUTPUT ${_outfile} - COMMAND ${Qt5Widgets_UIC_EXECUTABLE} - ARGS -o ${_outfile} ${_abs_FILE} - MAIN_DEPENDENCY ${_abs_FILE} VERBATIM) - - add_file_dependencies (${_source} ${_outfile}) - set (${uic_SRCS} ${${uic_SRCS}} ${_outfile}) - - endif () - endforeach () -endmacro () - -# generate qrc targets for sources in list -macro (acg_qt4_autoqrc qrc_SRCS) - - set (_matching_FILES ) - foreach (_current_FILE ${ARGN}) - - get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE) - - if ( EXISTS ${_abs_FILE} ) - - file (READ ${_abs_FILE} _contents) - - get_filename_component (_abs_PATH ${_abs_FILE} PATH) - - get_filename_component (_basename ${_current_FILE} NAME_WE) - set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${_basename}.cpp) - - add_custom_command (OUTPUT ${_outfile} - COMMAND ${QT_RCC_EXECUTABLE} - ARGS -o ${_outfile} ${_abs_FILE} - DEPENDS ${_abs_FILE}) - - add_file_dependencies (${_source} ${_outfile}) - set (${qrc_SRCS} ${${qrc_SRCS}} ${_outfile}) - - endif () - endforeach () -endmacro () - # get all files in directory, but ignore svn macro (acg_get_files_in_dir ret dir) file (GLOB_RECURSE __files RELATIVE "${dir}" "${dir}/*") foreach (_file ${__files}) - if (NOT _file MATCHES ".*svn.*") + if ( (NOT _file MATCHES ".*svn.*") AND (NOT _file MATCHES ".DS_Store") ) list (APPEND ${ret} "${_file}") endif () endforeach () @@ -600,7 +270,7 @@ function (acg_add_executable _target) # set common target properties defined in common.cmake acg_set_target_props (${_target}) - + if (WIN32 OR (APPLE AND NOT ACG_PROJECT_MACOS_BUNDLE)) add_custom_command (TARGET ${_target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E @@ -656,7 +326,7 @@ function (acg_add_library _target _libtype) copy_if_different $ ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}/$) - add_custom_command (TARGET ${_target} POST_BUILD + add_custom_command (TARGET ${_target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ @@ -671,22 +341,22 @@ function (acg_add_library _target _libtype) $ ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_PLUGINDIR}/$) elseif (${_type} STREQUAL STATIC) - add_custom_command (TARGET ${_target} POST_BUILD + add_custom_command (TARGET ${_target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}/$) - endif() - - - # make an extra copy for windows into the binary directory + endif() + + + # make an extra copy for windows into the binary directory if (${_type} STREQUAL SHARED AND WIN32) add_custom_command (TARGET ${_target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_BINDIR}/$) - endif () + endif () endif( (WIN32 AND MSVC) OR (APPLE AND NOT ACG_PROJECT_MACOS_BUNDLE)) @@ -720,57 +390,3 @@ function (acg_add_library _target _libtype) endfunction () -#generates qt translations -function (acg_add_translations _target _languages _sources) - - string (TOUPPER ${_target} _TARGET) - # generate/use translation files - # run with UPDATE_TRANSLATIONS set to on to build qm files - option (UPDATE_TRANSLATIONS_${_TARGET} "Update source translation *.ts files (WARNING: make clean will delete the source .ts files! Danger!)") - - set (_new_ts_files) - set (_ts_files) - - foreach (lang ${_languages}) - if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/translations/${_target}_${lang}.ts" OR UPDATE_TRANSLATIONS_${_TARGET}) - list (APPEND _new_ts_files "translations/${_target}_${lang}.ts") - else () - list (APPEND _ts_files "translations/${_target}_${lang}.ts") - endif () - endforeach () - - - set (_qm_files) - if ( _new_ts_files ) - qt4_create_translation(_qm_files ${_sources} ${_new_ts_files}) - endif () - - if ( _ts_files ) - qt4_add_translation(_qm_files2 ${_ts_files}) - list (APPEND _qm_files ${_qm_files2}) - endif () - - # create a target for the translation files ( and object files ) - # Use this target, to update only the translations - add_custom_target (translations_target_${_target} DEPENDS ${_qm_files}) - - # Build translations with the application - add_dependencies(${_target} translations_target_${_target} ) - - if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Translations) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Translations ) - endif () - - foreach (_qm ${_qm_files}) - get_filename_component (_qm_name "${_qm}" NAME) - add_custom_command (TARGET translations_target_${_target} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E - copy_if_different - ${_qm} - ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Translations/${_qm_name}) - endforeach () - - if (NOT ACG_PROJECT_MACOS_BUNDLE OR NOT APPLE) - install (FILES ${_qm_files} DESTINATION "${ACG_PROJECT_DATADIR}/Translations") - endif () -endfunction () diff --git a/cmake/ACGQt.cmake b/cmake/ACGQt.cmake new file mode 100644 index 00000000..60949353 --- /dev/null +++ b/cmake/ACGQt.cmake @@ -0,0 +1,396 @@ +#unset cached qt variables which are set by all qt versions. version is the major number of the qt version (e.g. 4 or 5, not 4.8) +macro (acg_unset_qt_shared_variables version) + if (ACG_INTERNAL_QT_LAST_VERSION) + if (NOT ${ACG_INTERNAL_QT_LAST_VERSION} EQUAL ${version}) + unset(QT_BINARY_DIR) + unset(QT_PLUGINS_DIR) + unset(ACG_INTERNAL_QT_LAST_VERSION) + endif() + endif() + set (ACG_INTERNAL_QT_LAST_VERSION "${version}" CACHE INTERNAL "Qt Version, which was used on the last time") +endmacro() + +macro (acg_qt5) + + if(POLICY CMP0020) + # Automatically link Qt executables to qtmain target on Windows + cmake_policy(SET CMP0020 NEW) + endif(POLICY CMP0020) + #if (NOT QT5_FOUND) + + #set (QT_MIN_VERSION ${ARGN}) + + #try to find qt5 automatically + #for custom installation of qt5, dont use any of these variables + set (QT5_INSTALL_PATH "" CACHE PATH "Path to Qt5 directory which contains lib and include folder") + + if (EXISTS "${QT5_INSTALL_PATH}") + set (CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${QT5_INSTALL_PATH}") + set (QT5_INSTALL_PATH_EXISTS TRUE) + endif(EXISTS "${QT5_INSTALL_PATH}") + + set(QT5_FINDER_FLAGS "" CACHE STRING "Flags for the Qt finder e.g. + NO_DEFAULT_PATH if no system installed Qt shall be found") + # compute default search paths + set(SUPPORTED_QT_VERSIONS 5.9 5.8 5.7 5.6) + foreach (suffix gcc_64 clang_64) + foreach(version ${SUPPORTED_QT_VERSIONS}) + list(APPEND QT_DEFAULT_PATH "~/sw/Qt/${version}/${suffix}") + endforeach() + endforeach() + + find_package (Qt5Core PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + if(Qt5Core_FOUND) + + if(Qt5Core_VERSION) # use the new version variable if it is set + set(Qt5Core_VERSION_STRING ${Qt5Core_VERSION}) + endif(Qt5Core_VERSION) + + string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${Qt5Core_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${Qt5Core_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${Qt5Core_VERSION_STRING}") + + find_package (Qt5Widgets QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + find_package (Qt5Gui QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + find_package (Qt5OpenGL QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + find_package (Qt5Network QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + find_package (Qt5Sql QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + find_package (Qt5Script QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + find_package (Qt5ScriptTools QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + find_package (Qt5Xml QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + find_package (Qt5XmlPatterns QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + find_package (Qt5Help QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + find_package (Qt5UiTools QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + find_package (Qt5Svg QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + find_package (Qt5PrintSupport QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + find_package (Qt5Concurrent QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + + #do noot look for Webkit and qt declarative on qt version 5.6 or newer + if(${QT_VERSION_MINOR} LESS 6) + find_package (Qt5Declarative QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + find_package (Qt5WebKit QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + endif(${QT_VERSION_MINOR} LESS 6) + + if (NOT WIN32 AND NOT APPLE) + find_package (Qt5X11Extras QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) + endif () + + if(${QT_VERSION_MINOR} GREATER 5) + if (Qt5Core_FOUND AND Qt5Widgets_FOUND + AND Qt5Gui_FOUND AND Qt5OpenGL_FOUND AND Qt5Network_FOUND + AND Qt5Script_FOUND AND Qt5ScriptTools_FOUND AND Qt5Sql_FOUND + AND Qt5Xml_FOUND AND Qt5XmlPatterns_FOUND AND Qt5Help_FOUND + AND Qt5UiTools_FOUND AND Qt5Concurrent_FOUND + AND Qt5PrintSupport_FOUND) + set (QT5_FOUND TRUE) + endif() + else(${QT_VERSION_MINOR} GREATER 5) + if (Qt5Core_FOUND AND Qt5Declarative_FOUND AND Qt5Widgets_FOUND + AND Qt5Gui_FOUND AND Qt5OpenGL_FOUND AND Qt5Network_FOUND + AND Qt5Script_FOUND AND Qt5ScriptTools_FOUND AND Qt5Sql_FOUND + AND Qt5Xml_FOUND AND Qt5XmlPatterns_FOUND AND Qt5Help_FOUND + AND Qt5WebKit_FOUND AND Qt5UiTools_FOUND AND Qt5Concurrent_FOUND + AND Qt5PrintSupport_FOUND) + set (QT5_FOUND TRUE) + endif() + endif(${QT_VERSION_MINOR} GREATER 5) + endif(Qt5Core_FOUND) + + if (QT5_FOUND) + acg_unset_qt_shared_variables(5) + + #set plugin dir + list(GET Qt5Gui_PLUGINS 0 _plugin) + if (_plugin) + get_target_property(_plugin_full ${_plugin} LOCATION) + get_filename_component(_plugin_dir ${_plugin_full} PATH) + set (QT_PLUGINS_DIR "${_plugin_dir}/../" CACHE PATH "Path to the qt plugin directory") + elseif(QT5_INSTALL_PATH_EXISTS) + set (QT_PLUGINS_DIR "${QT5_INSTALL_PATH}/plugins/" CACHE PATH "Path to the qt plugin directory") + elseif() + set (QT_PLUGINS_DIR "QT_PLUGIN_DIR_NOT_FOUND" CACHE PATH "Path to the qt plugin directory") + endif(_plugin) + + #set binary dir for fixupbundle + if(QT5_INSTALL_PATH_EXISTS) + set(_QT_BINARY_DIR "${QT5_INSTALL_PATH}/bin") + else() + get_target_property(_QT_BINARY_DIR ${Qt5Widgets_UIC_EXECUTABLE} LOCATION) + get_filename_component(_QT_BINARY_DIR ${_QT_BINARY_DIR} PATH) + endif(QT5_INSTALL_PATH_EXISTS) + + set (QT_BINARY_DIR "${_QT_BINARY_DIR}" CACHE PATH "Qt5 binary Directory") + mark_as_advanced(QT_BINARY_DIR) + + set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + include_directories(${Qt5Core_INCLUDE_DIRS}) + include_directories(${Qt5Declarative_INCLUDE_DIRS}) + include_directories(${Qt5Widgets_INCLUDE_DIRS}) + include_directories(${Qt5Gui_INCLUDE_DIRS}) + include_directories(${Qt5OpenGL_INCLUDE_DIRS}) + include_directories(${Qt5Network_INCLUDE_DIRS}) + include_directories(${Qt5Script_INCLUDE_DIRS}) + include_directories(${Qt5ScriptTools_INCLUDE_DIRS}) + include_directories(${Qt5Sql_INCLUDE_DIRS}) + include_directories(${Qt5Xml_INCLUDE_DIRS}) + include_directories(${Qt5XmlPatterns_INCLUDE_DIRS}) + include_directories(${Qt5Help_INCLUDE_DIRS}) + include_directories(${Qt5WebKit_INCLUDE_DIRS}) + include_directories(${Qt5UiTools_INCLUDE_DIRS}) + include_directories(${Qt5Concurrent_INCLUDE_DIRS}) + include_directories(${Qt5PrintSupport_INCLUDE_DIRS}) + add_definitions(${Qt5Core_DEFINITIONS}) + add_definitions(${Qt5Widgets_DEFINITIONS}) + add_definitions(${Qt5Gui_DEFINITIONS}) + add_definitions(${Qt5OpenGL_DEFINITIONS}) + add_definitions(${Qt5Network_DEFINITIONS}) + add_definitions(${Qt5Script_DEFINITIONS}) + add_definitions(${Qt5ScriptTools_DEFINITIONS}) + add_definitions(${Qt5Sql_DEFINITIONS}) + add_definitions(${Qt5Xml_DEFINITIONS}) + add_definitions(${Qt5XmlPatterns_DEFINITIONS}) + add_definitions(${Qt5Help_DEFINITIONS}) + add_definitions(${Qt5WebKit_DEFINITIONS}) + add_definitions(${Qt5UiTools_DEFINITIONS}) + add_definitions(${Qt5Concurrent_DEFINITIONS}) + add_definitions(${Qt5PrintSupport_DEFINITIONS}) + + if (Qt5X11Extras_FOUND) + include_directories(${Qt5X11Extras_INCLUDE_DIRS}) + add_definitions(${Qt5X11Extras_DEFINITIONS}) + endif () + + if ( NOT MSVC ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + endif() + + set (QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Declarative_LIBRARIES} ${Qt5Widgets_LIBRARIES} + ${Qt5Gui_LIBRARIES} ${Qt5OpenGL_LIBRARIES} ${Qt5Network_LIBRARIES} + ${Qt5Script_LIBRARIES} ${Qt5ScriptTools_LIBRARIES} ${Qt5Sql_LIBRARIES} + ${Qt5Xml_LIBRARIES} ${Qt5XmlPatterns_LIBRARIES} ${Qt5Help_LIBRARIES} + ${Qt5WebKit_LIBRARIES} ${Qt5UiTools_LIBRARIES} ${Qt5Concurrent_LIBARIES} + ${Qt5PrintSupport_LIBRARIES}) + + if (Qt5X11Extras_FOUND) + list (APPEND QT_LIBRARIES ${Qt5X11Extras_LIBRARIES}) + endif () + + if (MSVC) + set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Core_QTMAIN_LIBRARIES}) + endif() + + #add_definitions(-DQT_NO_OPENGL) + + #adding QT_NO_DEBUG to all release modes. + # Note: for multi generators like msvc you cannot set this definition depending of + # the current build type, because it may change in the future inside the ide and not via cmake + if (MSVC_IDE) + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") + + set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") + set(CMAKE_CXX_FLAGS_MINSITEREL "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") + + set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") + else(MSVC_IDE) + if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + add_definitions(-DQT_NO_DEBUG) + endif() + endif(MSVC_IDE) + + endif () +endmacro () + +# generate moc targets for sources in list +macro (acg_qt5_automoc moc_SRCS) + qt5_get_moc_flags (_moc_INCS) + + list(REMOVE_DUPLICATES _moc_INCS) + + set (_matching_FILES ) + foreach (_current_FILE ${ARGN}) + + get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE) + # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. + # here. this is required to make bouic work correctly: + # we need to add generated .cpp files to the sources (to compile them), + # but we cannot let automoc handle them, as the .cpp files don't exist yet when + # cmake is run for the very first time on them -> however the .cpp files might + # exist at a later run. at that time we need to skip them, so that we don't add two + # different rules for the same moc file + get_source_file_property (_skip ${_abs_FILE} SKIP_AUTOMOC) + + if ( NOT _skip AND EXISTS ${_abs_FILE} ) + + file (READ ${_abs_FILE} _contents) + + get_filename_component (_abs_PATH ${_abs_FILE} PATH) + + string (REGEX MATCHALL "Q_OBJECT" _match "${_contents}") + if (_match) + get_filename_component (_basename ${_current_FILE} NAME_WE) + set (_header ${_abs_FILE}) + set (_moc ${CMAKE_CURRENT_BINARY_DIR}/moc_${_basename}.cpp) + + add_custom_command (OUTPUT ${_moc} + COMMAND ${QT_MOC_EXECUTABLE} + ARGS ${_moc_INCS} ${_header} -o ${_moc} + DEPENDS ${_header} + ) + + add_file_dependencies (${_abs_FILE} ${_moc}) + set (${moc_SRCS} ${${moc_SRCS}} ${_moc}) + + endif () + endif () + endforeach () +endmacro () + +# generate uic targets for sources in list +macro (acg_qt5_autouic uic_SRCS) + + set (_matching_FILES ) + foreach (_current_FILE ${ARGN}) + + get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE) + + if ( EXISTS ${_abs_FILE} ) + + file (READ ${_abs_FILE} _contents) + + get_filename_component (_abs_PATH ${_abs_FILE} PATH) + + get_filename_component (_basename ${_current_FILE} NAME_WE) + string (REGEX REPLACE "Ui$" "" _cbasename ${_basename}) + set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.hh) + set (_header ${_basename}.hh) + set (_source ${_abs_PATH}/${_cbasename}.cc) + + add_custom_command (OUTPUT ${_outfile} + COMMAND ${Qt5Widgets_UIC_EXECUTABLE} + ARGS -o ${_outfile} ${_abs_FILE} + MAIN_DEPENDENCY ${_abs_FILE} VERBATIM) + + add_file_dependencies (${_source} ${_outfile}) + set (${uic_SRCS} ${${uic_SRCS}} ${_outfile}) + + endif () + endforeach () +endmacro () + +# generate qrc targets for sources in list +macro (acg_qt5_autoqrc qrc_SRCS) + + set (_matching_FILES ) + foreach (_current_FILE ${ARGN}) + + get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE) + + if ( EXISTS ${_abs_FILE} ) + + file (READ ${_abs_FILE} _contents) + + get_filename_component (_abs_PATH ${_abs_FILE} PATH) + + get_filename_component (_basename ${_current_FILE} NAME_WE) + set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${_basename}.cpp) + + qt5_add_resources( ${_outfile} ${_abs_FILE} ) + + add_file_dependencies (${_source} ${_outfile}) + set (${qrc_SRCS} ${${qrc_SRCS}} ${_outfile}) + + endif () + endforeach () +endmacro () + + +#generates qt translations +function (acg_add_translations _target _languages _sources) + + string (TOUPPER ${_target} _TARGET) + # generate/use translation files + # run with UPDATE_TRANSLATIONS set to on to build qm files + option (UPDATE_TRANSLATIONS_${_TARGET} "Update source translation *.ts files (WARNING: make clean will delete the source .ts files! Danger!)") + + set (_new_ts_files) + set (_ts_files) + + foreach (lang ${_languages}) + if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/translations/${_target}_${lang}.ts" OR UPDATE_TRANSLATIONS_${_TARGET}) + list (APPEND _new_ts_files "translations/${_target}_${lang}.ts") + else () + list (APPEND _ts_files "translations/${_target}_${lang}.ts") + endif () + endforeach () + + + set (_qm_files) + if ( _new_ts_files ) + if (QT5_FOUND) + #qt5_create_translation(_qm_files ${_sources} ${_new_ts_files}) + endif () + endif () + + if ( _ts_files ) + if (QT5_FOUND) + #qt5_add_translation(_qm_files2 ${_ts_files}) + endif() + list (APPEND _qm_files ${_qm_files2}) + endif () + + # create a target for the translation files ( and object files ) + # Use this target, to update only the translations + add_custom_target (tr_${_target} DEPENDS ${_qm_files}) + GROUP_PROJECT( tr_${_target} "Translations") + + # Build translations with the application + add_dependencies(${_target} tr_${_target} ) + + if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Translations) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Translations ) + endif () + + foreach (_qm ${_qm_files}) + get_filename_component (_qm_name "${_qm}" NAME) + add_custom_command (TARGET tr_${_target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E + copy_if_different + ${_qm} + ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Translations/${_qm_name}) + endforeach () + + if (NOT ACG_PROJECT_MACOS_BUNDLE OR NOT APPLE) + install (FILES ${_qm_files} DESTINATION "${ACG_PROJECT_DATADIR}/Translations") + endif () +endfunction () + +# Function that writes all generated qch files into one Help.qhcp project file +function (generate_qhp_file files_loc plugin_name) + + set(qhp_file "${files_loc}/${plugin_name}.qhp") + # Read in template file + file(STRINGS "${CMAKE_SOURCE_DIR}/OpenFlipper/Documentation/QtHelpResources/QtHelpProject.qhp" qhp_template) + + # Initialize new project file + file(WRITE ${qhp_file} "") + foreach (_line ${qhp_template}) + string(STRIP ${_line} stripped) + if("${stripped}" STREQUAL "files") + acg_get_files_in_dir (_files ${files_loc}) + foreach (_file ${_files}) + string(REGEX MATCH ".+[.]+((html)|(htm)|(xml))$" fileresult ${_file}) + string(LENGTH "${fileresult}" len) + if(${len} GREATER 0) + file(APPEND ${qhp_file} "${_file}\n") + endif() + endforeach() + else() + string(REGEX REPLACE "plugin" ${plugin} newline ${_line}) + file(APPEND ${qhp_file} "${newline}\n") + endif() + endforeach() +endfunction() + From 290481604923802c91aa1d5fcb022ecb57ac8abc Mon Sep 17 00:00:00 2001 From: schultz Date: Wed, 23 May 2018 14:23:59 +0200 Subject: [PATCH 082/118] removed 32bit builds with apps for VS2017, as Qt does not provide binariews for VS2017 32 bit --- .gitlab-ci.yml | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 62d94510..95d8d1d6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,35 +43,6 @@ cppcheck: artifacts: paths: - cppcheck.log - -VS2017-32-bit-shared-apps: - variables: - BUILD_PLATFORM: "VS2017" - ARCHITECTURE: "x32" - SHARED: "TRUE" - APPS: "ON" - script: "CI\\Windows.bat" - tags: - - VS2017 - - Qt5101 - artifacts: - paths: - - build-release/*.exe - -VS2017-32-bit-static-apps: - variables: - BUILD_PLATFORM: "VS2017" - ARCHITECTURE: "x32" - SHARED: "FALSE" - APPS: "ON" - script: "CI\\Windows.bat" - tags: - - VS2017 - - Qt5101 - artifacts: - paths: - - build-release/*.exe - VS2017-64-bit-shared-apps: variables: From 978327a40c756134d32b9b1951602c10835045df Mon Sep 17 00:00:00 2001 From: schultz Date: Wed, 23 May 2018 14:39:58 +0200 Subject: [PATCH 083/118] use finder for freeglut --- CI/Windows.bat | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/CI/Windows.bat b/CI/Windows.bat index 6173f1fe..fd170598 100644 --- a/CI/Windows.bat +++ b/CI/Windows.bat @@ -89,14 +89,7 @@ IF "%APPS%" == "ON" ( REM Copy the platform plugins subdirectory for the qt plugins required to run the gui apps xcopy /Y %QT_INSTALL_PATH%\plugins\platforms Build\plugins\platforms - - IF "%BUILD_PLATFORM%" == "VS2015" ( - set CMAKE_CONFIGURATION=%QT_BASE_CONFIG% -DGLUT_INCLUDE_DIR="%LIBPATH%\%ARCHITECTURE%\freeglut-3.0.0\include" -DGLUT_glut_LIBRARY="%LIBPATH%\%ARCHITECTURE%\freeglut-3.0.0\lib\freeglut.lib" - - - ) ELSE ( - set CMAKE_CONFIGURATION=%QT_BASE_CONFIG% -DGLUT_INCLUDE_DIR="%LIBPATH%\%ARCHITECTURE%\freeglut-2.8.1\include" -DGLUT_glut_LIBRARY="%LIBPATH%\%ARCHITECTURE%\freeglut-2.8.1\lib\freeglut.lib" - ) + set CMAKE_CONFIGURATION=%QT_BASE_CONFIG%" ) ELSE ( set STRING_APPS=-no-apps set CMAKE_CONFIGURATION= From cccf00d9b143b7265e3ad4bd8d764aabbac1c5e3 Mon Sep 17 00:00:00 2001 From: schultz Date: Wed, 23 May 2018 14:52:50 +0200 Subject: [PATCH 084/118] fixed typo in CI windows.bat --- CI/Windows.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Windows.bat b/CI/Windows.bat index fd170598..201218f3 100644 --- a/CI/Windows.bat +++ b/CI/Windows.bat @@ -89,7 +89,7 @@ IF "%APPS%" == "ON" ( REM Copy the platform plugins subdirectory for the qt plugins required to run the gui apps xcopy /Y %QT_INSTALL_PATH%\plugins\platforms Build\plugins\platforms - set CMAKE_CONFIGURATION=%QT_BASE_CONFIG%" + set CMAKE_CONFIGURATION=%QT_BASE_CONFIG% ) ELSE ( set STRING_APPS=-no-apps set CMAKE_CONFIGURATION= From eecd387727283def82d6bff4fa22100bffa49f1a Mon Sep 17 00:00:00 2001 From: schultz Date: Wed, 23 May 2018 15:07:02 +0200 Subject: [PATCH 085/118] modified scope of GLUT_glut_LIBRARY --- cmake/FindGLUT.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindGLUT.cmake b/cmake/FindGLUT.cmake index faece669..5546069c 100644 --- a/cmake/FindGLUT.cmake +++ b/cmake/FindGLUT.cmake @@ -72,7 +72,7 @@ IF (WIN32) "${VS_SEARCH_PATH}/freeglut-2.8.1/lib" ) - set(GLUT_glut_LIBRARY optimized ${GLUT_release_LIBRARY} debug ${GLUT_debug_LIBRARY}) + set(GLUT_glut_LIBRARY optimized ${GLUT_release_LIBRARY} debug ${GLUT_debug_LIBRARY} CACHE STRING "Path to the glut libraries") ELSE (WIN32) From 9a04fd8b2b25e0484c66cfbb34520176b972ff60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 23 May 2018 16:20:47 +0200 Subject: [PATCH 086/118] Added VS2017 Builds with apps to readme download links [skip-ci] --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 80a4ccae..dd7f78a9 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python | Visual Studio Version: | 2017 | 2015 | 2013 | | -------- | -------- |-------- |-------- | -| 64-Bit shared, with apps | - | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-64-bit-shared-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-64-bit-shared-apps) | +| 64-Bit shared, with apps | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-64-bit-shared-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-64-bit-shared-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-64-bit-shared-apps) | | 32-Bit shared, with apps | - | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-32-bit-shared-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-32-bit-shared-apps) | -| 64-Bit static, with apps | - | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-64-bit-static-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-64-bit-static-apps) | +| 64-Bit static, with apps | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-64-bit-static-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-64-bit-static-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-64-bit-static-apps) | | 32-Bit static, with apps | - | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-32-bit-static-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-32-bit-static-apps) | | 64-Bit shared, no apps | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-64-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-64-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-64-bit-shared-no-apps) | | 32-Bit shared, no apps | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-32-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-32-bit-shared-no-apps) | [Download](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-32-bit-shared-no-apps) | From d0744a426e3dfdeb10a919a7904924ed820eaf80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Wed, 23 May 2018 16:25:23 +0200 Subject: [PATCH 087/118] Fixed wrong version name --- CI/Windows.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Windows.bat b/CI/Windows.bat index f3806e9a..3c6d3cf8 100644 --- a/CI/Windows.bat +++ b/CI/Windows.bat @@ -152,7 +152,7 @@ del *.exe IF %errorlevel% NEQ 0 exit /b %errorlevel% -move OpenMesh-*.exe "OpenMesh-7.0-Git-Master-%CI_BUILD_REF%-%BUILD_PLATFORM%-%STRING_ARCH%%STRING_DLL%%STRING_APPS%.exe" +move OpenMesh-*.exe "OpenMesh-7.1-Git-Master-%CI_BUILD_REF%-%BUILD_PLATFORM%-%STRING_ARCH%%STRING_DLL%%STRING_APPS%.exe" From b98fc15267d2e59ce804153bc121faf6eb1d110f Mon Sep 17 00:00:00 2001 From: Martin Schultz Date: Wed, 23 May 2018 16:37:33 +0200 Subject: [PATCH 088/118] Update .gitlab-ci.yml to use anchors for VS2017x64 definitions --- .gitlab-ci.yml | 71 +++++++++++++++++++------------------------------- 1 file changed, 27 insertions(+), 44 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 95d8d1d6..7202bf35 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,48 +43,45 @@ cppcheck: artifacts: paths: - cppcheck.log - -VS2017-64-bit-shared-apps: + +.VS2017_64_TEMPLATE: &VS2017_x64 variables: BUILD_PLATFORM: "VS2017" ARCHITECTURE: "x64" - SHARED: "TRUE" - APPS: "ON" - script: "CI\\Windows.bat" - tags: - - VS2017 - - Qt5101 - artifacts: - paths: - - build-release/*.exe - -VS2017-64-bit-static-apps: - variables: - BUILD_PLATFORM: "VS2017" - ARCHITECTURE: "x64" - SHARED: "FALSE" - APPS: "ON" - script: "CI\\Windows.bat" - tags: - - VS2017 - - Qt5101 + script: "CI\Windows.bat" artifacts: paths: - build-release/*.exe + tags: + - VS2017 + - Qt5101 + +VS2017-64-bit-shared-apps: + variables: + SHARED: "TRUE" + APPS: "ON" + <<: *VS2017_x64 + + +VS2017-64-bit-static-apps: + variables: + SHARED: "FALSE" + APPS: "ON" + <<: *VS2017_x64 VS2017-64-bit-shared-no-apps: variables: - BUILD_PLATFORM: "VS2017" - ARCHITECTURE: "x64" SHARED: "TRUE" APPS: "OFF" - script: "CI\\Windows.bat" - tags: - - VS2017 - artifacts: - paths: - - build-release/*.exe + <<: *VS2017_x64 + + +VS2017-64-bit-static-no-apps: + variables: + SHARED: "FALSE" + APPS: "OFF" + <<: *VS2017_x64 VS2017-32-bit-shared-no-apps: @@ -99,20 +96,6 @@ VS2017-32-bit-shared-no-apps: artifacts: paths: - build-release/*.exe - - -VS2017-64-bit-static-no-apps: - variables: - BUILD_PLATFORM: "VS2017" - ARCHITECTURE: "x64" - SHARED: "FALSE" - APPS: "OFF" - script: "CI\\Windows.bat" - tags: - - VS2017 - artifacts: - paths: - - build-release/*.exe VS2017-32-bit-static-no-apps: From b7e8f0d9b47443a5b8a21c347a54bc13da466b07 Mon Sep 17 00:00:00 2001 From: Martin Schultz Date: Wed, 23 May 2018 16:38:06 +0200 Subject: [PATCH 089/118] Update .gitlab-ci.yml typo --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7202bf35..06033921 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,7 +48,7 @@ cppcheck: variables: BUILD_PLATFORM: "VS2017" ARCHITECTURE: "x64" - script: "CI\Windows.bat" + script: "CI\\Windows.bat" artifacts: paths: - build-release/*.exe From d7fc167f0cd9e1aae47b6e00eb75c9c4d8b1bbd9 Mon Sep 17 00:00:00 2001 From: Martin Schultz Date: Wed, 23 May 2018 16:42:40 +0200 Subject: [PATCH 090/118] Update .gitlab-ci.yml --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 06033921..9cc5e15c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -60,28 +60,28 @@ VS2017-64-bit-shared-apps: variables: SHARED: "TRUE" APPS: "ON" - <<: *VS2017_x64 + <<: *VS2017_x64 VS2017-64-bit-static-apps: variables: SHARED: "FALSE" APPS: "ON" - <<: *VS2017_x64 + <<: *VS2017_x64 VS2017-64-bit-shared-no-apps: variables: SHARED: "TRUE" APPS: "OFF" - <<: *VS2017_x64 + <<: *VS2017_x64 VS2017-64-bit-static-no-apps: variables: SHARED: "FALSE" APPS: "OFF" - <<: *VS2017_x64 + <<: *VS2017_x64 VS2017-32-bit-shared-no-apps: From 12fb6d7ee9fdec87d81f7443b0884f8269bfb27a Mon Sep 17 00:00:00 2001 From: Martin Schultz Date: Wed, 23 May 2018 17:16:12 +0200 Subject: [PATCH 091/118] Update .gitlab-ci.yml to use anchors for all VisualStudio jobs and the linux tags. * reduces filesizes and improves maintainability --- .gitlab-ci.yml | 404 +++++++++++++++++++------------------------------ 1 file changed, 156 insertions(+), 248 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9cc5e15c..6ef81b27 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,22 +1,120 @@ -gcc-c++11: - script: "CI/ci-linux.sh gcc C++11" +### Templates for common job definitions ### +.LINUX_TAG: &LINUX_TAG tags: - Linux +### VS2017 ### + +.VS2017_64_TEMPLATE: &VS2017_x64 + variables: + BUILD_PLATFORM: "VS2017" + ARCHITECTURE: "x64" + script: "CI\\Windows.bat" + artifacts: + paths: + - build-release/*.exe + tags: + - VS2017 + - Qt5101 + +.VS2017_32_TEMPLATE: &VS2017_x32 + variables: + BUILD_PLATFORM: "VS2017" + ARCHITECTURE: "x32" + script: "CI\\Windows.bat" + tags: + - VS2017 + artifacts: + paths: + - build-release/*.exe + +### VS2015 ### + +.VS2015_64_TEMPLATE: &VS2015_x64 + variables: + BUILD_PLATFORM: "VS2015" + ARCHITECTURE: "x64" + script: "CI\\Windows.bat" + tags: + - VS2015 + artifacts: + paths: + - build-release/*.exe + +.VS2015_32_TEMPLATE: &VS2015_x32 + variables: + BUILD_PLATFORM: "VS2015" + ARCHITECTURE: "x32" + script: "CI\\Windows.bat" + tags: + - VS2015 + artifacts: + paths: + - build-release/*.exe + +### VS2013 ### + +.VS2013_64_TEMPLATE: &VS2013_x64 + variables: + BUILD_PLATFORM: "VS2013" + ARCHITECTURE: "x64" + script: "CI\\Windows.bat" + tags: + - VS2013 + artifacts: + paths: + - build-release/*.exe + +.VS2013_32_TEMPLATE: &VS2013_x32 + variables: + BUILD_PLATFORM: "VS2013" + ARCHITECTURE: "x32" + script: "CI\\Windows.bat" + tags: + - VS2013 + artifacts: + paths: + - build-release/*.exe + +### Linker and App configurations for VS ### + +.STATIC_NO_APPS: &STATIC_NO_APPS + variables: + SHARED: "FALSE" + APPS: "OFF" + +.STATIC_APPS: &STATIC_APPS + variables: + SHARED: "FLASE" + APPS: "ON" + +.SHARED_NO_APPS: &SHARED_NO_APPS + variables: + SHARED: "TRUE" + APPS: "OFF" + +.SHARED_APPS: &SHARED_APPS + variables: + SHARED: "TRUE" + APPS: "ON" + +### actual job definitions ### + +gcc-c++11: + script: "CI/ci-linux.sh gcc C++11" + <<: *LINUX_TAG + clang-c++11: script: "CI/ci-linux.sh clang C++11" - tags: - - Linux + <<: *LINUX_TAG gcc-c++14: script: "CI/ci-linux.sh gcc C++14" - tags: - - Linux + <<: *LINUX_TAG clang-c++14: script: "CI/ci-linux.sh clang C++14" - tags: - - Linux + <<: *LINUX_TAG macos-c++11: script: "CI/ci-mac.sh C++11" @@ -44,283 +142,93 @@ cppcheck: paths: - cppcheck.log -.VS2017_64_TEMPLATE: &VS2017_x64 - variables: - BUILD_PLATFORM: "VS2017" - ARCHITECTURE: "x64" - script: "CI\\Windows.bat" - artifacts: - paths: - - build-release/*.exe - tags: - - VS2017 - - Qt5101 - VS2017-64-bit-shared-apps: - variables: - SHARED: "TRUE" - APPS: "ON" + variables: *SHARED_APPS <<: *VS2017_x64 - VS2017-64-bit-static-apps: - variables: - SHARED: "FALSE" - APPS: "ON" + variables: *STATIC_APPS <<: *VS2017_x64 - VS2017-64-bit-shared-no-apps: - variables: - SHARED: "TRUE" - APPS: "OFF" + variables: *SHARED_NO_APPS <<: *VS2017_x64 - VS2017-64-bit-static-no-apps: - variables: - SHARED: "FALSE" - APPS: "OFF" + variables: *STATIC_NO_APPS <<: *VS2017_x64 - VS2017-32-bit-shared-no-apps: - variables: - BUILD_PLATFORM: "VS2017" - ARCHITECTURE: "x32" - SHARED: "TRUE" - APPS: "OFF" - script: "CI\\Windows.bat" - tags: - - VS2017 - artifacts: - paths: - - build-release/*.exe - + variables: *SHARED_NO_APPS + <<: *VS2017_x32 VS2017-32-bit-static-no-apps: - variables: - BUILD_PLATFORM: "VS2017" - ARCHITECTURE: "x32" - SHARED: "FALSE" - APPS: "OFF" - script: "CI\\Windows.bat" - tags: - - VS2017 - artifacts: - paths: - - build-release/*.exe + variables: *STATIC_NO_APPS + <<: *VS2017_x32 VS2015-64-bit-shared-apps: - variables: - BUILD_PLATFORM: "VS2015" - ARCHITECTURE: "x64" - SHARED: "TRUE" - APPS: "ON" - script: "CI\\Windows.bat" - tags: - - VS2015 - artifacts: - paths: - - build-release/*.exe - - + variables: *SHARED_APPS + <<: *VS2015_x64 + VS2015-64-bit-shared-no-apps: - variables: - BUILD_PLATFORM: "VS2015" - ARCHITECTURE: "x64" - SHARED: "TRUE" - APPS: "OFF" - script: "CI\\Windows.bat" - tags: - - VS2015 - artifacts: - paths: - - build-release/*.exe + variables: *SHARED_NO_APPS + <<: *VS2015_x64 -VS2015-32-bit-shared-apps: - variables: - BUILD_PLATFORM: "VS2015" - ARCHITECTURE: "x32" - SHARED: "TRUE" - APPS: "ON" - script: "CI\\Windows.bat" - tags: - - VS2015 - artifacts: - paths: - - build-release/*.exe - -VS2015-32-bit-shared-no-apps: - variables: - BUILD_PLATFORM: "VS2015" - ARCHITECTURE: "x32" - SHARED: "TRUE" - APPS: "OFF" - script: "CI\\Windows.bat" - tags: - - VS2015 - artifacts: - paths: - - build-release/*.exe - VS2015-64-bit-static-apps: - variables: - BUILD_PLATFORM: "VS2015" - ARCHITECTURE: "x64" - SHARED: "FALSE" - APPS: "ON" - script: "CI\\Windows.bat" - tags: - - VS2015 - artifacts: - paths: - - build-release/*.exe + variables: *STATIC_APPS + <<: *VS2015_x64 VS2015-64-bit-static-no-apps: - variables: - BUILD_PLATFORM: "VS2015" - ARCHITECTURE: "x64" - SHARED: "FALSE" - APPS: "OFF" - script: "CI\\Windows.bat" - tags: - - VS2015 - artifacts: - paths: - - build-release/*.exe + variables: *STATIC_NO_APPS + <<: *VS2015_x64 + +VS2015-32-bit-shared-apps: + variables: *SHARED_APPS + <<: *VS2015_x32 + +VS2015-32-bit-shared-no-apps: + variables: *SHARED_NO_APPS + <<: *VS2015_x32 VS2015-32-bit-static-apps: - variables: - BUILD_PLATFORM: "VS2015" - ARCHITECTURE: "x32" - SHARED: "FALSE" - APPS: "ON" - script: "CI\\Windows.bat" - tags: - - VS2015 - artifacts: - paths: - - build-release/*.exe + variables: *STATIC_APPS + <<: *VS2015_x32 VS2015-32-bit-static-no-apps: - variables: - BUILD_PLATFORM: "VS2015" - ARCHITECTURE: "x32" - SHARED: "FALSE" - APPS: "OFF" - script: "CI\\Windows.bat" - tags: - - VS2015 - artifacts: - paths: - - build-release/*.exe - - - + variables: *STATIC_NO_APPS + <<: *VS2015_x32 + VS2013-64-bit-shared-apps: - variables: - BUILD_PLATFORM: "VS2013" - ARCHITECTURE: "x64" - SHARED: "TRUE" - APPS: "ON" - script: "CI\\Windows.bat" - tags: - - VS2013 - artifacts: - paths: - - build-release/*.exe + variables: *SHARED_APPS + <<: *VS2013_x64 VS2013-64-bit-shared-no-apps: - variables: - BUILD_PLATFORM: "VS2013" - ARCHITECTURE: "x64" - SHARED: "TRUE" - APPS: "OFF" - script: "CI\\Windows.bat" - tags: - - VS2013 - artifacts: - paths: - - build-release/*.exe + variables: *SHARED_NO_APPS + <<: *VS2013_x64 -VS2013-32-bit-shared-apps: - variables: - BUILD_PLATFORM: "VS2013" - ARCHITECTURE: "x32" - SHARED: "TRUE" - APPS: "ON" - script: "CI\\Windows.bat" - tags: - - VS2013 - artifacts: - paths: - - build-release/*.exe - -VS2013-32-bit-shared-no-apps: - variables: - BUILD_PLATFORM: "VS2013" - ARCHITECTURE: "x32" - SHARED: "TRUE" - APPS: "OFF" - script: "CI\\Windows.bat" - tags: - - VS2013 - artifacts: - paths: - - build-release/*.exe - VS2013-64-bit-static-apps: - variables: - BUILD_PLATFORM: "VS2013" - ARCHITECTURE: "x64" - SHARED: "FALSE" - APPS: "ON" - script: "CI\\Windows.bat" - tags: - - VS2013 - artifacts: - paths: - - build-release/*.exe + variables: *STATIC_APPS + <<: *VS2013_x64 VS2013-64-bit-static-no-apps: - variables: - BUILD_PLATFORM: "VS2013" - ARCHITECTURE: "x64" - SHARED: "FALSE" - APPS: "OFF" - script: "CI\\Windows.bat" - tags: - - VS2013 - artifacts: - paths: - - build-release/*.exe + variables: *STATIC_NO_APPS + <<: *VS2013_x64 + +VS2013-32-bit-shared-apps: + variables: *SHARED_APPS + <<: *VS2013_x32 + +VS2013-32-bit-shared-no-apps: + variables: *SHARED_NO_APPS + <<: *VS2013_x32 VS2013-32-bit-static-apps: - variables: - BUILD_PLATFORM: "VS2013" - ARCHITECTURE: "x32" - SHARED: "FALSE" - APPS: "ON" - script: "CI\\Windows.bat" - tags: - - VS2013 - artifacts: - paths: - - build-release/*.exe + variables: *STATIC_APPS + <<: *VS2013_x32 VS2013-32-bit-static-no-apps: - variables: - BUILD_PLATFORM: "VS2013" - ARCHITECTURE: "x32" - SHARED: "FALSE" - APPS: "OFF" - script: "CI\\Windows.bat" - tags: - - VS2013 - artifacts: - paths: - - build-release/*.exe + variables: *STATIC_NO_APPS + <<: *VS2013_x32 Doc-publish: only: From 82819182b2f341fe1951e46201258ae19c167a62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 24 May 2018 08:37:46 +0200 Subject: [PATCH 092/118] Added debug output --- CI/Windows.bat | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CI/Windows.bat b/CI/Windows.bat index 3c6d3cf8..38c0b8ab 100644 --- a/CI/Windows.bat +++ b/CI/Windows.bat @@ -95,6 +95,19 @@ IF "%APPS%" == "ON" ( set CMAKE_CONFIGURATION= ) +ECHO "Building with :" +ECHO "ARCHITECTURE : %ARCHITECTURE%" +ECHO "BUILD_PLATFORM : %BUILD_PLATFORM%" +ECHO "GTESTVERSION : %GTESTVERSION%" +ECHO "GENERATOR : %GENERATOR%" +ECHO "VS_PATH : %VS_PATH%" +ECHO "LIBPATH : %LIBPATH%" +ECHO "APPS : %APPS%" +ECHO "SHARED : %SHARED%" +ECHO "QT_INSTALL_PATH : %QT_INSTALL_PATH%" +ECHO "CMAKE_CONFIGURATION : %CMAKE_CONFIGURATION%" + + "C:\Program Files\CMake\bin\cmake.exe" -DGTEST_PREFIX="%LIBPATH%\%ARCHITECTURE%\%GTESTVERSION%" -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=Release -DBUILD_APPS=%APPS% -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DCMAKE_WINDOWS_LIBS_DIR="e:\libs" -DOPENMESH_BUILD_SHARED=%SHARED% %CMAKE_CONFIGURATION% .. From 3b61fd197ad3f0e5be976ead1c7fb724fd317c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 24 May 2018 08:53:49 +0200 Subject: [PATCH 093/118] Revert "Merge branch 'featureCIYamlAnchors' into 'master'" This reverts commit c091dd11d8ba2e0a8f534dd896ccff1977da526f, reversing changes made to 9a04fd8b2b25e0484c66cfbb34520176b972ff60. --- .gitlab-ci.yml | 435 +++++++++++++++++++++++++++++++------------------ 1 file changed, 272 insertions(+), 163 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6ef81b27..95d8d1d6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,120 +1,22 @@ -### Templates for common job definitions ### -.LINUX_TAG: &LINUX_TAG +gcc-c++11: + script: "CI/ci-linux.sh gcc C++11" tags: - Linux -### VS2017 ### - -.VS2017_64_TEMPLATE: &VS2017_x64 - variables: - BUILD_PLATFORM: "VS2017" - ARCHITECTURE: "x64" - script: "CI\\Windows.bat" - artifacts: - paths: - - build-release/*.exe - tags: - - VS2017 - - Qt5101 - -.VS2017_32_TEMPLATE: &VS2017_x32 - variables: - BUILD_PLATFORM: "VS2017" - ARCHITECTURE: "x32" - script: "CI\\Windows.bat" - tags: - - VS2017 - artifacts: - paths: - - build-release/*.exe - -### VS2015 ### - -.VS2015_64_TEMPLATE: &VS2015_x64 - variables: - BUILD_PLATFORM: "VS2015" - ARCHITECTURE: "x64" - script: "CI\\Windows.bat" - tags: - - VS2015 - artifacts: - paths: - - build-release/*.exe - -.VS2015_32_TEMPLATE: &VS2015_x32 - variables: - BUILD_PLATFORM: "VS2015" - ARCHITECTURE: "x32" - script: "CI\\Windows.bat" - tags: - - VS2015 - artifacts: - paths: - - build-release/*.exe - -### VS2013 ### - -.VS2013_64_TEMPLATE: &VS2013_x64 - variables: - BUILD_PLATFORM: "VS2013" - ARCHITECTURE: "x64" - script: "CI\\Windows.bat" - tags: - - VS2013 - artifacts: - paths: - - build-release/*.exe - -.VS2013_32_TEMPLATE: &VS2013_x32 - variables: - BUILD_PLATFORM: "VS2013" - ARCHITECTURE: "x32" - script: "CI\\Windows.bat" - tags: - - VS2013 - artifacts: - paths: - - build-release/*.exe - -### Linker and App configurations for VS ### - -.STATIC_NO_APPS: &STATIC_NO_APPS - variables: - SHARED: "FALSE" - APPS: "OFF" - -.STATIC_APPS: &STATIC_APPS - variables: - SHARED: "FLASE" - APPS: "ON" - -.SHARED_NO_APPS: &SHARED_NO_APPS - variables: - SHARED: "TRUE" - APPS: "OFF" - -.SHARED_APPS: &SHARED_APPS - variables: - SHARED: "TRUE" - APPS: "ON" - -### actual job definitions ### - -gcc-c++11: - script: "CI/ci-linux.sh gcc C++11" - <<: *LINUX_TAG - clang-c++11: script: "CI/ci-linux.sh clang C++11" - <<: *LINUX_TAG + tags: + - Linux gcc-c++14: script: "CI/ci-linux.sh gcc C++14" - <<: *LINUX_TAG + tags: + - Linux clang-c++14: script: "CI/ci-linux.sh clang C++14" - <<: *LINUX_TAG + tags: + - Linux macos-c++11: script: "CI/ci-mac.sh C++11" @@ -141,94 +43,301 @@ cppcheck: artifacts: paths: - cppcheck.log - + VS2017-64-bit-shared-apps: - variables: *SHARED_APPS - <<: *VS2017_x64 - + variables: + BUILD_PLATFORM: "VS2017" + ARCHITECTURE: "x64" + SHARED: "TRUE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2017 + - Qt5101 + artifacts: + paths: + - build-release/*.exe + VS2017-64-bit-static-apps: - variables: *STATIC_APPS - <<: *VS2017_x64 + variables: + BUILD_PLATFORM: "VS2017" + ARCHITECTURE: "x64" + SHARED: "FALSE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2017 + - Qt5101 + artifacts: + paths: + - build-release/*.exe + VS2017-64-bit-shared-no-apps: - variables: *SHARED_NO_APPS - <<: *VS2017_x64 + variables: + BUILD_PLATFORM: "VS2017" + ARCHITECTURE: "x64" + SHARED: "TRUE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2017 + artifacts: + paths: + - build-release/*.exe -VS2017-64-bit-static-no-apps: - variables: *STATIC_NO_APPS - <<: *VS2017_x64 VS2017-32-bit-shared-no-apps: - variables: *SHARED_NO_APPS - <<: *VS2017_x32 + variables: + BUILD_PLATFORM: "VS2017" + ARCHITECTURE: "x32" + SHARED: "TRUE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2017 + artifacts: + paths: + - build-release/*.exe + + +VS2017-64-bit-static-no-apps: + variables: + BUILD_PLATFORM: "VS2017" + ARCHITECTURE: "x64" + SHARED: "FALSE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2017 + artifacts: + paths: + - build-release/*.exe + VS2017-32-bit-static-no-apps: - variables: *STATIC_NO_APPS - <<: *VS2017_x32 + variables: + BUILD_PLATFORM: "VS2017" + ARCHITECTURE: "x32" + SHARED: "FALSE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2017 + artifacts: + paths: + - build-release/*.exe VS2015-64-bit-shared-apps: - variables: *SHARED_APPS - <<: *VS2015_x64 - + variables: + BUILD_PLATFORM: "VS2015" + ARCHITECTURE: "x64" + SHARED: "TRUE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2015 + artifacts: + paths: + - build-release/*.exe + + VS2015-64-bit-shared-no-apps: - variables: *SHARED_NO_APPS - <<: *VS2015_x64 - -VS2015-64-bit-static-apps: - variables: *STATIC_APPS - <<: *VS2015_x64 - -VS2015-64-bit-static-no-apps: - variables: *STATIC_NO_APPS - <<: *VS2015_x64 + variables: + BUILD_PLATFORM: "VS2015" + ARCHITECTURE: "x64" + SHARED: "TRUE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2015 + artifacts: + paths: + - build-release/*.exe VS2015-32-bit-shared-apps: - variables: *SHARED_APPS - <<: *VS2015_x32 + variables: + BUILD_PLATFORM: "VS2015" + ARCHITECTURE: "x32" + SHARED: "TRUE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2015 + artifacts: + paths: + - build-release/*.exe VS2015-32-bit-shared-no-apps: - variables: *SHARED_NO_APPS - <<: *VS2015_x32 + variables: + BUILD_PLATFORM: "VS2015" + ARCHITECTURE: "x32" + SHARED: "TRUE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2015 + artifacts: + paths: + - build-release/*.exe + +VS2015-64-bit-static-apps: + variables: + BUILD_PLATFORM: "VS2015" + ARCHITECTURE: "x64" + SHARED: "FALSE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2015 + artifacts: + paths: + - build-release/*.exe + +VS2015-64-bit-static-no-apps: + variables: + BUILD_PLATFORM: "VS2015" + ARCHITECTURE: "x64" + SHARED: "FALSE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2015 + artifacts: + paths: + - build-release/*.exe VS2015-32-bit-static-apps: - variables: *STATIC_APPS - <<: *VS2015_x32 + variables: + BUILD_PLATFORM: "VS2015" + ARCHITECTURE: "x32" + SHARED: "FALSE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2015 + artifacts: + paths: + - build-release/*.exe VS2015-32-bit-static-no-apps: - variables: *STATIC_NO_APPS - <<: *VS2015_x32 - + variables: + BUILD_PLATFORM: "VS2015" + ARCHITECTURE: "x32" + SHARED: "FALSE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2015 + artifacts: + paths: + - build-release/*.exe + + + VS2013-64-bit-shared-apps: - variables: *SHARED_APPS - <<: *VS2013_x64 + variables: + BUILD_PLATFORM: "VS2013" + ARCHITECTURE: "x64" + SHARED: "TRUE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2013 + artifacts: + paths: + - build-release/*.exe VS2013-64-bit-shared-no-apps: - variables: *SHARED_NO_APPS - <<: *VS2013_x64 - -VS2013-64-bit-static-apps: - variables: *STATIC_APPS - <<: *VS2013_x64 - -VS2013-64-bit-static-no-apps: - variables: *STATIC_NO_APPS - <<: *VS2013_x64 + variables: + BUILD_PLATFORM: "VS2013" + ARCHITECTURE: "x64" + SHARED: "TRUE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2013 + artifacts: + paths: + - build-release/*.exe VS2013-32-bit-shared-apps: - variables: *SHARED_APPS - <<: *VS2013_x32 + variables: + BUILD_PLATFORM: "VS2013" + ARCHITECTURE: "x32" + SHARED: "TRUE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2013 + artifacts: + paths: + - build-release/*.exe VS2013-32-bit-shared-no-apps: - variables: *SHARED_NO_APPS - <<: *VS2013_x32 + variables: + BUILD_PLATFORM: "VS2013" + ARCHITECTURE: "x32" + SHARED: "TRUE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2013 + artifacts: + paths: + - build-release/*.exe + +VS2013-64-bit-static-apps: + variables: + BUILD_PLATFORM: "VS2013" + ARCHITECTURE: "x64" + SHARED: "FALSE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2013 + artifacts: + paths: + - build-release/*.exe + +VS2013-64-bit-static-no-apps: + variables: + BUILD_PLATFORM: "VS2013" + ARCHITECTURE: "x64" + SHARED: "FALSE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2013 + artifacts: + paths: + - build-release/*.exe VS2013-32-bit-static-apps: - variables: *STATIC_APPS - <<: *VS2013_x32 + variables: + BUILD_PLATFORM: "VS2013" + ARCHITECTURE: "x32" + SHARED: "FALSE" + APPS: "ON" + script: "CI\\Windows.bat" + tags: + - VS2013 + artifacts: + paths: + - build-release/*.exe VS2013-32-bit-static-no-apps: - variables: *STATIC_NO_APPS - <<: *VS2013_x32 + variables: + BUILD_PLATFORM: "VS2013" + ARCHITECTURE: "x32" + SHARED: "FALSE" + APPS: "OFF" + script: "CI\\Windows.bat" + tags: + - VS2013 + artifacts: + paths: + - build-release/*.exe Doc-publish: only: From 449252a4238ec57d9abddcb10e7337b8924be49c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 24 May 2018 08:56:24 +0200 Subject: [PATCH 094/118] Highlight debug output --- CI/Windows.bat | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CI/Windows.bat b/CI/Windows.bat index 38c0b8ab..4460e6fe 100644 --- a/CI/Windows.bat +++ b/CI/Windows.bat @@ -95,6 +95,8 @@ IF "%APPS%" == "ON" ( set CMAKE_CONFIGURATION= ) +ECHO "=============================================================" +ECHO "=============================================================" ECHO "Building with :" ECHO "ARCHITECTURE : %ARCHITECTURE%" ECHO "BUILD_PLATFORM : %BUILD_PLATFORM%" @@ -106,6 +108,8 @@ ECHO "APPS : %APPS%" ECHO "SHARED : %SHARED%" ECHO "QT_INSTALL_PATH : %QT_INSTALL_PATH%" ECHO "CMAKE_CONFIGURATION : %CMAKE_CONFIGURATION%" +ECHO "=============================================================" +ECHO "=============================================================" From 22d3a85d84de1721e59d8d2e6a2aeef7480e705f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 24 May 2018 11:55:09 +0200 Subject: [PATCH 095/118] Update README.md [skib-ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd7f78a9..debd1f74 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# OpenMesh, 7.0 +# OpenMesh, 7.1 [![](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/badges/master/pipeline.svg)](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/commits/master) From 24a1eafc9a25f9d0d895e1db8aca6acad379a7a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 07:42:01 +0200 Subject: [PATCH 096/118] Fixed slow OBJ reader (Thanks to Etienne Danvoye for the patch) Updated changelog --- Doc/changelog.docu | 9 ++++++++- src/OpenMesh/Core/IO/reader/OBJReader.cc | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 88dc44a5..a76d5a96 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -9,10 +9,17 @@ 7.1 (?/?/?) +b>IO +
      +
    • Fixed slow OBJ reader (Thanks to Etienne Danvoye for the patch)
    • +
    -General + +Build System
    • Remove old qmake project files. Unmaintained for a very long time
    • +
    • Replaced Qt finders
    • +
    • Added VS 2017 to CI builds
    diff --git a/src/OpenMesh/Core/IO/reader/OBJReader.cc b/src/OpenMesh/Core/IO/reader/OBJReader.cc index 4128b231..6be24e0f 100644 --- a/src/OpenMesh/Core/IO/reader/OBJReader.cc +++ b/src/OpenMesh/Core/IO/reader/OBJReader.cc @@ -540,6 +540,7 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt) vhandles.clear(); face_texcoords.clear(); + face_texcoords3d.clear(); // read full line after detecting a face std::string faceLine; From 2e147e07b3da4d6630d24acb3a60b656640c7fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 09:16:12 +0200 Subject: [PATCH 097/118] Updated Build instructions [skip-ci] --- Doc/compiling.docu | 163 +++++++++++++++++++++++++++++++++++++++++++++ Doc/misc.docu | 163 --------------------------------------------- 2 files changed, 163 insertions(+), 163 deletions(-) create mode 100644 Doc/compiling.docu diff --git a/Doc/compiling.docu b/Doc/compiling.docu new file mode 100644 index 00000000..5e7d7b33 --- /dev/null +++ b/Doc/compiling.docu @@ -0,0 +1,163 @@ +//----------------------------------------------------------------------------- + +/** \page compiling Compiling OpenMesh + +\section compilers Tested compilers + +%OpenMesh has been successfully tested for the following operating +systems / compilers. This is only a list of tested compilers. +More might be supported but are not tested. Make sure that your compiler +supports at least C++11 + + + + + + + + + + +
    Linux +gcc >= 4.8.x
    +clang >= 3.3
    +
    Windows +Microsoft Visual Studio 2013
    +Microsoft Visual Studio 2015
    +Microsoft Visual Studio 2017
    +
    Tested MacOS X Compilers +XCode
    +
    + +\section req_libs Required libraries (Only if you want to build the included Apps) + +Install the following external libraries / frameworks if you want to use the included Applications:

    + + +
    Qt5https://www.qt.io/download

    + +\section build_systems Chosing build system + +%OpenMesh can be built using the cmake build system. +
    +
    + +\section sec_compiling_unix Unix + +\subsection linux_using_cmake Compiling OpenMesh using CMake + +In order to compile %OpenMesh, create a directory named e.g. "build" in +OpenMesh's root directory. Change to the newly created directory and type +

    + +cmake ..            ## Generates the appropriate Makefiles
    +make                ## Builds the project
    +

    + +\warning If your compiler does not support c++11 natively, you might have to enable it by changing the cmake call to:
    + cmake .. -DCMAKE_CXX_FLAGS=-std=c++98 + +You can choose the build type by using cmake with the flag
    +-DCMAKE_BUILD_TYPE=(Debug|Release) The default is: Release
    + +Other flags are:
    +-DBUILD_APPS=OFF to disable build of applications and
    +-DCMAKE_INSTALL_PREFIX=<path> to specify the install path.
    + +When calling make install cmake will install %OpenMesh into this +directory using the subdirectories lib/include/bin. + +CMake builds both shared and static under Linux. + +Everything will then be build in the Build subdirectory containing the libraries in lib and the binaries in bin. + + +There are some additional targets:
    +doc: Builds the Documentation
    +doc-install: Builds the Documentation and installs it
    +
    +\note When you link against the static libraries of OpenMesh and get the error "can not be used when making a +shared object; recompile with -fPIC" you need to add "-fPIC" to the CMAKE_CXX_FLAGS. (This is usually added automatically) + + + + + + + + +\section sec_compiling_windows Windows + +\subsection windows_using_cmake Compiling OpenMesh using CMake + +Building OpenMesh on Windows requires cmake to generate the project files for Visual Studio. + + + +
      +
    • Get Visual Studio ( 2013-2017 )
    • +
    • Extract %OpenMesh source code.
    • +
    • Get all required libraries and install them ( including headers! ).
    • +
    • Download and install cmake: www.cmake.org.
    • +
    • Start the cmake gui and open the %OpenMesh toplevel directory as source directory
    • +
    • Choose a build directory (e.g. create a directory called "build" in OpenMesh's root folder)
    • +
    • Click on configure .... If any libraries are left unconfigured, you can adjust the path manually. Rerun configure until everything is configured correctly.
      + Attention: Some build variables are only visible in advanced view mode. Select Visual Studio 9 (2008), Visual Studio 10(2010), Visual Studio 11 (2012), Visual Studio 12 (2013) (Depending on your version) as + generator.
    • +
    • Click generate to create the visual studio project files
    • +
    • You can now find a Visual Studio solution file (OpenMesh.sln) in the build directory you chose in cmake
    • +
    • Now you can build %OpenMesh from within Visual Studio using the newly created project file.
    • +
    + +
    +
    + +\section sec_compiling_macosx MacOS X + +Download and install required libraries as stated above. +You can download %OpenMesh's sources from www.openmesh.org or check out the latest repository via SVN:
    +svn co http://www.openmesh.org/svnrepo/OpenMesh/trunk %OpenMesh.

    + +\subsection mac_using_cmake Compiling OpenMesh using CMake + +We recommend you to use CMake >= 3.7 as build system. This can also easily be installed +via MacPorts as well as the Qt >= 5.6 library which is used for some example applications +in %OpenMesh.
    +Once installed, change to %OpenMesh's root directory and create a directory +named e.g. "buildDebug" (assuming you want to build with debug symbols).
    +Then type in the following command to initially set up the build environment: +

    + +cmake ..            ## Generates the appropriate Makefiles
    +
    +
    +Note: If the build directory is not a subdirectory of %OpenMesh's root folder, replace ".." with %OpenMesh's +absolute (or relative) path. +In order to manually set specific build variables, just type: +

    + +ccmake .            ## Configure build environment
    +
    +
    +This opens the CMake configure tool. Change the CMAKE_BUILD_TYPE variable to "Release" in order to prepare build +for release configuration. Now, when everything is set up, just type: +

    + +make                ## Build %OpenMesh
    +
    +
    +And optionally: +

    + +make doc            ## Build %OpenMesh's documentation
    +
    +
    +The mac application bundle will be found under "Build" in the recently created build folder. +It automatically contains all needed shared objects (libs, fonts, textures, etc.). + +CMake builds both shared and static under MacOS X. + +**/ + + +//----------------------------------------------------------------------------- diff --git a/Doc/misc.docu b/Doc/misc.docu index 864127ef..73db2d39 100644 --- a/Doc/misc.docu +++ b/Doc/misc.docu @@ -27,167 +27,4 @@ The following naming conventions are used for the %OpenMesh code: **/ - -//----------------------------------------------------------------------------- - - -/** \page compiling Compiling OpenMesh - -\section compilers Tested compilers - -%OpenMesh has been successfully tested for the following operating -systems / compilers. This is only a list of tested compilers. More might be supported but are not tested. - - - - - - - - - - -
    Linux -gcc 4.6.x
    -gcc 4.7.x
    -gcc 4.8.x
    -gcc 4.9.x
    -clang 3.3
    -clang 3.4
    -
    Windows -Microsoft Visual Studio 2008
    -Microsoft Visual Studio 2010
    -Microsoft Visual Studio 2012
    -Microsoft Visual Studio 2013
    -Microsoft Visual Studio 2015
    -
    Tested MacOS X Compilers -XCode 4.3
    -XCode 4.4
    -XCode 4.5
    -XCode 5.1.1
    -Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
    -
    - -\section req_libs Required libraries (Only for included Apps) - -Install the following external libraries / frameworks if you want to use the included Applications:

    - - -
    Qt4/Qt5http://qt-project.org/downloads

    - -\section build_systems Chosing build system - -%OpenMesh can be built using the cmake build system. -
    -
    - -\section sec_compiling_unix Unix - -\subsection linux_using_cmake Compiling OpenMesh using CMake - -In order to compile %OpenMesh, create a directory named e.g. "build" in -OpenMesh's root directory. Change to the newly created directory and type -

    - -cmake ..            ## Generates the appropriate Makefiles
    -make                ## Builds the project
    -

    -You can choose the build type by using cmake with the flag
    --DCMAKE_BUILD_TYPE=(Debug|Release)
    -The default is: Debug -
    -Other flags are:
    --DBUILD_APPS=OFF to disable build of applications and
    --DCMAKE_INSTALL_PREFIX=<path> to specify the install path. -
    -When calling make install cmake will install %OpenMesh into this -directory using the subdirectories lib/include/bin. - -CMake builds both shared and static under Linux. - -Everything will then be build in the Build subdirectory containing the libraries in lib and the binaries in bin. - -There are some additional targets:
    -doc: Builds the Documentation
    -doc-install: Builds the Documentation and installs it
    -
    -\note When you link against the static libraries of OpenMesh and get the error "can not be used when making a -shared object; recompile with -fPIC" you need to add "-fPIC" to the CMAKE_CXX_FLAGS. (This is usually added automatically) - -\section sec_compiling_windows Windows - -\subsection windows_using_cmake Compiling OpenMesh using CMake - -If you want to use cmake to build your Visual Studio 2008 solution file,
    -download and install CMake from www.cmake.org.
    -(Note: This is not mandatory since there are already VS2008 solution files included in %OpenMesh).

    -
      -
    • Get Visual Studio ( 2008-2013 )
    • -
    • Extract %OpenMesh source code.
    • -
    • Get all required libraries and install them ( including headers! ).
    • -
    • Get cmake for windows from http://www.cmake.org/cmake/resources/software.html
    • -
    • Start the cmake gui and open the %OpenMesh toplevel directory as source directory
    • -
    • Choose a build directory (e.g. create a directory called "build" in OpenMesh's root folder)
    • -
    • Click on configure .... If any libraries are left unconfigured, you can adjust the path manually. Rerun configure until everything is configured correctly. - Attention: Some build variables are only visible in advanced view mode. Select Visual Studio 9 (2008), Visual Studio 10(2010), Visual Studio 11 (2012), Visual Studio 12 (2013) (Depending on your version) as - generator.
    • -
    • Click generate to create the visual studio project files
    • -
    • You can now find a Visual Studio solution file (OpenMesh.sln) in the build directory you chose in cmake
    • -
    • Now you can build %OpenMesh from within Visual Studio using the newly created project file.
    • -
    - -Note: Set the CMAKE_BUILD_TYPE variable to "Release" if you want %OpenMesh to be built as release. -In Visual Studio choose "Release" in the appropriate select box and build the solution afterwards. - -
    -
    - -\section sec_compiling_macosx MacOS X - -Download and install required libraries as stated above. -You can download %OpenMesh's sources from www.openmesh.org or check out the latest repository via SVN:
    -svn co http://www.openmesh.org/svnrepo/OpenMesh/trunk %OpenMesh.

    - -\subsection mac_using_cmake Compiling OpenMesh using CMake - -We recommend you to use CMake >= 2.8 as build system. This can also easily be installed -via MacPorts as well as the Qt >= 4.7 library which is used for some example applications -in %OpenMesh.
    -Once installed, change to %OpenMesh's root directory and create a directory -named e.g. "buildDebug" (assuming you want to build with debug symbols).
    -Then type in the following command to initially set up the build environment: -

    - -cmake ..            ## Generates the appropriate Makefiles
    -
    -
    -Note: If the build directory is not a subdirectory of %OpenMesh's root folder, replace ".." with %OpenMesh's -absolute (or relative) path. -In order to manually set specific build variables, just type: -

    - -ccmake .            ## Configure build environment
    -
    -
    -This opens the CMake configure tool. Change the CMAKE_BUILD_TYPE variable to "Release" in order to prepare build -for release configuration. Now, when everything is set up, just type: -

    - -make                ## Build %OpenMesh
    -
    -
    -And optionally: -

    - -make doc            ## Build %OpenMesh's documentation
    -
    -
    -The mac application bundle will be found under "Build" in the recently created build folder. -It automatically contains all needed shared objects (libs, fonts, textures, etc.). - -CMake builds both shared and static under MacOS X. - -**/ - - //----------------------------------------------------------------------------- From 3188e2d809d03b1256db2599c8331b4f1a061033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 09:29:02 +0200 Subject: [PATCH 098/118] Enforce c++11 --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) mode change 100644 => 100755 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100644 new mode 100755 index fec71a5e..dda2f40a --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,10 @@ cmake_minimum_required (VERSION 2.6) + +# Set and enforce C++-11 flags +set( CMAKE_CXX_STANDARD_REQUIRED TRUE ) +set( CMAKE_CXX_STANDARD 11 ) + enable_testing() # Only set project name if OpenMesh is built as stand-alone library From 89633936a528e6c39f96f81a727787d3d0508cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 09:44:00 +0200 Subject: [PATCH 099/118] Removed hint to svn --- Doc/compiling.docu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/compiling.docu b/Doc/compiling.docu index 5e7d7b33..338b2b12 100644 --- a/Doc/compiling.docu +++ b/Doc/compiling.docu @@ -115,8 +115,8 @@ Building OpenMesh on Windows requires cmake to generate the project files for Vi \section sec_compiling_macosx MacOS X Download and install required libraries as stated above. -You can download %OpenMesh's sources from www.openmesh.org or check out the latest repository via SVN:
    -svn co http://www.openmesh.org/svnrepo/OpenMesh/trunk %OpenMesh.

    +You can download %OpenMesh's sources from www.openmesh.org or check out the latest repository via GIT:
    +https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh.

    \subsection mac_using_cmake Compiling OpenMesh using CMake From b2d3bdb43c17bd3141010a0122cb2df7bf49b8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 10:21:42 +0200 Subject: [PATCH 100/118] Added script to pack sources --- CI/ci-source.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 CI/ci-source.sh diff --git a/CI/ci-source.sh b/CI/ci-source.sh new file mode 100755 index 00000000..da0956fa --- /dev/null +++ b/CI/ci-source.sh @@ -0,0 +1,36 @@ + +# This script just creates compressed files of OpenMesh sources + +# Create Build directory and Build documentation +mkdir build + +cd build +cmake .. +make doc +cd .. + +# Extract Version Information +VERSION=OpenMesh-$(cat ../VERSION | grep VERSION | tr -d "VERSION=") + +# Create Publishing directory +mkdir OpenMesh-$VERSION + +# Move all files into Publishing directory +mv CHANGELOG.md $VERSION/ +mv cmake $VERSION/ +mv CMakeLists.txt $VERSION/ +mv debian $VERSION/ +mv Doc $VERSION/ +mv LICENSE $VERSION/ +mv README.md $VERSION/ +mv src $VERSION/ +mv VERSION $VERSION/ + +mv build/Build/share/OpenMesh/Doc/html/ OpenMesh-$VERSION/Documentation + +tar + +tar cjf $VERSION.tar.bz2 $VERSION & +tar czf $VERSION.tar.gz $VERSION & +zip -9 -q -r $VERSION.zip $VERSION & + From ee2976b58e7d79cb27a74763566b2f79f091e75f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 10:23:36 +0200 Subject: [PATCH 101/118] Runs sources step --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 95d8d1d6..0d002149 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -345,3 +345,7 @@ Doc-publish: script: "CI/ci-doc.sh" tags: - Linux + +Sources: + script: "CI/ci-source.sh" + From 50914787ea67d9fd849d82e7fc630e72522afa67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 10:24:35 +0200 Subject: [PATCH 102/118] Fixed typo --- CI/ci-source.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/ci-source.sh b/CI/ci-source.sh index da0956fa..398eb6cd 100755 --- a/CI/ci-source.sh +++ b/CI/ci-source.sh @@ -10,7 +10,7 @@ make doc cd .. # Extract Version Information -VERSION=OpenMesh-$(cat ../VERSION | grep VERSION | tr -d "VERSION=") +VERSION=OpenMesh-$(cat VERSION | grep VERSION | tr -d "VERSION=") # Create Publishing directory mkdir OpenMesh-$VERSION From 06a5e4e1d2574d53ccbb079a4b06e9070eb49f57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 10:26:09 +0200 Subject: [PATCH 103/118] Fixed another typo --- CI/ci-source.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CI/ci-source.sh b/CI/ci-source.sh index 398eb6cd..80bf8f21 100755 --- a/CI/ci-source.sh +++ b/CI/ci-source.sh @@ -2,9 +2,9 @@ # This script just creates compressed files of OpenMesh sources # Create Build directory and Build documentation -mkdir build +mkdir build-doc -cd build +cd build-doc cmake .. make doc cd .. @@ -13,7 +13,7 @@ cd .. VERSION=OpenMesh-$(cat VERSION | grep VERSION | tr -d "VERSION=") # Create Publishing directory -mkdir OpenMesh-$VERSION +mkdir $VERSION # Move all files into Publishing directory mv CHANGELOG.md $VERSION/ @@ -26,7 +26,7 @@ mv README.md $VERSION/ mv src $VERSION/ mv VERSION $VERSION/ -mv build/Build/share/OpenMesh/Doc/html/ OpenMesh-$VERSION/Documentation +mv build-doc/Build/share/OpenMesh/Doc/html/ $VERSION/Documentation tar From 58b2afb498f10b1ec3ff40febf3869a005674b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 10:27:48 +0200 Subject: [PATCH 104/118] Fixed another typo --- CI/ci-source.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/CI/ci-source.sh b/CI/ci-source.sh index 80bf8f21..5fa53811 100755 --- a/CI/ci-source.sh +++ b/CI/ci-source.sh @@ -28,9 +28,7 @@ mv VERSION $VERSION/ mv build-doc/Build/share/OpenMesh/Doc/html/ $VERSION/Documentation -tar - -tar cjf $VERSION.tar.bz2 $VERSION & -tar czf $VERSION.tar.gz $VERSION & -zip -9 -q -r $VERSION.zip $VERSION & +tar cjf $VERSION.tar.bz2 $VERSION +tar czf $VERSION.tar.gz $VERSION +zip -9 -q -r $VERSION.zip $VERSION From 8934a5a9052dbf40a7d0e7c9f15174c187b09592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 10:31:31 +0200 Subject: [PATCH 105/118] Added a source stage --- .gitlab-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0d002149..57bda5f5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -347,5 +347,12 @@ Doc-publish: - Linux Sources: + only: + - master script: "CI/ci-source.sh" + artifacts: + paths: + - *.zip + - *.tar.bz2 + - *.tar.gz From 15a6bbcea312903f73e56248bec7ac70c6b514b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 10:35:12 +0200 Subject: [PATCH 106/118] Added stages --- .gitlab-ci.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 57bda5f5..90c82d8f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,24 +1,33 @@ +stages: + - build + - deploy + gcc-c++11: + stage: build script: "CI/ci-linux.sh gcc C++11" tags: - Linux clang-c++11: + stage: build script: "CI/ci-linux.sh clang C++11" tags: - Linux gcc-c++14: + stage: build script: "CI/ci-linux.sh gcc C++14" tags: - Linux clang-c++14: + stage: build script: "CI/ci-linux.sh clang C++14" tags: - Linux macos-c++11: + stage: build script: "CI/ci-mac.sh C++11" tags: - Apple @@ -28,6 +37,7 @@ macos-c++11: - build-release-cpp11/*.tar.gz macos-c++98: + stage: build script: "CI/ci-mac.sh C++14" tags: - Apple @@ -37,6 +47,7 @@ macos-c++98: - build-release-cpp14/*.tar.gz cppcheck: + stage: build script: "CI/ci-cppcheck.sh" tags: - Linux @@ -45,6 +56,7 @@ cppcheck: - cppcheck.log VS2017-64-bit-shared-apps: + stage: build variables: BUILD_PLATFORM: "VS2017" ARCHITECTURE: "x64" @@ -59,6 +71,7 @@ VS2017-64-bit-shared-apps: - build-release/*.exe VS2017-64-bit-static-apps: + stage: build variables: BUILD_PLATFORM: "VS2017" ARCHITECTURE: "x64" @@ -74,6 +87,7 @@ VS2017-64-bit-static-apps: VS2017-64-bit-shared-no-apps: + stage: build variables: BUILD_PLATFORM: "VS2017" ARCHITECTURE: "x64" @@ -88,6 +102,7 @@ VS2017-64-bit-shared-no-apps: VS2017-32-bit-shared-no-apps: + stage: build variables: BUILD_PLATFORM: "VS2017" ARCHITECTURE: "x32" @@ -102,6 +117,7 @@ VS2017-32-bit-shared-no-apps: VS2017-64-bit-static-no-apps: + stage: build variables: BUILD_PLATFORM: "VS2017" ARCHITECTURE: "x64" @@ -116,6 +132,7 @@ VS2017-64-bit-static-no-apps: VS2017-32-bit-static-no-apps: + stage: build variables: BUILD_PLATFORM: "VS2017" ARCHITECTURE: "x32" @@ -129,6 +146,7 @@ VS2017-32-bit-static-no-apps: - build-release/*.exe VS2015-64-bit-shared-apps: + stage: build variables: BUILD_PLATFORM: "VS2015" ARCHITECTURE: "x64" @@ -143,6 +161,7 @@ VS2015-64-bit-shared-apps: VS2015-64-bit-shared-no-apps: + stage: build variables: BUILD_PLATFORM: "VS2015" ARCHITECTURE: "x64" @@ -156,6 +175,7 @@ VS2015-64-bit-shared-no-apps: - build-release/*.exe VS2015-32-bit-shared-apps: + stage: build variables: BUILD_PLATFORM: "VS2015" ARCHITECTURE: "x32" @@ -169,6 +189,7 @@ VS2015-32-bit-shared-apps: - build-release/*.exe VS2015-32-bit-shared-no-apps: + stage: build variables: BUILD_PLATFORM: "VS2015" ARCHITECTURE: "x32" @@ -182,6 +203,7 @@ VS2015-32-bit-shared-no-apps: - build-release/*.exe VS2015-64-bit-static-apps: + stage: build variables: BUILD_PLATFORM: "VS2015" ARCHITECTURE: "x64" @@ -195,6 +217,7 @@ VS2015-64-bit-static-apps: - build-release/*.exe VS2015-64-bit-static-no-apps: + stage: build variables: BUILD_PLATFORM: "VS2015" ARCHITECTURE: "x64" @@ -208,6 +231,7 @@ VS2015-64-bit-static-no-apps: - build-release/*.exe VS2015-32-bit-static-apps: + stage: build variables: BUILD_PLATFORM: "VS2015" ARCHITECTURE: "x32" @@ -221,6 +245,7 @@ VS2015-32-bit-static-apps: - build-release/*.exe VS2015-32-bit-static-no-apps: + stage: build variables: BUILD_PLATFORM: "VS2015" ARCHITECTURE: "x32" @@ -236,6 +261,7 @@ VS2015-32-bit-static-no-apps: VS2013-64-bit-shared-apps: + stage: build variables: BUILD_PLATFORM: "VS2013" ARCHITECTURE: "x64" @@ -249,6 +275,7 @@ VS2013-64-bit-shared-apps: - build-release/*.exe VS2013-64-bit-shared-no-apps: + stage: build variables: BUILD_PLATFORM: "VS2013" ARCHITECTURE: "x64" @@ -262,6 +289,7 @@ VS2013-64-bit-shared-no-apps: - build-release/*.exe VS2013-32-bit-shared-apps: + stage: build variables: BUILD_PLATFORM: "VS2013" ARCHITECTURE: "x32" @@ -275,6 +303,7 @@ VS2013-32-bit-shared-apps: - build-release/*.exe VS2013-32-bit-shared-no-apps: + stage: build variables: BUILD_PLATFORM: "VS2013" ARCHITECTURE: "x32" @@ -288,6 +317,7 @@ VS2013-32-bit-shared-no-apps: - build-release/*.exe VS2013-64-bit-static-apps: + stage: build variables: BUILD_PLATFORM: "VS2013" ARCHITECTURE: "x64" @@ -301,6 +331,7 @@ VS2013-64-bit-static-apps: - build-release/*.exe VS2013-64-bit-static-no-apps: + stage: build variables: BUILD_PLATFORM: "VS2013" ARCHITECTURE: "x64" @@ -314,6 +345,7 @@ VS2013-64-bit-static-no-apps: - build-release/*.exe VS2013-32-bit-static-apps: + stage: build variables: BUILD_PLATFORM: "VS2013" ARCHITECTURE: "x32" @@ -327,6 +359,7 @@ VS2013-32-bit-static-apps: - build-release/*.exe VS2013-32-bit-static-no-apps: + stage: build variables: BUILD_PLATFORM: "VS2013" ARCHITECTURE: "x32" @@ -340,6 +373,7 @@ VS2013-32-bit-static-no-apps: - build-release/*.exe Doc-publish: + stage: deploy only: - master script: "CI/ci-doc.sh" @@ -347,6 +381,7 @@ Doc-publish: - Linux Sources: + stage: deploy only: - master script: "CI/ci-source.sh" From 0f286ba49c45b83cb3c52d0e65499f75537acc37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 10:37:14 +0200 Subject: [PATCH 107/118] Changed artifact paths --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 90c82d8f..84aa9dd8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -387,7 +387,7 @@ Sources: script: "CI/ci-source.sh" artifacts: paths: - - *.zip - - *.tar.bz2 - - *.tar.gz + - OpenMesh*.zip + - OpenMesh*.tar.bz2 + - OpenMesh*.tar.gz From 63443380c05e255d577f736005608f404eeaeb35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 12:13:59 +0200 Subject: [PATCH 108/118] Updated Readme [skip-ci] --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index debd1f74..c03bf114 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,10 @@ https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python | 64-Bit static, no apps | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-64-bit-static-no-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-64-bit-static-no-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-64-bit-static-no-apps) | | 32-Bit static, no apps | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-32-bit-static-no-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-32-bit-static-no-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-32-bit-static-no-apps) | +Sources: +https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=Sources) | [ Download Sources](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/?job=Sources + + ## Installing Unpack the tar-ball to a suitable place. From 470e30b75fb3805e1e2e8e2c86d68d388bf813a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 12:15:52 +0200 Subject: [PATCH 109/118] Updated Readme [skip-ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c03bf114..9f3afd25 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python | 32-Bit static, no apps | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-32-bit-static-no-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-32-bit-static-no-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-32-bit-static-no-apps) | Sources: -https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=Sources) | [ Download Sources](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/?job=Sources +[ Download Sources](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/?job=Sources ) ## Installing From bd03dee61d7cb628e3a2fedf6dd94444061a9112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 12:28:55 +0200 Subject: [PATCH 110/118] Updated changelog for release date --- Doc/changelog.docu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index a76d5a96..4e81940c 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -7,7 +7,7 @@ -7.1 (?/?/?) +7.1 (2018/05/29) b>IO
      From e31653a789c85f64d9175c94b062d3e17653948b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 12:30:38 +0200 Subject: [PATCH 111/118] Fixed typo in changelog --- Doc/changelog.docu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 4e81940c..4ca8e009 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -9,7 +9,7 @@ 7.1 (2018/05/29) -b>IO +IO
      • Fixed slow OBJ reader (Thanks to Etienne Danvoye for the patch)
      From 402d196e8592916ad10ebe70358b3f73de611f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 12:32:25 +0200 Subject: [PATCH 112/118] Missing changelog entry --- Doc/changelog.docu | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 4ca8e009..c7734109 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -17,6 +17,7 @@ Build System
        +
      • Default to C++11 in cmake files
      • Remove old qmake project files. Unmaintained for a very long time
      • Replaced Qt finders
      • Added VS 2017 to CI builds
      • From 206da0108619b5b6ef0071b506de7ffb4b4910ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 12:34:37 +0200 Subject: [PATCH 113/118] Missing changelog entry --- Doc/changelog.docu | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index c7734109..ff196b7b 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -14,6 +14,10 @@
      • Fixed slow OBJ reader (Thanks to Etienne Danvoye for the patch)
      +Documentation +
        +
      • Updated build instructions.
      • +
      Build System
        From a6d50c11aa7ca2c360ceb6b41f4a658cca435efa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 12:52:53 +0200 Subject: [PATCH 114/118] Update to new version --- Doc/changelog.docu | 5 +++++ README.md | 2 +- VERSION | 4 ++-- cmake/FindOpenMesh.cmake | 1 + src/OpenMesh/Core/System/config.h | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index ff196b7b..e46c8a6b 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -7,6 +7,11 @@ +7.2 (?/?/?) + + + + 7.1 (2018/05/29) IO diff --git a/README.md b/README.md index 9f3afd25..f5f5f1f7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# OpenMesh, 7.1 +# OpenMesh, 7.2 [![](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/badges/master/pipeline.svg)](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/commits/master) diff --git a/VERSION b/VERSION index 965f7b0e..c975e25f 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ -VERSION=7.1 +VERSION=7.2 MAJOR=7 -MINOR=1 +MINOR=2 PATCH=0 ID=OPENMESH diff --git a/cmake/FindOpenMesh.cmake b/cmake/FindOpenMesh.cmake index 5893b084..19509deb 100644 --- a/cmake/FindOpenMesh.cmake +++ b/cmake/FindOpenMesh.cmake @@ -63,6 +63,7 @@ IF (NOT OPENMESH_FOUND) "${CMAKE_SOURCE_DIR}/OpenMesh/src/OpenMesh" "${CMAKE_SOURCE_DIR}/libs_required/OpenMesh/src/OpenMesh" "${CMAKE_SOURCE_DIR}/../OpenMesh/src/OpenMesh" + "C:/Program Files/OpenMesh 7.2" "C:/Program Files/OpenMesh 7.1" "C:/Program Files/OpenMesh 7.0" "C:/Program Files/OpenMesh 6.3" diff --git a/src/OpenMesh/Core/System/config.h b/src/OpenMesh/Core/System/config.h index 65c0b3e2..9d7520c1 100644 --- a/src/OpenMesh/Core/System/config.h +++ b/src/OpenMesh/Core/System/config.h @@ -65,7 +65,7 @@ // ---------------------------------------------------------------------------- -#define OM_VERSION 0x70100 +#define OM_VERSION 0x70200 #define OM_GET_VER ((OM_VERSION & 0xf0000) >> 16) #define OM_GET_MAJ ((OM_VERSION & 0x0ff00) >> 8) From 2ef59bf5d92afff0c1cbccde117ecf3ce85686f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 12:53:42 +0200 Subject: [PATCH 115/118] Updated readme [skip-ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f5f5f1f7..f3a4d17f 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python | 64-Bit static, no apps | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-64-bit-static-no-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-64-bit-static-no-apps) | [Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-64-bit-static-no-apps) | | 32-Bit static, no apps | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2017-32-bit-static-no-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2015-32-bit-static-no-apps) | [ Download ](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/build-release?job=VS2013-32-bit-static-no-apps) | -Sources: +## Download Sources [ Download Sources](https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/jobs/artifacts/master/browse/?job=Sources ) From 1dee3f74b78d9ee618a0de3e5106ba1897d0ab5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 15:15:49 +0200 Subject: [PATCH 116/118] Restrict source build to linux machines --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 84aa9dd8..545b79db 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -385,6 +385,8 @@ Sources: only: - master script: "CI/ci-source.sh" + tags: + - Linux artifacts: paths: - OpenMesh*.zip From 2b21fabfddfdb8321fc80756aa81e589f7d290b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 15:16:37 +0200 Subject: [PATCH 117/118] Allowing the PLY reader to read custom face ( Thanks to morgan Leborgne for the patch) --- src/OpenMesh/Core/IO/reader/PLYReader.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/OpenMesh/Core/IO/reader/PLYReader.cc b/src/OpenMesh/Core/IO/reader/PLYReader.cc index 618f347d..87078882 100644 --- a/src/OpenMesh/Core/IO/reader/PLYReader.cc +++ b/src/OpenMesh/Core/IO/reader/PLYReader.cc @@ -1270,6 +1270,8 @@ bool _PLYReader_::can_u_read(std::istream& _is) const { omerr() << "Custom face Properties defined, before 'vertex_indices' property was defined. They will be skipped" << std::endl; elements_.back().properties_.clear(); } + } else { + options_ += Options::Custom; } } From c187fc97d84a19e9bb07ffac0ea7ea1b23a2c94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 29 May 2018 15:17:53 +0200 Subject: [PATCH 118/118] Updated changelog --- Doc/changelog.docu | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Doc/changelog.docu b/Doc/changelog.docu index e46c8a6b..1abf1df0 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -9,6 +9,12 @@ 7.2 (?/?/?) +IO +
          +
        • PLY Reader: Allowing the PLY reader to read custom face ( Thanks to morgan Leborgne for the patch)
        • +
        + + @@ -16,7 +22,7 @@ IO
          -
        • Fixed slow OBJ reader (Thanks to Etienne Danvoye for the patch)
        • +
        • OBJ Reader: Fixed slow OBJ reader (Thanks to Etienne Danvoye for the patch)
        Documentation