├── .gitignore ├── .gitlab-ci.yml ├── CHANGELOG.md ├── CI ├── Windows.bat ├── ci-cppcheck.sh ├── ci-doc.sh ├── ci-linux.sh ├── ci-mac.sh └── ci-source.sh ├── CMakeLists.txt ├── Doc ├── CMakeLists.txt ├── Concepts │ ├── MeshItems.hh │ └── MeshKernel.hh ├── Examples │ ├── BaseExporter.hh │ ├── BaseImporter.hh │ ├── BaseReader.hh │ ├── adasub.cc │ ├── build-trimesh.cc │ ├── circulator_functions.cc │ ├── circulators.cc │ ├── decimater.cc │ ├── draw_normals.cc │ ├── iterators.cc │ ├── mesh_io.cc │ ├── mymesh.cc │ ├── nav_code1.cc │ ├── nav_code2.cc │ ├── nav_code3.cc │ ├── nav_code4.cc │ ├── nav_code4a.cc │ ├── nav_code_to_from.cc │ ├── traits0.cc │ ├── traits1.cc │ ├── traits2.cc │ ├── traits3.cc │ ├── traits4.cc │ └── traits5.cc ├── Tutorial │ ├── 01-build_cube │ │ └── build_cube.cc │ ├── 02-iterators │ │ └── smooth.cc │ ├── 03-properties │ │ └── smooth.cc │ ├── 04-stl_algorithms │ │ ├── smooth.cc │ │ └── smooth_algo.hh │ ├── 05-std_properties │ │ └── properties.cc │ ├── 06-attributes │ │ └── attributes.cc │ ├── 07-traits │ │ └── smooth.cc │ ├── 07b-delete_geometry │ │ └── delete_geometry.cc │ ├── 08-io_options │ │ └── io_options.cc │ ├── 09-persistence │ │ ├── fill_props.hh │ │ ├── generate_cube.hh │ │ ├── int2roman.cc │ │ ├── int2roman.hh │ │ ├── persistence.cc │ │ └── stats.hh │ └── CMakeLists.txt ├── changelog.docu ├── compiling.docu ├── decimater.docu ├── doxy.config.in ├── html │ ├── acg_footer.html │ └── logo_align.css ├── images │ ├── OpenMesh_text_128.png │ ├── class-hierarchy.png │ ├── class-hierarchy2.png │ ├── collapse_info.png │ ├── diagrams.sxi │ ├── halfedge_structure.gif │ ├── halfedge_structure2.png │ ├── halfedge_structure3.png │ ├── inheritance-simple.png │ ├── inheritance-simple.scaled.png │ ├── inheritance.fig │ ├── inheritance.gif │ ├── iomanager.gif │ ├── iomanager.png │ ├── mesh.collapse.png │ ├── mesh.flip.png │ ├── mesh.inner.png │ ├── mesh.inout.png │ ├── mesh.normal.png │ ├── mesh.opp.png │ ├── mesh.outer.png │ ├── mesh.to.from.png │ ├── om-format.png │ ├── rwth_vci_rgb.jpg │ └── src │ │ ├── iomanager.tex │ │ ├── mesh.collapse.tex │ │ ├── mesh.flip.tex │ │ ├── mesh.inner.tex │ │ ├── mesh.io.tex │ │ ├── mesh.normal.tex │ │ ├── mesh.opp.tex │ │ ├── mesh.outer.tex │ │ └── mesh.to.from.tex ├── mainpage.docu ├── mesh.docu ├── misc.docu ├── namespaces.docu ├── navigation.docu ├── operations.docu ├── smoother.docu ├── speedup.docu ├── subdivider.docu ├── tools.docu ├── tutorial_01.docu ├── tutorial_02.docu ├── tutorial_03.docu ├── tutorial_04.docu ├── tutorial_05.docu ├── tutorial_06.docu ├── tutorial_07.docu ├── tutorial_07b.docu ├── tutorial_08.docu ├── tutorial_09.docu ├── tutorial_build.docu ├── tutorial_main.docu └── vdpm.docu ├── LICENSE ├── README.md ├── VERSION ├── cmake ├── ACGCommon.cmake ├── ACGCompiler.cmake ├── ACGDoxygen.cmake ├── ACGOutput.cmake ├── ACGQt.cmake ├── FindGLUT.cmake ├── FindOpenMesh.cmake ├── OpenMeshPackage.cmake ├── fixbundle.cmake.in └── fixbundle.cmake.win.in ├── conanfile.py ├── debian ├── changelog ├── compat ├── control ├── copyright └── rules ├── release.howto └── src ├── Benchmark ├── CMakeLists.txt ├── VectorT.cpp ├── VectorT_dummy_data.cpp ├── VectorT_dummy_data.hpp ├── VectorT_legacy.cpp ├── VectorT_new.cpp └── main.cpp ├── OpenMesh ├── Apps │ ├── CMakeLists.txt │ ├── Decimating │ │ ├── CmdOption.hh │ │ ├── DecimaterGui │ │ │ └── CMakeLists.txt │ │ ├── DecimaterViewerWidget.cc │ │ ├── DecimaterViewerWidget.hh │ │ ├── commandlineDecimater │ │ │ └── CMakeLists.txt │ │ ├── decimater.cc │ │ └── decimaterviewer.cc │ ├── Dualizer │ │ ├── CMakeLists.txt │ │ └── dualizer.cc │ ├── ProgViewer │ │ ├── CMakeLists.txt │ │ ├── ProgViewerWidget.cc │ │ ├── ProgViewerWidget.hh │ │ └── progviewer.cc │ ├── Qt │ │ └── qt.conf │ ├── QtViewer │ │ ├── CMakeLists.txt │ │ ├── MeshViewerWidget.cc │ │ ├── MeshViewerWidget.hh │ │ ├── MeshViewerWidgetT.cc │ │ ├── MeshViewerWidgetT.hh │ │ ├── QGLViewerWidget.cc │ │ ├── QGLViewerWidget.hh │ │ └── meshviewer.cc │ ├── Smoothing │ │ ├── CMakeLists.txt │ │ └── smooth.cc │ ├── Subdivider │ │ ├── MeshViewerWidget.hh │ │ ├── SubdivideWidget.cc │ │ ├── SubdivideWidget.hh │ │ ├── SubdividerGui │ │ │ └── CMakeLists.txt │ │ ├── adaptive_subdivider.cc │ │ ├── commandlineAdaptiveSubdivider │ │ │ └── CMakeLists.txt │ │ ├── commandlineSubdivider │ │ │ └── CMakeLists.txt │ │ ├── qtsubdivider.cc │ │ └── subdivider.cc │ ├── Unsupported │ │ ├── IvViewer │ │ │ ├── SoOpenMeshNodeT.cc │ │ │ ├── SoOpenMeshNodeT.hh │ │ │ ├── SoOpenMeshSupport.hh │ │ │ └── ivviewer.cc │ │ ├── OsgViewer │ │ │ ├── README │ │ │ ├── meshviewer.cc │ │ │ └── osgviewer.cc │ │ ├── Streaming-qt4 │ │ │ ├── Client │ │ │ │ ├── MeshViewerWidgetT.cc │ │ │ │ ├── MeshViewerWidgetT.hh │ │ │ │ ├── MyMesh.hh │ │ │ │ ├── QGLViewerWidget.cc │ │ │ │ ├── QGLViewerWidget.hh │ │ │ │ ├── VDPMClientViewerWidget.cc │ │ │ │ ├── VDPMClientViewerWidget.hh │ │ │ │ ├── VDPMStreamingClient.cc │ │ │ │ └── camera.cmr │ │ │ └── Server │ │ │ │ ├── ServerSideVDPM.cc │ │ │ │ ├── ServerSideVDPM.hh │ │ │ │ ├── VDPMServerSession.cc │ │ │ │ ├── VDPMServerSession.hh │ │ │ │ ├── VDPMServerSocket.hh │ │ │ │ ├── VDPMServerViewerWidget.cc │ │ │ │ ├── VDPMServerViewerWidget.hh │ │ │ │ ├── VDPMStreamingServer.cc │ │ │ │ ├── VDPMStreamingServer.hh │ │ │ │ ├── bunny.pm │ │ │ │ ├── bunny.spm │ │ │ │ └── rockerArm.pm │ │ └── Streaming │ │ │ ├── Client │ │ │ ├── MeshViewerWidgetT.cc │ │ │ ├── MeshViewerWidgetT.hh │ │ │ ├── MyMesh.hh │ │ │ ├── QGLViewerWidget.cc │ │ │ ├── QGLViewerWidget.hh │ │ │ ├── VDPMClientViewerWidget.cc │ │ │ ├── VDPMClientViewerWidget.hh │ │ │ └── VDPMStreamingClient.cc │ │ │ └── Server │ │ │ ├── ServerSideVDPM.cc │ │ │ ├── ServerSideVDPM.hh │ │ │ ├── VDPMServerSession.cc │ │ │ ├── VDPMServerSession.hh │ │ │ ├── VDPMServerSocket.hh │ │ │ ├── VDPMServerViewerWidget.cc │ │ │ ├── VDPMServerViewerWidget.hh │ │ │ ├── VDPMStreamingServer.cc │ │ │ └── VDPMStreamingServer.hh │ ├── VDProgMesh │ │ ├── Analyzer │ │ │ ├── CMakeLists.txt │ │ │ └── vdpmanalyzer.cc │ │ ├── Synthesizer │ │ │ ├── CMakeLists.txt │ │ │ ├── VDPMSynthesizerViewerWidget.cc │ │ │ ├── VDPMSynthesizerViewerWidget.hh │ │ │ └── vdpmsynthesizer.cc │ │ └── mkbalancedpm │ │ │ ├── CMakeLists.txt │ │ │ └── mkbalancedpm.cc │ └── mconvert │ │ ├── CMakeLists.txt │ │ └── mconvert.cc ├── Core │ ├── CMakeLists.txt │ ├── Geometry │ │ ├── Config.hh │ │ ├── LoopSchemeMaskT.hh │ │ ├── MathDefs.hh │ │ ├── NormalConeT.cc │ │ ├── NormalConeT.hh │ │ ├── Plane3d.hh │ │ ├── QuadricT.hh │ │ ├── Vector11T.hh │ │ ├── VectorT.hh │ │ └── VectorT_inc.hh │ ├── IO │ │ ├── BinaryHelper.cc │ │ ├── BinaryHelper.hh │ │ ├── IOInstances.hh │ │ ├── IOManager.cc │ │ ├── IOManager.hh │ │ ├── MeshIO.hh │ │ ├── OFFFormat.hh │ │ ├── OMFormat.cc │ │ ├── OMFormat.hh │ │ ├── OMFormatT.cc │ │ ├── Options.hh │ │ ├── SR_binary.hh │ │ ├── SR_binary_spec.hh │ │ ├── SR_binary_vector_of_bool.inl │ │ ├── SR_binary_vector_of_fundamentals.inl │ │ ├── SR_binary_vector_of_string.inl │ │ ├── SR_rbo.hh │ │ ├── SR_store.hh │ │ ├── SR_types.hh │ │ ├── StoreRestore.hh │ │ ├── exporter │ │ │ ├── BaseExporter.hh │ │ │ └── ExporterT.hh │ │ ├── importer │ │ │ ├── BaseImporter.hh │ │ │ └── ImporterT.hh │ │ ├── reader │ │ │ ├── BaseReader.cc │ │ │ ├── BaseReader.hh │ │ │ ├── OBJReader.cc │ │ │ ├── OBJReader.hh │ │ │ ├── OFFReader.cc │ │ │ ├── OFFReader.hh │ │ │ ├── OMReader.cc │ │ │ ├── OMReader.hh │ │ │ ├── PLYReader.cc │ │ │ ├── PLYReader.hh │ │ │ ├── STLReader.cc │ │ │ └── STLReader.hh │ │ └── writer │ │ │ ├── BaseWriter.cc │ │ │ ├── BaseWriter.hh │ │ │ ├── OBJWriter.cc │ │ │ ├── OBJWriter.hh │ │ │ ├── OFFWriter.cc │ │ │ ├── OFFWriter.hh │ │ │ ├── OMWriter.cc │ │ │ ├── OMWriter.hh │ │ │ ├── PLYWriter.cc │ │ │ ├── PLYWriter.hh │ │ │ ├── STLWriter.cc │ │ │ ├── STLWriter.hh │ │ │ ├── VTKWriter.cc │ │ │ └── VTKWriter.hh │ ├── Mesh │ │ ├── ArrayItems.hh │ │ ├── ArrayKernel.cc │ │ ├── ArrayKernel.hh │ │ ├── ArrayKernelT.cc │ │ ├── AttribKernelT.hh │ │ ├── Attributes.hh │ │ ├── BaseKernel.cc │ │ ├── BaseKernel.hh │ │ ├── BaseMesh.hh │ │ ├── Casts.hh │ │ ├── CirculatorsT.hh │ │ ├── FinalMeshItemsT.hh │ │ ├── Handles.hh │ │ ├── IteratorsT.hh │ │ ├── PolyConnectivity.cc │ │ ├── PolyConnectivity.hh │ │ ├── PolyMeshT.cc │ │ ├── PolyMeshT.hh │ │ ├── PolyMesh_ArrayKernelT.hh │ │ ├── Status.hh │ │ ├── Traits.hh │ │ ├── TriConnectivity.cc │ │ ├── TriConnectivity.hh │ │ ├── TriMeshT.cc │ │ ├── TriMeshT.hh │ │ ├── TriMesh_ArrayKernelT.hh │ │ └── gen │ │ │ ├── circulators_header.hh │ │ │ ├── circulators_template.hh │ │ │ ├── footer.hh │ │ │ ├── generate.sh │ │ │ ├── iterators_header.hh │ │ │ └── iterators_template.hh │ ├── System │ │ ├── OpenMeshDLLMacros.hh │ │ ├── compiler.hh │ │ ├── config.h │ │ ├── config.hh │ │ ├── mostream.hh │ │ ├── omstream.cc │ │ └── omstream.hh │ ├── Templates │ │ ├── newClass.cc │ │ ├── newClass.hh │ │ ├── newClass.sh │ │ ├── newClassT.cc │ │ ├── newClassT.hh │ │ └── newClassT.sh │ └── Utils │ │ ├── AutoPropertyHandleT.hh │ │ ├── BaseProperty.cc │ │ ├── BaseProperty.hh │ │ ├── Endian.cc │ │ ├── Endian.hh │ │ ├── GenProg.hh │ │ ├── HandleToPropHandle.hh │ │ ├── Noncopyable.hh │ │ ├── Property.hh │ │ ├── PropertyContainer.hh │ │ ├── PropertyManager.hh │ │ ├── RandomNumberGenerator.cc │ │ ├── RandomNumberGenerator.hh │ │ ├── SingletonT.cc │ │ ├── SingletonT.hh │ │ ├── color_cast.hh │ │ ├── vector_cast.hh │ │ └── vector_traits.hh ├── Examples │ ├── Tutorial01 │ │ └── cube.cc │ ├── Tutorial02 │ │ └── smooth.cc │ ├── Tutorial03 │ │ └── smooth.cc │ ├── Tutorial04 │ │ ├── smooth.cc │ │ └── smooth_algo.hh │ ├── Tutorial05 │ │ └── properties.cc │ ├── Tutorial06 │ │ └── attributes.cc │ ├── Tutorial07 │ │ └── smooth.cc │ ├── Tutorial08 │ │ └── delete_geometry.cc │ ├── Tutorial09 │ │ └── io_options.cc │ └── Tutorial10 │ │ ├── fill_props.hh │ │ ├── generate_cube.hh │ │ ├── int2roman.cc │ │ ├── int2roman.hh │ │ ├── persistence.cc │ │ └── stats.hh └── Tools │ ├── CMakeLists.txt │ ├── Decimater │ ├── BaseDecimaterT.cc │ ├── BaseDecimaterT.hh │ ├── CollapseInfoT.hh │ ├── DecimaterT.cc │ ├── DecimaterT.hh │ ├── McDecimaterT.cc │ ├── McDecimaterT.hh │ ├── MixedDecimaterT.cc │ ├── MixedDecimaterT.hh │ ├── ModAspectRatioT.cc │ ├── ModAspectRatioT.hh │ ├── ModBaseT.hh │ ├── ModEdgeLengthT.cc │ ├── ModEdgeLengthT.hh │ ├── ModHausdorffT.cc │ ├── ModHausdorffT.hh │ ├── ModIndependentSetsT.hh │ ├── ModNormalDeviationT.hh │ ├── ModNormalFlippingT.hh │ ├── ModProgMeshT.cc │ ├── ModProgMeshT.hh │ ├── ModQuadricT.cc │ ├── ModQuadricT.hh │ ├── ModRoundnessT.hh │ ├── Observer.cc │ └── Observer.hh │ ├── Dualizer │ └── meshDualT.hh │ ├── Kernel_OSG │ ├── ArrayKernelT.hh │ ├── AttribKernelT.hh │ ├── PropertyKernel.hh │ ├── PropertyT.hh │ ├── Traits.hh │ ├── TriMesh_OSGArrayKernelT.hh │ ├── VectorAdapter.hh │ ├── bindT.hh │ └── color_cast.hh │ ├── SmartTagger │ ├── SmartTaggerT.cc │ └── SmartTaggerT.hh │ ├── Smoother │ ├── JacobiLaplaceSmootherT.cc │ ├── JacobiLaplaceSmootherT.hh │ ├── LaplaceSmootherT.cc │ ├── LaplaceSmootherT.hh │ ├── SmootherT.cc │ ├── SmootherT.hh │ └── smooth_mesh.hh │ ├── Subdivider │ ├── Adaptive │ │ └── Composite │ │ │ ├── CompositeT.cc │ │ │ ├── CompositeT.hh │ │ │ ├── CompositeTraits.hh │ │ │ ├── RuleInterfaceT.hh │ │ │ ├── RulesT.cc │ │ │ ├── RulesT.hh │ │ │ └── Traits.hh │ └── Uniform │ │ ├── CatmullClarkT.cc │ │ ├── CatmullClarkT.hh │ │ ├── Composite │ │ ├── CompositeT.cc │ │ ├── CompositeT.hh │ │ └── CompositeTraits.hh │ │ ├── CompositeLoopT.hh │ │ ├── CompositeSqrt3T.hh │ │ ├── LongestEdgeT.hh │ │ ├── LoopT.hh │ │ ├── MidpointT.hh │ │ ├── ModifiedButterFlyT.hh │ │ ├── Sqrt3InterpolatingSubdividerLabsikGreinerT.hh │ │ ├── Sqrt3T.hh │ │ └── SubdividerT.hh │ ├── Utils │ ├── Config.hh │ ├── GLConstAsString.hh │ ├── Gnuplot.cc │ ├── Gnuplot.hh │ ├── HeapT.hh │ ├── MeshCheckerT.cc │ ├── MeshCheckerT.hh │ ├── NumLimitsT.hh │ ├── StripifierT.cc │ ├── StripifierT.hh │ ├── TestingFramework.hh │ ├── Timer.cc │ ├── Timer.hh │ ├── conio.cc │ ├── conio.hh │ ├── getopt.c │ └── getopt.h │ └── VDPM │ ├── MeshTraits.hh │ ├── StreamingDef.hh │ ├── VFront.cc │ ├── VFront.hh │ ├── VHierarchy.cc │ ├── VHierarchy.hh │ ├── VHierarchyNode.hh │ ├── VHierarchyNodeIndex.cc │ ├── VHierarchyNodeIndex.hh │ ├── VHierarchyWindow.cc │ ├── VHierarchyWindow.hh │ ├── ViewingParameters.cc │ ├── ViewingParameters.hh │ └── xpm │ ├── fileopen.xpm │ ├── fileprint.xpm │ └── filesave.xpm └── Unittests ├── .gitignore ├── CMakeLists.txt ├── TestFiles ├── .gitignore ├── cube-minimal-custom_props.ply ├── cube-minimal-degenerated.obj ├── cube-minimal-extra-elements-binary.ply ├── cube-minimal-extra-elements.ply ├── cube-minimal-normals.ply ├── cube-minimal-texCoords.obj ├── cube-minimal-texCoords.om ├── cube-minimal-texCoords.ply ├── cube-minimal-texCoords3d.obj ├── cube-minimal-vertex-colors-after-vertex-definition.obj ├── cube-minimal-vertex-colors-as-vc-lines.obj ├── cube-minimal-vertexColors.om ├── cube-minimal-vertexColors.ply ├── cube-minimal.obj ├── cube-minimal.om ├── cube-minimal.ply ├── cube1.off ├── cube1.pm ├── cube1.stl ├── cube1Binary.stl ├── cube1_customProps.om ├── cube_poly_version_1_2.om ├── cube_poly_version_2_0.om ├── cube_tri_version_1_2.om ├── cube_tri_version_2_0.om ├── cube_tri_version_7_5.om ├── meshlab.ply ├── pointCloudBadEncoding.ply ├── pointCloudGoodEncoding.ply ├── square_material.mtl ├── square_material.obj ├── square_material_texture.mtl └── square_material_texture.obj ├── fill_props.hh ├── generate_cube.hh ├── int2roman.hh ├── unittests.cc ├── unittests_add_face.cc ├── unittests_boundary.cc ├── unittests_common.hh ├── unittests_common_customtraits.hh ├── unittests_convert_meshes.cc ├── unittests_cpp_11_features.cc ├── unittests_decimater.cc ├── unittests_delete_face.cc ├── unittests_faceless_mesh.cc ├── unittests_mc_decimater.cc ├── unittests_mesh_cast.cc ├── unittests_mesh_dual.cc ├── unittests_mixed_decimater.cc ├── unittests_normal_calculations.cc ├── unittests_polymesh_collapse.cc ├── unittests_polymesh_vec2i.cc ├── unittests_property.cc ├── unittests_propertymanager.cc ├── unittests_randomNumberGenerator.cc ├── unittests_read_write_OBJ.cc ├── unittests_read_write_OFF.cc ├── unittests_read_write_OM.cc ├── unittests_read_write_PLY.cc ├── unittests_read_write_STL.cc ├── unittests_smarttagger.cc ├── unittests_smoother.cc ├── unittests_split_copy.cc ├── unittests_split_edge_copy.cc ├── unittests_sr_binary.cc ├── unittests_stripifier.cc ├── unittests_subdivider_adaptive.cc ├── unittests_subdivider_uniform.cc ├── unittests_trimesh_circulator_current_halfedge_handle_replacement.cc ├── unittests_trimesh_circulator_face_edge.cc ├── unittests_trimesh_circulator_face_face.cc ├── unittests_trimesh_circulator_face_halfedge.cc ├── unittests_trimesh_circulator_face_vertex.cc ├── unittests_trimesh_circulator_halfedge_loop.cc ├── unittests_trimesh_circulator_vertex_edge.cc ├── unittests_trimesh_circulator_vertex_face.cc ├── unittests_trimesh_circulator_vertex_ihalfedge.cc ├── unittests_trimesh_circulator_vertex_ohalfedge.cc ├── unittests_trimesh_circulator_vertex_vertex.cc ├── unittests_trimesh_collapse.cc ├── unittests_trimesh_garbage_collection.cc ├── unittests_trimesh_iterators.cc ├── unittests_trimesh_others.cc ├── unittests_trimesh_split.cc ├── unittests_trimesh_vec2i.cc ├── unittests_tutorials.cc ├── unittests_vdpm.cc └── unittests_vector_type.cc /.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | .cproject 3 | CMakeLists.txt.user 4 | build* 5 | *.swp 6 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | The changelog can be found in the html Documentation. 2 | 3 | The latest changelog for the master can be found here: 4 | http://openmesh.org/Daily-Builds/Doc/ 5 | -------------------------------------------------------------------------------- /CI/ci-cppcheck.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Exit script on any error 4 | set -e 5 | 6 | #===================================== 7 | # Color Settings: 8 | #===================================== 9 | NC='\033[0m' 10 | OUTPUT='\033[0;32m' 11 | WARNING='\033[0;93m' 12 | 13 | echo -e "${OUTPUT}" 14 | echo "==============================================================================" 15 | echo "Running cppcheck" 16 | echo "==============================================================================" 17 | echo -e "${NC}" 18 | echo "Please Wait ..." 19 | 20 | # Run cppcheck and output into file 21 | 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 22 | 23 | echo -e "${OUTPUT}" 24 | echo "==============================================================================" 25 | echo "CPPCHECK Messages" 26 | echo "==============================================================================" 27 | echo -e "${NC}" 28 | 29 | 30 | # Echo output to command line for simple analysis via gitlab 31 | cat cppcheck.log 32 | 33 | COUNT=$(wc -l < cppcheck.log ) 34 | 35 | echo -e "${OUTPUT}" 36 | echo "==============================================================================" 37 | echo "CPPCHECK Summary" 38 | echo "==============================================================================" 39 | echo -e "${NC}" 40 | 41 | MAX_COUNT=0 42 | 43 | if [ $COUNT -gt $MAX_COUNT ]; then 44 | echo -e ${WARNING} 45 | echo "Total CPPCHECK error Count is $COUNT, which is too High (max is $MAX_COUNT)! CPPCHECK Run failed"; 46 | echo -e "${NC}" 47 | exit 1; 48 | else 49 | echo "Total CPPCHECK error Count is $COUNT ... OK" 50 | fi 51 | 52 | 53 | -------------------------------------------------------------------------------- /CI/ci-doc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ! -d build-release ]; then 4 | mkdir build-release 5 | fi 6 | 7 | cd build-release 8 | 9 | cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=FALSE ../ 10 | 11 | make doc 12 | 13 | # Copy to webserver 14 | scp -r -P 2222 Build/share/OpenMesh/Doc/html/* hudson@web4-info8:OpenMesh-Daily/Doc/ 15 | -------------------------------------------------------------------------------- /CI/ci-source.sh: -------------------------------------------------------------------------------- 1 | 2 | # This script just creates compressed files of OpenMesh sources 3 | 4 | # Create Build directory and Build documentation 5 | mkdir build-doc 6 | 7 | cd build-doc 8 | cmake .. 9 | make doc 10 | cd .. 11 | 12 | # Extract Version Information 13 | VERSION=OpenMesh-$(cat VERSION | grep VERSION | tr -d "VERSION=") 14 | 15 | # Create Publishing directory 16 | mkdir $VERSION 17 | 18 | # Move all files into Publishing directory 19 | mv CHANGELOG.md $VERSION/ 20 | mv cmake $VERSION/ 21 | mv CMakeLists.txt $VERSION/ 22 | mv debian $VERSION/ 23 | mv Doc $VERSION/ 24 | mv LICENSE $VERSION/ 25 | mv README.md $VERSION/ 26 | mv src $VERSION/ 27 | mv VERSION $VERSION/ 28 | 29 | mv build-doc/Build/share/OpenMesh/Doc/html/ $VERSION/Documentation 30 | 31 | tar cjf $VERSION.tar.bz2 $VERSION 32 | tar czf $VERSION.tar.gz $VERSION 33 | zip -9 -q -r $VERSION.zip $VERSION 34 | 35 | -------------------------------------------------------------------------------- /Doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGDoxygen) 2 | 3 | IF (DOXYGEN_FOUND) 4 | 5 | # Add a documentation install target 6 | add_custom_target(doc-install COMMENT "Installing Documentation" VERBATIM ) 7 | 8 | # Build Documentation before installing it 9 | add_dependencies(doc-install doc) 10 | 11 | if (TARGET doc-install) 12 | acg_copy_after_build (doc-install "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc/html" "${CMAKE_INSTALL_PREFIX}/${ACG_PROJECT_DATADIR}/doc/html") 13 | endif() 14 | 15 | ENDIF(DOXYGEN_FOUND) 16 | -------------------------------------------------------------------------------- /Doc/Examples/BaseExporter.hh: -------------------------------------------------------------------------------- 1 | class BaseExporter 2 | { 3 | public: 4 | 5 | virtual void update() = 0; 6 | 7 | virtual PVertexIter const_vertices_begin() = 0; 8 | virtual PVertexIter const_vertices_end() = 0; 9 | 10 | virtual PTexCoordIter const_texcoords_begin() = 0; 11 | virtual PTexCoordIter const_texcoords_end() = 0; 12 | 13 | virtual PIdxFaceIter const_idx_faces_begin() = 0; 14 | virtual PIdxFaceIter const_idx_faces_end() = 0; 15 | 16 | virtual PFaceIter const_set_faces_begin() = 0; 17 | virtual PFaceIter const_set_faces_end() = 0; 18 | 19 | virtual unsigned int n_faces() = 0; 20 | virtual unsigned int n_vertices() = 0; 21 | virtual unsigned int n_texcoords() = 0; 22 | }; 23 | -------------------------------------------------------------------------------- /Doc/Examples/BaseImporter.hh: -------------------------------------------------------------------------------- 1 | class BaseImporter 2 | { 3 | public: 4 | 5 | virtual void add_vertex (const OpenMesh::Vec3f&) {}; 6 | virtual void add_normal (const OpenMesh::Vec3f&) {}; 7 | virtual void add_texture (const OpenMesh::Vec2f&) {}; 8 | virtual void add_face (const FaceType&) {}; 9 | }; 10 | -------------------------------------------------------------------------------- /Doc/Examples/BaseReader.hh: -------------------------------------------------------------------------------- 1 | class BaseReader 2 | { 3 | public: 4 | 5 | virtual std::string get_description() const = 0; 6 | virtual std::string get_extensions() const = 0; 7 | virtual std::string get_magic() const { return std::string(""); } 8 | 9 | virtual bool read(std::istream& _is, BaseImporter& _bi) const = 0; 10 | virtual bool read(const std::string& _filename, BaseImporter& _bi) const = 0; 11 | 12 | ... 13 | }; 14 | -------------------------------------------------------------------------------- /Doc/Examples/adasub.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | // ---------------------------------------- 9 | 10 | using OpenMesh::Subdivider::Adaptive; 11 | 12 | // ---------------------------------------- necessary types 13 | 14 | OpenMesh::TriMesh_ArrayKernelT< CompositeTraits > MyMesh; 15 | CompositeT< MyMesh > Subdivider; 16 | 17 | // ---------------------------------------- setup a subdivider 18 | 19 | int main(int argc, char **argv) 20 | { 21 | MyMesh mesh; // create mesh and fill it 22 | 23 | if (!OpenMesh::IO::read_mesh(mesh, argv[1])) 24 | return 1; // error reading mesh 25 | 26 | Subdivider subdivider(mesh); // bind subdivider to mesh 27 | 28 | // -------------------- add some rules 29 | 30 | // anonymous registration 31 | subdivider.add< Tvv3::Handle >(); 32 | subdivider.add< VF::Handle >(); 33 | subdivider.add< FF::Handle >(); 34 | 35 | // 'named' registration 36 | FVc::Handle hFVc; 37 | subdivider.add( hFVc ); 38 | 39 | // print pre-computed coefficients to std::cout... 40 | std::copy(subdivider.rule( hFVc ).coeffs().begin(), 41 | subdivider.rule( hFVc ).coeffs().end(), 42 | std::ostream_iterator(std::cout, ", ")); 43 | 44 | // prepare subdivider and the traits 45 | if (!subdivider.initialize()) 46 | return 1; // error initializing subdivider 47 | 48 | MyMesh::FaceHandle fh; // select a face 49 | subdivider.refine(fh); 50 | } 51 | -------------------------------------------------------------------------------- /Doc/Examples/build-trimesh.cc: -------------------------------------------------------------------------------- 1 | template 2 | struct TriMesh_ArrayKernel_GeneratorT 3 | { 4 | typedef FinalMeshItemsT MeshItems; 5 | typedef AttribKernelT AttribKernel; 6 | typedef ArrayKernelT MeshKernel; 7 | typedef TriMeshT Mesh; 8 | }; 9 | -------------------------------------------------------------------------------- /Doc/Examples/circulator_functions.cc: -------------------------------------------------------------------------------- 1 | /************************************************** 2 | * Vertex circulators 3 | **************************************************/ 4 | 5 | // Get the vertex-vertex circulator (1-ring) of vertex _vh 6 | VertexVertexIter OpenMesh::PolyConnectivity::vv_iter (VertexHandle _vh); 7 | 8 | // Get the vertex-incoming halfedges circulator of vertex _vh 9 | VertexIHalfedgeIter OpenMesh::PolyConnectivity::vih_iter (VertexHandle _vh); 10 | 11 | // Get the vertex-outgoing halfedges circulator of vertex _vh 12 | VertexOHalfedgeIter OpenMesh::PolyConnectivity::voh_iter (VertexHandle _vh); 13 | 14 | // Get the vertex-edge circulator of vertex _vh 15 | VertexEdgeIter OpenMesh::PolyConnectivity::ve_iter (VertexHandle _vh); 16 | 17 | // Get the vertex-face circulator of vertex _vh 18 | VertexFaceIter OpenMesh::PolyConnectivity::vf_iter (VertexHandle _vh); 19 | 20 | /************************************************** 21 | * Face circulators 22 | **************************************************/ 23 | 24 | // Get the face-vertex circulator of face _fh 25 | FaceVertexIter OpenMesh::PolyConnectivity::fv_iter (FaceHandle _fh); 26 | 27 | // Get the face-halfedge circulator of face _fh 28 | FaceHalfedgeIter OpenMesh::PolyConnectivity::fh_iter (FaceHandle _fh); 29 | 30 | // Get the face-edge circulator of face _fh 31 | FaceEdgeIter OpenMesh::PolyConnectivity::fe_iter (FaceHandle _fh); 32 | 33 | // Get the face-face circulator of face _fh 34 | FaceFaceIter OpenMesh::PolyConnectivity::ff_iter (FaceHandle _fh); 35 | -------------------------------------------------------------------------------- /Doc/Examples/circulators.cc: -------------------------------------------------------------------------------- 1 | MyMesh mesh; 2 | 3 | // (linearly) iterate over all vertices 4 | for (MyMesh::VertexIter v_it=mesh.vertices_sbegin(); v_it!=mesh.vertices_end(); ++v_it) 5 | { 6 | // circulate around the current vertex 7 | for (MyMesh::VertexVertexIter vv_it=mesh.vv_iter(*v_it); vv_it.is_valid(); ++vv_it) 8 | { 9 | // do something with e.g. mesh.point(*vv_it) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Doc/Examples/decimater.cc: -------------------------------------------------------------------------------- 1 | using namespace OpenMesh; 2 | 3 | typedef TriMesh_ArrayKernelT<> Mesh; 4 | typedef Decimater::DecimaterT Decimater; 5 | typedef Decimater::ModQuadricT::Handle HModQuadric; 6 | 7 | Mesh mesh; // a mesh object 8 | Decimater decimater(mesh); // a decimater object, connected to a mesh 9 | HModQuadric hModQuadric; // use a quadric module 10 | 11 | decimater.add(hModQuadric); // register module at the decimater 12 | std::cout << decimater.module(hModQuadric).name() << std::endl; // module access 13 | 14 | /* 15 | * since we need exactly one priority module (non-binary) 16 | * we have to call set_binary(false) for our priority module 17 | * in the case of HModQuadric, unset_max_err() calls set_binary(false) internally 18 | */ 19 | decimater.module(hModQuadric).unset_max_err(); 20 | 21 | decimater.initialize(); 22 | decimater.decimate(); 23 | 24 | // after decimation: remove decimated elements from the mesh 25 | mesh.garbage_collection(); 26 | -------------------------------------------------------------------------------- /Doc/Examples/draw_normals.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // draw a face normal if we have one 4 | void drawFaceNormal(const MyMesh::Face& _f) { 5 | drawFaceNormal(_f, GenProg::Bool2Type()); 6 | } 7 | 8 | // normal exists -> use it 9 | void drawFaceNormal(const MyMesh::Face& _f, GenProg::Bool2Type) { 10 | glNormal3fv(_f.normal()); 11 | } 12 | 13 | // empty dummy (no normals) 14 | void drawFaceNormal(const MyMesh::Face& _f, GenProg::Bool2Type){} 15 | -------------------------------------------------------------------------------- /Doc/Examples/iterators.cc: -------------------------------------------------------------------------------- 1 | MyMesh mesh; 2 | 3 | // iterate over all vertices 4 | for (MyMesh::VertexIter v_it=mesh.vertices_begin(); v_it!=mesh.vertices_end(); ++v_it) 5 | ...; // do something with *v_it, v_it->, or *v_it 6 | 7 | // iterate over all halfedges 8 | for (MyMesh::HalfedgeIter h_it=mesh.halfedges_begin(); h_it!=mesh.halfedges_end(); ++h_it) 9 | ...; // do something with *h_it, h_it->, or *h_it 10 | 11 | // iterate over all edges 12 | for (MyMesh::EdgeIter e_it=mesh.edges_begin(); e_it!=mesh.edges_end(); ++e_it) 13 | ...; // do something with *e_it, e_it->, or *e_it 14 | 15 | // iterator over all faces 16 | for (MyMesh::FaceIter f_it=mesh.faces_begin(); f_it!=mesh.faces_end(); ++f_it) 17 | ...; // do something with *f_it, f_it->, or *f_it 18 | 19 | -------------------------------------------------------------------------------- /Doc/Examples/mesh_io.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | MyMesh mesh; 4 | 5 | if (!OpenMesh::IO::read_mesh(mesh, "some input file")) 6 | { 7 | std::cerr << "read error\n"; 8 | exit(1); 9 | } 10 | 11 | // do something with your mesh ... 12 | 13 | if (!OpenMesh::IO::write_mesh(mesh, "some output file")) 14 | { 15 | std::cerr << "write error\n"; 16 | exit(1); 17 | } 18 | -------------------------------------------------------------------------------- /Doc/Examples/mymesh.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | // define traits 5 | struct MyTraits : public OpenMesh::DefaultTraits 6 | { 7 | // use double valued coordinates 8 | typedef OpenMesh::Vec3d Point; 9 | 10 | // use vertex normals and vertex colors 11 | VertexAttributes( OpenMesh::DefaultAttributer::Normal | 12 | OpenMesh::DefaultAttributer::Color ); 13 | 14 | // store the previous halfedge 15 | HalfedgeAttributes( OpenMesh::DefaultAttributer::PrevHalfedge ); 16 | 17 | // use face normals 18 | FaceAttributes( OpenMesh::DefaultAttributer::Normal ); 19 | 20 | // store a face handle for each vertex 21 | VertexTraits 22 | { 23 | typename Base::Refs::FaceHandle my_face_handle; 24 | }; 25 | 26 | }; 27 | 28 | 29 | // Select mesh type (TriMesh) and kernel (ArrayKernel) 30 | // and define my personal mesh type (MyMesh) 31 | typedef OpenMesh::TriMesh_ArrayKernelT MyMesh; 32 | 33 | int main(int argc, char **argv) 34 | { 35 | MyMesh mesh; 36 | 37 | // -------------------- Add dynamic data 38 | 39 | // for each vertex an extra double value 40 | OpenMesh::VPropHandleT< double > vprop_double; 41 | mesh.add_property( vprop_double ); 42 | 43 | // for the mesh an extra string 44 | OpenMesh::MPropHandleT< string > mprop_string; 45 | mesh.add_property( mprop_string ); 46 | 47 | // -------------------- do something 48 | 49 | ...; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /Doc/Examples/nav_code1.cc: -------------------------------------------------------------------------------- 1 | [...] 2 | 3 | TriMesh::HalfedgeHandle heh, heh_init; 4 | 5 | // Get the halfedge handle assigned to vertex[0] 6 | heh = heh_init = mesh.halfedge_handle(vertex[0].handle()); 7 | 8 | // heh now holds the handle to the initial halfedge. 9 | // We now get further on the boundary by requesting 10 | // the next halfedge adjacent to the vertex heh 11 | // points to... 12 | heh = mesh.next_halfedge_handle(heh); 13 | 14 | // We can do this as often as we want: 15 | while(heh != heh_init) { 16 | heh = mesh.next_halfedge_handle(heh); 17 | } 18 | 19 | [...] 20 | -------------------------------------------------------------------------------- /Doc/Examples/nav_code2.cc: -------------------------------------------------------------------------------- 1 | // Test if a halfedge lies at a boundary (is not adjacent to a face) 2 | bool is_boundary (HalfedgeHandle _heh) const 3 | 4 | // Test if an edge lies at a boundary 5 | bool is_boundary (EdgeHandle _eh) const 6 | 7 | // Test if a vertex is adjacent to a boundary edge 8 | bool is_boundary (VertexHandle _vh) const 9 | 10 | // Test if a face has at least one adjacent boundary edge. 11 | // If _check_vertex=true, this function also tests if at least one 12 | // of the adjacent vertices is a boundary vertex 13 | bool is_boundary (FaceHandle _fh, bool _check_vertex=false) const 14 | -------------------------------------------------------------------------------- /Doc/Examples/nav_code3.cc: -------------------------------------------------------------------------------- 1 | [...] 2 | 3 | // Get some vertex handle 4 | PolyMesh::VertexHandle v = ...; 5 | 6 | for(PolyMesh::VertexIHalfedgeIter vih_it = mesh.vih_iter(v); vih_it; ++vih_it) { 7 | // Iterate over all incoming halfedges... 8 | } 9 | 10 | for(PolyMesh::VertexOHalfedgeIter voh_it = mesh.voh_iter(v); voh_it; ++voh_it) { 11 | // Iterate over all outgoing halfedges... 12 | } 13 | 14 | [...] 15 | -------------------------------------------------------------------------------- /Doc/Examples/nav_code4.cc: -------------------------------------------------------------------------------- 1 | // Get the face adjacent to the opposite halfedge 2 | OpenMesh::PolyConnectivity::opposite_face_handle(); 3 | 4 | // Get the handle to the opposite halfedge 5 | OpenMesh::Concepts::KernelT::opposite_halfedge_handle(); 6 | 7 | // Get the opposite vertex to the opposite halfedge 8 | OpenMesh::TriConnectivity::opposite_he_opposite_vh(); 9 | 10 | // Get the vertex assigned to the opposite halfedge 11 | OpenMesh::TriConnectivity::opposite_vh(); 12 | -------------------------------------------------------------------------------- /Doc/Examples/nav_code4a.cc: -------------------------------------------------------------------------------- 1 | // Get the halfedge handle of i.e. the halfedge 2 | // that is associated to the first vertex 3 | // of our set of vertices 4 | PolyMesh::HalfedgeHandle heh = mesh.halfedge_handle(*(mesh.vertices_begin())); 5 | 6 | // Now get the handle of its opposing halfedge 7 | PolyMesh::HalfedgeHandle opposite_heh = mesh.opposite_halfedge_handle(heh); 8 | -------------------------------------------------------------------------------- /Doc/Examples/nav_code_to_from.cc: -------------------------------------------------------------------------------- 1 | // Get the handle of the to vertex 2 | OpenMesh::Concepts::KernelT::to_vertex_handle(); 3 | 4 | // Get the handle of the from vertex 5 | OpenMesh::Concepts::KernelT::from_vertex_handle(); 6 | -------------------------------------------------------------------------------- /Doc/Examples/traits0.cc: -------------------------------------------------------------------------------- 1 | struct DefaultTraits 2 | { 3 | typedef Vec3f Point; 4 | typedef Vec3f Normal; 5 | typedef Vec2f TexCoord; 6 | typedef Vec3uc Color; 7 | 8 | VertexTraits {}; 9 | HalfedgeTraits {}; 10 | EdgeTraits {}; 11 | FaceTraits {}; 12 | 13 | VertexAttributes(0); 14 | HalfedgeAttributes(Attributes::PrevHalfedge); 15 | EdgeAttributes(0); 16 | FaceAttributes(0); 17 | }; 18 | -------------------------------------------------------------------------------- /Doc/Examples/traits1.cc: -------------------------------------------------------------------------------- 1 | struct MyTraits : public OpenMesh::DefaultTraits 2 | { 3 | typedef OpenMesh::Vec3d Point; // use double-values points 4 | }; 5 | -------------------------------------------------------------------------------- /Doc/Examples/traits2.cc: -------------------------------------------------------------------------------- 1 | struct MyTraits : public OpenMesh::DefaultTraits 2 | { 3 | VertexTraits 4 | { 5 | int some_additional_index; 6 | }; 7 | }; 8 | -------------------------------------------------------------------------------- /Doc/Examples/traits3.cc: -------------------------------------------------------------------------------- 1 | struct MyTraits : public OpenMesh::DefaultTraits 2 | { 3 | template struct VertexT : public Base 4 | { 5 | int some_additional_index; 6 | }; 7 | }; 8 | -------------------------------------------------------------------------------- /Doc/Examples/traits4.cc: -------------------------------------------------------------------------------- 1 | struct MyTraits : public OpenMesh::DefaultTraits 2 | { 3 | VertexTraits 4 | { 5 | int some_additional_index; 6 | typename Base::Refs::FaceHandle my_face_handle; 7 | }; 8 | }; 9 | -------------------------------------------------------------------------------- /Doc/Examples/traits5.cc: -------------------------------------------------------------------------------- 1 | struct MyTraits : public OpenMesh::DefaultTraits 2 | { 3 | VertexAttributes( OpenMesh::Attributes::Normal | 4 | OpenMesh::Attributes::Color ); 5 | 6 | FaceAttributes( OpenMesh::Attributes::Normal ); 7 | }; 8 | -------------------------------------------------------------------------------- /Doc/Tutorial/02-iterators/smooth.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | // -------------------- OpenMesh 4 | #include 5 | #include 6 | 7 | typedef OpenMesh::TriMesh_ArrayKernelT<> MyMesh; 8 | 9 | 10 | int main(int argc, char **argv) 11 | { 12 | MyMesh mesh; 13 | 14 | 15 | // check command line options 16 | if (argc != 4) 17 | { 18 | std::cerr << "Usage: " << argv[0] << " #iterations infile outfile\n"; 19 | return 1; 20 | } 21 | 22 | 23 | // read mesh from stdin 24 | if ( ! OpenMesh::IO::read_mesh(mesh, argv[2]) ) 25 | { 26 | std::cerr << "Error: Cannot read mesh from " << argv[2] << std::endl; 27 | return 1; 28 | } 29 | 30 | 31 | // this vector stores the computed centers of gravity 32 | std::vector cogs; 33 | std::vector::iterator cog_it; 34 | cogs.reserve(mesh.n_vertices()); 35 | 36 | 37 | // smoothing mesh argv[1] times 38 | MyMesh::VertexIter v_it, v_end(mesh.vertices_end()); 39 | MyMesh::VertexVertexIter vv_it; 40 | MyMesh::Point cog; 41 | MyMesh::Scalar valence; 42 | unsigned int i, N(atoi(argv[1])); 43 | 44 | 45 | for (i=0; i < N; ++i) 46 | { 47 | cogs.clear(); 48 | for (v_it=mesh.vertices_begin(); v_it!=v_end; ++v_it) 49 | { 50 | cog[0] = cog[1] = cog[2] = valence = 0.0; 51 | 52 | for (vv_it=mesh.vv_iter( *v_it ); vv_it.is_valid(); ++vv_it) 53 | { 54 | cog += mesh.point( *vv_it ); 55 | ++valence; 56 | } 57 | 58 | cogs.push_back(cog / valence); 59 | } 60 | 61 | for (v_it=mesh.vertices_begin(), cog_it=cogs.begin(); 62 | v_it!=v_end; ++v_it, ++cog_it) 63 | if ( !mesh.is_boundary( *v_it ) ) 64 | mesh.set_point( *v_it, *cog_it ); 65 | } 66 | 67 | 68 | // write mesh to stdout 69 | if ( ! OpenMesh::IO::write_mesh(mesh, argv[3]) ) 70 | { 71 | std::cerr << "Error: cannot write mesh to " << argv[3] << std::endl; 72 | return 1; 73 | } 74 | 75 | return 0; 76 | } 77 | -------------------------------------------------------------------------------- /Doc/Tutorial/03-properties/smooth.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | using MyMesh = OpenMesh::TriMesh_ArrayKernelT<>; 9 | 10 | int main(int argc, char** argv) 11 | { 12 | // Read command line options 13 | MyMesh mesh; 14 | if (argc != 4) { 15 | std::cerr << "Usage: " << argv[0] << " #iterations infile outfile" << std::endl; 16 | return 1; 17 | } 18 | const int iterations = argv[1]; 19 | const std::string infile = argv[2]; 20 | const std::string outfile = argv[3]; 21 | 22 | // Read mesh file 23 | if (!OpenMesh::IO::read_mesh(mesh, infile)) { 24 | std::cerr << "Error: Cannot read mesh from " << infile << std::endl; 25 | return 1; 26 | } 27 | 28 | { 29 | // Add a vertex property storing the computed centers of gravity 30 | auto cog = OpenMesh::makeTemporaryProperty(mesh); 31 | 32 | // Smooth the mesh several times 33 | for (int i = 0; i < iterations; ++i) { 34 | // Iterate over all vertices to compute centers of gravity 35 | for (const auto& vh : mesh.vertices()) { 36 | cog[vh] = {0,0,0}; 37 | int valence = 0; 38 | // Iterate over all 1-ring vertices around vh 39 | for (const auto& vvh : mesh.vv_range(vh)) { 40 | cog[vh] += mesh.point(vvh); 41 | ++valence; 42 | } 43 | cog[vh] /= valence; 44 | } 45 | // Move all vertices to the previously computed positions 46 | for (const auto& vh : mesh.vertices()) { 47 | mesh.point(vh) = cog[vh]; 48 | } 49 | } 50 | } // The cog vertex property is removed from the mesh at the end of this scope 51 | 52 | // Write mesh file 53 | if (!OpenMesh::IO::read_mesh(mesh, outfile)) { 54 | std::cerr << "Error: Cannot write mesh to " << outfile << std::endl; 55 | return 1; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Doc/Tutorial/04-stl_algorithms/smooth.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | // -------------------- OpenMesh 4 | #include 5 | #include 6 | // -------------------- 7 | #include "smooth_algo.hh" 8 | 9 | 10 | // ---------------------------------------------------------------------------- 11 | 12 | #ifndef DOXY_IGNORE_THIS 13 | 14 | struct MyTraits : public OpenMesh::DefaultTraits 15 | { 16 | HalfedgeAttributes(OpenMesh::Attributes::PrevHalfedge); 17 | }; 18 | 19 | #endif 20 | 21 | typedef OpenMesh::TriMesh_ArrayKernelT MyMesh; 22 | 23 | 24 | // ---------------------------------------------------------------------------- 25 | 26 | int main(int argc, char **argv) 27 | { 28 | MyMesh mesh; 29 | 30 | 31 | // check command line options 32 | if (argc != 4) 33 | { 34 | std::cerr << "Usage: " << argv[0] << " #iterations infile outfile\n"; 35 | return 1; 36 | } 37 | 38 | 39 | // read mesh from stdin 40 | if ( ! OpenMesh::IO::read_mesh(mesh, argv[2]) ) 41 | { 42 | std::cerr << "Error: Cannot read mesh from " << argv[2] << std::endl; 43 | return 1; 44 | } 45 | 46 | 47 | // smoothing mesh argv[1] times 48 | SmootherT smoother(mesh); 49 | smoother.smooth(atoi(argv[1])); 50 | 51 | 52 | // write mesh to stdout 53 | if ( ! OpenMesh::IO::write_mesh(mesh, argv[3]) ) 54 | { 55 | std::cerr << "Error: cannot write mesh to " << argv[3] << std::endl; 56 | return 1; 57 | } 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /Doc/Tutorial/04-stl_algorithms/smooth_algo.hh: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifndef DOXY_IGNORE_THIS 5 | 6 | template class SmootherT 7 | { 8 | public: 9 | 10 | typedef typename Mesh::Point cog_t; 11 | typedef OpenMesh::VPropHandleT< cog_t > Property_cog; 12 | 13 | public: 14 | 15 | // construct with a given mesh 16 | explicit SmootherT(Mesh& _mesh) 17 | : mesh_(_mesh) 18 | { 19 | mesh_.add_property( cog_ ); 20 | } 21 | 22 | ~SmootherT() 23 | { 24 | mesh_.remove_property( cog_ ); 25 | } 26 | 27 | // smooth mesh _iterations times 28 | void smooth(unsigned int _iterations) 29 | { 30 | for (unsigned int i=0; i < _iterations; ++i) 31 | { 32 | std::for_each(mesh_.vertices_begin(), 33 | mesh_.vertices_end(), 34 | ComputeCOG(mesh_, cog_)); 35 | 36 | std::for_each(mesh_.vertices_begin(), 37 | mesh_.vertices_end(), 38 | SetCOG(mesh_, cog_)); 39 | } 40 | } 41 | 42 | 43 | private: 44 | 45 | 46 | //--- private classes --- 47 | 48 | class ComputeCOG 49 | { 50 | public: 51 | ComputeCOG(Mesh& _mesh, Property_cog& _cog) 52 | : mesh_(_mesh), cog_(_cog) 53 | {} 54 | 55 | void operator()(const typename Mesh::VertexHandle& _vh) 56 | { 57 | typename Mesh::VertexVertexIter vv_it; 58 | typename Mesh::Scalar valence(0.0); 59 | 60 | mesh_.property(cog_, _vh) = typename Mesh::Point(0.0, 0.0, 0.0); 61 | 62 | for (vv_it=mesh_.vv_iter(_vh); vv_it.is_valid(); ++vv_it) 63 | { 64 | mesh_.property(cog_, _vh) += mesh_.point( *vv_it ); 65 | ++valence; 66 | } 67 | 68 | mesh_.property(cog_, _vh ) /= valence; 69 | } 70 | 71 | private: 72 | Mesh& mesh_; 73 | Property_cog& cog_; 74 | }; 75 | 76 | 77 | class SetCOG 78 | { 79 | public: 80 | SetCOG(Mesh& _mesh, Property_cog& _cog) 81 | : mesh_(_mesh), cog_(_cog) 82 | {} 83 | 84 | void operator()(const typename Mesh::VertexHandle& _vh) 85 | { 86 | 87 | if (!mesh_.is_boundary(_vh)) 88 | mesh_.set_point( _vh, mesh_.property(cog_, _vh) ); 89 | } 90 | 91 | private: 92 | 93 | Mesh& mesh_; 94 | Property_cog& cog_; 95 | }; 96 | 97 | 98 | //--- private elements --- 99 | 100 | Mesh& mesh_; 101 | Property_cog cog_; 102 | }; 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /Doc/Tutorial/05-std_properties/properties.cc: -------------------------------------------------------------------------------- 1 | #include 2 | // -------------------- 3 | #include 4 | #include 5 | 6 | 7 | typedef OpenMesh::TriMesh_ArrayKernelT<> MyMesh; 8 | 9 | 10 | int main(int argc, char **argv) 11 | { 12 | MyMesh mesh; 13 | 14 | if (argc!=2) 15 | { 16 | std::cerr << "Usage: " << argv[0] << " \n"; 17 | return 1; 18 | } 19 | 20 | // request vertex normals, so the mesh reader can use normal information 21 | // if available 22 | mesh.request_vertex_normals(); 23 | 24 | // assure we have vertex normals 25 | if (!mesh.has_vertex_normals()) 26 | { 27 | std::cerr << "ERROR: Standard vertex property 'Normals' not available!\n"; 28 | return 1; 29 | } 30 | 31 | OpenMesh::IO::Options opt; 32 | if ( ! OpenMesh::IO::read_mesh(mesh,argv[1], opt)) 33 | { 34 | std::cerr << "Error loading mesh from file " << argv[1] << std::endl; 35 | return 1; 36 | } 37 | 38 | // If the file did not provide vertex normals, then calculate them 39 | if ( !opt.check( OpenMesh::IO::Options::VertexNormal ) ) 40 | { 41 | // we need face normals to update the vertex normals 42 | mesh.request_face_normals(); 43 | 44 | // let the mesh update the normals 45 | mesh.update_normals(); 46 | 47 | // dispose the face normals, as we don't need them anymore 48 | mesh.release_face_normals(); 49 | } 50 | 51 | // move all vertices one unit length along it's normal direction 52 | for (MyMesh::VertexIter v_it = mesh.vertices_begin(); 53 | v_it != mesh.vertices_end(); ++v_it) 54 | { 55 | std::cout << "Vertex #" << *v_it << ": " << mesh.point( *v_it ); 56 | mesh.set_point( *v_it, mesh.point(*v_it)+mesh.normal(*v_it) ); 57 | std::cout << " moved to " << mesh.point( *v_it ) << std::endl; 58 | } 59 | 60 | // don't need the normals anymore? Remove them! 61 | mesh.release_vertex_normals(); 62 | 63 | // just check if it really works 64 | if (mesh.has_vertex_normals()) 65 | { 66 | std::cerr << "Ouch! ERROR! Shouldn't have any vertex normals anymore!\n"; 67 | return 1; 68 | } 69 | 70 | return 0; 71 | } 72 | -------------------------------------------------------------------------------- /Doc/Tutorial/06-attributes/attributes.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | // -------------------- 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | #ifndef DOXY_IGNORE_THIS 10 | 11 | // Define my personal traits 12 | struct MyTraits : OpenMesh::DefaultTraits 13 | { 14 | // Let Point and Normal be a vector of doubles 15 | typedef OpenMesh::Vec3d Point; 16 | typedef OpenMesh::Vec3d Normal; 17 | 18 | // Already defined in OpenMesh::DefaultTraits 19 | // HalfedgeAttributes( OpenMesh::Attributes::PrevHalfedge ); 20 | 21 | // Uncomment next line to disable attribute PrevHalfedge 22 | // HalfedgeAttributes( OpenMesh::Attributes::None ); 23 | // 24 | // or 25 | // 26 | // HalfedgeAttributes( 0 ); 27 | }; 28 | 29 | #endif 30 | 31 | // Define my mesh with the new traits! 32 | typedef OpenMesh::TriMesh_ArrayKernelT MyMesh; 33 | 34 | // ------------------------------------------------------------------ main ---- 35 | 36 | int main(int argc, char **argv) 37 | { 38 | MyMesh mesh; 39 | 40 | if (argc!=2) 41 | { 42 | std::cerr << "Usage: " << argv[0] << " \n"; 43 | return 1; 44 | } 45 | 46 | // Just make sure that point element type is double 47 | if ( typeid( OpenMesh::vector_traits::value_type ) 48 | != typeid(double) ) 49 | { 50 | std::cerr << "Ouch! ERROR! Data type is wrong!\n"; 51 | return 1; 52 | } 53 | 54 | // Make sure that normal element type is double 55 | if ( typeid( OpenMesh::vector_traits::value_type ) 56 | != typeid(double) ) 57 | { 58 | std::cerr << "Ouch! ERROR! Data type is wrong!\n"; 59 | return 1; 60 | } 61 | 62 | // Add vertex normals as default property (ref. previous tutorial) 63 | mesh.request_vertex_normals(); 64 | 65 | // Add face normals as default property 66 | mesh.request_face_normals(); 67 | 68 | // load a mesh 69 | OpenMesh::IO::Options opt; 70 | if ( ! OpenMesh::IO::read_mesh(mesh,argv[1], opt)) 71 | { 72 | std::cerr << "Error loading mesh from file " << argv[1] << std::endl; 73 | return 1; 74 | } 75 | 76 | // If the file did not provide vertex normals, then calculate them 77 | if ( !opt.check( OpenMesh::IO::Options::VertexNormal ) && 78 | mesh.has_face_normals() && mesh.has_vertex_normals() ) 79 | { 80 | // let the mesh update the normals 81 | mesh.update_normals(); 82 | } 83 | 84 | // move all vertices one unit length along it's normal direction 85 | for (MyMesh::VertexIter v_it = mesh.vertices_begin(); 86 | v_it != mesh.vertices_end(); ++v_it) 87 | { 88 | std::cout << "Vertex #" << *v_it << ": " << mesh.point( *v_it ); 89 | mesh.set_point( *v_it, mesh.point(*v_it)+mesh.normal(*v_it) ); 90 | std::cout << " moved to " << mesh.point( *v_it ) << std::endl; 91 | } 92 | 93 | return 0; 94 | } 95 | -------------------------------------------------------------------------------- /Doc/Tutorial/09-persistence/fill_props.hh: -------------------------------------------------------------------------------- 1 | #ifndef FILL_PROPS_HH 2 | #define FILL_PROPS_HH 3 | 4 | #include 5 | #include "int2roman.hh" 6 | 7 | 8 | template 9 | bool 10 | fill_props( Mesh& _m, OpenMesh::VPropHandleT _ph, bool _check=false) 11 | { 12 | static float a[9] = { 1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f }; 13 | 14 | for(typename Mesh::VertexIter it=_m.vertices_begin(); 15 | it != _m.vertices_end(); ++it) 16 | { 17 | const float v = a[it->idx()%9]; 18 | if ( _check && !(_m.property( _ph, *it ) == v) ) 19 | return false; 20 | else 21 | _m.property( _ph, *it ) = v; 22 | } 23 | return true; 24 | } 25 | 26 | 27 | template 28 | bool 29 | fill_props( Mesh& _m, OpenMesh::EPropHandleT _ph, bool _check=false ) 30 | { 31 | 32 | for( typename Mesh::EdgeIter it=_m.edges_begin(); 33 | it != _m.edges_end(); ++it) 34 | { 35 | const size_t n = it->idx(); 36 | const bool v = ((n&(n-1))==0); // true for 0,1,2,4,8,.. 37 | 38 | if (_check && _m.property( _ph, *it ) != v) 39 | { 40 | std::cout << " eprop_bool: " << n << " -> " 41 | << _m.property(_ph, *it ) << " != " << v << std::endl; 42 | return false; 43 | } 44 | else 45 | { 46 | _m.property( _ph, *it ) = v; 47 | std::cout << " eprop_bool: " << n << " -> " << v << std::endl; 48 | } 49 | } 50 | return true; 51 | } 52 | 53 | 54 | 55 | template 56 | bool 57 | fill_props(Mesh& _m, OpenMesh::FPropHandleT _ph, bool _check=false) 58 | { 59 | 60 | for( typename Mesh::FaceIter it=_m.faces_begin(); 61 | it != _m.faces_end(); ++it) 62 | { 63 | const int n = (it->idx()) + 1; 64 | _m.property( _ph, *it ) = int2roman(n); 65 | } 66 | return true; 67 | } 68 | 69 | 70 | template 71 | bool 72 | fill_props( Mesh& _m, OpenMesh::HPropHandleT _ph, bool _check=false) 73 | { 74 | T v; 75 | static float a[9] = { 1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f }; 76 | static float b[9] = { 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f }; 77 | static float c[9] = { 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f, 2.2f }; 78 | static float d[9] = { 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f, 2.2f, 3.3f }; 79 | static double values[9] = { 0.1, 0.02, 0.003, 0.0004, 0.00005, 0.000006, 80 | 0.0000007, 0.00000008, 0.000000009 }; 81 | 82 | for( typename Mesh::HalfedgeIter it=_m.halfedges_begin(); 83 | it != _m.halfedges_end(); ++it) 84 | { 85 | const int n = it->idx(); 86 | 87 | v = it->idx()+1; // ival 88 | v = values[n%9]; // dval 89 | v = ((n&(n-1))==0); // bval 90 | v.vec4fval[0] = a[n%9]; 91 | v.vec4fval[1] = b[n%9]; 92 | v.vec4fval[2] = c[n%9]; 93 | v.vec4fval[3] = d[n%9]; 94 | 95 | if ( _check && _m.property( _ph, *it ) != v ) 96 | return false; 97 | else 98 | _m.property( _ph, *it ) = v; 99 | } 100 | return true; 101 | } 102 | 103 | template 104 | bool 105 | fill_props( Mesh& _m, OpenMesh::MPropHandleT _ph, bool _check=false) 106 | { 107 | for( typename Mesh::FaceIter it=_m.faces_begin(); it != _m.faces_end(); ++it) 108 | { 109 | const size_t idx = it->idx(); 110 | if ( _check && _m.property( _ph )[int2roman(idx+1)] != idx ) 111 | return false; 112 | else 113 | _m.property( _ph )[int2roman(idx+1)] = idx; 114 | } 115 | return true; 116 | } 117 | 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /Doc/Tutorial/09-persistence/generate_cube.hh: -------------------------------------------------------------------------------- 1 | #ifndef GENERATE_CUBE_HH 2 | #define GENERATE_CUBE_HH 3 | 4 | template 5 | size_t generate_cube( MeshType& mesh ) 6 | { 7 | typedef typename MeshType::VertexHandle VertexHandle; 8 | typedef typename MeshType::Point Point; 9 | 10 | typename MeshType::VertexHandle vhandle[8]; 11 | 12 | vhandle[0] = mesh.add_vertex(Point(-1, -1, 1)); 13 | vhandle[1] = mesh.add_vertex(Point( 1, -1, 1)); 14 | vhandle[2] = mesh.add_vertex(Point( 1, 1, 1)); 15 | vhandle[3] = mesh.add_vertex(Point(-1, 1, 1)); 16 | vhandle[4] = mesh.add_vertex(Point(-1, -1, -1)); 17 | vhandle[5] = mesh.add_vertex(Point( 1, -1, -1)); 18 | vhandle[6] = mesh.add_vertex(Point( 1, 1, -1)); 19 | vhandle[7] = mesh.add_vertex(Point(-1, 1, -1)); 20 | 21 | // generate (quadrilateral) faces 22 | 23 | std::vector< VertexHandle > face_vhandles; 24 | 25 | face_vhandles.clear(); 26 | face_vhandles.push_back(vhandle[0]); 27 | face_vhandles.push_back(vhandle[1]); 28 | face_vhandles.push_back(vhandle[2]); 29 | face_vhandles.push_back(vhandle[3]); 30 | mesh.add_face(face_vhandles); 31 | 32 | face_vhandles.clear(); 33 | face_vhandles.push_back(vhandle[7]); 34 | face_vhandles.push_back(vhandle[6]); 35 | face_vhandles.push_back(vhandle[5]); 36 | face_vhandles.push_back(vhandle[4]); 37 | mesh.add_face(face_vhandles); 38 | 39 | face_vhandles.clear(); 40 | face_vhandles.push_back(vhandle[1]); 41 | face_vhandles.push_back(vhandle[0]); 42 | face_vhandles.push_back(vhandle[4]); 43 | face_vhandles.push_back(vhandle[5]); 44 | mesh.add_face(face_vhandles); 45 | 46 | face_vhandles.clear(); 47 | face_vhandles.push_back(vhandle[2]); 48 | face_vhandles.push_back(vhandle[1]); 49 | face_vhandles.push_back(vhandle[5]); 50 | face_vhandles.push_back(vhandle[6]); 51 | mesh.add_face(face_vhandles); 52 | 53 | face_vhandles.clear(); 54 | face_vhandles.push_back(vhandle[3]); 55 | face_vhandles.push_back(vhandle[2]); 56 | face_vhandles.push_back(vhandle[6]); 57 | face_vhandles.push_back(vhandle[7]); 58 | mesh.add_face(face_vhandles); 59 | 60 | face_vhandles.clear(); 61 | face_vhandles.push_back(vhandle[0]); 62 | face_vhandles.push_back(vhandle[3]); 63 | face_vhandles.push_back(vhandle[7]); 64 | face_vhandles.push_back(vhandle[4]); 65 | mesh.add_face(face_vhandles); 66 | 67 | return mesh.n_vertices(); 68 | }; 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /Doc/Tutorial/09-persistence/int2roman.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #if defined(OM_CC_MIPS) 3 | # include 4 | #else 5 | # include 6 | #endif 7 | #include "int2roman.hh" 8 | 9 | 10 | std::string int2roman( size_t decimal, size_t length ) 11 | { 12 | assert( decimal > 0 && decimal < 1000 ); 13 | 14 | const size_t nrows = 4; 15 | const size_t ncols = 4; 16 | 17 | static size_t table_arabs[ nrows ][ ncols ] = { { 1000, 1000, 1000, 1000 }, 18 | { 900, 500, 400, 100 }, 19 | { 90, 50, 40, 10 }, 20 | { 9, 5, 4, 1 } }; 21 | 22 | static char *table_romans[ nrows ][ ncols ] = { { "M", "M", "M", "M" }, 23 | { "CM", "D", "CD", "C" }, 24 | { "XC", "L", "XL", "X" }, 25 | { "IX", "V", "IV", "I" } }; 26 | 27 | size_t power; // power of ten 28 | size_t index; // Indexes thru values to subtract 29 | 30 | std::string roman = ""; 31 | roman.reserve(length); 32 | 33 | for ( power = 0; power < nrows; power++ ) 34 | for ( index = 0; index < ncols; index++ ) 35 | while ( decimal >= table_arabs[ power ][ index ] ) 36 | { 37 | roman += table_romans[ power ][ index ]; 38 | decimal -= table_arabs[ power ][ index ]; 39 | } 40 | 41 | return roman; 42 | } 43 | -------------------------------------------------------------------------------- /Doc/Tutorial/09-persistence/int2roman.hh: -------------------------------------------------------------------------------- 1 | #ifndef INT2ROMAN_HH 2 | #define INT2ROMAN_HH 3 | 4 | #include 5 | 6 | std::string int2roman( size_t decimal, size_t length=30 ); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /Doc/Tutorial/09-persistence/stats.hh: -------------------------------------------------------------------------------- 1 | #ifndef STATS_HH 2 | #define STATS_HH 3 | 4 | template 5 | void mesh_stats( Mesh& _m, const std::string& prefix = "" ) 6 | { 7 | std::cout << prefix 8 | << _m.n_vertices() << " vertices, " 9 | << _m.n_edges() << " edges, " 10 | << _m.n_faces() << " faces\n"; 11 | } 12 | 13 | template 14 | void mesh_property_stats(Mesh& _m) 15 | { 16 | std::cout << "Current set of properties:\n"; 17 | _m.property_stats(std::cout); 18 | } 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /Doc/Tutorial/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGCommon) 2 | 3 | include_directories ( 4 | ../../.. 5 | ${CMAKE_CURRENT_SOURCE_DIR} 6 | ) 7 | 8 | set (targetName MyOwnProject) 9 | 10 | # collect all header and source files 11 | acg_append_files (headers "*.hh" .) 12 | acg_append_files (sources "*.cc" .) 13 | 14 | acg_add_executable (${targetName} ${headers} ${sources}) 15 | 16 | target_link_libraries (${targetName} 17 | OpenMeshCore 18 | OpenMeshTools 19 | ) 20 | 21 | -------------------------------------------------------------------------------- /Doc/html/acg_footer.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 | 6 | Project $projectname, 7 | ©  Computer Graphics Group, RWTH Aachen. 8 | Documentation generated using 9 | 10 | doxygen 11 | . 12 | 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /Doc/html/logo_align.css: -------------------------------------------------------------------------------- 1 | 2 | #projectlogo 3 | { 4 | padding-right:64px; 5 | right:0px; 6 | position:absolute; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /Doc/images/OpenMesh_text_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/OpenMesh_text_128.png -------------------------------------------------------------------------------- /Doc/images/class-hierarchy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/class-hierarchy.png -------------------------------------------------------------------------------- /Doc/images/class-hierarchy2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/class-hierarchy2.png -------------------------------------------------------------------------------- /Doc/images/collapse_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/collapse_info.png -------------------------------------------------------------------------------- /Doc/images/diagrams.sxi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/diagrams.sxi -------------------------------------------------------------------------------- /Doc/images/halfedge_structure.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/halfedge_structure.gif -------------------------------------------------------------------------------- /Doc/images/halfedge_structure2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/halfedge_structure2.png -------------------------------------------------------------------------------- /Doc/images/halfedge_structure3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/halfedge_structure3.png -------------------------------------------------------------------------------- /Doc/images/inheritance-simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/inheritance-simple.png -------------------------------------------------------------------------------- /Doc/images/inheritance-simple.scaled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/inheritance-simple.scaled.png -------------------------------------------------------------------------------- /Doc/images/inheritance.fig: -------------------------------------------------------------------------------- 1 | #FIG 3.2 2 | Landscape 3 | Center 4 | Inches 5 | Letter 6 | 100.00 7 | Single 8 | -2 9 | 1200 2 10 | 2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 11 | 1 1 2.00 120.00 240.00 12 | 2550 3900 2550 3300 13 | 2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 14 | 1 1 2.00 120.00 240.00 15 | 2550 2700 2550 2100 16 | 2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5 17 | 1500 1500 3600 1500 3600 2100 1500 2100 1500 1500 18 | 2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5 19 | 1500 2700 3600 2700 3600 3300 1500 3300 1500 2700 20 | 2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5 21 | 1500 3900 3600 3900 3600 4500 1500 4500 1500 3900 22 | 4 1 0 50 0 0 25 0.0000 4 255 990 2475 1950 Kernel\001 23 | 4 1 0 50 0 0 25 0.0000 4 345 1500 2550 3150 PolyMesh\001 24 | 4 1 0 50 0 0 25 0.0000 4 255 1290 2550 4350 TriMesh\001 25 | -------------------------------------------------------------------------------- /Doc/images/inheritance.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/inheritance.gif -------------------------------------------------------------------------------- /Doc/images/iomanager.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/iomanager.gif -------------------------------------------------------------------------------- /Doc/images/iomanager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/iomanager.png -------------------------------------------------------------------------------- /Doc/images/mesh.collapse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/mesh.collapse.png -------------------------------------------------------------------------------- /Doc/images/mesh.flip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/mesh.flip.png -------------------------------------------------------------------------------- /Doc/images/mesh.inner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/mesh.inner.png -------------------------------------------------------------------------------- /Doc/images/mesh.inout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/mesh.inout.png -------------------------------------------------------------------------------- /Doc/images/mesh.normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/mesh.normal.png -------------------------------------------------------------------------------- /Doc/images/mesh.opp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/mesh.opp.png -------------------------------------------------------------------------------- /Doc/images/mesh.outer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/mesh.outer.png -------------------------------------------------------------------------------- /Doc/images/mesh.to.from.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/mesh.to.from.png -------------------------------------------------------------------------------- /Doc/images/om-format.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/om-format.png -------------------------------------------------------------------------------- /Doc/images/rwth_vci_rgb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/Doc/images/rwth_vci_rgb.jpg -------------------------------------------------------------------------------- /Doc/images/src/iomanager.tex: -------------------------------------------------------------------------------- 1 | \documentclass{minimal} 2 | 3 | % Tikz 4 | \usepackage{pgf} 5 | \usepackage{tikz} 6 | 7 | \usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,% 8 | decorations.pathreplacing,decorations.pathmorphing,shapes,% 9 | matrix,shapes.symbols,positioning} 10 | 11 | \tikzset{ 12 | kiste/.style={ 13 | rectangle, 14 | rounded corners, 15 | % fill=black!10, 16 | draw=black, very thick, 17 | text width=10em, 18 | minimum height=3em, 19 | text centered}, 20 | kkiste/.style={ 21 | rectangle, 22 | rounded corners, 23 | % fill=black!10, 24 | draw=black, very thick, 25 | text width=7em, 26 | minimum height=2em, 27 | text centered}, 28 | } 29 | 30 | \begin{document} 31 | \begin{center} 32 | \begin{tikzpicture} 33 | 34 | \node[kiste](IOM) at (0,0) {IOManager}; 35 | \node[kiste,rotate=90](PD) at (-5,-4) {Persistent Data}; 36 | \node[kiste,rotate=-90](DS) at (5,-4) {Data Structures}; 37 | 38 | \path[fill=yellow!20,rounded corners,draw=black!50, dashed] 39 | (-3.5,-2) rectangle (-0.5,-6); 40 | \path[fill=yellow!20,rounded corners,draw=black!50, dashed] 41 | (.5,-2) rectangle (3.5,-6); 42 | 43 | \node[] at (-2,-2.5) {Reader/Writer}; 44 | \node[kkiste] at (-2,-3.5) {OBJ}; 45 | \node[] at (-2,-4.25) {$\vdots$}; 46 | \node[kkiste] at (-2,-5.25) {Custom file format}; 47 | 48 | \node[] at (2,-2.5) {Importer/Exporter}; 49 | \node[kkiste] at (2,-3.5) {OpenMesh}; 50 | \node[] at (2,-4.25) {$\vdots$}; 51 | \node[kkiste] at (2,-5.25) {Custom data structure}; 52 | 53 | \path [draw,thick,>=latex,<->] (-0.1,-0.6) -- (-2,-1.9) {}; 54 | \path [draw,thick,>=latex,<->] (0.1,-0.6) -- (2,-1.9) {}; 55 | 56 | \path [draw,thick,>=latex,->] (-4.4,-3.8) -- (-3.6,-3.8) {}; 57 | \path [draw,thick,>=latex,<-] (-4.4,-4.2) -- (-3.6,-4.2) {}; 58 | 59 | \path [draw,thick,>=latex,->] (4.4,-3.8) -- (3.6,-3.8) {}; 60 | \path [draw,thick,>=latex,<-] (4.4,-4.2) -- (3.6,-4.2) {}; 61 | 62 | \end{tikzpicture} 63 | \end{center} 64 | 65 | \end{document} 66 | -------------------------------------------------------------------------------- /Doc/images/src/mesh.flip.tex: -------------------------------------------------------------------------------- 1 | \documentclass{minimal} 2 | 3 | % Tikz 4 | \usepackage{pgf} 5 | \usepackage{tikz} 6 | \usepackage{color} 7 | 8 | \definecolor{ACG}{RGB}{55,91,64} 9 | 10 | \begin{document} 11 | 12 | \begin{center} 13 | 14 | %\colorbox{ACG}{ 15 | 16 | \begin{tikzpicture} 17 | [ 18 | vertex/.style={draw=none,circle,fill=white,minimum size=2pt}, 19 | edge/.style={draw,white,thick}, 20 | redge/.style={line width=3pt,color=red!50!white} 21 | ] 22 | 23 | \begin{scope}[xshift=-5cm] 24 | 25 | \coordinate (V1) at (-3,3); 26 | \coordinate (V2) at (0,0); 27 | \coordinate (V3) at (0,6); 28 | \coordinate (V4) at (3,3); 29 | 30 | \draw[edge] (V1) to (V2) {}; 31 | 32 | \draw[edge] (V1) -- (V3) {}; 33 | 34 | \draw[redge] (V1) -- (V4) {}; 35 | 36 | \draw[edge] (V2) -- (V4) {}; 37 | 38 | \draw[edge] (V3) -- (V4) {}; 39 | 40 | \node[vertex] at (V1) {}; 41 | \node[vertex] at (V2) {}; 42 | \node[vertex] at (V3) {}; 43 | \node[vertex] at (V4) {}; 44 | 45 | \end{scope} 46 | 47 | \draw[->,>=latex,thick,white] (-1.5, 4) arc (105:75:6); 48 | \node[above] at (0, 4.2) {\textcolor{white}{\textbf{Flip edge}}}; 49 | 50 | \begin{scope}[xshift=5cm] 51 | 52 | \coordinate (V1) at (-3,3); 53 | \coordinate (V2) at (0,0); 54 | \coordinate (V3) at (0,6); 55 | \coordinate (V4) at (3,3); 56 | 57 | \draw[edge] (V1) to (V2) {}; 58 | 59 | \draw[edge] (V1) -- (V3) {}; 60 | 61 | \draw[redge] (V2) -- (V3) {}; 62 | 63 | \draw[edge] (V2) -- (V4) {}; 64 | 65 | \draw[edge] (V3) -- (V4) {}; 66 | 67 | \node[vertex] at (V1) {}; 68 | \node[vertex] at (V2) {}; 69 | \node[vertex] at (V3) {}; 70 | \node[vertex] at (V4) {}; 71 | 72 | \end{scope} 73 | \end{tikzpicture} 74 | 75 | %} 76 | 77 | \end{center} 78 | 79 | \end{document} 80 | -------------------------------------------------------------------------------- /Doc/images/src/mesh.inner.tex: -------------------------------------------------------------------------------- 1 | \documentclass{minimal} 2 | 3 | % Tikz 4 | \usepackage{pgf} 5 | \usepackage{tikz} 6 | 7 | \begin{document} 8 | 9 | \begin{center} 10 | \begin{tikzpicture} 11 | [ 12 | vertex/.style={draw=none,circle,fill=black,minimum size=2pt}, 13 | oedge/.style={->,>=latex,shorten >=6pt,draw,black,thick}, 14 | roedge/.style={->,>=latex,shorten >=6pt,draw,black,thick,color=red} 15 | ] 16 | 17 | \coordinate (V1) at (-3,3); 18 | \coordinate (V2) at (0,0); 19 | \coordinate (V3) at (0,6); 20 | \coordinate (V4) at (3,3); 21 | 22 | \path[roedge] ([yshift=3pt]V1) to ([yshift=3pt]V2) {}; 23 | \path[oedge] ([yshift=-3pt]V2) to ([yshift=-3pt]V1) {}; 24 | 25 | \path[oedge] ([yshift=3pt]V1) -- ([yshift=3pt]V3) {}; 26 | \path[roedge] ([yshift=-3pt]V3) -- ([yshift=-3pt]V1) {}; 27 | 28 | \path[oedge] ([xshift=2pt]V3) -- ([xshift=2pt]V2) {}; 29 | \path[roedge] ([xshift=-2pt]V2) -- ([xshift=-2pt]V3) {}; 30 | 31 | \path[oedge] ([yshift=3pt]V2) -- ([yshift=3pt]V4) {}; 32 | \path[oedge] ([yshift=-3pt]V4) -- ([yshift=-3pt]V2) {}; 33 | 34 | \path[oedge] ([yshift=3pt]V3) -- ([yshift=3pt]V4) {}; 35 | \path[oedge] ([yshift=-3pt]V4) -- ([yshift=-3pt]V3) {}; 36 | 37 | \node[vertex] at (V1) {}; 38 | \node[vertex] at (V2) {}; 39 | \node[vertex] at (V3) {}; 40 | \node[vertex] at (V4) {}; 41 | 42 | \draw[->,>= latex,thick] (-0.4,3) arc (0:320:20pt); 43 | 44 | 45 | \end{tikzpicture} 46 | \end{center} 47 | 48 | \end{document} 49 | -------------------------------------------------------------------------------- /Doc/images/src/mesh.io.tex: -------------------------------------------------------------------------------- 1 | \documentclass{minimal} 2 | 3 | % Tikz 4 | \usepackage{pgf} 5 | \usepackage{tikz} 6 | 7 | \begin{document} 8 | 9 | \begin{center} 10 | \begin{tikzpicture} 11 | [ 12 | vertex/.style={draw=none,circle,fill=white,minimum size=2pt}, 13 | vertex/.style={draw=none,circle,fill=white,minimum size=2pt}, 14 | oedge/.style={->,>=latex,shorten >=6pt,draw,white,thick}, 15 | roedge/.style={->,>=latex,shorten >=6pt,draw,thick,color=red!60!white}, 16 | boedge/.style={->,>=latex,shorten >=6pt,draw,thick,color=blue!60!white} 17 | ] 18 | 19 | \coordinate (V1) at (-3,3); 20 | \coordinate (V2) at (0,0); 21 | \coordinate (V3) at (0,6); 22 | \coordinate (V4) at (3,3); 23 | 24 | \path[boedge] ([yshift=3pt]V1) to ([yshift=3pt]V2) {}; 25 | \path[roedge] ([yshift=-3pt]V2) to ([yshift=-3pt]V1) {}; 26 | 27 | \path[oedge] ([yshift=3pt]V1) -- ([yshift=3pt]V3) {}; 28 | \path[oedge] ([yshift=-3pt]V3) -- ([yshift=-3pt]V1) {}; 29 | 30 | \path[boedge] ([xshift=2pt]V3) -- ([xshift=2pt]V2) {}; 31 | \path[roedge] ([xshift=-2pt]V2) -- ([xshift=-2pt]V3) {}; 32 | 33 | \path[roedge] ([yshift=3pt]V2) -- ([yshift=3pt]V4) {}; 34 | \path[boedge] ([yshift=-3pt]V4) -- ([yshift=-3pt]V2) {}; 35 | 36 | \path[oedge] ([yshift=3pt]V3) -- ([yshift=3pt]V4) {}; 37 | \path[oedge] ([yshift=-3pt]V4) -- ([yshift=-3pt]V3) {}; 38 | 39 | \node[vertex] at (V1) {}; 40 | \node[vertex] at (V2) {}; 41 | \node[vertex] at (V3) {}; 42 | \node[vertex] at (V4) {}; 43 | 44 | %\draw[->, thick] (-0.4,3) arc (0:320:20pt); 45 | 46 | 47 | \end{tikzpicture} 48 | \end{center} 49 | 50 | \end{document} 51 | -------------------------------------------------------------------------------- /Doc/images/src/mesh.normal.tex: -------------------------------------------------------------------------------- 1 | \documentclass{minimal} 2 | 3 | % Tikz 4 | \usepackage{pgf} 5 | \usepackage{tikz} 6 | 7 | \begin{document} 8 | 9 | \begin{center} 10 | \begin{tikzpicture} 11 | [ 12 | vertex/.style={draw=none,circle,fill=black,minimum size=2pt}, 13 | oedge/.style={->,>=latex,shorten >=6pt,draw,black,thick}, 14 | roedge/.style={->,>=latex,shorten >=6pt,draw,black,thick,color=red} 15 | ] 16 | 17 | \coordinate (V1) at (-3,3); 18 | \coordinate (V2) at (0,0); 19 | \coordinate (V3) at (0,6); 20 | \coordinate (V4) at (3,3); 21 | 22 | \path[oedge] ([yshift=3pt]V1) to ([yshift=3pt]V2) {}; 23 | \path[oedge] ([yshift=-3pt]V2) to ([yshift=-3pt]V1) {}; 24 | 25 | \path[oedge] ([yshift=3pt]V1) -- ([yshift=3pt]V3) {}; 26 | \path[oedge] ([yshift=-3pt]V3) -- ([yshift=-3pt]V1) {}; 27 | 28 | \path[oedge] ([xshift=2pt]V3) -- ([xshift=2pt]V2) {}; 29 | \path[oedge] ([xshift=-2pt]V2) -- ([xshift=-2pt]V3) {}; 30 | 31 | \path[oedge] ([yshift=3pt]V2) -- ([yshift=3pt]V4) {}; 32 | \path[oedge] ([yshift=-3pt]V4) -- ([yshift=-3pt]V2) {}; 33 | 34 | \path[oedge] ([yshift=3pt]V3) -- ([yshift=3pt]V4) {}; 35 | \path[oedge] ([yshift=-3pt]V4) -- ([yshift=-3pt]V3) {}; 36 | 37 | \node[vertex] at (V1) {}; 38 | \node[vertex] at (V2) {}; 39 | \node[vertex] at (V3) {}; 40 | \node[vertex] at (V4) {}; 41 | 42 | %\draw[->, thick] (-0.4,3) arc (0:320:20pt); 43 | 44 | 45 | \end{tikzpicture} 46 | \end{center} 47 | 48 | \end{document} 49 | -------------------------------------------------------------------------------- /Doc/images/src/mesh.opp.tex: -------------------------------------------------------------------------------- 1 | \documentclass{minimal} 2 | 3 | % Tikz 4 | \usepackage{pgf} 5 | \usepackage{tikz} 6 | 7 | \begin{document} 8 | 9 | \begin{center} 10 | \begin{tikzpicture} 11 | [ 12 | vertex/.style={draw=none,circle,fill=white,minimum size=2pt}, 13 | vertex/.style={draw=none,circle,fill=white,minimum size=2pt}, 14 | oedge/.style={->,>=latex,shorten >=6pt,draw,white,thick}, 15 | roedge/.style={->,>=latex,shorten >=6pt,draw,thick,color=red!60!white}, 16 | boedge/.style={->,>=latex,shorten >=6pt,draw,thick,color=blue!60!white} 17 | ] 18 | 19 | \coordinate (V1) at (-3,3); 20 | \coordinate (V2) at (0,0); 21 | \coordinate (V3) at (0,6); 22 | \coordinate (V4) at (3,3); 23 | 24 | \path[oedge] ([yshift=3pt]V1) to ([yshift=3pt]V2) {}; 25 | \path[oedge] ([yshift=-3pt]V2) to ([yshift=-3pt]V1) {}; 26 | 27 | \path[boedge] ([yshift=3pt]V1) -- ([yshift=3pt]V3) {}; 28 | \path[roedge] ([yshift=-3pt]V3) -- ([yshift=-3pt]V1) {}; 29 | 30 | \path[oedge] ([xshift=2pt]V3) -- ([xshift=2pt]V2) {}; 31 | \path[oedge] ([xshift=-2pt]V2) -- ([xshift=-2pt]V3) {}; 32 | 33 | \path[oedge] ([yshift=3pt]V2) -- ([yshift=3pt]V4) {}; 34 | \path[oedge] ([yshift=-3pt]V4) -- ([yshift=-3pt]V2) {}; 35 | 36 | \path[oedge] ([yshift=3pt]V3) -- ([yshift=3pt]V4) {}; 37 | \path[oedge] ([yshift=-3pt]V4) -- ([yshift=-3pt]V3) {}; 38 | 39 | \node[vertex] at (V1) {}; 40 | \node[vertex] at (V2) {}; 41 | \node[vertex] at (V3) {}; 42 | \node[vertex] at (V4) {}; 43 | 44 | %\draw[->, thick] (-0.4,3) arc (0:320:20pt); 45 | 46 | 47 | \end{tikzpicture} 48 | \end{center} 49 | 50 | \end{document} 51 | -------------------------------------------------------------------------------- /Doc/images/src/mesh.outer.tex: -------------------------------------------------------------------------------- 1 | \documentclass{minimal} 2 | 3 | % Tikz 4 | \usepackage{pgf} 5 | \usepackage{tikz} 6 | 7 | \begin{document} 8 | 9 | \begin{center} 10 | \begin{tikzpicture} 11 | [ 12 | vertex/.style={draw=none,circle,fill=black,minimum size=2pt}, 13 | oedge/.style={->,>=latex,shorten >=6pt,draw,black,thick}, 14 | roedge/.style={->,>=latex,shorten >=6pt,draw,black,thick,color=red} 15 | ] 16 | 17 | \coordinate (V1) at (-3,3); 18 | \coordinate (V2) at (0,0); 19 | \coordinate (V3) at (0,6); 20 | \coordinate (V4) at (3,3); 21 | 22 | \path[oedge] ([yshift=3pt]V1) to ([yshift=3pt]V2) {}; 23 | \path[roedge] ([yshift=-3pt]V2) to ([yshift=-3pt]V1) {}; 24 | 25 | \path[roedge] ([yshift=3pt]V1) -- ([yshift=3pt]V3) {}; 26 | \path[oedge] ([yshift=-3pt]V3) -- ([yshift=-3pt]V1) {}; 27 | 28 | \path[oedge] ([xshift=2pt]V3) -- ([xshift=2pt]V2) {}; 29 | \path[oedge] ([xshift=-2pt]V2) -- ([xshift=-2pt]V3) {}; 30 | 31 | \path[oedge] ([yshift=3pt]V2) -- ([yshift=3pt]V4) {}; 32 | \path[roedge] ([yshift=-3pt]V4) -- ([yshift=-3pt]V2) {}; 33 | 34 | \path[roedge] ([yshift=3pt]V3) -- ([yshift=3pt]V4) {}; 35 | \path[oedge] ([yshift=-3pt]V4) -- ([yshift=-3pt]V3) {}; 36 | 37 | \node[vertex] at (V1) {}; 38 | \node[vertex] at (V2) {}; 39 | \node[vertex] at (V3) {}; 40 | \node[vertex] at (V4) {}; 41 | 42 | \draw[<-,>= latex,thick] (3.3,3) arc (0:320:94pt); 43 | 44 | 45 | \end{tikzpicture} 46 | \end{center} 47 | 48 | \end{document} 49 | -------------------------------------------------------------------------------- /Doc/images/src/mesh.to.from.tex: -------------------------------------------------------------------------------- 1 | \documentclass{minimal} 2 | 3 | % Tikz 4 | \usepackage{pgf} 5 | \usepackage{tikz} 6 | 7 | \begin{document} 8 | 9 | \begin{center} 10 | \begin{tikzpicture} 11 | [ 12 | vertex/.style={draw=none,circle,fill=black,minimum size=2pt}, 13 | oedge/.style={->,>=latex,shorten >=6pt,draw,black,thick}, 14 | roedge/.style={->,>=latex,shorten >=6pt,draw,black,thick,color=red} 15 | ] 16 | 17 | \coordinate (V1) at (-3,3); 18 | \coordinate (V2) at (0,0); 19 | 20 | \path[oedge] ([yshift=3pt]V1) to ([yshift=3pt]V2) {}; 21 | \path[oedge] ([yshift=-3pt]V2) to ([yshift=-3pt]V1) {}; 22 | 23 | \node[vertex] at (V1) {}; 24 | \node[vertex] at (V2) {}; 25 | 26 | \end{tikzpicture} 27 | \end{center} 28 | 29 | \end{document} 30 | -------------------------------------------------------------------------------- /Doc/misc.docu: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | 3 | 4 | /** \page naming_conventions Naming Conventions 5 | 6 | The following naming conventions are used for the %OpenMesh code: 7 | 8 | Files: 9 | \li \c MyClass.cc for C++-Implementation of class \c MyClass 10 | \li \c MyClass.hh for C++-Header of class \c MyClass 11 | 12 | Classes: 13 | \li Class names start with a capital letter: \c MyClass 14 | \li Class templates end with \c T: \c MyClassTemplateT 15 | 16 | Variables: 17 | \li One leading underscore for parameters in function-calls: \c _var 18 | \li One trailing underscore for member-variables: \c var_ 19 | \li Two trailing underscores for static member-variables: \c var__ 20 | 21 | Functions: 22 | \li Words are separated by underscores: \c my_function() 23 | 24 | Accessing members: 25 | \li To get the member \c xxx_ use const& xxx() const 26 | \li To set the member \c xxx_ use void set_xxx(arg) 27 | 28 | **/ 29 | 30 | //----------------------------------------------------------------------------- 31 | -------------------------------------------------------------------------------- /Doc/namespaces.docu: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | // 3 | // Documents all used namespaces for doxygen 4 | // 5 | //============================================================================= 6 | 7 | 8 | /** \namespace OpenMesh::Concepts 9 | Descriptions of the concepts used in OpenMesh. 10 | */ 11 | 12 | 13 | /** \namespace OpenMesh 14 | Contains all the mesh ingredients like the polygonal mesh, 15 | the triangle mesh, different mesh kernels and mesh traits. 16 | **/ 17 | 18 | 19 | /** \namespace OpenMesh::Iterators 20 | Contains all mesh iterators and circulators. The two classes 21 | OpenMesh::Concepts::IteratorT and OpenMesh::Concepts::CirculatorT describe 22 | the interfaces provided by all iterators and circulators, respectively. 23 | 24 | All iterators/circulators defined in this namespace are template classes 25 | that require a mesh a template parameter. Therefore you should use 26 | the iterators/circulators that are defined by the mesh itself. See 27 | OpenMesh::Mesh::PolyMeshT for a complete list of them. 28 | 29 | \see The mesh docu section \ref mesh_iterators for a more detailed 30 | description. 31 | \see OpenMesh::Concepts::IteratorT 32 | \see OpenMesh::Concepts::CirculatorT 33 | */ 34 | 35 | 36 | /** \namespace OpenMesh::IO 37 | This namespace contains functions for reading and writing polygonal 38 | meshes and a list of supported file formats. 39 | */ 40 | 41 | 42 | /** \namespace OpenMesh::GenProg 43 | Utilities for generative programming. 44 | */ 45 | 46 | 47 | /** \namespace OpenMesh::Attributes 48 | This namespace holds per item attributes like normal/color. 49 | There are some macros provided for convenience, see Attributes.hh. 50 | \see Attributes.hh 51 | */ 52 | 53 | 54 | /** \namespace OpenMesh::Kernel_OSG 55 | In this namespace resides the OpenSG integration of OpenMesh. 56 | Here you find the class 57 | OpenMesh::OSG_Kernel::TriMesh_OSGArrayKernelT<> and the 58 | template function OpenMesh::OSG_Kernel::bindT<> to link such a 59 | mesh with a OpenSG Geometry. */ 60 | 61 | 62 | /** \namespace OpenMesh::Decimater 63 | Software related to mesh decimation. 64 | \see DecimaterT.hh 65 | */ 66 | 67 | 68 | /** \namespace OpenMesh::Subdivider::Adaptive 69 | * Software related to adaptive subdivision of meshes. 70 | */ 71 | 72 | /** \namespace OpenMesh::Subdivider::Uniform 73 | * Software related to uniform subdivision of meshes. 74 | */ 75 | 76 | /** \namespace OpenMesh::VDPM 77 | * Software related to view dependent progressive meshes. 78 | */ 79 | 80 | /** \namespace OpenMesh::Utils 81 | * Collection of little utility classes and helpers. 82 | */ -------------------------------------------------------------------------------- /Doc/smoother.docu: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | 3 | /** \page smoother_docu Smoother Tools 4 | 5 | \section OM_Smoother_Overview Overview 6 | 7 | The %OpenMesh library provides tools for smoothing Triangle- and Polymeshes 8 | 9 | -# Smoother: 10 | -# OpenMesh::Smoother::SmootherT 11 | -# OpenMesh::Smoother::LaplaceSmootherT 12 | -# OpenMesh::Smoother::JacobiLaplaceSmootherT 13 | 14 | \section OM_Smoother_Usage Usage 15 | The smoothers directly work on an OpenMesh. The following example shows how to use them: 16 | 17 | \code 18 | #include 19 | 20 | // Initialize smoother with input mesh 21 | OpenMesh::Smoother::JacobiLaplaceSmootherT smoother(mesh); 22 | 23 | smoother.initialize( Tangential_and_Normal, //Smooth direction 24 | C0) //Continuity 25 | 26 | // Execute 3 smooth steps 27 | smoother.smooth(3); 28 | \endcode 29 | 30 | \section Options 31 | 32 | \subsection Continuity 33 | \li C0: shape is continuous, but not the tangent 34 | \li C1: shape and tangent are continuous 35 | \li C2: preserves curvature 36 | 37 | \subsection Component 38 | \li Tangential: Smooth in tangential direction 39 | \li Normal: Smooth in normal direction 40 | \li Tangential_and_Normal: Smooth in tangential and normal direction 41 | 42 | \subsection localError Local Error 43 | By default, this option is disabled. 44 | You can set local max. local errors (absolute or relative) via following functions: 45 | \code 46 | void OpenMesh::Smoother::SmootherT::set_relative_local_error(Scalar _err); 47 | void OpenMesh::Smoother::SmootherT::set_absolute_local_error(Scalar _err); 48 | void OpenMesh::Smoother::SmootherT::disable_local_error_check(); 49 | \endcode 50 | 51 | 52 | */ 53 | 54 | //----------------------------------------------------------------------------- 55 | -------------------------------------------------------------------------------- /Doc/speedup.docu: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | 3 | 4 | /** \page mesh_speedup Some Notes on how to speedup OpenMesh 5 | 6 | On this page we collect some hints which can be used to speedup OpenMesh. This list is not complete, so if you 7 | have additional hints, just tell us. 8 | 9 |
    10 |
  • Visual Studio 11 |
      12 |
    • The prebuild binaries we ship are not compiled with full optimization enabled. You can build it yourself with full 13 | optimization. ("Full Optimization" (Project setting: C/C++ ->> Optimization) ). Please remember that you than have 14 | to build everything with this flag to avoid incompatibilities.
    • 15 |
    16 |
  • 17 |
18 | 19 | */ 20 | 21 | 22 | 23 | 24 | //----------------------------------------------------------------------------- 25 | 26 | -------------------------------------------------------------------------------- /Doc/subdivider.docu: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | 3 | /** \page subdivider_docu Sudivision Tools 4 | 5 | \section OM_Subdivider_Overview Overview 6 | 7 | The %OpenMesh library provides a few tools for uniform and adaptive 8 | subdivision: 9 | 10 | -# Uniform subdivision 11 | -# OpenMesh::Subdivider::Uniform::LoopT 12 | -# OpenMesh::Subdivider::Uniform::Sqrt3T 13 | -# OpenMesh::Subdivider::Uniform::ModifiedButterflyT 14 | -# OpenMesh::Subdivider::Uniform::InterpolatingSqrt3LGT 15 | -# OpenMesh::Subdivider::Uniform::CompositeT 16 | -# OpenMesh::Subdivider::Uniform::CatmullClarkT 17 | -# OpenMesh::Subdivider::Uniform::MidpointT 18 | -# Adaptive subdivision 19 | -# OpenMesh::Subdivider::Adaptive::CompositeT 20 | -# Simple subdivision 21 | -# OpenMesh::Subdivider::Uniform::LongestEdgeT 22 | 23 | \section OM_Subdivider_Usage Usage 24 | The subdividers directly work on an OpenMesh. The following example shows how to use them: 25 | 26 | \code 27 | #include 28 | 29 | // Initialize subdivider 30 | OpenMesh::Subdivider::Uniform::CatmullClarkT catmull; 31 | 32 | // Execute 3 subdivision steps 33 | catmull.attach(mesh_); 34 | catmull( 3 ); 35 | catmull.detach(); 36 | \endcode 37 | 38 | */ 39 | 40 | //----------------------------------------------------------------------------- 41 | -------------------------------------------------------------------------------- /Doc/tools.docu: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | 3 | /** \page tools_docu OpenMesh Tools Documentation 4 | 5 | \li \subpage decimater_docu 6 | \li \subpage subdivider_docu 7 | \li \subpage vdpm_docu 8 | \li \subpage smoother_docu 9 | \li \subpage smarttagger_docu 10 | \li Miscellaneous 11 | OpenMesh::StripifierT 12 | 13 | */ 14 | 15 | // ---------------------------------------------------------------------------- 16 | -------------------------------------------------------------------------------- /Doc/tutorial_01.docu: -------------------------------------------------------------------------------- 1 | /** \page tutorial_01 First Steps - Building a cube 2 | 3 | This small example shows: 4 | \li How to declare your type \c MyMesh, 5 | \li How to add vertices and faces to a mesh, 6 | \li How to write a mesh using the IO functions. 7 | 8 | For each program the first step is to define your type \c 9 | MyMesh. %OpenMesh supports general polygonal meshes (faces are polygons 10 | with varying number of vertices) as well as specialized triangle 11 | meshes (all faces are triangles). In this example we want to build a 12 | cube from six quadrangles, therefore we choose the polygonal mesh. 13 | 14 | %OpenMesh also supports different mesh kernels, specifying how all the 15 | vertices, edges, and faces are stored internally (see also \ref 16 | mesh_kernels_group). However, the storage must provide an array like interface. 17 | For the tutorial we use the supplied ArrayKernel. The predefined 18 | combinations of TriMesh/PolyMesh and the kernel are 19 | contained in \c %OpenMesh/src/OpenMesh/Core/Mesh, we use the 20 | PolyMesh_ArrayKernelT. 21 | 22 | \dontinclude build_cube.cc 23 | \skipline PolyMesh_ArrayKernel 24 | \skipline MyMesh 25 | 26 | Now since we have declared our type \c MyMesh, we only have to add 8 27 | vertices and 6 quadrangles to build a cube. Adding a vertex is done 28 | using the add_vertex method. It gets a coordinate and returns 29 | a handle to the inserted vertex. We store all handles in an array, 30 | since we need them for specifying the faces. 31 | 32 | \skipline vhandle[0] 33 | \until vhandle[3] 34 | 35 |
In order to add a face to the mesh, we have to build a vector holding 36 | the handles to the face's vertices. This vector is passed to the 37 | \c add_face method. The following block will create a face from the first 38 | four vertices: 39 | 40 | \skipline face_vhandles 41 | \until add_face 42 | 43 |
The orientation of the face is defined by the order in which the 44 | vertices are given: If you look at the frontfacing side of the 45 | polygon, then the vertices are in counter-clockwise order. 46 | 47 | After creating all of the six faces, we want to write the resulting 48 | mesh to standard output. %OpenMesh provides some basic input/output 49 | methods in the namespace OpenMesh::IO: 50 | 51 | \skipline write_ 52 | 53 |
To use the IO facility of %OpenMesh make sure that the include MeshIO.hh is 54 | included first. 55 | 56 | \dontinclude build_cube.cc 57 | \skipline MeshIO 58 | \until PolyMesh_ArrayKernel 59 | 60 |
The complete source looks like this: 61 | 62 | \include build_cube.cc 63 | 64 | **/ 65 | -------------------------------------------------------------------------------- /Doc/tutorial_02.docu: -------------------------------------------------------------------------------- 1 | /** \page tutorial_02 Using iterators and circulators 2 | 3 | This examples shows: 4 | 5 | - How to use iterators, 6 | - How to use circulators. 7 | 8 | This example is the first version of the simple mesh smoother. Here we 9 | will introduce \em iterators and \em circulators. These two concepts 10 | provide functionality to linearly enumerate e.g. all vertices of a 11 | mesh, and to circulate around a vertex, i.e. to enumerate all its 12 | one-ring neighbors. For a more detailed description, see \ref 13 | mesh_iterators. 14 | 15 | First we have to define the mesh type we want to use. This time we use 16 | a triangle mesh instead of a polygonal mesh: 17 | 18 | \dontinclude 02-iterators/smooth.cc 19 | \skipline TriMesh_ArrayKernel 20 | \skipline MyMesh 21 | 22 |
We read the mesh to be smoothed from a file: 23 | 24 | \skipline read_mesh 25 | 26 |
One smoothing iteration is done in two steps: 27 |
    28 |
  1. For each vertex: calculate the barycenter of its one-ring neighbors.
  2. 29 |
  3. For each vertex: move the vertex to the computed barycenter.
  4. 30 |
31 | 32 | This can easily be implemented using vertex iterators. The mesh 33 | provides begin and end iterators by vertices_begin() and 34 | vertices_end(). 35 | 36 | \skipline VertexIter 37 | \skipline v_it!=v_end 38 | 39 |
For calculating the barycenter, we have to iterate through the 40 | one-ring neighborhood of the current vertex. This functionality 41 | is provided by the VertexVertexIter: 42 | 43 | \dontinclude 02-iterators/smooth.cc 44 | \skipline VertexVertexIter 45 | \skipline vv_it= 46 | 47 |
Now we can calculate the barycenters for each vertex and store them in 48 | the array cogs: 49 | 50 | \dontinclude 02-iterators/smooth.cc 51 | \skipline std::vector 52 | \skipline v_it= 53 | \until cogs.push_back 54 | \until } 55 | 56 |
After we have calculated the barycenters all that is left to do is to 57 | move the vertices to the corresponding barycenters. The complete source 58 | code is listed below. 59 | 60 | \include 02-iterators/smooth.cc 61 | 62 | **/ -------------------------------------------------------------------------------- /Doc/tutorial_04.docu: -------------------------------------------------------------------------------- 1 | /** \page tutorial_04 Using STL algorithms 2 | 3 | Since the %OpenMesh iterators are (almost) conformant to STL iterators, 4 | one can apply the STL algorithms on meshes. The following example 5 | shows how to use the STL \c for_each construct, since it is 6 | easier to read and may be more efficient than hand-written loops. 7 | 8 | We will define a class which provides the smoothing algorithm, hence 9 | define a reusable component. The class must be template class because there 10 | is no such thing as a class %OpenMesh, but many different types of %OpenMesh: 11 | 12 | \dontinclude 04-stl_algorithms/smooth_algo.hh 13 | \skipline template 14 | 15 | The class SmootherT has two functors, one that computes the barycenter 16 | for a given vertex, and a second that sets the vertex position to the 17 | corresponding barycenter. A functor is simply a class with a function 18 | operator()(...). The first functor \c ComputeCOG 19 | computes the barycenter and stores it in a custom vertex property \c 20 | cog_: 21 | 22 | \skipline operator 23 | \until } 24 | \until } 25 | 26 | Note, that \c ComputeCOG needs to have access to the mesh object and 27 | the property handle. Here, both are references to member variables of 28 | the smoother object. 29 | 30 | The second functor \c class \c SetCOG, which sets the vertex position, 31 | is constructed analogical. 32 | 33 | Using these functors and std::for_each from the STL 34 | the smoothing algorithm can be realized in a member function of 35 | \c SmootherT: 36 | 37 | \dontinclude 04-stl_algorithms/smooth_algo.hh 38 | \skipline void smooth 39 | \until } 40 | \until } 41 | 42 |
The complete example looks like this: 43 | 44 | \include 04-stl_algorithms/smooth_algo.hh 45 | 46 |
and 47 | 48 | \include 04-stl_algorithms/smooth.cc 49 | 50 | */ -------------------------------------------------------------------------------- /Doc/tutorial_06.docu: -------------------------------------------------------------------------------- 1 | /** \page tutorial_06 Using mesh attributes and traits 2 | 3 | this example shows how to change the data type for positions, normals, colors, and texture, 4 | 5 | In the previous tutorial (\ref tutorial_05) we learned to use standard 6 | properties by calling the appropriate \c request method. 7 | Unlike the custom properties, where the user specifies the 8 | data type by passing the type to the handle (e.g. \c 9 | MyMesh::FPropHandleT< int>), the data types of the standard 10 | properties are defined by so-called mesh traits. With traits we can 11 | customize and extend the mesh data structure. We can do this by 12 | changing two important features 13 | 14 | -# changing data type for positions, normals, colors, and texture 15 | coordinates 16 | -# extend mesh entities Vertex, Face, Edge, and Halfedge 17 | (see tutorial '\ref tutorial_07') 18 | 19 | Let's start. Every custom traits should derive from the default traits 20 | 21 | \dontinclude 06-attributes/attributes.cc 22 | \skipline struct MyTraits 23 | 24 | As mentioned, we can change the basic data types for the basic types 25 | \c MyMesh::Point, \c MyMesh::Normal, \c MyMesh::Color, and \c MyMesh::TexCoord. 26 | We can use the provided vector class or we use a 27 | different one from another library. Here we simply replace the default 28 | type \c OpenMesh::Vec3f (defined in the \c OpenMesh::DefaultTraits) 29 | for positions and normals with \c OpenMesh::Vec3d 30 | 31 | \skipline Vec3d 32 | \skipline Vec3d 33 | 34 | (In general it's better to have the same scalar type for the point and 35 | normal vector, for instance \c double in this case. Otherwise we have 36 | to cast quite a lot depending on the implementation of the vector class.) 37 | 38 | Be aware that these settings overwrite the ones of the parent traits 39 | class! As we usually derive from the DefaultTraits let's have a close look. 40 | 41 | Actually the struct \c OpenMesh::DefaultTraits is merely empty. It solely 42 | defines the types for \c Point, \c Normal, \c TexCoord, and \c Color 43 | and one attribute, that we used implicitly all the time: 44 | 45 | \skipline HalfedgeAttributes 46 | 47 | The attribute \c PrevHalfedge is different, as it does not control a 48 | property. Yet it has a great impact on the resulting mesh type, as it 49 | adds additional information to the halfedge structure. The impact 50 | is twofold: 51 | 52 | -# fast access to previous halfedge 53 | -# increase of memory consumption 54 | 55 | Using this feature depends highly on our needs. One situation where 56 | the previous halfedges are quite handy, is the mesh member function 57 | add_face(). The execution time for the member function drops 58 | dramatically, when the information about the previous halfedge is 59 | available. Usually we want to have this information. But if not, because we 60 | must save memory, we can easily remove it with 61 | 62 | \skipline HalfedgeAttributes 63 | 64 | Then we need 8 bytes less per edge, which can be quite a lot as one can 65 | derive from the Euler formula (\f$V-E+F=2 (1-g)\f$), that for a regular 66 | triangle meshes with genus \f$g=0\f$ the number of edges 67 | \f$E\f$ is approximately 68 | three times the number of vertices \f$V\f$: \f$ E \approx 3 \cdot V\f$. 69 | 70 | The complete source looks like this: 71 | 72 | \include 06-attributes/attributes.cc 73 | 74 | */ -------------------------------------------------------------------------------- /Doc/tutorial_07.docu: -------------------------------------------------------------------------------- 1 | /** \page tutorial_07 Extending the mesh using traits 2 | 3 | This examples shows: 4 | 5 | - How to extend the behaviour of entities using traits. 6 | 7 | In the previous tutorial we used attributes and changed the type of 8 | the data types \c Point, \c Normal, \c TexCoord, and \c Color. But we 9 | can do even more with traits. We can change the behaviour of the mesh 10 | entities \c Vertex, \c Face, \c Edge, and \c Halfedge. 11 | 12 | One goal in the design was a highly customizable data structure. Using 13 | the traits technique makes it possible. We pick up the smoother again 14 | and show an alternative way to implement it. Now we place the necessary 15 | data and the functions in the vertex itself 16 | 17 | \dontinclude 07-traits/smooth.cc 18 | \skipline MyTraits 19 | \until }; 20 | 21 | Note the definition of the vertex entity. We use the supplied define 22 | \c VertexTraits (which resolves in a rather inconvenient template 23 | definition). Similary we can use the defines \c FaceTraits, \c 24 | EdgeTraits, and \c HalfedgeTraits to extend these entities. Now we 25 | enhanced the vertex, with the additional member variable \c cog_, and 26 | the get/set-method pair to access the new member. 27 | 28 | As before we compute in a first loop the barycenters for all vertices 29 | and store the information at the vertices 30 | 31 | \skipline mesh.data(*v_it).set_cog 32 | 33 | In the second pass we set the new position of each vertex 34 | 35 | \skipline mesh.data(*v_it).cog 36 | 37 | It looks neat, but on the other hand we can't remove the data anymore 38 | as we could do with properties! By using traits one creates a 'static' 39 | configuration, which can't be changed during runtime. 40 | 41 | The complete source looks like this: 42 | 43 | \include 07-traits/smooth.cc 44 | 45 | */ -------------------------------------------------------------------------------- /Doc/tutorial_07b.docu: -------------------------------------------------------------------------------- 1 | /** \page tutorial_07b Deleting geometry elements 2 | 3 | This small example shows how to remove faces and vertices from a mesh. 4 | 5 | We basically use the geometry created in \ref tutorial_01. 6 | 7 | If we want our mesh class to be able to remove vertices, faces or edges 8 | we have to extend the default traits for our mesh class. 9 | Vertices, faces and (half-)edges need the OpenMesh::Attributes::Status attribute 10 | which is used to hold the flag "deleted" if an element is deleted. 11 | 12 | Instead of defining the required attributes via traits on compile-time, it is possible to request 13 | attributes dynamically on run-time by requesting them. 14 | In this example, we want to delete faces, edges and vertices, therefore requesting the status attribute is required. 15 | \note You have to request attributes before you use them, if you don't enable them via traits. 16 | 17 | \dontinclude delete_geometry.cc 18 | \skipline // the request 19 | \until mesh.request_vertex_status(); 20 | 21 | After having created the geometry of the cube one can delete faces and vertices 22 | by simply calling delete_vertices() (delete_faces() or delete_edges() respectively). 23 | 24 | Note that there is actually no way to directly delete halfedges since they are automatically 25 | affected when the parent edge is marked as deleted! 26 | 27 | The status whether an element is marked as deleted can be requested by 28 | 29 | \code 30 | mesh.status(handle).deleted(); // true if element handle is marked as deleted 31 | // false otherwise 32 | \endcode 33 | 34 | where handle is either a vertex-, edge- or face-handle. 35 | 36 | In this example we delete all faces except one and the corresponding vertices. 37 | The code looks like this 38 | 39 | \dontinclude delete_geometry.cc 40 | \skipline // Delete face 0 41 | \until mesh.delete_vertex(vhandle[3], false); 42 | 43 | Now the deleted faces and vertices are marked as "deleted" internally. 44 | Call garbage_collection() to definitely remove them from memory. 45 | 46 | \dontinclude delete_geometry.cc 47 | \skipline // Delete all 48 | \until mesh.garbage_collection(); 49 | 50 | The full source code of the example: 51 | 52 | \include delete_geometry.cc 53 | 54 | **/ 55 | -------------------------------------------------------------------------------- /Doc/tutorial_build.docu: -------------------------------------------------------------------------------- 1 | /** \page tutorial_build How to create your own project using OpenMesh 2 | 3 | In this tutorial we will explain, how to create a new project using 4 | %OpenMesh and build it with the CMake build system. We assume, that you have already 5 | downloaded the %OpenMesh source files as well as installed the CMake build tools. 6 | 7 | There are quite few steps to follow to successfully add your own application to the build tree: 8 | 9 | \li Go to OpenMeshRoot/src/OpenMesh/Apps and create a new directory, say "MyOwnProject" 10 | \li Now create a new file called "CMakeLists.txt" containing the following lines: 11 | 12 | \include CMakeLists.txt 13 | 14 | (Remember to replace "MyProjectName" with whatever you have chosen as your project's name. 15 | Note: If you don't want to use *.hh and *.cc as your C++ source file suffices, you'll 16 | have to change this, too, because CMake won't build your sources otherwise. 17 | 18 | \li Create your source files as for example explained in the previous tutorial (\ref tutorial_01) 19 | and save them in the same directory. 20 | 21 | \li Add \code add_subdirectory (MyOwnProject) \endcode to OpenMeshRoot/src/OpenMesh/Apps/CMakeLists.txt (note: You can either 22 | add this line right after the other projects or at the end of the file). 23 | 24 | \li Create a directory called "build" in OpenMesh's root directory. Change to the newly created directory and call 25 | \code cmake .. \endcode and \code make \endcode 26 | 27 | That's all. Your project will now be built. 28 | 29 | **/ 30 | -------------------------------------------------------------------------------- /Doc/tutorial_main.docu: -------------------------------------------------------------------------------- 1 | /** \page tutorial Tutorials (code examples) 2 | 3 | The %OpenMesh mesh library is a powerful tool for handling polygonal 4 | meshes. Due to its inherent generative structure it allows the user to 5 | create mesh types which are custom tailored to the specific needs of 6 | the application. The user can either supply his own data structures 7 | for representing vertices, edges and faces or he can conveniently use 8 | the predefined structures of %OpenMesh. 9 | Additionally %OpenMesh offers dynamic properties allowing the user to attach 10 | and detach data to the mesh during runtime. 11 | 12 | This document is supposed to introduce the basic concepts of 13 | %OpenMesh. 15 | 16 | In this tutorial we will introduce the %OpenMesh library by means of 17 | simple examples. The first one just builds a polygonal mesh 18 | representing a cube and writes the result to standard output. The 19 | following examples develop a simple mesh smoother: Recall that the 20 | immediate neighbors of a vertex are called the 1-ring of this 21 | vertex. It is well known that a polygonal mesh can be smoothed by 22 | repeatedly replacing each vertex' position by the center of gravity 23 | (cog) of its 1-ring. The basic smoother will 24 | 25 | \li read a polygonal mesh from standard input, 26 | \li compute the cog of the 1-ring of each vertex, 27 | \li replace each vertex' position by its cog and finally, 28 | \li write the mesh to standard output. 29 | 30 |
    31 |
  1. \subpage tutorial_build 32 |
  2. \subpage tutorial_01 33 |
  3. \subpage tutorial_02 34 |
  4. \subpage tutorial_03 35 |
  5. \subpage tutorial_04 36 |
  6. \subpage tutorial_05 37 |
  7. \subpage tutorial_06 38 |
  8. \subpage tutorial_07 39 |
  9. \subpage tutorial_07b 40 |
  10. \subpage tutorial_08 41 |
  11. \subpage tutorial_09 42 |
43 | 44 | */ 45 | -------------------------------------------------------------------------------- /Doc/vdpm.docu: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | 3 | /** \page vdpm_docu View Dependent Progressive Meshes 4 | 5 | The VDPM software is based on "Truly Selective 7 | Refinement of Progressive Meshes", J. Kim and S. Lee, In 8 | Proc. Graphics Interface 2001. 9 | 10 | The library is located in \c %OpenMesh/Tools/VDPM/ and in 11 | \c %OpenMesh/Apps/VDProgMesh/ are demo applications: 12 | -# \c mkbalancedpm creates balanced progressive meshes 13 | -# \c vdpmanalyzer takes a progressive mesh and generates a view dependent 14 | progressive mesh. 15 | -# \c vdpmsynthezier is viewer for vdpm meshes. 16 | 17 | \todo Complete VDPM documentation. 18 | */ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | OpenMesh is licensed under the 3-clause BSD License. See the LICENSE file for the complete license. 2 | 3 | /* ========================================================================= * 4 | * * 5 | * OpenMesh * 6 | * Copyright (c) 2001-2015, RWTH-Aachen University * 7 | * Department of Computer Graphics and Multimedia * 8 | * All rights reserved. * 9 | * www.openmesh.org * 10 | * * 11 | *---------------------------------------------------------------------------* 12 | * This file is part of OpenMesh. * 13 | *---------------------------------------------------------------------------* 14 | * * 15 | * Redistribution and use in source and binary forms, with or without * 16 | * modification, are permitted provided that the following conditions * 17 | * are met: * 18 | * * 19 | * 1. Redistributions of source code must retain the above copyright notice, * 20 | * this list of conditions and the following disclaimer. * 21 | * * 22 | * 2. Redistributions in binary form must reproduce the above copyright * 23 | * notice, this list of conditions and the following disclaimer in the * 24 | * documentation and/or other materials provided with the distribution. * 25 | * * 26 | * 3. Neither the name of the copyright holder nor the names of its * 27 | * contributors may be used to endorse or promote products derived from * 28 | * this software without specific prior written permission. * 29 | * * 30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * 31 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * 32 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * 33 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * 34 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * 35 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * 36 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * 37 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * 38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * 39 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 40 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 41 | * * 42 | * ========================================================================= *\ 43 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | VERSION=8.0 2 | MAJOR=8 3 | MINOR=0 4 | PATCH=0 5 | ID=OPENMESH 6 | 7 | -------------------------------------------------------------------------------- /cmake/ACGOutput.cmake: -------------------------------------------------------------------------------- 1 | # fill string with spaces 2 | macro (acg_format_string str length return) 3 | string (LENGTH "${str}" _str_len) 4 | math (EXPR _add_chr "${length} - ${_str_len}") 5 | set (${return} "${str}") 6 | while (_add_chr GREATER 0) 7 | set (${return} "${${return}} ") 8 | math (EXPR _add_chr "${_add_chr} - 1") 9 | endwhile () 10 | endmacro () 11 | 12 | # print message with color escape sequences if CMAKE_COLOR_MAKEFILE is set 13 | string (ASCII 27 _escape) 14 | function (acg_color_message _str) 15 | if (CMAKE_COLOR_MAKEFILE AND NOT WIN32) 16 | message (${_str}) 17 | else () 18 | string (REGEX REPLACE "${_escape}.[0123456789;]*m" "" __str ${_str}) 19 | message (${__str}) 20 | endif () 21 | endfunction () 22 | 23 | # info header 24 | function (acg_print_configure_header _id _name) 25 | acg_format_string ("${_name}" 40 _project) 26 | acg_format_string ("${${_id}_VERSION}" 40 _version) 27 | acg_color_message ("\n${_escape}[40;37m************************************************************${_escape}[0m") 28 | acg_color_message ("${_escape}[40;37m* ${_escape}[1;31mACG ${_escape}[0;40;34mBuildsystem${_escape}[0m${_escape}[40;37m *${_escape}[0m") 29 | acg_color_message ("${_escape}[40;37m* *${_escape}[0m") 30 | acg_color_message ("${_escape}[40;37m* Package : ${_escape}[32m${_project} ${_escape}[37m *${_escape}[0m") 31 | acg_color_message ("${_escape}[40;37m* Version : ${_escape}[32m${_version} ${_escape}[37m *${_escape}[0m") 32 | 33 | if ( NOT WIN32 ) 34 | # Just artistic. remove 2 spaces for release to make it look nicer ;-) 35 | if (${CMAKE_BUILD_TYPE} MATCHES "Debug") 36 | acg_color_message ("${_escape}[40;37m* Type : ${_escape}[32m${CMAKE_BUILD_TYPE} ${_escape}[37m *${_escape}[0m") 37 | else() 38 | acg_color_message ("${_escape}[40;37m* Type : ${_escape}[32m${CMAKE_BUILD_TYPE} ${_escape}[37m *${_escape}[0m") 39 | endif() 40 | endif() 41 | 42 | acg_color_message ("${_escape}[40;37m************************************************************${_escape}[0m") 43 | endfunction () 44 | 45 | # info line 46 | function (acg_print_configure_footer) 47 | acg_color_message ("${_escape}[40;37m************************************************************${_escape}[0m\n") 48 | endfunction () 49 | 50 | -------------------------------------------------------------------------------- /cmake/fixbundle.cmake.in: -------------------------------------------------------------------------------- 1 | # Interpret booleans directly without dereferencing them 2 | cmake_policy(SET CMP0012 NEW) 3 | 4 | # gp_item_default_embedded_path_override item default_embedded_path_var 5 | # 6 | # Return the path that others should refer to the item by when the item 7 | # is embedded inside a bundle. 8 | # 9 | # This is a project-specific override of BundleUtilities.cmake's 10 | # gp_item_default_embedded_path 11 | # 12 | function(gp_item_default_embedded_path_override item default_embedded_path_var) 13 | 14 | # By default, embed items as set by gp_item_default_embedded_path: 15 | # 16 | set(path "${${default_embedded_path_var}}") 17 | 18 | # But for OpenFlipper... 19 | # 20 | # ...embed *.dylib in the Libraries folder: 21 | # 22 | if(item MATCHES "\\.dylib$") 23 | set(path "@executable_path/../Libraries") 24 | endif() 25 | 26 | # ...embed qt plugins in the Libraries folder: 27 | # 28 | if(item MATCHES "@QT_PLUGINS_DIR@" AND item MATCHES "\\.bundle") 29 | file (RELATIVE_PATH _plugin "@QT_PLUGINS_DIR@" "${item}") 30 | get_filename_component(_dir "${_plugin}" PATH) 31 | set(path "@executable_path/../Resources/QtPlugins/${_dir}") 32 | endif() 33 | 34 | # ...embed *.so in the Plugins folder: 35 | # 36 | if(item MATCHES "\\.so$") 37 | set(path "@executable_path/../Resources/Plugins") 38 | endif() 39 | 40 | set(${default_embedded_path_var} "${path}" PARENT_SCOPE) 41 | endfunction(gp_item_default_embedded_path_override) 42 | 43 | include (BundleUtilities) 44 | 45 | #if ( @BUILD_APPS@ ) 46 | # message("Fixing up bundle ...") 47 | # 48 | # # copy qt plugins to bundle 49 | # file (GLOB _plugins "@CMAKE_BINARY_DIR@/Build/OpenFlipper.app/Contents/Resources/Plugins/*.so") 50 | # file (GLOB_RECURSE _qtplugins "@QT_PLUGINS_DIR@/*.bundle") 51 | # foreach (_qtp ${_qtplugins}) 52 | # get_filename_component(_dir "${_qtp}" PATH) 53 | # list(APPEND _qtdirs "${_dir}") 54 | # endforeach () 55 | 56 | # # Get library paths 57 | # get_filename_component(_GlutDir "@GLUT_glut_LIBRARY@" PATH) 58 | 59 | # # fix all dependencies 60 | # fixup_bundle (@CMAKE_BINARY_DIR@/Build/bin/QtViewer "${_qtplugins}" "/usr/lib;${_qtdirs};${_GlutDir}") 61 | # 62 | #endif() 63 | 64 | # create qt plugin configuration file 65 | # file(WRITE "@CMAKE_BINARY_DIR@/Build/OpenMesh.app/Contents/Resources/qt.conf" "[Paths]\nPlugins = Resources/QtPlugins") 66 | 67 | -------------------------------------------------------------------------------- /cmake/fixbundle.cmake.win.in: -------------------------------------------------------------------------------- 1 | # gp_item_default_embedded_path_override item default_embedded_path_var 2 | # 3 | # Return the path that others should refer to the item by when the item 4 | # is embedded inside a bundle. 5 | # 6 | # This is a project-specific override of BundleUtilities.cmake's 7 | # gp_item_default_embedded_path 8 | # 9 | function(gp_item_default_embedded_path_override item default_embedded_path_var) 10 | 11 | # By default, embed items as set by gp_item_default_embedded_path: 12 | # 13 | set(path "${${default_embedded_path_var}}") 14 | 15 | set(${default_embedded_path_var} "${path}" PARENT_SCOPE) 16 | endfunction(gp_item_default_embedded_path_override) 17 | 18 | include (BundleUtilities) 19 | 20 | # Get library paths 21 | get_filename_component(_GlutDir "@GLUT_glut_LIBRARY@" PATH) 22 | 23 | # fix all dependencies 24 | fixup_bundle ("@CMAKE_BINARY_DIR@/Build/Smoothing.exe" "" "${_GlutDir};@QT_BINARY_DIR@") 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /conanfile.py: -------------------------------------------------------------------------------- 1 | from conans import ConanFile, CMake, tools 2 | 3 | 4 | class OpenmeshConan(ConanFile): 5 | name = "OpenMesh" 6 | version = "7.1" 7 | license = "" 8 | author = " " 9 | url = "https://github.com/lawrencem99/openmesh.git" 10 | description = "" 11 | topics = ("", "", "") 12 | settings = "os", "compiler", "build_type", "arch" 13 | options = {"shared": [True, False], "fPIC": [True, False]} 14 | default_options = {"shared": False, "fPIC": False} 15 | generators = "cmake" 16 | scm = { 17 | "type": "git", 18 | "url": "https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh.git", 19 | "revision": "OpenMesh-"+version, 20 | "subfolder": "OpenMesh", 21 | } 22 | 23 | def configure(self): 24 | if self.settings.compiler == "Visual Studio": 25 | del self.options.fPIC 26 | 27 | def source(self): 28 | # disable documentation build 29 | tools.replace_in_file("OpenMesh/CMakeLists.txt", "add_subdirectory (Doc)", "") 30 | 31 | # disable "d" suffix for Debug build 32 | tools.replace_in_file("OpenMesh/CMakeLists.txt", 'set (CMAKE_DEBUG_POSTFIX "d")', '') 33 | 34 | # do not build both shared and static library for non-Windows builds 35 | tools.replace_in_file("OpenMesh/src/OpenMesh/Tools/CMakeLists.txt", "target_link_libraries (OpenMeshToolsStatic OpenMeshCoreStatic)", "") 36 | tools.replace_in_file("OpenMesh/src/OpenMesh/Tools/CMakeLists.txt", "add_dependencies (fixbundle OpenMeshToolsStatic)", "") 37 | 38 | def build(self): 39 | # choose shared/static for Windows builds 40 | tools.replace_in_file("OpenMesh/CMakeLists.txt", "set( OPENMESH_BUILD_SHARED false", "set( OPENMESH_BUILD_SHARED " + ("true" if self.options.shared else "false")) 41 | 42 | # do not build both shared and static library for non-Windows builds 43 | tools.replace_in_file("OpenMesh/src/OpenMesh/Core/CMakeLists.txt", "SHAREDANDSTATIC", "SHARED" if self.options.shared else "STATIC") 44 | tools.replace_in_file("OpenMesh/src/OpenMesh/Tools/CMakeLists.txt", "SHAREDANDSTATIC", "SHARED" if self.options.shared else "STATIC") 45 | 46 | cmake = CMake(self) 47 | 48 | if self.settings.compiler != "Visual Studio": 49 | cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.fPIC 50 | 51 | cmake.configure(defs={"BUILD_APPS": "OFF"}, source_folder="OpenMesh") 52 | cmake.build() 53 | cmake.install() 54 | 55 | def package(self): 56 | pass 57 | # self.copy("*", dst="include/OpenMesh", src="openmesh/src/OpenMesh") 58 | # self.copy("*.lib", dst="lib", keep_path=False) 59 | # self.copy("*.dll", dst="bin", keep_path=False) 60 | # self.copy("*.so", dst="lib", keep_path=False) 61 | # self.copy("*.dylib", dst="lib", keep_path=False) 62 | # self.copy("*.a", dst="lib", keep_path=False) 63 | 64 | def package_info(self): 65 | self.cpp_info.libs = ["OpenMeshCore", "OpenMeshTools"] 66 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | openmesh (2.0-0~ppa1~maverick1) maverick; urgency=low 2 | 3 | * First maverick version of the official openmesh v2 release. 4 | * Adding libxi-dev, libxmu-dev dependencies to build the apps. 5 | 6 | -- Jean Pierre Charalambos Sun, 02 Jan 2011 10:29:02 -0500 7 | 8 | openmesh (2.0~svn216-0~ppa3~karmic1) karmic; urgency=low 9 | 10 | * Fix UPSTREAM SVN REPOSITORY in rules. Thanks to Jan Möbius. 11 | 12 | -- Jean Pierre Charalambos Wed, 11 Nov 2009 17:14:27 -0500 13 | 14 | openmesh (2.0~svn216-0~ppa2~karmic1) karmic; urgency=low 15 | 16 | * Same as first karmic version but this one includes the changelog from Jaunty versions 17 | * Karmic versions fix PACKAGE name in rules from libopenmesh to openmesh 18 | * Karmic versions remove debian directory from svn export 19 | * It remains to fix a SONAMES warning. Maybe it has to see with the upper case letters usage? 20 | 21 | -- Jean Pierre Charalambos Thu, 05 Nov 2009 14:53:02 -0500 22 | 23 | openmesh (2.0~svn216-0~ppa1~karmic1) karmic; urgency=low 24 | 25 | * Fisrt karmic version 26 | * New upstream SVN snapshot taken from revision 216 27 | 28 | -- Jean Pierre Charalambos Tue, 03 Nov 2009 21:32:38 -0500 29 | 30 | openmesh (2.0~svn177-0~ppa2~jaunty1) jaunty; urgency=low 31 | 32 | * Adding the documentation package. 33 | 34 | -- Jean Pierre Charalambos Thu, 25 Jun 2009 20:07:43 -0500 35 | 36 | openmesh (2.0~svn177-0~ppa1~jaunty1) jaunty; urgency=low 37 | 38 | * New upstream SVN snapshot. 39 | * Splitting the library into libopenmesh and libopenmesh-dev, after 40 | fixes to SONAMES added at this upstream revision. 41 | * No documentation added yet. 42 | * Removing r167 packages from the ppa because they do not conform with 43 | packaging sources directly imported from SVN. According to debian 44 | policies, in this case get-orig-source must be used. 45 | 46 | -- Jean Pierre Charalambos Wed, 24 Jun 2009 22:26:31 -0500 47 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: openmesh 2 | Section: libs 3 | Priority: optional 4 | Maintainer: Jean Pierre Charalambos 5 | Build-Depends: cdbs, debhelper (>= 7), cmake, libqt4-dev, libqt4-opengl-dev, freeglut3-dev, libfreetype6-dev, libgomp1, doxygen 6 | Standards-Version: 3.9.1 7 | Homepage: http://www.openmesh.org 8 | 9 | Package: libopenmesh 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends} 12 | Description: OpenMesh is a generic and efficient data structure for representing 13 | and manipulating polygonal meshes. OpenMesh provides the following features: 14 | . 15 | * Representation of arbitrary polygonal and pure triangle meshes. 16 | * Explicit representation of vertices, halfedges, edges and faces. 17 | * Fast neighborhood access, especially the one-ring neighborhood. 18 | * Highly customizable. 19 | . 20 | This package contains the shared library needed to run programs using 21 | OpenMesh. 22 | 23 | Package: libopenmesh-dev 24 | Section: libdevel 25 | Architecture: any 26 | Depends: ${shlibs:Depends}, ${misc:Depends}, libopenmesh (= ${binary:Version}), libqt4-dev, libqt4-opengl-dev, freeglut3-dev, libfreetype6-dev 27 | Suggests: qt4-designer(>= 4.5), qt4-dev-tools (>= 4.5), libopenmesh-doc, libopenmesh-apps 28 | Description: OpenMesh is a generic and efficient data structure for representing 29 | and manipulating polygonal meshes. OpenMesh provides the following features: 30 | . 31 | * Representation of arbitrary polygonal and pure triangle meshes. 32 | * Explicit representation of vertices, halfedges, edges and faces. 33 | * Fast neighborhood access, especially the one-ring neighborhood. 34 | * Highly customizable. 35 | . 36 | This package contains all supplementary files (static library and headers) 37 | you need to develop your own programs using the OpenMesh library. 38 | 39 | Package: libopenmesh-apps 40 | Architecture: any 41 | Depends: ${shlibs:Depends}, ${misc:Depends}, libopenmesh (= ${binary:Version}) 42 | Description: OpenMesh is a generic and efficient data structure for representing 43 | and manipulating polygonal meshes. OpenMesh provides the following features: 44 | . 45 | * Representation of arbitrary polygonal and pure triangle meshes. 46 | * Explicit representation of vertices, halfedges, edges and faces. 47 | * Fast neighborhood access, especially the one-ring neighborhood. 48 | * Highly customizable. 49 | . 50 | This package contains some binary applications that show some features of the 51 | OpenMesh library. 52 | 53 | Package: libopenmesh-doc 54 | Architecture: all 55 | Depends: ${misc:Depends} 56 | Section: doc 57 | Suggests: libopenmesh-dev (= ${binary:Version}), libopenmesh-apps (= ${binary:Version}) 58 | Description: OpenMesh is a generic and efficient data structure for representing 59 | and manipulating polygonal meshes. OpenMesh provides the following features: 60 | . 61 | * Representation of arbitrary polygonal and pure triangle meshes. 62 | * Explicit representation of vertices, halfedges, edges and faces. 63 | * Fast neighborhood access, especially the one-ring neighborhood. 64 | * Highly customizable. 65 | . 66 | This package constains the API documentation of the OpenMesh library in HTML 67 | format. 68 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by: 2 | 3 | Jean Pierre Charalambos on Sun, 21 Jun 2009 17:49:34 -0500 4 | 5 | It was downloaded from: 6 | 7 | http://www.openmesh.org 8 | 9 | Upstream Author: 10 | 11 | Computer Graphics Group, RWTH Aachen 12 | 13 | Copyright: 14 | 15 | Copyright (C) 2001-2015 by Computer Graphics Group, RWTH-Aachen University 16 | 17 | License: 18 | 19 | Redistribution and use in source and binary forms, with or without 20 | modification, are permitted provided that the following conditions 21 | are met: 22 | 23 | 1. Redistributions of source code must retain the above copyright notice, 24 | this list of conditions and the following disclaimer. 25 | 26 | 2. Redistributions in binary form must reproduce the above copyright 27 | notice, this list of conditions and the following disclaimer in the 28 | documentation and/or other materials provided with the distribution. 29 | 30 | 3. Neither the name of the copyright holder nor the names of its 31 | contributors may be used to endorse or promote products derived from 32 | this software without specific prior written permission. 33 | 34 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 35 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 36 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 37 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 38 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 39 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 40 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 41 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 42 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 43 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 44 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 45 | 46 | 47 | On Debian systems, the complete text of the BSD License can be 48 | found in `/usr/share/common-licenses/BSD '. 49 | 50 | The Debian packaging is: 51 | 52 | Copyright C) 2009, Jean Pierre Charalambos 53 | 54 | and is licensed under the GPL, see above. 55 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | include /usr/share/cdbs/1/rules/debhelper.mk 4 | include /usr/share/cdbs/1/class/cmake.mk 5 | 6 | build/libopenmesh-doc:: 7 | cd $(DEB_BUILDDIR) && $(MAKE) doc 8 | mkdir -p debian/tmp/usr/share/doc/ 9 | cp -r $(DEB_BUILDDIR)/Build/share/OpenMesh/Doc/html debian/tmp/usr/share/doc/OpenMesh 10 | 11 | install/libopenmesh:: 12 | ln -sf libOpenMeshCore.so.2.0 debian/tmp/usr/lib/OpenMesh/libOpenMeshCore.so.2 13 | ln -sf libOpenMeshTools.so.2.0 debian/tmp/usr/lib/OpenMesh/libOpenMeshTools.so.2 14 | dh_install -plibopenmesh debian/tmp/usr/lib/OpenMesh/lib*.so.* /usr/lib/ 15 | 16 | install/libopenmesh-dev:: 17 | dh_install -plibopenmesh-dev debian/tmp/usr/lib/OpenMesh/lib*.so /usr/lib/ 18 | dh_install -plibopenmesh-dev debian/tmp/usr/lib/OpenMesh/lib*.a /usr/lib/ 19 | dh_install -plibopenmesh-dev --autodest debian/tmp/usr/include/OpenMesh 20 | 21 | install/libopenmesh-apps:: 22 | dh_install -plibopenmesh-apps debian/tmp/usr/bin/* /usr/lib/OpenMesh/Apps 23 | 24 | install/libopenmesh-doc:: 25 | dh_install -plibopenmesh-doc debian/tmp/usr/share/doc/* 26 | -------------------------------------------------------------------------------- /release.howto: -------------------------------------------------------------------------------- 1 | 1. check files, build on windows,mac,linux with cmake 2 | 2. check files with release numbers: 3 | cmake/FindOpenMesh.cmake 4 | Doc/changelog.docu 5 | src/OpenMesh/Core/System/config.h 6 | README 7 | VERSION 8 | 3. Tag the current version in the svn (checkout, remove .svn readd as tag) 9 | 4. Create HTML-Documentation in OpenMesh/Docu/ (!) 10 | 5. Create tar-ball and zip-archive 11 | > tar cvzf OpenMesh-.tar.gz OpenMesh-/ 12 | > tar cvjf OpenMesh-.tar.bz2 OpenMesh-/ 13 | > zip -9 -r OpenMesh-.zip OpenMesh-/ 14 | 6. Release Upload 15 | 7. Upload the Documentation to webserver 16 | 8. Set new links in content management system 17 | -------------------------------------------------------------------------------- /src/Benchmark/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (SOURCES "") 2 | list (APPEND SOURCES 3 | main.cpp 4 | VectorT_new.cpp 5 | VectorT_legacy.cpp 6 | VectorT_dummy_data.cpp 7 | ) 8 | 9 | add_executable(OMBenchmark ${SOURCES}) 10 | set_target_properties(OMBenchmark PROPERTIES 11 | INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/..") 12 | target_link_libraries(OMBenchmark benchmark OpenMeshCore) -------------------------------------------------------------------------------- /src/Benchmark/VectorT_dummy_data.cpp: -------------------------------------------------------------------------------- 1 | #include "VectorT_dummy_data.hpp" 2 | 3 | template<> std::valarray make_dummy_component() { 4 | return std::valarray(128); 5 | } 6 | -------------------------------------------------------------------------------- /src/Benchmark/VectorT_dummy_data.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | template 7 | T make_dummy_component() { 8 | return T(); 9 | } 10 | 11 | template<> std::valarray make_dummy_component(); 12 | 13 | template 14 | Vec make_dummy_vector() { 15 | return Vec(make_dummy_component()); 16 | } 17 | 18 | template 19 | double observe_dummy_component(const Scalar& _s) { 20 | return _s; 21 | } 22 | 23 | template 24 | double observe_dummy_component(const std::valarray& _s) { 25 | return _s.sum(); 26 | } 27 | 28 | template 29 | double observe_dummy_component(const std::complex& _s) { 30 | return _s.real() + _s.imag(); 31 | } 32 | 33 | template 34 | double observe_dummy_vector(const Vec& _vec) { 35 | double result = 0.0; 36 | for (int dim = 0; dim < _vec.dim(); ++dim) { 37 | result += observe_dummy_component(_vec[dim]); 38 | } 39 | return result; 40 | } 41 | -------------------------------------------------------------------------------- /src/Benchmark/VectorT_legacy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * VectorT_legacy.cpp 3 | * 4 | * Created on: Nov 19, 2015 5 | * Author: ebke 6 | */ 7 | 8 | #include 9 | 10 | #define OPENMESH_VECTOR_LEGACY 11 | #include 12 | 13 | #define BMPOSTFIX _Legacy 14 | #include "VectorT.cpp" 15 | -------------------------------------------------------------------------------- /src/Benchmark/VectorT_new.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * VectorT_new.cpp 3 | * 4 | * Created on: Nov 19, 2015 5 | * Author: ebke 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | #define BMPOSTFIX _CPP11 12 | #include "VectorT.cpp" 13 | -------------------------------------------------------------------------------- /src/Benchmark/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * main.cpp 3 | * 4 | * Created on: Nov 19, 2015 5 | * Author: ebke 6 | */ 7 | 8 | #include 9 | 10 | BENCHMARK_MAIN(); 11 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/Decimating/DecimaterGui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGCommon) 2 | 3 | include_directories ( 4 | ../../../.. 5 | ${CMAKE_CURRENT_SOURCE_DIR} 6 | ${GLUT_INCLUDE_DIR} 7 | ) 8 | 9 | # source code directories 10 | set (directories 11 | ../../QtViewer 12 | ../ 13 | ) 14 | 15 | # collect all header and source files 16 | acg_append_files (headers "*.hh" ${directories}) 17 | 18 | set (sources 19 | ../../QtViewer/QGLViewerWidget.cc 20 | ../../QtViewer/MeshViewerWidgetT.cc 21 | ../DecimaterViewerWidget.cc 22 | ../decimaterviewer.cc 23 | ) 24 | 25 | # remove template cc files from source file list 26 | acg_drop_templates (sources) 27 | 28 | if (WIN32) 29 | acg_add_executable (DecimaterGui WIN32 ${sources} ${headers}) 30 | else () 31 | acg_add_executable (DecimaterGui ${sources} ${headers} ) 32 | endif () 33 | 34 | target_link_libraries (DecimaterGui 35 | OpenMeshCore 36 | OpenMeshTools 37 | Qt5::OpenGL 38 | ${OPENGL_LIBRARIES} 39 | ${GLUT_LIBRARIES} 40 | ) 41 | 42 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/Decimating/commandlineDecimater/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGCommon) 2 | 3 | include_directories ( 4 | ../../../.. 5 | ${CMAKE_CURRENT_SOURCE_DIR} 6 | ) 7 | 8 | # collect all header and source files 9 | set (sources 10 | ../decimater.cc 11 | ) 12 | 13 | acg_add_executable (commandlineDecimater ${sources}) 14 | 15 | target_link_libraries (commandlineDecimater 16 | OpenMeshCore 17 | OpenMeshTools 18 | ) 19 | 20 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/Dualizer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGCommon) 2 | 3 | include_directories ( 4 | ../../.. 5 | ${CMAKE_CURRENT_SOURCE_DIR} 6 | ) 7 | 8 | # collect all header and source files 9 | acg_append_files (headers "*.hh" .) 10 | acg_append_files (sources "*.cc" .) 11 | 12 | acg_add_executable (Dualizer ${headers} ${sources}) 13 | 14 | target_link_libraries (Dualizer 15 | OpenMeshCore 16 | OpenMeshTools 17 | ) 18 | 19 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/ProgViewer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGCommon) 2 | 3 | include_directories ( 4 | ../../.. 5 | ${CMAKE_CURRENT_SOURCE_DIR} 6 | ${GLUT_INCLUDE_DIR} 7 | ) 8 | 9 | 10 | # collect all header and source files 11 | acg_append_files (headers "*.hh" .) 12 | acg_append_files (sources "*.cc" .) 13 | 14 | list (APPEND sources "../QtViewer/QGLViewerWidget.cc") 15 | list (APPEND sources "../QtViewer/MeshViewerWidgetT.cc") 16 | 17 | list (APPEND headers "../QtViewer/QGLViewerWidget.hh") 18 | list (APPEND headers "../QtViewer/MeshViewerWidgetT.hh") 19 | 20 | # remove template cc files from source file list 21 | acg_drop_templates (sources) 22 | 23 | if (WIN32) 24 | acg_add_executable( ProgViewer WIN32 ${sources} ${headers}) 25 | else () 26 | acg_add_executable( ProgViewer ${sources} ${headers}) 27 | endif () 28 | 29 | target_link_libraries ( ProgViewer 30 | OpenMeshCore 31 | OpenMeshTools 32 | Qt5::OpenGL 33 | ${OPENGL_LIBRARIES} 34 | ${GLUT_LIBRARIES} 35 | ) 36 | 37 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/Qt/qt.conf: -------------------------------------------------------------------------------- 1 | [Paths] 2 | Plugins = plugins 3 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/QtViewer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGCommon) 2 | 3 | include_directories ( 4 | ../../.. 5 | ${CMAKE_CURRENT_SOURCE_DIR} 6 | ${GLUT_INCLUDE_DIR} 7 | ) 8 | 9 | # source code directories 10 | set (directories 11 | . 12 | ) 13 | 14 | # collect all header and source files 15 | acg_append_files (headers "*.hh" ${directories}) 16 | acg_append_files (sources "*.cc" ${directories}) 17 | 18 | # remove template cc files from source file list 19 | acg_drop_templates (sources) 20 | 21 | if (WIN32) 22 | acg_add_executable (QtViewer WIN32 ${sources} ${headers}) 23 | else () 24 | acg_add_executable (QtViewer ${sources} ${headers}) 25 | endif () 26 | 27 | target_link_libraries (QtViewer 28 | OpenMeshCore 29 | OpenMeshTools 30 | Qt5::OpenGL 31 | ${OPENGL_LIBRARIES} 32 | ${GLUT_LIBRARIES} 33 | ) 34 | 35 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/Smoothing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGCommon) 2 | 3 | include_directories ( 4 | ../../.. 5 | ${CMAKE_CURRENT_SOURCE_DIR} 6 | ) 7 | 8 | # collect all header and source files 9 | acg_append_files (headers "*.hh" .) 10 | acg_append_files (sources "*.cc" .) 11 | 12 | acg_add_executable (Smoothing ${headers} ${sources}) 13 | 14 | target_link_libraries (Smoothing 15 | OpenMeshCore 16 | OpenMeshTools 17 | ) 18 | 19 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/Subdivider/SubdividerGui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGCommon) 2 | 3 | include_directories ( 4 | ../../../.. 5 | ${CMAKE_CURRENT_SOURCE_DIR} 6 | ${GLUT_INCLUDE_DIR} 7 | ) 8 | 9 | # source code directories 10 | set (directories 11 | ../../QtViewer 12 | ../ 13 | ) 14 | 15 | # collect all header and source files 16 | acg_append_files (headers "*.hh" ${directories}) 17 | 18 | set (sources 19 | ../../QtViewer/QGLViewerWidget.cc 20 | ../../QtViewer/MeshViewerWidgetT.cc 21 | ../SubdivideWidget.cc 22 | ../qtsubdivider.cc 23 | ) 24 | 25 | # remove template cc files from source file list 26 | acg_drop_templates (sources) 27 | 28 | if (WIN32) 29 | acg_add_executable (SubdividerGui WIN32 ${sources} ${headers}) 30 | else () 31 | acg_add_executable (SubdividerGui ${sources} ${headers}) 32 | endif () 33 | 34 | target_link_libraries (SubdividerGui 35 | OpenMeshCore 36 | OpenMeshTools 37 | Qt5::OpenGL 38 | ${OPENGL_LIBRARIES} 39 | ${GLUT_LIBRARIES} 40 | ) 41 | 42 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/Subdivider/commandlineAdaptiveSubdivider/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGCommon) 2 | 3 | include_directories ( 4 | ../../../.. 5 | ${CMAKE_CURRENT_SOURCE_DIR} 6 | ) 7 | 8 | # collect all header and source files 9 | set (sources 10 | ../adaptive_subdivider.cc 11 | ) 12 | 13 | acg_add_executable (commandlineAdaptiveSubdivider ${sources}) 14 | 15 | target_link_libraries (commandlineAdaptiveSubdivider 16 | OpenMeshCore 17 | OpenMeshTools 18 | ) 19 | 20 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/Subdivider/commandlineSubdivider/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGCommon) 2 | 3 | include_directories ( 4 | ../../../.. 5 | ${CMAKE_CURRENT_SOURCE_DIR} 6 | ) 7 | 8 | # collect all header and source files 9 | set (sources 10 | ../subdivider.cc 11 | ) 12 | 13 | acg_add_executable (commandlineSubdivider ${sources}) 14 | 15 | target_link_libraries (commandlineSubdivider 16 | OpenMeshCore 17 | OpenMeshTools 18 | ) 19 | 20 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/Unsupported/OsgViewer/README: -------------------------------------------------------------------------------- 1 | Usage: 2 | 3 | 1. osgviewer 4 | 5 | Load a model via I/O routines of OpenMesh and save as a OpenSG 6 | binary file in file opensg.bin. 7 | 8 | 2. osgviewer 9 | 10 | Load model previously stored in opensg.bin via OpenSG BINLoader. 11 | 12 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/Unsupported/Streaming-qt4/Client/camera.cmr: -------------------------------------------------------------------------------- 1 | 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.016996 -0.109919 -0.370638 1.000000 2 | 2.414214 0.000000 0.000000 0.000000 0.000000 2.414214 0.000000 0.000000 0.000000 0.000000 -1.000200 -1.000000 0.000000 0.000000 -0.002487 0.000000 3 | 0.000000 1.000000 0.000000 176744288671350421565538919745292424325033476751523693228169963004884932940091916749086946235466103001193375847224942690972512534721986560.000000 0.000000 nan 425134321045072769729657674081032044702092994459323810191320335465371399515446481741965189098676184821816460416151892487150071042707962836116024422753449790030954505984610613125759424311663740707690994610961772976644207938664290688788945427521964959221153792.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 4 | 0.000000 0.000000 0.000000 1.000000 0.000000 43138399251230245763880957247161123402511258100486738812232497009688599814651595596323661983776768.000000 0.000000 nan 56217166495396395288300850038172311276865324027010017909696113739489719293525015037327494588529843730643950329227434086235241736485385775424471015442015055292454325203222134784.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 5 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/Unsupported/Streaming-qt4/Server/bunny.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Server/bunny.pm -------------------------------------------------------------------------------- /src/OpenMesh/Apps/Unsupported/Streaming-qt4/Server/bunny.spm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Server/bunny.spm -------------------------------------------------------------------------------- /src/OpenMesh/Apps/Unsupported/Streaming-qt4/Server/rockerArm.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Server/rockerArm.pm -------------------------------------------------------------------------------- /src/OpenMesh/Apps/VDProgMesh/Analyzer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGCommon) 2 | 3 | include_directories ( 4 | ../../../.. 5 | ${CMAKE_CURRENT_SOURCE_DIR} 6 | ) 7 | 8 | # collect all header and source files 9 | set (sources 10 | ./vdpmanalyzer.cc 11 | ) 12 | 13 | acg_add_executable (Analyzer ${sources}) 14 | 15 | target_link_libraries (Analyzer 16 | OpenMeshCore 17 | OpenMeshTools 18 | ) 19 | 20 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/VDProgMesh/Synthesizer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGCommon) 2 | 3 | include_directories ( 4 | ../../../.. 5 | ${CMAKE_CURRENT_SOURCE_DIR} 6 | ${GLUT_INCLUDE_DIR} 7 | ) 8 | 9 | # collect all header and source files 10 | acg_append_files (headers "*.hh" .) 11 | acg_append_files (sources "*.cc" .) 12 | 13 | list (APPEND sources "../../QtViewer/QGLViewerWidget.cc") 14 | list (APPEND sources "../../QtViewer/MeshViewerWidgetT.cc") 15 | 16 | list (APPEND headers "../../QtViewer/QGLViewerWidget.hh") 17 | list (APPEND headers "../../QtViewer/MeshViewerWidgetT.hh") 18 | 19 | # remove template cc files from source file list 20 | acg_drop_templates (sources) 21 | 22 | if (WIN32) 23 | acg_add_executable (Synthesizer WIN32 ${sources} ${headers}) 24 | else () 25 | acg_add_executable (Synthesizer ${sources} ${headers}) 26 | endif () 27 | 28 | target_link_libraries (Synthesizer 29 | OpenMeshCore 30 | OpenMeshTools 31 | Qt5::OpenGL 32 | ${OPENGL_LIBRARIES} 33 | ${GLUT_LIBRARIES} 34 | ) 35 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGCommon) 2 | 3 | include_directories ( 4 | ../../../.. 5 | ${CMAKE_CURRENT_SOURCE_DIR} 6 | ) 7 | 8 | # collect all header and source files 9 | set (sources 10 | ./mkbalancedpm.cc 11 | ) 12 | 13 | acg_add_executable (mkbalancedpm ${sources}) 14 | 15 | target_link_libraries (mkbalancedpm 16 | OpenMeshCore 17 | OpenMeshTools 18 | ) 19 | 20 | -------------------------------------------------------------------------------- /src/OpenMesh/Apps/mconvert/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include (ACGCommon) 2 | 3 | include_directories ( 4 | ../../.. 5 | ${CMAKE_CURRENT_SOURCE_DIR} 6 | ) 7 | 8 | # collect all header and source files 9 | acg_append_files (headers "*.hh" .) 10 | acg_append_files (sources "*.cc" .) 11 | 12 | acg_add_executable (mconvert ${headers} ${sources}) 13 | 14 | target_link_libraries (mconvert 15 | OpenMeshCore 16 | OpenMeshTools 17 | ) 18 | 19 | -------------------------------------------------------------------------------- /src/OpenMesh/Core/IO/SR_binary_vector_of_bool.inl: -------------------------------------------------------------------------------- 1 | 2 | template <> struct binary< std::vector > 3 | { 4 | 5 | typedef std::vector< bool > value_type; 6 | typedef value_type::value_type elem_type; 7 | 8 | static const bool is_streamable = true; 9 | 10 | static size_t size_of(void) { return UnknownSize; } 11 | static size_t size_of(const value_type& _v) 12 | { 13 | return _v.size() / 8 + ((_v.size() % 8)!=0); 14 | } 15 | 16 | static 17 | size_t store( std::ostream& _ostr, const value_type& _v, bool ) 18 | { 19 | size_t bytes = 0; 20 | 21 | size_t N = _v.size() / 8; 22 | size_t R = _v.size() % 8; 23 | 24 | size_t idx; // element index 25 | unsigned char bits; // bitset 26 | 27 | for (idx=0; idx < N; ++idx) 28 | { 29 | bits = static_cast(_v[idx]) 30 | | (static_cast(_v[idx+1]) << 1) 31 | | (static_cast(_v[idx+2]) << 2) 32 | | (static_cast(_v[idx+3]) << 3) 33 | | (static_cast(_v[idx+4]) << 4) 34 | | (static_cast(_v[idx+5]) << 5) 35 | | (static_cast(_v[idx+6]) << 6) 36 | | (static_cast(_v[idx+7]) << 7); 37 | _ostr << bits; 38 | } 39 | bytes = N; 40 | 41 | if (R) 42 | { 43 | bits = 0; 44 | switch(R) 45 | { 46 | case 7: bits |= (static_cast(_v[idx+6]) << 6); 47 | case 6: bits |= (static_cast(_v[idx+5]) << 5); 48 | case 5: bits |= (static_cast(_v[idx+4]) << 4); 49 | case 4: bits |= (static_cast(_v[idx+3]) << 3); 50 | case 3: bits |= (static_cast(_v[idx+2]) << 2); 51 | case 2: bits |= (static_cast(_v[idx+1]) << 1); 52 | case 1: bits |= static_cast(_v[idx+0]); 53 | } 54 | _ostr << bits; 55 | ++bytes; 56 | } 57 | 58 | assert( bytes == size_of(_v) ); 59 | 60 | return bytes; 61 | } 62 | 63 | static 64 | size_t restore( std::istream& _istr, value_type& _v, bool ) 65 | { 66 | size_t bytes = 0; 67 | 68 | size_t N = _v.size() / 8; 69 | size_t R = _v.size() % 8; 70 | 71 | size_t idx; // element index 72 | unsigned char bits; // bitset 73 | 74 | for (idx=0; idx < N; ++idx) 75 | { 76 | _istr >> bits; 77 | _v[idx+0] = ((bits & 0x01)!=0); 78 | _v[idx+1] = ((bits & 0x02)!=0); 79 | _v[idx+2] = ((bits & 0x04)!=0); 80 | _v[idx+3] = ((bits & 0x08)!=0); 81 | _v[idx+4] = ((bits & 0x10)!=0); 82 | _v[idx+5] = ((bits & 0x20)!=0); 83 | _v[idx+6] = ((bits & 0x40)!=0); 84 | _v[idx+7] = ((bits & 0x80)!=0); 85 | } 86 | bytes = N; 87 | 88 | if (R) 89 | { 90 | _istr >> bits; 91 | for(; idx < _v.size(); ++idx) 92 | _v[idx] = (bits & (1 << (idx%8)))!=0; 93 | ++bytes; 94 | } 95 | 96 | return bytes; 97 | } 98 | }; 99 | -------------------------------------------------------------------------------- /src/OpenMesh/Core/IO/SR_binary_vector_of_fundamentals.inl: -------------------------------------------------------------------------------- 1 | 2 | #define BINARY_VECTOR( T ) \ 3 | template <> struct binary< std::vector< T > > { \ 4 | typedef std::vector< T > value_type; \ 5 | typedef value_type::value_type elem_type; \ 6 | \ 7 | static const bool is_streamable = true; \ 8 | \ 9 | static size_t size_of(void) \ 10 | { return IO::UnknownSize; } \ 11 | \ 12 | static size_t size_of(const value_type& _v) \ 13 | { return sizeof(elem_type)*_v.size(); } \ 14 | \ 15 | static \ 16 | size_t store(std::ostream& _os, const value_type& _v, bool _swap=false) { \ 17 | size_t bytes=0; \ 18 | \ 19 | if (_swap) \ 20 | bytes = std::accumulate( _v.begin(), _v.end(), bytes, \ 21 | FunctorStore(_os,_swap) ); \ 22 | else { \ 23 | bytes = size_of(_v); \ 24 | _os.write( reinterpret_cast(&_v[0]), bytes ); \ 25 | } \ 26 | return _os.good() ? bytes : 0; \ 27 | } \ 28 | \ 29 | static size_t restore(std::istream& _is, value_type& _v, bool _swap=false) { \ 30 | size_t bytes=0; \ 31 | \ 32 | if ( _swap) \ 33 | bytes = std::accumulate( _v.begin(), _v.end(), size_t(0), \ 34 | FunctorRestore(_is, _swap) ); \ 35 | else \ 36 | { \ 37 | bytes = size_of(_v); \ 38 | _is.read( reinterpret_cast(&_v[0]), bytes ); \ 39 | } \ 40 | return _is.good() ? bytes : 0; \ 41 | } \ 42 | } 43 | 44 | BINARY_VECTOR( short ); 45 | BINARY_VECTOR( unsigned short ); 46 | BINARY_VECTOR( int ); 47 | BINARY_VECTOR( unsigned int ); 48 | BINARY_VECTOR( long ); 49 | BINARY_VECTOR( unsigned long ); 50 | BINARY_VECTOR( float ); 51 | BINARY_VECTOR( double ); 52 | 53 | #undef BINARY_VECTOR 54 | -------------------------------------------------------------------------------- /src/OpenMesh/Core/IO/SR_binary_vector_of_string.inl: -------------------------------------------------------------------------------- 1 | 2 | template <> struct binary< std::vector< std::string > > 3 | { 4 | // struct binary interface 5 | 6 | typedef std::vector< std::string > value_type; 7 | typedef value_type::value_type elem_type; 8 | 9 | static const bool is_streamable = true; 10 | 11 | // Helper 12 | 13 | struct Sum 14 | { 15 | size_t operator() ( size_t _v1, const elem_type& _s2 ) 16 | { return _v1 + binary::size_of(_s2); } 17 | }; 18 | 19 | // struct binary interface 20 | 21 | static size_t size_of(void) { return UnknownSize; } 22 | 23 | static size_t size_of(const value_type& _v) 24 | { return std::accumulate( _v.begin(), _v.end(), size_t(0), Sum() ); } 25 | 26 | static 27 | size_t store(std::ostream& _os, const value_type& _v, bool _swap=false) 28 | { 29 | return std::accumulate( _v.begin(), _v.end(), size_t(0), 30 | FunctorStore(_os, _swap) ); 31 | } 32 | 33 | static 34 | size_t restore(std::istream& _is, value_type& _v, bool _swap=false) 35 | { 36 | return std::accumulate( _v.begin(), _v.end(), size_t(0), 37 | FunctorRestore(_is, _swap) ); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /src/OpenMesh/Core/IO/writer/VTKWriter.cc: -------------------------------------------------------------------------------- 1 | //== INCLUDES ================================================================= 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | //=== NAMESPACES ============================================================== 12 | 13 | namespace OpenMesh { 14 | namespace IO { 15 | 16 | //=== INSTANTIATE ============================================================= 17 | 18 | _VTKWriter_ __VTKWriterinstance; 19 | _VTKWriter_& VTKWriter() { return __VTKWriterinstance; } 20 | 21 | //=== IMPLEMENTATION ========================================================== 22 | 23 | _VTKWriter_::_VTKWriter_() { IOManager().register_module(this); } 24 | 25 | //----------------------------------------------------------------------------- 26 | 27 | bool _VTKWriter_::write(const std::string& _filename, BaseExporter& _be, Options _opt, std::streamsize _precision) const 28 | { 29 | std::ofstream out(_filename.c_str()); 30 | 31 | if (!out) { 32 | omerr() << "[VTKWriter] : cannot open file " << _filename << std::endl; 33 | return false; 34 | } 35 | 36 | return write(out, _be, _opt, _precision); 37 | } 38 | 39 | //----------------------------------------------------------------------------- 40 | 41 | bool _VTKWriter_::write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _precision) const 42 | { 43 | Vec3f v, n; 44 | Vec2f t; 45 | VertexHandle vh; 46 | OpenMesh::Vec3f c; 47 | OpenMesh::Vec4f cA; 48 | 49 | // check exporter features 50 | if (!check(_be, _opt)) { 51 | return false; 52 | } 53 | 54 | // check writer features 55 | if (!_opt.is_empty()) { 56 | omlog() << "[VTKWriter] : writer does not support any options\n"; 57 | return false; 58 | } 59 | 60 | omlog() << "[VTKWriter] : write file\n"; 61 | _out.precision(_precision); 62 | 63 | std::vector vhandles; 64 | size_t polygon_table_size = 0; 65 | size_t nf = _be.n_faces(); 66 | for (size_t i = 0; i < nf; ++i) { 67 | polygon_table_size += _be.get_vhandles(FaceHandle(int(i)), vhandles); 68 | } 69 | polygon_table_size += nf; 70 | 71 | // header 72 | _out << "# vtk DataFile Version 3.0\n"; 73 | _out << "Generated by OpenMesh\n"; 74 | _out << "ASCII\n"; 75 | _out << "DATASET POLYDATA\n"; 76 | 77 | // points 78 | _out << "POINTS " << _be.n_vertices() << " float\n"; 79 | size_t nv = _be.n_vertices(); 80 | for (size_t i = 0; i < nv; ++i) { 81 | Vec3f v = _be.point(VertexHandle(int(i))); 82 | _out << v[0] << ' ' << v[1] << ' ' << v[2] << '\n'; 83 | } 84 | 85 | // faces 86 | _out << "POLYGONS " << nf << ' ' << polygon_table_size << '\n'; 87 | for (size_t i = 0; i < nf; ++i) { 88 | _be.get_vhandles(FaceHandle(int(i)), vhandles); 89 | 90 | _out << vhandles.size() << ' '; 91 | for (size_t j = 0; j < vhandles.size(); ++j) { 92 | _out << " " << vhandles[j].idx(); 93 | } 94 | _out << '\n'; 95 | } 96 | 97 | return true; 98 | } 99 | 100 | //============================================================================= 101 | } // namespace IO 102 | } // namespace OpenMesh 103 | //============================================================================= 104 | -------------------------------------------------------------------------------- /src/OpenMesh/Core/IO/writer/VTKWriter.hh: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | // 3 | // Implements an IOManager writer module for VTK files 4 | // 5 | //============================================================================= 6 | 7 | #ifndef __VTKWRITER_HH__ 8 | #define __VTKWRITER_HH__ 9 | 10 | //=== INCLUDES ================================================================ 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | //== NAMESPACES =============================================================== 21 | 22 | namespace OpenMesh { 23 | namespace IO { 24 | 25 | //=== IMPLEMENTATION ========================================================== 26 | 27 | class OPENMESHDLLEXPORT _VTKWriter_ : public BaseWriter 28 | { 29 | public: 30 | _VTKWriter_(); 31 | 32 | std::string get_description() const { return "VTK"; } 33 | std::string get_extensions() const { return "vtk"; } 34 | 35 | bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const; 36 | bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const; 37 | 38 | size_t binary_size(BaseExporter&, Options) const { return 0; } 39 | }; 40 | 41 | //== TYPE DEFINITION ========================================================== 42 | 43 | /// Declare the single entity of the OBJ writer 44 | extern _VTKWriter_ __VTKWriterinstance; 45 | OPENMESHDLLEXPORT _VTKWriter_& VTKWriter(); 46 | 47 | //============================================================================= 48 | } // namespace IO 49 | } // namespace OpenMesh 50 | //============================================================================= 51 | #endif 52 | //============================================================================= 53 | -------------------------------------------------------------------------------- /src/OpenMesh/Core/Mesh/gen/footer.hh: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | } // namespace Iterators 3 | } // namespace OpenMesh 4 | //============================================================================= 5 | #endif 6 | //============================================================================= 7 | -------------------------------------------------------------------------------- /src/OpenMesh/Core/Templates/newClass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | A=`echo $1_ | tr '[:lower:]' '[:upper:]'` 4 | 5 | sed -e s/newClass/$1/g -e s/NEWCLASS_/$A/g < newClass.cc > tmp_newClass.cc 6 | sed -e s/newClass/$1/g -e s/NEWCLASS_/$A/g < newClass.hh > tmp_newClass.hh 7 | 8 | mv -i tmp_newClass.cc $1.cc && echo $1.cc - ok 9 | mv -i tmp_newClass.hh $1.hh && echo $1.hh - ok 10 | -------------------------------------------------------------------------------- /src/OpenMesh/Core/Templates/newClassT.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | A=`echo $1_ | tr '[:lower:]' '[:upper:]'` 4 | 5 | sed -e s/newClass/$1/g -e s/NEWCLASS_/$A/g < newClassT.cc > tmp_newClass.cc 6 | sed -e s/newClass/$1/g -e s/NEWCLASS_/$A/g < newClassT.hh > tmp_newClass.hh 7 | 8 | mv -i tmp_newClass.cc $1.cc && echo $1.cc - ok 9 | mv -i tmp_newClass.hh $1.hh && echo $1.hh - ok 10 | -------------------------------------------------------------------------------- /src/OpenMesh/Core/Utils/HandleToPropHandle.hh: -------------------------------------------------------------------------------- 1 | #ifndef HANDLETOPROPHANDLE_HH_ 2 | #define HANDLETOPROPHANDLE_HH_ 3 | 4 | #include 5 | #include 6 | 7 | namespace OpenMesh { 8 | 9 | template 10 | struct HandleToPropHandle { 11 | }; 12 | 13 | template 14 | struct HandleToPropHandle { 15 | using type = OpenMesh::VPropHandleT; 16 | }; 17 | 18 | template 19 | struct HandleToPropHandle { 20 | using type = OpenMesh::HPropHandleT; 21 | }; 22 | 23 | template 24 | struct HandleToPropHandle { 25 | using type = OpenMesh::EPropHandleT; 26 | }; 27 | 28 | template 29 | struct HandleToPropHandle { 30 | using type = OpenMesh::FPropHandleT; 31 | }; 32 | 33 | template 34 | struct HandleToPropHandle { 35 | using type = OpenMesh::MPropHandleT; 36 | }; 37 | 38 | } // namespace OpenMesh 39 | 40 | #endif // HANDLETOPROPHANDLE_HH_ -------------------------------------------------------------------------------- /src/OpenMesh/Examples/Tutorial02/smooth.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | // -------------------- OpenMesh 4 | #include 5 | #include 6 | 7 | typedef OpenMesh::TriMesh_ArrayKernelT<> MyMesh; 8 | 9 | 10 | int main(int argc, char **argv) 11 | { 12 | MyMesh mesh; 13 | 14 | 15 | // check command line options 16 | if (argc != 4) 17 | { 18 | std::cerr << "Usage: " << argv[0] << " #iterations infile outfile\n"; 19 | return 1; 20 | } 21 | 22 | 23 | // read mesh from stdin 24 | if ( ! OpenMesh::IO::read_mesh(mesh, argv[2]) ) 25 | { 26 | std::cerr << "Error: Cannot read mesh from " << argv[2] << std::endl; 27 | return 1; 28 | } 29 | 30 | 31 | // this vector stores the computed centers of gravity 32 | std::vector cogs; 33 | std::vector::iterator cog_it; 34 | cogs.reserve(mesh.n_vertices()); 35 | 36 | 37 | // smoothing mesh argv[1] times 38 | MyMesh::VertexIter v_it, v_end(mesh.vertices_end()); 39 | MyMesh::VertexVertexIter vv_it; 40 | MyMesh::Point cog; 41 | MyMesh::Scalar valence; 42 | unsigned int i, N(atoi(argv[1])); 43 | 44 | 45 | for (i=0; i < N; ++i) 46 | { 47 | cogs.clear(); 48 | for (v_it=mesh.vertices_begin(); v_it!=v_end; ++v_it) 49 | { 50 | cog[0] = cog[1] = cog[2] = valence = 0.0; 51 | 52 | for (vv_it=mesh.vv_iter( v_it ); vv_it; ++vv_it) 53 | { 54 | cog += mesh.point( vv_it ); 55 | ++valence; 56 | } 57 | 58 | cogs.push_back(cog / valence); 59 | } 60 | 61 | for (v_it=mesh.vertices_begin(), cog_it=cogs.begin(); 62 | v_it!=v_end; ++v_it, ++cog_it) 63 | if ( !mesh.is_boundary( v_it ) ) 64 | mesh.set_point( v_it, *cog_it ); 65 | } 66 | 67 | 68 | // write mesh to stdout 69 | if ( ! OpenMesh::IO::write_mesh(mesh, argv[3]) ) 70 | { 71 | std::cerr << "Error: cannot write mesh to " << argv[3] << std::endl; 72 | return 1; 73 | } 74 | 75 | return 0; 76 | } 77 | -------------------------------------------------------------------------------- /src/OpenMesh/Examples/Tutorial03/smooth.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | // -------------------- 4 | #include 5 | #include 6 | 7 | typedef OpenMesh::TriMesh_ArrayKernelT<> MyMesh; 8 | 9 | 10 | int main(int argc, char **argv) 11 | { 12 | MyMesh mesh; 13 | 14 | 15 | // check command line options 16 | if (argc != 4) 17 | { 18 | std::cerr << "Usage: " << argv[0] << " #iterations infile outfile\n"; 19 | return 1; 20 | } 21 | 22 | 23 | 24 | // read mesh from stdin 25 | if ( ! OpenMesh::IO::read_mesh(mesh, argv[2]) ) 26 | { 27 | std::cerr << "Error: Cannot read mesh from " << argv[2] << std::endl; 28 | return 1; 29 | } 30 | 31 | 32 | 33 | // this vertex property stores the computed centers of gravity 34 | OpenMesh::VPropHandleT cogs; 35 | mesh.add_property(cogs); 36 | 37 | // smoothing mesh argv[1] times 38 | MyMesh::VertexIter v_it, v_end(mesh.vertices_end()); 39 | MyMesh::VertexVertexIter vv_it; 40 | MyMesh::Point cog; 41 | MyMesh::Scalar valence; 42 | unsigned int i, N(atoi(argv[1])); 43 | 44 | 45 | for (i=0; i < N; ++i) 46 | { 47 | for (v_it=mesh.vertices_begin(); v_it!=v_end; ++v_it) 48 | { 49 | mesh.property(cogs,v_it).vectorize(0.0f); 50 | valence = 0; 51 | 52 | for (vv_it=mesh.vv_iter( v_it ); vv_it; ++vv_it) 53 | { 54 | mesh.property(cogs,v_it) += mesh.point( vv_it ); 55 | ++valence; 56 | } 57 | mesh.property(cogs,v_it) /= valence; 58 | } 59 | 60 | for (v_it=mesh.vertices_begin(); v_it!=v_end; ++v_it) 61 | if ( !mesh.is_boundary( v_it ) ) 62 | mesh.set_point( v_it, mesh.property(cogs,v_it) ); 63 | } 64 | 65 | 66 | // write mesh to stdout 67 | if ( ! OpenMesh::IO::write_mesh(mesh, argv[3]) ) 68 | { 69 | std::cerr << "Error: cannot write mesh to " << argv[3] << std::endl; 70 | return 1; 71 | } 72 | 73 | return 0; 74 | } 75 | -------------------------------------------------------------------------------- /src/OpenMesh/Examples/Tutorial04/smooth.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | // -------------------- OpenMesh 4 | #include 5 | #include 6 | // -------------------- 7 | #include "smooth_algo.hh" 8 | 9 | 10 | // ---------------------------------------------------------------------------- 11 | 12 | #ifndef DOXY_IGNORE_THIS 13 | 14 | struct MyTraits : public OpenMesh::DefaultTraits 15 | { 16 | HalfedgeAttributes(OpenMesh::Attributes::PrevHalfedge); 17 | }; 18 | 19 | #endif 20 | 21 | typedef OpenMesh::TriMesh_ArrayKernelT MyMesh; 22 | 23 | 24 | // ---------------------------------------------------------------------------- 25 | 26 | int main(int argc, char **argv) 27 | { 28 | MyMesh mesh; 29 | 30 | 31 | // check command line options 32 | if (argc != 4) 33 | { 34 | std::cerr << "Usage: " << argv[0] << " #iterations infile outfile\n"; 35 | return 1; 36 | } 37 | 38 | 39 | // read mesh from stdin 40 | if ( ! OpenMesh::IO::read_mesh(mesh, argv[2]) ) 41 | { 42 | std::cerr << "Error: Cannot read mesh from " << argv[2] << std::endl; 43 | return 1; 44 | } 45 | 46 | 47 | // smoothing mesh argv[1] times 48 | SmootherT smoother(mesh); 49 | smoother.smooth(atoi(argv[1])); 50 | 51 | 52 | // write mesh to stdout 53 | if ( ! OpenMesh::IO::write_mesh(mesh, argv[3]) ) 54 | { 55 | std::cerr << "Error: cannot write mesh to " << argv[3] << std::endl; 56 | return 1; 57 | } 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /src/OpenMesh/Examples/Tutorial04/smooth_algo.hh: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifndef DOXY_IGNORE_THIS 5 | 6 | template class SmootherT 7 | { 8 | public: 9 | 10 | typedef typename Mesh::Point cog_t; 11 | typedef OpenMesh::VPropHandleT< cog_t > Property_cog; 12 | 13 | public: 14 | 15 | // construct with a given mesh 16 | explicit SmootherT(Mesh& _mesh) 17 | : mesh_(_mesh) 18 | { 19 | mesh_.add_property( cog_ ); 20 | } 21 | 22 | ~SmootherT() 23 | { 24 | mesh_.remove_property( cog_ ); 25 | } 26 | 27 | // smooth mesh _iterations times 28 | void smooth(unsigned int _iterations) 29 | { 30 | for (unsigned int i=0; i < _iterations; ++i) 31 | { 32 | std::for_each(mesh_.vertices_begin(), 33 | mesh_.vertices_end(), 34 | ComputeCOG(mesh_, cog_)); 35 | 36 | std::for_each(mesh_.vertices_begin(), 37 | mesh_.vertices_end(), 38 | SetCOG(mesh_, cog_)); 39 | } 40 | } 41 | 42 | 43 | private: 44 | 45 | 46 | //--- private classes --- 47 | 48 | class ComputeCOG 49 | { 50 | public: 51 | ComputeCOG(Mesh& _mesh, Property_cog& _cog) 52 | : mesh_(_mesh), cog_(_cog) 53 | {} 54 | 55 | void operator()(typename Mesh::Vertex& _v) 56 | { 57 | typename Mesh::VertexHandle vh( mesh_.handle(_v) ); 58 | typename Mesh::VertexVertexIter vv_it; 59 | typename Mesh::Scalar valence(0.0); 60 | 61 | mesh_.property(cog_, vh) = typename Mesh::Point(0.0, 0.0, 0.0); 62 | 63 | for (vv_it=mesh_.vv_iter(vh); vv_it; ++vv_it) 64 | { 65 | mesh_.property(cog_, vh) += mesh_.point( vv_it ); 66 | ++valence; 67 | } 68 | 69 | mesh_.property(cog_, mesh_.handle(_v) ) /= valence; 70 | } 71 | 72 | private: 73 | Mesh& mesh_; 74 | Property_cog& cog_; 75 | }; 76 | 77 | 78 | class SetCOG 79 | { 80 | public: 81 | SetCOG(Mesh& _mesh, Property_cog& _cog) 82 | : mesh_(_mesh), cog_(_cog) 83 | {} 84 | 85 | void operator()(typename Mesh::Vertex& _v) 86 | { 87 | typename Mesh::VertexHandle vh(mesh_.handle(_v)); 88 | 89 | if (!mesh_.is_boundary(vh)) 90 | mesh_.set_point( vh, mesh_.property(cog_, vh) ); 91 | } 92 | 93 | private: 94 | 95 | Mesh& mesh_; 96 | Property_cog& cog_; 97 | }; 98 | 99 | 100 | //--- private elements --- 101 | 102 | Mesh& mesh_; 103 | Property_cog cog_; 104 | }; 105 | 106 | #endif 107 | -------------------------------------------------------------------------------- /src/OpenMesh/Examples/Tutorial05/properties.cc: -------------------------------------------------------------------------------- 1 | #include 2 | // -------------------- 3 | #include 4 | #include 5 | 6 | 7 | typedef OpenMesh::TriMesh_ArrayKernelT<> MyMesh; 8 | 9 | 10 | int main(int argc, char **argv) 11 | { 12 | MyMesh mesh; 13 | 14 | if (argc!=2) 15 | { 16 | std::cerr << "Usage: " << argv[0] << " \n"; 17 | return 1; 18 | } 19 | 20 | // request vertex normals, so the mesh reader can use normal information 21 | // if available 22 | mesh.request_vertex_normals(); 23 | 24 | // assure we have vertex normals 25 | if (!mesh.has_vertex_normals()) 26 | { 27 | std::cerr << "ERROR: Standard vertex property 'Normals' not available!\n"; 28 | return 1; 29 | } 30 | 31 | OpenMesh::IO::Options opt; 32 | if ( ! OpenMesh::IO::read_mesh(mesh,argv[1], opt)) 33 | { 34 | std::cerr << "Error loading mesh from file " << argv[1] << std::endl; 35 | return 1; 36 | } 37 | 38 | // If the file did not provide vertex normals, then calculate them 39 | if ( !opt.check( OpenMesh::IO::Options::VertexNormal ) ) 40 | { 41 | // we need face normals to update the vertex normals 42 | mesh.request_face_normals(); 43 | 44 | // let the mesh update the normals 45 | mesh.update_normals(); 46 | 47 | // dispose the face normals, as we don't need them anymore 48 | mesh.release_face_normals(); 49 | } 50 | 51 | // move all vertices one unit length along it's normal direction 52 | for (MyMesh::VertexIter v_it = mesh.vertices_begin(); 53 | v_it != mesh.vertices_end(); ++v_it) 54 | { 55 | std::cout << "Vertex #" << v_it << ": " << mesh.point( v_it ); 56 | mesh.set_point( v_it, mesh.point(v_it)+mesh.normal(v_it) ); 57 | std::cout << " moved to " << mesh.point( v_it ) << std::endl; 58 | } 59 | 60 | // don't need the normals anymore? Remove them! 61 | mesh.release_vertex_normals(); 62 | 63 | // just check if it really works 64 | if (mesh.has_vertex_normals()) 65 | { 66 | std::cerr << "Ouch! ERROR! Shouldn't have any vertex normals anymore!\n"; 67 | return 1; 68 | } 69 | 70 | return 0; 71 | } 72 | -------------------------------------------------------------------------------- /src/OpenMesh/Examples/Tutorial06/attributes.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | // -------------------- 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | #ifndef DOXY_IGNORE_THIS 10 | 11 | // Define my personal traits 12 | struct MyTraits : OpenMesh::DefaultTraits 13 | { 14 | // Let Point and Normal be a vector of doubles 15 | typedef OpenMesh::Vec3d Point; 16 | typedef OpenMesh::Vec3d Normal; 17 | 18 | // Already defined in OpenMesh::DefaultTraits 19 | // HalfedgeAttributes( OpenMesh::Attributes::PrevHalfedge ); 20 | 21 | // Uncomment next line to disable attribute PrevHalfedge 22 | // HalfedgeAttributes( OpenMesh::Attributes::None ); 23 | // 24 | // or 25 | // 26 | // HalfedgeAttributes( 0 ); 27 | }; 28 | 29 | #endif 30 | 31 | // Define my mesh with the new traits! 32 | typedef OpenMesh::TriMesh_ArrayKernelT MyMesh; 33 | 34 | // ------------------------------------------------------------------ main ---- 35 | 36 | int main(int argc, char **argv) 37 | { 38 | MyMesh mesh; 39 | 40 | if (argc!=2) 41 | { 42 | std::cerr << "Usage: " << argv[0] << " \n"; 43 | return 1; 44 | } 45 | 46 | // Just make sure that point element type is double 47 | if ( typeid( OpenMesh::vector_traits::value_type ) 48 | != typeid(double) ) 49 | { 50 | std::cerr << "Ouch! ERROR! Data type is wrong!\n"; 51 | return 1; 52 | } 53 | 54 | // Make sure that normal element type is double 55 | if ( typeid( OpenMesh::vector_traits::value_type ) 56 | != typeid(double) ) 57 | { 58 | std::cerr << "Ouch! ERROR! Data type is wrong!\n"; 59 | return 1; 60 | } 61 | 62 | // Add vertex normals as default property (ref. previous tutorial) 63 | mesh.request_vertex_normals(); 64 | 65 | // Add face normals as default property 66 | mesh.request_face_normals(); 67 | 68 | // load a mesh 69 | OpenMesh::IO::Options opt; 70 | if ( ! OpenMesh::IO::read_mesh(mesh,argv[1], opt)) 71 | { 72 | std::cerr << "Error loading mesh from file " << argv[1] << std::endl; 73 | return 1; 74 | } 75 | 76 | // If the file did not provide vertex normals, then calculate them 77 | if ( !opt.check( OpenMesh::IO::Options::VertexNormal ) && 78 | mesh.has_face_normals() && mesh.has_vertex_normals() ) 79 | { 80 | // let the mesh update the normals 81 | mesh.update_normals(); 82 | } 83 | 84 | // move all vertices one unit length along it's normal direction 85 | for (MyMesh::VertexIter v_it = mesh.vertices_begin(); 86 | v_it != mesh.vertices_end(); ++v_it) 87 | { 88 | std::cout << "Vertex #" << v_it << ": " << mesh.point( v_it ); 89 | mesh.set_point( v_it, mesh.point(v_it)+mesh.normal(v_it) ); 90 | std::cout << " moved to " << mesh.point( v_it ) << std::endl; 91 | } 92 | 93 | return 0; 94 | } 95 | -------------------------------------------------------------------------------- /src/OpenMesh/Examples/Tutorial10/fill_props.hh: -------------------------------------------------------------------------------- 1 | #ifndef FILL_PROPS_HH 2 | #define FILL_PROPS_HH 3 | 4 | #include 5 | #include "int2roman.hh" 6 | 7 | 8 | template 9 | bool 10 | fill_props( Mesh& _m, OpenMesh::VPropHandleT _ph, bool _check=false) 11 | { 12 | static float a[9] = { 1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f }; 13 | 14 | for(typename Mesh::VertexIter it=_m.vertices_begin(); 15 | it != _m.vertices_end(); ++it) 16 | { 17 | const float v = a[it->idx()%9]; 18 | if ( _check && !(_m.property( _ph, it ) == v) ) 19 | return false; 20 | else 21 | _m.property( _ph, it ) = v; 22 | } 23 | return true; 24 | } 25 | 26 | 27 | template 28 | bool 29 | fill_props( Mesh& _m, OpenMesh::EPropHandleT _ph, bool _check=false ) 30 | { 31 | for( typename Mesh::EdgeIter it=_m.edges_begin(); 32 | it != _m.edges_end(); ++it) 33 | { 34 | const size_t n = it->idx(); 35 | const bool v = ((n&(n-1))==0); // true for 0,1,2,4,8,.. 36 | 37 | if (_check && _m.property( _ph, it ) != v) 38 | { 39 | std::cout << " eprop_bool: " << n << " -> " 40 | << _m.property(_ph, it ) << " != " << v << std::endl; 41 | return false; 42 | } 43 | else 44 | { 45 | _m.property( _ph, it ) = v; 46 | std::cout << " eprop_bool: " << n << " -> " << v << std::endl; 47 | } 48 | } 49 | return true; 50 | } 51 | 52 | 53 | 54 | template 55 | bool 56 | fill_props(Mesh& _m, OpenMesh::FPropHandleT _ph, bool _check=false) 57 | { 58 | for( typename Mesh::FaceIter it=_m.faces_begin(); 59 | it != _m.faces_end(); ++it) 60 | { 61 | const int n = it->idx(); 62 | _m.property( _ph, it ) = int2roman(++n); 63 | } 64 | return true; 65 | } 66 | 67 | 68 | template 69 | bool 70 | fill_props( Mesh& _m, OpenMesh::HPropHandleT _ph, bool _check=false) 71 | { 72 | static float a[9] = { 1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f }; 73 | static float b[9] = { 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f }; 74 | static float c[9] = { 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f, 2.2f }; 75 | static float d[9] = { 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f, 2.2f, 3.3f }; 76 | // static double values[9] = { 0.1, 0.02, 0.003, 0.0004, 0.00005, 0.000006, 77 | // 0.0000007, 0.00000008, 0.000000009 }; 78 | 79 | for( typename Mesh::HalfedgeIter it=_m.halfedges_begin(); 80 | it != _m.halfedges_end(); ++it) 81 | { 82 | const int n = it->idx(); 83 | 84 | // v = it->idx()+1; // ival 85 | // v = values[n%9]; // dval 86 | T v = ((n&(n-1))==0); // bval 87 | v.vec4fval[0] = a[n%9]; 88 | v.vec4fval[1] = b[n%9]; 89 | v.vec4fval[2] = c[n%9]; 90 | v.vec4fval[3] = d[n%9]; 91 | 92 | if ( _check && _m.property( _ph, it ) != v ) 93 | return false; 94 | else 95 | _m.property( _ph, it ) = v; 96 | } 97 | return true; 98 | } 99 | 100 | template 101 | bool 102 | fill_props( Mesh& _m, OpenMesh::MPropHandleT _ph, bool _check=false) 103 | { 104 | for( typename Mesh::FaceIter it=_m.faces_begin(); it != _m.faces_end(); ++it) 105 | { 106 | const size_t idx = it->idx(); 107 | if ( _check && _m.property( _ph )[int2roman(idx+1)] != idx ) 108 | return false; 109 | else 110 | _m.property( _ph )[int2roman(idx+1)] = idx; 111 | } 112 | return true; 113 | } 114 | 115 | 116 | #endif 117 | -------------------------------------------------------------------------------- /src/OpenMesh/Examples/Tutorial10/generate_cube.hh: -------------------------------------------------------------------------------- 1 | #ifndef GENERATE_CUBE_HH 2 | #define GENERATE_CUBE_HH 3 | 4 | template 5 | size_t generate_cube( MeshType& mesh ) 6 | { 7 | typedef typename MeshType::VertexHandle VertexHandle; 8 | typedef typename MeshType::Point Point; 9 | 10 | typename MeshType::VertexHandle vhandle[8]; 11 | 12 | vhandle[0] = mesh.add_vertex(Point(-1, -1, 1)); 13 | vhandle[1] = mesh.add_vertex(Point( 1, -1, 1)); 14 | vhandle[2] = mesh.add_vertex(Point( 1, 1, 1)); 15 | vhandle[3] = mesh.add_vertex(Point(-1, 1, 1)); 16 | vhandle[4] = mesh.add_vertex(Point(-1, -1, -1)); 17 | vhandle[5] = mesh.add_vertex(Point( 1, -1, -1)); 18 | vhandle[6] = mesh.add_vertex(Point( 1, 1, -1)); 19 | vhandle[7] = mesh.add_vertex(Point(-1, 1, -1)); 20 | 21 | // generate (quadrilateral) faces 22 | 23 | std::vector< VertexHandle > face_vhandles; 24 | 25 | face_vhandles.clear(); 26 | face_vhandles.push_back(vhandle[0]); 27 | face_vhandles.push_back(vhandle[1]); 28 | face_vhandles.push_back(vhandle[2]); 29 | face_vhandles.push_back(vhandle[3]); 30 | mesh.add_face(face_vhandles); 31 | 32 | face_vhandles.clear(); 33 | face_vhandles.push_back(vhandle[7]); 34 | face_vhandles.push_back(vhandle[6]); 35 | face_vhandles.push_back(vhandle[5]); 36 | face_vhandles.push_back(vhandle[4]); 37 | mesh.add_face(face_vhandles); 38 | 39 | face_vhandles.clear(); 40 | face_vhandles.push_back(vhandle[1]); 41 | face_vhandles.push_back(vhandle[0]); 42 | face_vhandles.push_back(vhandle[4]); 43 | face_vhandles.push_back(vhandle[5]); 44 | mesh.add_face(face_vhandles); 45 | 46 | face_vhandles.clear(); 47 | face_vhandles.push_back(vhandle[2]); 48 | face_vhandles.push_back(vhandle[1]); 49 | face_vhandles.push_back(vhandle[5]); 50 | face_vhandles.push_back(vhandle[6]); 51 | mesh.add_face(face_vhandles); 52 | 53 | face_vhandles.clear(); 54 | face_vhandles.push_back(vhandle[3]); 55 | face_vhandles.push_back(vhandle[2]); 56 | face_vhandles.push_back(vhandle[6]); 57 | face_vhandles.push_back(vhandle[7]); 58 | mesh.add_face(face_vhandles); 59 | 60 | face_vhandles.clear(); 61 | face_vhandles.push_back(vhandle[0]); 62 | face_vhandles.push_back(vhandle[3]); 63 | face_vhandles.push_back(vhandle[7]); 64 | face_vhandles.push_back(vhandle[4]); 65 | mesh.add_face(face_vhandles); 66 | 67 | return mesh.n_vertices(); 68 | }; 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /src/OpenMesh/Examples/Tutorial10/int2roman.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #if defined(OM_CC_MIPS) 3 | # include 4 | #else 5 | # include 6 | #endif 7 | #include "int2roman.hh" 8 | 9 | 10 | std::string int2roman( size_t decimal, size_t length ) 11 | { 12 | assert( decimal > 0 && decimal < 1000 ); 13 | 14 | const size_t nrows = 4; 15 | const size_t ncols = 4; 16 | 17 | static size_t table_arabs[ nrows ][ ncols ] = { { 1000, 1000, 1000, 1000 }, 18 | { 900, 500, 400, 100 }, 19 | { 90, 50, 40, 10 }, 20 | { 9, 5, 4, 1 } }; 21 | 22 | static char *table_romans[ nrows ][ ncols ] = { { "M", "M", "M", "M" }, 23 | { "CM", "D", "CD", "C" }, 24 | { "XC", "L", "XL", "X" }, 25 | { "IX", "V", "IV", "I" } }; 26 | 27 | size_t power; // power of ten 28 | size_t index; // Indexes thru values to subtract 29 | 30 | std::string roman; 31 | 32 | roman.reserve(length); 33 | 34 | roman[ 0 ] = '\0'; 35 | 36 | for ( power = 0; power < nrows; power++ ) 37 | for ( index = 0; index < ncols; index++ ) 38 | while ( decimal >= table_arabs[ power ][ index ] ) 39 | { 40 | roman += table_romans[ power ][ index ]; 41 | decimal -= table_arabs[ power ][ index ]; 42 | } 43 | 44 | return roman; 45 | } 46 | -------------------------------------------------------------------------------- /src/OpenMesh/Examples/Tutorial10/int2roman.hh: -------------------------------------------------------------------------------- 1 | #ifndef INT2ROMAN_HH 2 | #define INT2ROMAN_HH 3 | 4 | #include 5 | 6 | std::string int2roman( size_t decimal, size_t length=30 ); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/OpenMesh/Examples/Tutorial10/stats.hh: -------------------------------------------------------------------------------- 1 | #ifndef STATS_HH 2 | #define STATS_HH 3 | 4 | template 5 | void mesh_stats( Mesh& _m, const std::string& prefix = "" ) 6 | { 7 | std::cout << prefix 8 | << _m.n_vertices() << " vertices, " 9 | << _m.n_edges() << " edges, " 10 | << _m.n_faces() << " faces\n"; 11 | } 12 | 13 | template 14 | void mesh_property_stats(Mesh& _m) 15 | { 16 | std::cout << "Current set of properties:\n"; 17 | _m.property_stats(std::cout); 18 | } 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/OpenMesh/Tools/Utils/getopt.h: -------------------------------------------------------------------------------- 1 | #ifndef _GETOPT_H_ 2 | #define _GETOPT_H_ 3 | 4 | #include 5 | #include 6 | 7 | #if defined(_MSC_VER) 8 | #if defined(__cplusplus) 9 | 10 | extern "C" { 11 | 12 | extern OPENMESHDLLEXPORT int opterr; 13 | extern OPENMESHDLLEXPORT int optind; 14 | extern OPENMESHDLLEXPORT int optopt; 15 | extern OPENMESHDLLEXPORT int optreset; 16 | extern OPENMESHDLLEXPORT char *optarg; 17 | 18 | OPENMESHDLLEXPORT extern int getopt(int nargc, char * const *nargv, const char *ostr); 19 | 20 | } 21 | 22 | #endif 23 | 24 | #elif defined __APPLE__ 25 | #include 26 | #else 27 | #include 28 | #endif 29 | 30 | #endif /* _GETOPT_H_ */ 31 | -------------------------------------------------------------------------------- /src/OpenMesh/Tools/VDPM/xpm/fileopen.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char *fileopen[] = { 3 | " 16 13 5 1", 4 | ". c #040404", 5 | "# c #808304", 6 | "a c None", 7 | "b c #f3f704", 8 | "c c #f3f7f3", 9 | "aaaaaaaaa...aaaa", 10 | "aaaaaaaa.aaa.a.a", 11 | "aaaaaaaaaaaaa..a", 12 | "a...aaaaaaaa...a", 13 | ".bcb.......aaaaa", 14 | ".cbcbcbcbc.aaaaa", 15 | ".bcbcbcbcb.aaaaa", 16 | ".cbcb...........", 17 | ".bcb.#########.a", 18 | ".cb.#########.aa", 19 | ".b.#########.aaa", 20 | "..#########.aaaa", 21 | "...........aaaaa" 22 | }; 23 | -------------------------------------------------------------------------------- /src/OpenMesh/Tools/VDPM/xpm/fileprint.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char *fileprint[] = { 3 | " 16 14 6 1", 4 | ". c #000000", 5 | "# c #848284", 6 | "a c #c6c3c6", 7 | "b c #ffff00", 8 | "c c #ffffff", 9 | "d c None", 10 | "ddddd.........dd", 11 | "dddd.cccccccc.dd", 12 | "dddd.c.....c.ddd", 13 | "ddd.cccccccc.ddd", 14 | "ddd.c.....c....d", 15 | "dd.cccccccc.a.a.", 16 | "d..........a.a..", 17 | ".aaaaaaaaaa.a.a.", 18 | ".............aa.", 19 | ".aaaaaa###aa.a.d", 20 | ".aaaaaabbbaa...d", 21 | ".............a.d", 22 | "d.aaaaaaaaa.a.dd", 23 | "dd...........ddd" 24 | }; 25 | -------------------------------------------------------------------------------- /src/OpenMesh/Tools/VDPM/xpm/filesave.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char *filesave[] = { 3 | " 14 14 4 1", 4 | ". c #040404", 5 | "# c #808304", 6 | "a c #bfc2bf", 7 | "b c None", 8 | "..............", 9 | ".#.aaaaaaaa.a.", 10 | ".#.aaaaaaaa...", 11 | ".#.aaaaaaaa.#.", 12 | ".#.aaaaaaaa.#.", 13 | ".#.aaaaaaaa.#.", 14 | ".#.aaaaaaaa.#.", 15 | ".##........##.", 16 | ".############.", 17 | ".##.........#.", 18 | ".##......aa.#.", 19 | ".##......aa.#.", 20 | ".##......aa.#.", 21 | "b............." 22 | }; 23 | -------------------------------------------------------------------------------- /src/Unittests/.gitignore: -------------------------------------------------------------------------------- 1 | deleted_output.off 2 | output.off 3 | persistence-check.om 4 | smoothed_STL_output.off 5 | smoothed_custom_properties_output.off 6 | smoothed_extended_output.off 7 | smoothed_output.off 8 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/.gitignore: -------------------------------------------------------------------------------- 1 | cube-minimal-customprops_openmeshOutputTestfileBinary.ply 2 | cube_floating.off 3 | cube_floating_binary.off 4 | meshlab_binary.ply 5 | meshlab_binary_float.ply 6 | meshlab_float.ply 7 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal-custom_props.ply: -------------------------------------------------------------------------------- 1 | ply 2 | format ascii 1.0 3 | element vertex 8 4 | property float32 x 5 | property float32 y 6 | property float32 z 7 | property float32 nx 8 | property float32 ny 9 | property float32 nz 10 | property float32 quality 11 | property uint index 12 | property list uint8 int32 test_values 13 | element face 6 14 | property list uint8 int32 vertex_indices 15 | property list uint8 float32 texcoords 16 | property uint faceIndex 17 | end_header 18 | -1 -1 -1 0.0 0.0 1.0 1.0 0 2 1 2 19 | 1 -1 -1 0.0 1.0 0.0 0.5 1 2 3 4 20 | 1 1 -1 0.0 1.0 1.0 0.7 2 2 5 6 21 | -1 1 -1 1.0 0.0 0.0 1.0 3 2 7 8 22 | -1 -1 1 1.0 0.0 1.0 0.1 4 2 9 10 23 | 1 -1 1 1.0 1.0 0.0 0.0 5 2 11 12 24 | 1 1 1 1.0 1.0 1.0 2.0 6 2 13 14 25 | -1 1 1 1.0 1.0 2.0 5.0 7 2 15 16 26 | 4 0 1 2 3 8 1.0 1.0 -1.0 -1.0 0.0 0.0 -0.5 -0.5 0 27 | 4 5 4 7 6 8 1.0 1.0 -1.0 -1.0 0.0 0.0 -0.5 -0.5 1 28 | 4 6 2 1 5 8 1.0 1.0 -1.0 -1.0 0.0 0.0 -0.5 -0.5 2 29 | 4 3 7 4 0 8 1.0 1.0 -1.0 -1.0 0.0 0.0 -0.5 -0.5 3 30 | 4 7 3 2 6 8 1.0 1.0 -1.0 -1.0 0.0 0.0 -0.5 -0.5 4 31 | 4 5 1 0 4 8 1.0 1.0 -1.0 -1.0 0.0 0.0 -0.5 -0.5 5 32 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal-degenerated.obj: -------------------------------------------------------------------------------- 1 | g cube 2 | v 0.0 0.0 0.0 3 | v 0.0 0.0 1.0 4 | v 0.0 1.0 0.0 5 | v 0.0 1.0 1.0 6 | v 1.0 0.0 0.0 7 | v 1.0 0.0 1.0 8 | v 1.0 1.0 0.0 9 | v 1.0 1.0 1.0 10 | vn 0.0 0.0 1.0 11 | vn 0.0 0.0 -1.0 12 | vn 0.0 1.0 0.0 13 | vn 0.0 -1.0 0.0 14 | vn 1.0 0.0 0.0 15 | vn -1.0 0.0 0.0 16 | f 1//2 7//2 5//2 17 | f 1//2 3//2 7//2 18 | f 1//6 4//6 3//6 19 | f 1//6 2//6 4//6 20 | f 3//3 8//3 7//3 21 | f 3//3 4//3 8//3 22 | f 5//5 7//5 8//5 23 | f 5//5 8//5 6//5 24 | f 1//4 5//4 6//4 25 | f 1//4 6//4 2//4 26 | f 2//1 6//1 8//1 8//1 2//1 27 | f 2//1 8//1 4//1 28 | f 2//1 2//1 2//1 29 | f 2//1 8//1 2//1 30 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal-extra-elements-binary.ply: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/Unittests/TestFiles/cube-minimal-extra-elements-binary.ply -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal-extra-elements.ply: -------------------------------------------------------------------------------- 1 | ply 2 | format ascii 1.0 3 | element vertex 8 4 | property float32 x 5 | property float32 y 6 | property float32 z 7 | element edge 12 8 | property int32 vertex1 9 | property int32 vertex2 10 | element face 6 11 | property list uint8 int32 vertex_indices 12 | end_header 13 | -1 -1 -1 14 | 1 -1 -1 15 | 1 1 -1 16 | -1 1 -1 17 | -1 -1 1 18 | 1 -1 1 19 | 1 1 1 20 | -1 1 1 21 | 0 1 22 | 1 2 23 | 2 3 24 | 3 0 25 | 4 5 26 | 5 6 27 | 6 7 28 | 7 4 29 | 6 2 30 | 1 5 31 | 3 7 32 | 4 0 33 | 4 0 1 2 3 34 | 4 5 4 7 6 35 | 4 6 2 1 5 36 | 4 3 7 4 0 37 | 4 7 3 2 6 38 | 4 5 1 0 4 39 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal-normals.ply: -------------------------------------------------------------------------------- 1 | ply 2 | format ascii 1.0 3 | element vertex 8 4 | property float32 x 5 | property float32 y 6 | property float32 z 7 | property float32 nx 8 | property float32 ny 9 | property float32 nz 10 | element face 6 11 | property list uint8 int32 vertex_indices 12 | end_header 13 | -1 -1 -1 0.0 0.0 1.0 14 | 1 -1 -1 0.0 1.0 0.0 15 | 1 1 -1 0.0 1.0 1.0 16 | -1 1 -1 1.0 0.0 0.0 17 | -1 -1 1 1.0 0.0 1.0 18 | 1 -1 1 1.0 1.0 0.0 19 | 1 1 1 1.0 1.0 1.0 20 | -1 1 1 1.0 1.0 2.0 21 | 4 0 1 2 3 22 | 4 5 4 7 6 23 | 4 6 2 1 5 24 | 4 3 7 4 0 25 | 4 7 3 2 6 26 | 4 5 1 0 4 27 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal-texCoords.obj: -------------------------------------------------------------------------------- 1 | g cube 2 | v 0.0 0.0 0.0 3 | v 0.0 0.0 1.0 4 | v 0.0 1.0 0.0 5 | v 0.0 1.0 1.0 6 | v 1.0 0.0 0.0 7 | v 1.0 0.0 1.0 8 | v 1.0 1.0 0.0 9 | v 1.0 1.0 1.0 10 | vn 0.0 0.0 1.0 11 | vn 0.0 0.0 -1.0 12 | vn 0.0 1.0 0.0 13 | vn 0.0 -1.0 0.0 14 | vn 1.0 0.0 0.0 15 | vn -1.0 0.0 0.0 16 | vt 1.0 1.0 17 | vt 2.0 2.0 18 | vt 3.0 3.0 19 | vt 4.0 4.0 20 | vt 5.0 5.0 21 | vt 6.0 6.0 22 | vt 7.0 7.0 23 | vt 8.0 8.0 24 | vt 9.0 9.0 25 | vt 10.0 10.0 26 | vt 11.0 11.0 27 | vt 12.0 12.0 28 | f 1/1/2 7/1/2 5/1/2 29 | f 1/2/2 3/2/2 7/2/2 30 | f 1/3/6 4/3/6 3/3/6 31 | f 1/4/6 2/4/6 4/4/6 32 | f 3/5/3 8/5/3 7/5/3 33 | f 3/6/3 4/6/3 8/6/3 34 | f 5/7/5 7/7/5 8/7/5 35 | f 5/8/5 8/8/5 6/8/5 36 | f 1/9/4 5/9/4 6/9/4 37 | f 1/10/4 6/10/4 2/10/4 38 | f 2/11/1 6/11/1 8/11/1 39 | f 2/12/1 8/12/1 4/12/1 40 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal-texCoords.om: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/Unittests/TestFiles/cube-minimal-texCoords.om -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal-texCoords.ply: -------------------------------------------------------------------------------- 1 | ply 2 | format ascii 1.0 3 | comment ================================= 4 | comment Exported via OpenFlipper 1.4 5 | comment www.openflipper.org 6 | comment ================================= 7 | element vertex 8 8 | property float x 9 | property float y 10 | property float z 11 | property int32 u 12 | property int32 v 13 | element face 12 14 | property list uchar int32 vertex_index 15 | end_header 16 | 0 0 0 10 10 17 | 0 0 1 12 12 18 | 0 1 0 6 6 19 | 0 1 1 12 12 20 | 1 0 0 9 9 21 | 1 0 1 11 11 22 | 1 1 0 7 7 23 | 1 1 1 12 12 24 | 3 0 6 4 25 | 3 0 2 6 26 | 3 0 3 2 27 | 3 0 1 3 28 | 3 2 7 6 29 | 3 2 3 7 30 | 3 4 6 7 31 | 3 4 7 5 32 | 3 0 4 5 33 | 3 0 5 1 34 | 3 1 5 7 35 | 3 1 7 3 36 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal-texCoords3d.obj: -------------------------------------------------------------------------------- 1 | g cube 2 | v 0.0 0.0 0.0 3 | v 0.0 0.0 1.0 4 | v 0.0 1.0 0.0 5 | v 0.0 1.0 1.0 6 | v 1.0 0.0 0.0 7 | v 1.0 0.0 1.0 8 | v 1.0 1.0 0.0 9 | v 1.0 1.0 1.0 10 | vn 0.0 0.0 1.0 11 | vn 0.0 0.0 -1.0 12 | vn 0.0 1.0 0.0 13 | vn 0.0 -1.0 0.0 14 | vn 1.0 0.0 0.0 15 | vn -1.0 0.0 0.0 16 | vt 1.0 1.0 1.0 17 | vt 2.0 2.0 2.0 18 | vt 3.0 3.0 3.0 19 | vt 4.0 4.0 4.0 20 | vt 5.0 5.0 5.0 21 | vt 6.0 6.0 6.0 22 | vt 7.0 7.0 7.0 23 | vt 8.0 8.0 8.0 24 | vt 9.0 9.0 9.0 25 | vt 10.0 10.0 10.0 26 | vt 11.0 11.0 11.0 27 | vt 12.0 12.0 12.0 28 | f 1/1/2 7/1/2 5/1/2 29 | f 1/2/2 3/2/2 7/2/2 30 | f 1/3/6 4/3/6 3/3/6 31 | f 1/4/6 2/4/6 4/4/6 32 | f 3/5/3 8/5/3 7/5/3 33 | f 3/6/3 4/6/3 8/6/3 34 | f 5/7/5 7/7/5 8/7/5 35 | f 5/8/5 8/8/5 6/8/5 36 | f 1/9/4 5/9/4 6/9/4 37 | f 1/10/4 6/10/4 2/10/4 38 | f 2/11/1 6/11/1 8/11/1 39 | f 2/12/1 8/12/1 4/12/1 40 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal-vertex-colors-after-vertex-definition.obj: -------------------------------------------------------------------------------- 1 | g cube 2 | v 0.0 0.0 0.0 0.0 0.0 0.0 3 | v 0.0 0.0 1.0 0.0 0.0 1.0 4 | v 0.0 1.0 0.0 0.0 1.0 0.0 5 | v 0.0 1.0 1.0 0.0 1.0 1.0 6 | v 1.0 0.0 0.0 1.0 0.0 0.0 7 | v 1.0 0.0 1.0 1.0 0.0 1.0 8 | v 1.0 1.0 0.0 1.0 1.0 0.0 9 | v 1.0 1.0 1.0 1.0 1.0 1.0 10 | vn 0.0 0.0 1.0 11 | vn 0.0 0.0 -1.0 12 | vn 0.0 1.0 0.0 13 | vn 0.0 -1.0 0.0 14 | vn 1.0 0.0 0.0 15 | vn -1.0 0.0 0.0 16 | f 1//2 7//2 5//2 17 | f 1//2 3//2 7//2 18 | f 1//6 4//6 3//6 19 | f 1//6 2//6 4//6 20 | f 3//3 8//3 7//3 21 | f 3//3 4//3 8//3 22 | f 5//5 7//5 8//5 23 | f 5//5 8//5 6//5 24 | f 1//4 5//4 6//4 25 | f 1//4 6//4 2//4 26 | f 2//1 6//1 8//1 27 | f 2//1 8//1 4//1 28 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal-vertex-colors-as-vc-lines.obj: -------------------------------------------------------------------------------- 1 | g cube 2 | v 0.0 0.0 0.0 3 | v 0.0 0.0 1.0 4 | v 0.0 1.0 0.0 5 | v 0.0 1.0 1.0 6 | v 1.0 0.0 0.0 7 | v 1.0 0.0 1.0 8 | v 1.0 1.0 0.0 9 | v 1.0 1.0 1.0 10 | vc 0.0 0.0 0.0 11 | vc 0.0 0.0 1.0 12 | vc 0.0 1.0 0.0 13 | vc 0.0 1.0 1.0 14 | vc 1.0 0.0 0.0 15 | vc 1.0 0.0 1.0 16 | vc 1.0 1.0 0.0 17 | vc 1.0 1.0 1.0 18 | vn 0.0 0.0 1.0 19 | vn 0.0 0.0 -1.0 20 | vn 0.0 1.0 0.0 21 | vn 0.0 -1.0 0.0 22 | vn 1.0 0.0 0.0 23 | vn -1.0 0.0 0.0 24 | f 1//2 7//2 5//2 25 | f 1//2 3//2 7//2 26 | f 1//6 4//6 3//6 27 | f 1//6 2//6 4//6 28 | f 3//3 8//3 7//3 29 | f 3//3 4//3 8//3 30 | f 5//5 7//5 8//5 31 | f 5//5 8//5 6//5 32 | f 1//4 5//4 6//4 33 | f 1//4 6//4 2//4 34 | f 2//1 6//1 8//1 35 | f 2//1 8//1 4//1 36 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal-vertexColors.om: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/Unittests/TestFiles/cube-minimal-vertexColors.om -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal-vertexColors.ply: -------------------------------------------------------------------------------- 1 | ply 2 | format ascii 1.0 3 | comment ================================= 4 | comment Exported via OpenFlipper 1.4 5 | comment www.openflipper.org 6 | comment ================================= 7 | element vertex 8 8 | property float x 9 | property float y 10 | property float z 11 | property uchar red 12 | property uchar green 13 | property uchar blue 14 | element face 12 15 | property list uchar int32 vertex_index 16 | end_header 17 | 0 0 0 255 0 0 18 | 0 0 1 255 0 0 19 | 0 1 0 255 0 0 20 | 0 1 1 255 0 0 21 | 1 0 0 0 0 255 22 | 1 0 1 0 0 255 23 | 1 1 0 0 0 255 24 | 1 1 1 0 0 255 25 | 3 0 6 4 26 | 3 0 2 6 27 | 3 0 3 2 28 | 3 0 1 3 29 | 3 2 7 6 30 | 3 2 3 7 31 | 3 4 6 7 32 | 3 4 7 5 33 | 3 0 4 5 34 | 3 0 5 1 35 | 3 1 5 7 36 | 3 1 7 3 37 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal.obj: -------------------------------------------------------------------------------- 1 | g cube 2 | v 0.0 0.0 0.0 3 | v 0.0 0.0 1.0 4 | v 0.0 1.0 0.0 5 | v 0.0 1.0 1.0 6 | v 1.0 0.0 0.0 7 | v 1.0 0.0 1.0 8 | v 1.0 1.0 0.0 9 | v 1.0 1.0 1.0 10 | vn 0.0 0.0 1.0 11 | vn 0.0 0.0 -1.0 12 | vn 0.0 1.0 0.0 13 | vn 0.0 -1.0 0.0 14 | vn 1.0 0.0 0.0 15 | vn -1.0 0.0 0.0 16 | f 1//2 7//2 5//2 17 | f 1//2 3//2 7//2 18 | f 1//6 4//6 3//6 19 | f 1//6 2//6 4//6 20 | f 3//3 8//3 7//3 21 | f 3//3 4//3 8//3 22 | f 5//5 7//5 8//5 23 | f 5//5 8//5 6//5 24 | f 1//4 5//4 6//4 25 | f 1//4 6//4 2//4 26 | f 2//1 6//1 8//1 27 | f 2//1 8//1 4//1 28 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal.om: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/Unittests/TestFiles/cube-minimal.om -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube-minimal.ply: -------------------------------------------------------------------------------- 1 | ply 2 | format ascii 1.0 3 | element vertex 8 4 | property float32 x 5 | property float32 y 6 | property float32 z 7 | element face 6 8 | property list uint8 int32 vertex_indices 9 | end_header 10 | -1 -1 -1 11 | 1 -1 -1 12 | 1 1 -1 13 | -1 1 -1 14 | -1 -1 1 15 | 1 -1 1 16 | 1 1 1 17 | -1 1 1 18 | 4 0 1 2 3 19 | 4 5 4 7 6 20 | 4 6 2 1 5 21 | 4 3 7 4 0 22 | 4 7 3 2 6 23 | 4 5 1 0 4 24 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube1.pm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/Unittests/TestFiles/cube1.pm -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube1Binary.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/Unittests/TestFiles/cube1Binary.stl -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube1_customProps.om: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/Unittests/TestFiles/cube1_customProps.om -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube_poly_version_1_2.om: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/Unittests/TestFiles/cube_poly_version_1_2.om -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube_poly_version_2_0.om: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/Unittests/TestFiles/cube_poly_version_2_0.om -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube_tri_version_1_2.om: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/Unittests/TestFiles/cube_tri_version_1_2.om -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube_tri_version_2_0.om: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/Unittests/TestFiles/cube_tri_version_2_0.om -------------------------------------------------------------------------------- /src/Unittests/TestFiles/cube_tri_version_7_5.om: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lawrencemm/openmesh/4e2e481f438747d64e62899021da9f469fd9daf8/src/Unittests/TestFiles/cube_tri_version_7_5.om -------------------------------------------------------------------------------- /src/Unittests/TestFiles/meshlab.ply: -------------------------------------------------------------------------------- 1 | ply 2 | format ascii 1.0 3 | comment VCGLIB generated 4 | element vertex 8 5 | property float x 6 | property float y 7 | property float z 8 | property uchar red 9 | property uchar green 10 | property uchar blue 11 | property uchar alpha 12 | element face 12 13 | property list uchar int vertex_indices 14 | end_header 15 | 0.5 0.5 0.5 0 0 255 255 16 | -0.5 0.5 0.5 0 0 255 255 17 | 0.5 -0.5 0.5 0 0 255 255 18 | -0.5 -0.5 0.5 0 0 255 255 19 | 0.5 0.5 -0.5 0 0 255 255 20 | -0.5 0.5 -0.5 0 0 255 255 21 | 0.5 -0.5 -0.5 0 0 255 255 22 | -0.5 -0.5 -0.5 0 0 255 255 23 | 3 0 1 2 24 | 3 3 2 1 25 | 3 0 2 4 26 | 3 6 4 2 27 | 3 0 4 1 28 | 3 5 1 4 29 | 3 7 5 6 30 | 3 4 6 5 31 | 3 7 6 3 32 | 3 2 3 6 33 | 3 7 3 5 34 | 3 1 5 3 35 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/pointCloudBadEncoding.ply: -------------------------------------------------------------------------------- 1 | ply 2 | format ascii 1.0 3 | element vertex 10 4 | property float x 5 | property float y 6 | property float z 7 | property float nx 8 | property float ny 9 | property float nz 10 | property uchar diffuse_red 11 | property uchar diffuse_green 12 | property uchar diffuse_blue 13 | end_header 14 | -0.774382 0.446049 -2.05893 0.386853 -0.197849 0.900667 76 52 41 15 | -0.762621 0.446872 -2.06314 0.0431574 -0.643148 0.764525 77 58 46 16 | -0.769175 0.436518 -2.0635 0.257818 -0.156835 0.95338 121 97 88 17 | -1.07959 0.381204 -1.95964 0.948941 -0.303889 0.0846349 126 117 97 18 | -1.05841 0.398189 -1.98803 0.230719 0.341539 0.911109 103 90 86 19 | -1.04905 0.388091 -1.97944 -0.0175732 -0.131422 0.991171 72 62 70 20 | -0.784233 0.428294 -2.06324 -0.0394355 0.268678 0.962422 167 93 80 21 | -0.773624 0.429338 -2.06101 0.373176 -0.105125 0.921785 172 135 126 22 | -0.779554 0.433575 -2.06273 -0.0113203 -0.243327 0.969878 165 102 90 23 | -0.764714 0.428742 -2.06643 0.31292 -0.294884 0.902843 139 119 109 24 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/pointCloudGoodEncoding.ply: -------------------------------------------------------------------------------- 1 | ply 2 | format ascii 1.0 3 | element vertex 10 4 | property float x 5 | property float y 6 | property float z 7 | property float nx 8 | property float ny 9 | property float nz 10 | property uchar diffuse_red 11 | property uchar diffuse_green 12 | property uchar diffuse_blue 13 | end_header 14 | -0.774382 0.446049 -2.05893 0.386853 -0.197849 0.900667 76 52 41 15 | -0.762621 0.446872 -2.06314 0.0431574 -0.643148 0.764525 77 58 46 16 | -0.769175 0.436518 -2.0635 0.257818 -0.156835 0.95338 121 97 88 17 | -1.07959 0.381204 -1.95964 0.948941 -0.303889 0.0846349 126 117 97 18 | -1.05841 0.398189 -1.98803 0.230719 0.341539 0.911109 103 90 86 19 | -1.04905 0.388091 -1.97944 -0.0175732 -0.131422 0.991171 72 62 70 20 | -0.784233 0.428294 -2.06324 -0.0394355 0.268678 0.962422 167 93 80 21 | -0.773624 0.429338 -2.06101 0.373176 -0.105125 0.921785 172 135 126 22 | -0.779554 0.433575 -2.06273 -0.0113203 -0.243327 0.969878 165 102 90 23 | -0.764714 0.428742 -2.06643 0.31292 -0.294884 0.902843 139 119 109 24 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/square_material.mtl: -------------------------------------------------------------------------------- 1 | newmtl Colored 2 | Ka 0.500 0.500 0.500 3 | Kd 0.500 0.500 0.500 4 | Ks 0.500 0.500 0.500 5 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/square_material.obj: -------------------------------------------------------------------------------- 1 | mtllib square_material.mtl 2 | 3 | v 0.000000 2.000000 0.000000 4 | v 0.000000 0.000000 0.000000 5 | v 2.000000 0.000000 0.000000 6 | v 2.000000 2.000000 0.000000 7 | vt 0.000000 1.000000 0.000000 8 | vt 0.000000 0.000000 0.000000 9 | vt 1.000000 0.000000 0.000000 10 | vt 1.000000 1.000000 0.000000 11 | 12 | usemtl Colored 13 | f 1/1 2/2 3/3 4/4 14 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/square_material_texture.mtl: -------------------------------------------------------------------------------- 1 | newmtl Texture 2 | Ka 0.500 0.500 0.500 3 | Kd 0.500 0.500 0.500 4 | Ks 0.500 0.500 0.500 5 | Tr 1.000000 6 | illum 1 7 | Ns 0.000000 8 | map_Kd square_material_texture.jpg 9 | -------------------------------------------------------------------------------- /src/Unittests/TestFiles/square_material_texture.obj: -------------------------------------------------------------------------------- 1 | mtllib square_material_texture.mtl 2 | 3 | v 0.000000 2.000000 0.000000 4 | v 0.000000 0.000000 0.000000 5 | v 2.000000 0.000000 0.000000 6 | v 2.000000 2.000000 0.000000 7 | vt 0.000000 1.000000 0.000000 8 | vt 0.000000 0.000000 0.000000 9 | vt 1.000000 0.000000 0.000000 10 | vt 1.000000 1.000000 0.000000 11 | 12 | usemtl Texture 13 | f 1/1 2/2 3/3 4/4 14 | -------------------------------------------------------------------------------- /src/Unittests/fill_props.hh: -------------------------------------------------------------------------------- 1 | #ifndef FILL_PROPS_HH 2 | #define FILL_PROPS_HH 3 | 4 | #include 5 | #include "int2roman.hh" 6 | 7 | 8 | template 9 | bool 10 | fill_props( Mesh& _m, OpenMesh::VPropHandleT _ph, bool _check=false) 11 | { 12 | static float a[9] = { 1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f }; 13 | 14 | for(typename Mesh::VertexIter it=_m.vertices_begin(); 15 | it != _m.vertices_end(); ++it) 16 | { 17 | const float v = a[it->idx()%9]; 18 | if ( _check && !(_m.property( _ph, *it ) == v) ) 19 | return false; 20 | else 21 | _m.property( _ph, *it ) = v; 22 | } 23 | return true; 24 | } 25 | 26 | 27 | template 28 | bool 29 | fill_props( Mesh& _m, OpenMesh::EPropHandleT _ph, bool _check=false ) 30 | { 31 | 32 | for( typename Mesh::EdgeIter it=_m.edges_begin(); 33 | it != _m.edges_end(); ++it) 34 | { 35 | const size_t n = it->idx(); 36 | const bool v = ((n&(n-1))==0); // true for 0,1,2,4,8,.. 37 | 38 | if (_check && _m.property( _ph, *it ) != v) 39 | { 40 | return false; 41 | } 42 | else 43 | { 44 | _m.property( _ph, *it ) = v; 45 | } 46 | } 47 | return true; 48 | } 49 | 50 | 51 | 52 | template 53 | bool 54 | fill_props(Mesh& _m, OpenMesh::FPropHandleT _ph, bool _check=false) 55 | { 56 | 57 | for( typename Mesh::FaceIter it=_m.faces_begin(); 58 | it != _m.faces_end(); ++it) 59 | { 60 | const int n = (it->idx()) + 1; 61 | _m.property( _ph, *it ) = int2roman(n); 62 | } 63 | return true; 64 | } 65 | 66 | 67 | template 68 | bool 69 | fill_props( Mesh& _m, OpenMesh::HPropHandleT _ph, bool _check=false) 70 | { 71 | T v; 72 | static float a[9] = { 1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f }; 73 | static float b[9] = { 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f }; 74 | static float c[9] = { 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f, 2.2f }; 75 | static float d[9] = { 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f, 2.2f, 3.3f }; 76 | 77 | for( typename Mesh::HalfedgeIter it=_m.halfedges_begin(); 78 | it != _m.halfedges_end(); ++it) 79 | { 80 | const int n = it->idx(); 81 | 82 | v = ((n&(n-1))==0); 83 | v.vec4fval[0] = a[n%9]; 84 | v.vec4fval[1] = b[n%9]; 85 | v.vec4fval[2] = c[n%9]; 86 | v.vec4fval[3] = d[n%9]; 87 | 88 | if ( _check && _m.property( _ph, *it ) != v ) 89 | return false; 90 | else 91 | _m.property( _ph, *it ) = v; 92 | } 93 | return true; 94 | } 95 | 96 | template 97 | bool 98 | fill_props( Mesh& _m, OpenMesh::MPropHandleT _ph, bool _check=false) 99 | { 100 | for( typename Mesh::FaceIter it=_m.faces_begin(); it != _m.faces_end(); ++it) 101 | { 102 | const size_t idx = it->idx(); 103 | if ( _check && _m.property( _ph )[int2roman(idx+1)] != idx ) 104 | return false; 105 | else 106 | _m.property( _ph )[int2roman(idx+1)] = idx; 107 | } 108 | return true; 109 | } 110 | 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /src/Unittests/generate_cube.hh: -------------------------------------------------------------------------------- 1 | #ifndef GENERATE_CUBE_HH 2 | #define GENERATE_CUBE_HH 3 | 4 | template 5 | size_t generate_cube( MeshType& mesh ) 6 | { 7 | typedef typename MeshType::VertexHandle VertexHandle; 8 | typedef typename MeshType::Point Point; 9 | 10 | typename MeshType::VertexHandle vhandle[8]; 11 | 12 | vhandle[0] = mesh.add_vertex(Point(-1, -1, 1)); 13 | vhandle[1] = mesh.add_vertex(Point( 1, -1, 1)); 14 | vhandle[2] = mesh.add_vertex(Point( 1, 1, 1)); 15 | vhandle[3] = mesh.add_vertex(Point(-1, 1, 1)); 16 | vhandle[4] = mesh.add_vertex(Point(-1, -1, -1)); 17 | vhandle[5] = mesh.add_vertex(Point( 1, -1, -1)); 18 | vhandle[6] = mesh.add_vertex(Point( 1, 1, -1)); 19 | vhandle[7] = mesh.add_vertex(Point(-1, 1, -1)); 20 | 21 | // generate (quadrilateral) faces 22 | 23 | std::vector< VertexHandle > face_vhandles; 24 | 25 | face_vhandles.clear(); 26 | face_vhandles.push_back(vhandle[0]); 27 | face_vhandles.push_back(vhandle[1]); 28 | face_vhandles.push_back(vhandle[2]); 29 | face_vhandles.push_back(vhandle[3]); 30 | mesh.add_face(face_vhandles); 31 | 32 | face_vhandles.clear(); 33 | face_vhandles.push_back(vhandle[7]); 34 | face_vhandles.push_back(vhandle[6]); 35 | face_vhandles.push_back(vhandle[5]); 36 | face_vhandles.push_back(vhandle[4]); 37 | mesh.add_face(face_vhandles); 38 | 39 | face_vhandles.clear(); 40 | face_vhandles.push_back(vhandle[1]); 41 | face_vhandles.push_back(vhandle[0]); 42 | face_vhandles.push_back(vhandle[4]); 43 | face_vhandles.push_back(vhandle[5]); 44 | mesh.add_face(face_vhandles); 45 | 46 | face_vhandles.clear(); 47 | face_vhandles.push_back(vhandle[2]); 48 | face_vhandles.push_back(vhandle[1]); 49 | face_vhandles.push_back(vhandle[5]); 50 | face_vhandles.push_back(vhandle[6]); 51 | mesh.add_face(face_vhandles); 52 | 53 | face_vhandles.clear(); 54 | face_vhandles.push_back(vhandle[3]); 55 | face_vhandles.push_back(vhandle[2]); 56 | face_vhandles.push_back(vhandle[6]); 57 | face_vhandles.push_back(vhandle[7]); 58 | mesh.add_face(face_vhandles); 59 | 60 | face_vhandles.clear(); 61 | face_vhandles.push_back(vhandle[0]); 62 | face_vhandles.push_back(vhandle[3]); 63 | face_vhandles.push_back(vhandle[7]); 64 | face_vhandles.push_back(vhandle[4]); 65 | mesh.add_face(face_vhandles); 66 | 67 | return mesh.n_vertices(); 68 | } 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /src/Unittests/int2roman.hh: -------------------------------------------------------------------------------- 1 | #ifndef INT2ROMAN_HH 2 | #define INT2ROMAN_HH 3 | 4 | #include 5 | 6 | std::string int2roman( size_t decimal, size_t length = 30 ) 7 | { 8 | assert( decimal > 0 && decimal < 1000 ); 9 | 10 | const size_t nrows = 4; 11 | const size_t ncols = 4; 12 | 13 | static size_t table_arabs[ nrows ][ ncols ] = { { 1000, 1000, 1000, 1000 }, 14 | { 900, 500, 400, 100 }, 15 | { 90, 50, 40, 10 }, 16 | { 9, 5, 4, 1 } }; 17 | 18 | static const char *table_romans[ nrows ][ ncols ] = { { "M", "M", "M", "M" }, 19 | { "CM", "D", "CD", "C" }, 20 | { "XC", "L", "XL", "X" }, 21 | { "IX", "V", "IV", "I" } }; 22 | 23 | size_t power; // power of ten 24 | size_t index; // Indexes thru values to subtract 25 | 26 | std::string roman = ""; 27 | roman.reserve(length); 28 | 29 | for ( power = 0; power < nrows; power++ ) 30 | for ( index = 0; index < ncols; index++ ) 31 | while ( decimal >= table_arabs[ power ][ index ] ) 32 | { 33 | roman += table_romans[ power ][ index ]; 34 | decimal -= table_arabs[ power ][ index ]; 35 | } 36 | 37 | return roman; 38 | } 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/Unittests/unittests.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int _argc, char** _argv) { 4 | 5 | testing::InitGoogleTest(&_argc, _argv); 6 | return RUN_ALL_TESTS(); 7 | } 8 | -------------------------------------------------------------------------------- /src/Unittests/unittests_common.hh: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_UNITTESTS_COMMON_HH 2 | #define INCLUDE_UNITTESTS_COMMON_HH 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | #ifdef TEST_CUSTOM_TRAITS 11 | #include 12 | #else 13 | struct CustomTraits : public OpenMesh::DefaultTraits { 14 | }; 15 | #endif 16 | 17 | 18 | typedef OpenMesh::TriMesh_ArrayKernelT Mesh; 19 | 20 | typedef OpenMesh::PolyMesh_ArrayKernelT PolyMesh; 21 | 22 | /* 23 | * Simple test setting. 24 | */ 25 | 26 | class OpenMeshBase : public testing::Test { 27 | 28 | protected: 29 | 30 | // This function is called before each test is run 31 | virtual void SetUp() { 32 | 33 | // Do some initial stuff with the member data here... 34 | } 35 | 36 | // This function is called after all tests are through 37 | virtual void TearDown() { 38 | 39 | // Do some final stuff with the member data here... 40 | } 41 | 42 | // This member will be accessible in all tests 43 | Mesh mesh_; 44 | }; 45 | 46 | /* 47 | * Simple test setting. 48 | */ 49 | 50 | class OpenMeshBasePoly : public testing::Test { 51 | 52 | protected: 53 | 54 | // This function is called before each test is run 55 | virtual void SetUp() { 56 | 57 | // Do some initial stuff with the member data here... 58 | } 59 | 60 | // This function is called after all tests are through 61 | virtual void TearDown() { 62 | 63 | // Do some final stuff with the member data here... 64 | } 65 | 66 | // This member will be accessible in all tests 67 | PolyMesh mesh_; 68 | }; 69 | 70 | 71 | 72 | #endif // INCLUDE GUARD 73 | -------------------------------------------------------------------------------- /src/Unittests/unittests_faceless_mesh.cc: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | namespace { 7 | 8 | class OpenMeshFacelessMesh : public OpenMeshBase { 9 | 10 | protected: 11 | 12 | // This function is called before each test is run 13 | virtual void SetUp() { 14 | 15 | // Do some initial stuff with the member data here... 16 | } 17 | 18 | // This function is called after all tests are through 19 | virtual void TearDown() { 20 | 21 | // Do some final stuff with the member data here... 22 | } 23 | 24 | // Member already defined in OpenMeshBase 25 | //Mesh mesh_; 26 | }; 27 | 28 | ///* 29 | // * ==================================================================== 30 | // * Define tests below 31 | // * ==================================================================== 32 | // */ 33 | // 34 | // */ 35 | //TEST_F(OpenMeshFacelessMesh, TestCirculatorsAndIterators) { 36 | // 37 | // This setup is not supported by OpenMesh, we keep this test, if somebody creates 38 | // a connectivity class for faceless graph setup. 39 | //// mesh_.clear(); 40 | //// 41 | //// // Add some vertices 42 | //// Mesh::VertexHandle vhandle[4]; 43 | //// 44 | //// vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 0, 0)); 45 | //// vhandle[1] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); 46 | //// vhandle[2] = mesh_.add_vertex(Mesh::Point(1, 1, 0)); 47 | //// vhandle[3] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); 48 | //// 49 | //// 50 | //// Mesh::HalfedgeHandle heh00 = mesh_.new_edge(vhandle[0], vhandle[1]); 51 | //// Mesh::HalfedgeHandle heh10 = mesh_.new_edge(vhandle[1], vhandle[2]); 52 | //// 53 | //// 54 | //// // Halfedge Handles do not work in this setting! 55 | //// Mesh::HalfedgeHandle invalid_heh = mesh_.next_halfedge_handle(heh00); 56 | // 57 | //// //second he circulators does not work 58 | //// 59 | //// auto invalid_heh_circ = mesh_.cvoh_iter(vh1); 60 | //// 61 | //// //third, and most important, split_edge fails 62 | //// 63 | //// Mesh::VertexHandle vh12 = mesh_.new_vertex(Mesh::Point(1.5, 0, 0)); 64 | //// mesh_.split_edge(mesh_.edge_handle(heh10), vh12); //runtime error 65 | // 66 | //} 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/Unittests/unittests_mesh_cast.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | 7 | 8 | namespace { 9 | 10 | class OpenMeshMeshCastTest: public testing::Test { 11 | }; 12 | 13 | struct TriTraits1: public OpenMesh::DefaultTraits { 14 | typedef OpenMesh::Vec3d Point; 15 | }; 16 | struct TriTraits2: public OpenMesh::DefaultTraits { 17 | typedef OpenMesh::Vec3d Point; 18 | }; 19 | 20 | TEST_F(OpenMeshMeshCastTest, PerformCast) { 21 | OpenMesh::TriMesh_ArrayKernelT a; 22 | OpenMesh::TriMesh_ArrayKernelT &b = 23 | OpenMesh::mesh_cast&>(a); 24 | b.reserve(10,10,10); 25 | /* 26 | OpenMesh::TriMesh_ArrayKernelT < TriTraits2 > &b = 27 | OpenMesh::MeshCast< 28 | TriMesh_ArrayKernelT&, 29 | OpenMesh::TriMesh_ArrayKernelT& 30 | >::cast(a); 31 | */ 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/Unittests/unittests_mesh_dual.cc: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | namespace { 7 | 8 | class OpenMeshMeshDual : public OpenMeshBasePoly { 9 | 10 | protected: 11 | 12 | // This function is called before each test is run 13 | virtual void SetUp() { 14 | 15 | // Do some initial stuff with the member data here... 16 | } 17 | 18 | // This function is called after all tests are through 19 | virtual void TearDown() { 20 | 21 | // Do some final stuff with the member data here... 22 | } 23 | 24 | // Member already defined in OpenMeshBase 25 | //Mesh mesh_; 26 | }; 27 | 28 | /* 29 | * ==================================================================== 30 | * Define tests below 31 | * ==================================================================== 32 | */ 33 | 34 | /* 35 | */ 36 | TEST_F(OpenMeshMeshDual, Dualize) { 37 | 38 | bool ok = OpenMesh::IO::read_mesh(mesh_, "cube1.off"); 39 | 40 | ASSERT_TRUE(ok); 41 | 42 | PolyMesh* dualMesh; 43 | 44 | dualMesh = OpenMesh::Util::MeshDual(mesh_); 45 | 46 | EXPECT_EQ(15048u, dualMesh->n_vertices()) << "The number of vertices after dual computation is not correct!"; 47 | EXPECT_EQ(22572u, dualMesh->n_edges()) << "The number of edges after dual computation is not correct!"; 48 | EXPECT_EQ(7526u, dualMesh->n_faces()) << "The number of faces after dual computation is not correct!"; 49 | 50 | delete(dualMesh); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Unittests/unittests_polymesh_collapse.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | namespace { 7 | 8 | class OpenMeshCollapsePoly : public OpenMeshBasePoly { 9 | 10 | protected: 11 | 12 | // This function is called before each test is run 13 | virtual void SetUp() { 14 | } 15 | 16 | // This function is called after all tests are through 17 | virtual void TearDown() { 18 | 19 | // Do some final stuff with the member data here... 20 | } 21 | 22 | // Member already defined in OpenMeshBase 23 | //Mesh mesh_; 24 | }; 25 | 26 | /* 27 | * ==================================================================== 28 | * Define tests below 29 | * ==================================================================== 30 | */ 31 | 32 | 33 | 34 | 35 | /* 36 | * This code tests is_collapse_ok on a double sided triangle. The 37 | * test mesh comprises three vertices, that are connected to form two 38 | * triangles of opposite orientation. All halfedges should be non collapsable. 39 | */ 40 | TEST_F(OpenMeshCollapsePoly, CheckCollapseOkDoublesidedTriangle) { 41 | 42 | mesh_.clear(); 43 | 44 | Mesh::VertexHandle vh0 = mesh_.add_vertex(Mesh::Point(0,0,0)); 45 | Mesh::VertexHandle vh1 = mesh_.add_vertex(Mesh::Point(1,0,0)); 46 | Mesh::VertexHandle vh2 = mesh_.add_vertex(Mesh::Point(1,1,0)); 47 | mesh_.add_face(vh0, vh1, vh2); 48 | mesh_.add_face(vh0, vh2, vh1); 49 | 50 | 51 | 52 | mesh_.request_vertex_status(); 53 | mesh_.request_face_status(); 54 | mesh_.request_edge_status(); 55 | 56 | int collapsable = 0; 57 | 58 | for ( const auto hh : mesh_.all_halfedges() ) 59 | { 60 | if (mesh_.is_collapse_ok(hh) ) 61 | collapsable++; 62 | } 63 | 64 | 65 | EXPECT_EQ(collapsable,0) << "No collapse should be ok when we have only a double sided Triangle"; 66 | } 67 | 68 | 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/Unittests/unittests_polymesh_vec2i.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | struct CustomTraitsVec2i : OpenMesh::DefaultTraits 7 | { 8 | typedef OpenMesh::Vec2i Point; 9 | }; 10 | 11 | 12 | 13 | typedef OpenMesh::PolyMesh_ArrayKernelT PolyMeshVec2i; 14 | 15 | 16 | 17 | /* 18 | * OpenMesh Poly with Vec2i 19 | */ 20 | 21 | class OpenMeshBasePolyVec2i : public testing::Test { 22 | 23 | protected: 24 | 25 | // This function is called before each test is run 26 | virtual void SetUp() { 27 | 28 | // Do some initial stuff with the member data here... 29 | } 30 | 31 | // This function is called after all tests are through 32 | virtual void TearDown() { 33 | 34 | // Do some final stuff with the member data here... 35 | } 36 | 37 | // This member will be accessible in all tests 38 | PolyMeshVec2i mesh_; 39 | }; 40 | 41 | 42 | 43 | namespace { 44 | 45 | /* 46 | * ==================================================================== 47 | * Define tests below 48 | * ==================================================================== 49 | */ 50 | 51 | 52 | /* 53 | * Checking for feature edges based on angle 54 | */ 55 | TEST_F(OpenMeshBasePolyVec2i, Instance_Vec2i_Mesh) { 56 | 57 | mesh_.clear(); 58 | 59 | // Add some vertices 60 | PolyMeshVec2i::VertexHandle vhandle[4]; 61 | 62 | vhandle[0] = mesh_.add_vertex(PolyMeshVec2i::Point(0, 0)); 63 | vhandle[1] = mesh_.add_vertex(PolyMeshVec2i::Point(0, 1)); 64 | vhandle[2] = mesh_.add_vertex(PolyMeshVec2i::Point(1, 1)); 65 | 66 | // Add face 67 | std::vector face_vhandles; 68 | 69 | face_vhandles.push_back(vhandle[0]); 70 | face_vhandles.push_back(vhandle[1]); 71 | face_vhandles.push_back(vhandle[2]); 72 | mesh_.add_face(face_vhandles); 73 | 74 | // =============================================== 75 | // Setup complete 76 | // =============================================== 77 | 78 | // Check one Request only vertex normals 79 | // Face normals are required for vertex and halfedge normals, so 80 | // that prevent access to non existing properties are in place 81 | 82 | mesh_.request_vertex_normals(); 83 | mesh_.request_halfedge_normals(); 84 | mesh_.request_face_normals(); 85 | 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/Unittests/unittests_randomNumberGenerator.cc: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | namespace { 6 | 7 | class RandomNumberGenerator : public testing::Test { 8 | 9 | protected: 10 | 11 | // This function is called before each test is run 12 | virtual void SetUp() { 13 | 14 | // Do some initial stuff with the member data here... 15 | } 16 | 17 | // This function is called after all tests are through 18 | virtual void TearDown() { 19 | 20 | // Do some final stuff with the member data here... 21 | } 22 | 23 | // Member already defined in OpenMeshBase 24 | //Mesh mesh_; 25 | }; 26 | 27 | /* 28 | * ==================================================================== 29 | * Define tests below 30 | * ==================================================================== 31 | */ 32 | 33 | TEST_F(RandomNumberGenerator, RandomNumberGeneratorMaxTestHighres) { 34 | 35 | 36 | OpenMesh::RandomNumberGenerator rng(100000000); 37 | 38 | unsigned int lowerZero = 0; 39 | unsigned int above1 = 0; 40 | 41 | double average = 0.0; 42 | 43 | for ( unsigned int i = 0 ; i < 100000000 ; ++i) { 44 | double randomNumber = rng.getRand(); 45 | if ( randomNumber < 0.0 ) 46 | lowerZero++; 47 | 48 | if ( randomNumber > 1.0 ) 49 | above1++; 50 | 51 | average += randomNumber; 52 | } 53 | 54 | average /= 100000000.0; 55 | 56 | EXPECT_EQ(0u, lowerZero ) << "Below zero!"; 57 | EXPECT_EQ(0u, above1 ) << "Above zero!"; 58 | 59 | EXPECT_TRUE( (average - 0.5) < 0.01 ) << "Expected value not 0.5"; 60 | } 61 | 62 | TEST_F(RandomNumberGenerator, RandomNumberGeneratorMaxTestLowres) { 63 | 64 | OpenMesh::RandomNumberGenerator rng(1000); 65 | 66 | unsigned int lowerZero = 0; 67 | unsigned int above1 = 0; 68 | 69 | double average = 0.0; 70 | 71 | for ( unsigned int i = 0 ; i < 10000000 ; ++i) { 72 | 73 | double randomNumber = rng.getRand(); 74 | if ( randomNumber < 0.0 ) 75 | lowerZero++; 76 | 77 | if ( randomNumber > 1.0 ) { 78 | above1++; 79 | } 80 | 81 | average += randomNumber; 82 | } 83 | 84 | average /= 10000000.0; 85 | 86 | EXPECT_EQ(0u, lowerZero ) << "Below zero!"; 87 | EXPECT_EQ(0u, above1 ) << "Above zero!"; 88 | 89 | EXPECT_TRUE( (average - 0.5) < 0.01 ) << "Expected value not 0.5"; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/Unittests/unittests_smoother.cc: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | namespace { 7 | 8 | class OpenMeshSmoother_Poly : public OpenMeshBasePoly { 9 | 10 | protected: 11 | 12 | // This function is called before each test is run 13 | virtual void SetUp() { 14 | 15 | // Do some initial stuff with the member data here... 16 | } 17 | 18 | // This function is called after all tests are through 19 | virtual void TearDown() { 20 | 21 | // Do some final stuff with the member data here... 22 | } 23 | 24 | // Member already defined in OpenMeshBase 25 | //Mesh mesh_; 26 | }; 27 | 28 | class OpenMeshSmoother_Triangle : public OpenMeshBase { 29 | 30 | protected: 31 | 32 | // This function is called before each test is run 33 | virtual void SetUp() { 34 | 35 | // Do some initial stuff with the member data here... 36 | } 37 | 38 | // This function is called after all tests are through 39 | virtual void TearDown() { 40 | 41 | // Do some final stuff with the member data here... 42 | } 43 | 44 | // Member already defined in OpenMeshBase 45 | //Mesh mesh_; 46 | }; 47 | 48 | /* 49 | * ==================================================================== 50 | * Define tests below 51 | * ==================================================================== 52 | */ 53 | 54 | /* 55 | */ 56 | TEST_F(OpenMeshSmoother_Triangle, Smoother_Poly_Laplace) { 57 | 58 | mesh_.clear(); 59 | 60 | 61 | bool ok = OpenMesh::IO::read_mesh(mesh_, "cube1.off"); 62 | 63 | ASSERT_TRUE(ok); 64 | 65 | // Check setup 66 | EXPECT_EQ(7526u, mesh_.n_vertices() ) << "Wrong number of vertices"; 67 | EXPECT_EQ(15048u, mesh_.n_faces() ) << "Wrong number of faces"; 68 | 69 | 70 | // Initialize subdivider 71 | OpenMesh::Smoother::JacobiLaplaceSmootherT smoother(mesh_); 72 | 73 | // Just call function to instanciate template 74 | smoother.set_absolute_local_error(0.5f); 75 | 76 | // Set an error 77 | smoother.set_relative_local_error(0.1f); 78 | 79 | // Run algorithm with 5 steps 80 | smoother.smooth(5); 81 | 82 | 83 | EXPECT_EQ(7526u, mesh_.n_vertices() ) << "Wrong number of vertices after smoothing?"; 84 | EXPECT_EQ(15048u, mesh_.n_faces() ) << "Wrong number of faces after smoothing?"; 85 | 86 | } 87 | 88 | /* 89 | * ==================================================================== 90 | * Define tests below 91 | * ==================================================================== 92 | */ 93 | 94 | /* 95 | */ 96 | TEST_F(OpenMeshSmoother_Poly, Smoother_Triangle_Laplace) { 97 | 98 | mesh_.clear(); 99 | 100 | 101 | bool ok = OpenMesh::IO::read_mesh(mesh_, "cube1.off"); 102 | 103 | ASSERT_TRUE(ok); 104 | 105 | // Check setup 106 | EXPECT_EQ(7526u, mesh_.n_vertices() ) << "Wrong number of vertices"; 107 | EXPECT_EQ(15048u, mesh_.n_faces() ) << "Wrong number of faces"; 108 | 109 | 110 | // Initialize subdivider 111 | OpenMesh::Smoother::JacobiLaplaceSmootherT smoother(mesh_);; 112 | 113 | // Just call function to instantiate template 114 | smoother.set_absolute_local_error(0.5f); 115 | 116 | // Set an error 117 | smoother.set_relative_local_error(0.1f); 118 | 119 | // Run algorithm with 5 steps 120 | smoother.smooth(5); 121 | 122 | 123 | EXPECT_EQ(7526u, mesh_.n_vertices() ) << "Wrong number of vertices after smoothing?"; 124 | EXPECT_EQ(15048u, mesh_.n_faces() ) << "Wrong number of faces after smoothing?"; 125 | 126 | } 127 | 128 | 129 | } 130 | -------------------------------------------------------------------------------- /src/Unittests/unittests_sr_binary.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | namespace { 9 | 10 | class OpenMeshSRBinary : public testing::Test { 11 | 12 | protected: 13 | 14 | // This function is called before each test is run 15 | virtual void SetUp() { 16 | 17 | // Do some initial stuff with the member data here... 18 | } 19 | 20 | // This function is called after all tests are through 21 | virtual void TearDown() { 22 | 23 | // Do some final stuff with the member data here... 24 | } 25 | 26 | }; 27 | 28 | 29 | 30 | /* 31 | * ==================================================================== 32 | * Define tests below 33 | * ==================================================================== 34 | */ 35 | 36 | /* Check if len is swapped correctly 37 | * when storing strings using the binary serializer. 38 | * 39 | */ 40 | TEST_F(OpenMeshSRBinary, CheckStringSwap) { 41 | std::string testString = "OpenMesh String"; 42 | std::stringstream stream(""); 43 | OpenMesh::IO::binary::store(stream,testString,true); 44 | std::stringstream stream2(""); 45 | OpenMesh::IO::binary::store(stream2,testString,false); 46 | std::string res2 = stream2.str(); 47 | std::string res = stream.str(); 48 | uint16_t len, len2; 49 | stream.read((char*)&len,2); 50 | 51 | stream2.read( (char*)&len2,2); 52 | 53 | EXPECT_EQ(len2,testString.length()); 54 | EXPECT_EQ(len,(testString.length()>>8)|(testString.length()<<8)); 55 | EXPECT_NE(len,len2); 56 | } 57 | 58 | /* Check if storing and restoring a string gives proper result 59 | * Do that with and without swapping the byte order 60 | */ 61 | TEST_F(OpenMeshSRBinary, StringStoreRestore) { 62 | 63 | 64 | std::string testString = "OpenMesh String"; 65 | std::stringstream stream(""); 66 | OpenMesh::IO::binary::store(stream,testString,true); 67 | std::stringstream stream2(""); 68 | OpenMesh::IO::binary::store(stream2,testString,false); 69 | 70 | 71 | std::string restored1, restored2; 72 | OpenMesh::IO::binary::restore(stream, restored1 , true); 73 | OpenMesh::IO::binary::restore(stream2, restored2 , false); 74 | 75 | EXPECT_EQ(restored1.length(), restored2.length()); 76 | EXPECT_EQ(restored1.length(), testString.length()); 77 | for(size_t i = 0 ; i < testString.length() ; ++i) 78 | { 79 | EXPECT_EQ(restored1[i] , testString[i]); 80 | EXPECT_EQ(restored2[i] , testString[i]); 81 | } 82 | 83 | 84 | } 85 | 86 | 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/Unittests/unittests_stripifier.cc: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | namespace { 7 | 8 | class OpenMeshStripify : public OpenMeshBase { 9 | 10 | protected: 11 | 12 | // This function is called before each test is run 13 | virtual void SetUp() { 14 | 15 | // Do some initial stuff with the member data here... 16 | } 17 | 18 | // This function is called after all tests are through 19 | virtual void TearDown() { 20 | 21 | // Do some final stuff with the member data here... 22 | } 23 | 24 | // Member already defined in OpenMeshBase 25 | //Mesh mesh_; 26 | }; 27 | 28 | /* 29 | * ==================================================================== 30 | * Define tests below 31 | * ==================================================================== 32 | */ 33 | 34 | /* 35 | */ 36 | TEST_F(OpenMeshStripify, Stripify) { 37 | 38 | bool ok = OpenMesh::IO::read_mesh(mesh_, "cube1.off"); 39 | 40 | ASSERT_TRUE(ok); 41 | 42 | OpenMesh::StripifierT stripifier(mesh_); 43 | 44 | size_t strips = stripifier.stripify(); 45 | 46 | EXPECT_EQ(1269u, strips) << "The number of computed strips is not correct!"; 47 | EXPECT_TRUE(stripifier.is_valid()) << "Strips not computed!"; 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Unittests/unittests_trimesh_vec2i.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | struct CustomTraitsVec2i : OpenMesh::DefaultTraits 7 | { 8 | typedef OpenMesh::Vec2i Point; 9 | }; 10 | 11 | 12 | typedef OpenMesh::TriMesh_ArrayKernelT TriMeshVec2i; 13 | 14 | 15 | /* 16 | * OpenMesh Triangular with Vec2i 17 | */ 18 | 19 | class OpenMeshBaseTriVec2i : public testing::Test { 20 | 21 | protected: 22 | 23 | // This function is called before each test is run 24 | virtual void SetUp() { 25 | 26 | // Do some initial stuff with the member data here... 27 | } 28 | 29 | // This function is called after all tests are through 30 | virtual void TearDown() { 31 | 32 | // Do some final stuff with the member data here... 33 | } 34 | 35 | // This member will be accessible in all tests 36 | TriMeshVec2i mesh_; 37 | }; 38 | 39 | 40 | namespace { 41 | 42 | /* 43 | * ==================================================================== 44 | * Define tests below 45 | * ==================================================================== 46 | */ 47 | 48 | /* 49 | * Checking for feature edges based on angle 50 | */ 51 | TEST_F(OpenMeshBaseTriVec2i, Instance_Vec2i_Mesh) { 52 | 53 | mesh_.clear(); 54 | 55 | // Add some vertices 56 | TriMeshVec2i::VertexHandle vhandle[4]; 57 | 58 | vhandle[0] = mesh_.add_vertex(TriMeshVec2i::Point(0, 0)); 59 | vhandle[1] = mesh_.add_vertex(TriMeshVec2i::Point(0, 1)); 60 | vhandle[2] = mesh_.add_vertex(TriMeshVec2i::Point(1, 1)); 61 | 62 | // Add face 63 | std::vector face_vhandles; 64 | 65 | face_vhandles.push_back(vhandle[0]); 66 | face_vhandles.push_back(vhandle[1]); 67 | face_vhandles.push_back(vhandle[2]); 68 | mesh_.add_face(face_vhandles); 69 | 70 | // =============================================== 71 | // Setup complete 72 | // =============================================== 73 | 74 | // Check one Request only vertex normals 75 | // Face normals are required for vertex and halfedge normals, so 76 | // that prevent access to non existing properties are in place 77 | 78 | mesh_.request_vertex_normals(); 79 | mesh_.request_halfedge_normals(); 80 | mesh_.request_face_normals(); 81 | 82 | } 83 | 84 | } 85 | --------------------------------------------------------------------------------