### Install Optional Libraries on MacOS X Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a06305 Installs optional libraries required for specific OpenMesh functionalities using Homebrew. Googletest is needed for compiling tests, and Qt for UI examples. ```shell brew install googletest brew install qt ``` -------------------------------- ### OpenMesh Class Member 'b' Examples Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/functions_b Demonstrates the usage of class members starting with 'b' in OpenMesh. Includes examples for BaseProperty, begin, Binary options, binary_size for various writers, and bits for StatusInfo. ```cpp BaseProperty() : OpenMesh::BaseProperty ``` ```cpp begin() : OpenMesh::StripifierT< Mesh > ``` ```cpp Binary : OpenMesh::IO::Options ``` ```cpp binary_size() : OpenMesh::IO::_OBJWriter_, OpenMesh::IO::_OFFWriter_, OpenMesh::IO::_OMWriter_, OpenMesh::IO::_PLYWriter_, OpenMesh::IO::_STLWriter_, OpenMesh::IO::_VTKWriter_, OpenMesh::IO::BaseWriter ``` ```cpp bits() : OpenMesh::Attributes::StatusInfo ``` -------------------------------- ### Basic OpenMesh Triangle Mesh Example Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a06333 Demonstrates the setup and basic usage of OpenMesh with custom traits for a triangle mesh. It includes mesh loading, normal calculation, and vertex manipulation. ```C++ #include #include // -------------------- #include #include #include #ifndef DOXY_IGNORE_THIS // Define my personal traits struct MyTraits : OpenMesh::DefaultTraits { // Let Point and Normal be a vector of doubles typedef OpenMesh::Vec3d Point; typedef OpenMesh::Vec3d Normal; // Already defined in OpenMesh::DefaultTraits // HalfedgeAttributes( OpenMesh::Attributes::PrevHalfedge ); // Uncomment next line to disable attribute PrevHalfedge // HalfedgeAttributes( OpenMesh::Attributes::None ); // // or // // HalfedgeAttributes( 0 ); }; #endif // Define my mesh with the new traits! typedef OpenMesh::TriMesh_ArrayKernelT MyMesh; // ------------------------------------------------------------------ main ---- int main(int argc, char **argv) { MyMesh mesh; if (argc!=2) { std::cerr << "Usage: " << argv[0] << " \n"; return 1; } // Just make sure that point element type is double if ( typeid( OpenMesh::vector_traits::value_type ) != typeid(double) ) { std::cerr << "Ouch! ERROR! Data type is wrong!\n"; return 1; } // Make sure that normal element type is double if ( typeid( OpenMesh::vector_traits::value_type ) != typeid(double) ) { std::cerr << "Ouch! ERROR! Data type is wrong!\n"; return 1; } // Add vertex normals as default property (ref. previous tutorial) mesh.request_vertex_normals(); // Add face normals as default property mesh.request_face_normals(); // load a mesh OpenMesh::IO::Options opt; if ( ! OpenMesh::IO::read_mesh(mesh,argv[1], opt)) { std::cerr << "Error loading mesh from file " << argv[1] << std::endl; return 1; } // If the file did not provide vertex normals, then calculate them if ( !opt.check( OpenMesh::IO::Options::VertexNormal ) && mesh.has_face_normals() && mesh.has_vertex_normals() ) { // let the mesh update the normals mesh.update_normals(); } // move all vertices one unit length along it's normal direction for (MyMesh::VertexIter v_it = mesh.vertices_begin(); v_it != mesh.vertices_end(); ++v_it) { std::cout << "Vertex #" << *v_it << ": " << mesh.point( *v_it ); mesh.set_point( *v_it, mesh.point(*v_it)+mesh.normal(*v_it) ); std::cout << " moved to " << mesh.point( *v_it ) << std::endl; } return 0; } ``` -------------------------------- ### Improve Decimater example documentation Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a06304 Enhanced the documentation for the Decimater example to provide clearer instructions and explanations. This improves the usability of the example for users. ```markdown Fixed Decimater example documentation. ``` -------------------------------- ### OpenMesh Final Implementation Example Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a06316 An example demonstrating a final implementation of a triangle mesh rendering application using OpenMesh, including defining custom traits and adding dynamic properties. ```APIDOC ## Final Implementation Example ### Description This example considers an application that renders triangle meshes. It demonstrates selecting a triangle mesh, using the `ArrayKernelT`, and defining custom traits (`MyTraits`) for vertex and face attributes. It also shows how to add dynamic properties to the mesh at runtime. ### Method N/A (Code Example) ### Endpoint N/A ### Parameters N/A ### Request Example ```cpp #include #include // Define traits struct MyTraits : public OpenMesh::DefaultTraits { // use double valued coordinates typedef OpenMesh::Vec3d Point; // use vertex normals and vertex colors VertexAttributes( OpenMesh::DefaultAttributer::Normal | OpenMesh::DefaultAttributer::Color ); // store the previous halfedge HalfedgeAttributes( OpenMesh::DefaultAttributer::PrevHalfedge ); // use face normals FaceAttributes( OpenMesh::DefaultAttributer::Normal ); // store a face handle for each vertex VertexTraits { typename Base::Refs::FaceHandle my_face_handle; }; }; // Select mesh type (TriMesh) and kernel (ArrayKernel) // and define my personal mesh type (MyMesh) typedef OpenMesh::TriMesh_ArrayKernelT MyMesh; int main(int argc, char **argv) { MyMesh mesh; // Add dynamic data // for each vertex an extra double value OpenMesh::VPropHandleT< double > vprop_double; mesh.add_property( vprop_double ); // for the mesh an extra string OpenMesh::MPropHandleT< std::string > mprop_string; mesh.add_property( mprop_string ); // ... do something ... return 0; } ``` ### Response N/A (Code Execution) ``` -------------------------------- ### Basic Decimater Setup - C++ Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a06307 Demonstrates the fundamental steps to initialize and use the OpenMesh decimater. It includes creating a mesh, instantiating the decimater, adding a quadric module, configuring it as a non-binary module, initializing the decimater, performing decimation, and cleaning up the mesh. ```cpp using namespace OpenMesh; typedef TriMesh_ArrayKernelT<> Mesh; typedef Decimater::DecimaterT Decimater; typedef Decimater::ModQuadricT::Handle HModQuadric; Mesh mesh; // a mesh object Decimater decimater(mesh); // a decimater object, connected to a mesh HModQuadric hModQuadric; // use a quadric module decimater.add(hModQuadric); // register module at the decimater std::cout << decimater.module(hModQuadric).name() << std::endl; // module access /* * since we need exactly one priority module (non-binary) * we have to call set_binary(false) for our priority module * in the case of HModQuadric, unset_max_err() calls set_binary(false) internally */ decimater.module(hModQuadric).unset_max_err(); decimater.initialize(); decimater.decimate(); // after decimation: remove decimated elements from the mesh mesh.garbage_collection(); ``` -------------------------------- ### Get Starting Vertex of a SmartHalfedgeHandle in OpenMesh Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a00224_source Returns the vertex at the start of the halfedge. ```C++ SmartVertexHandle from() const ``` -------------------------------- ### OpenMesh Namespace Functions Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/functions_func_q This section details functions within the OpenMesh namespace, categorized by their starting letter. Below are examples for functions starting with 'q'. ```APIDOC ## GET /openmesh/namespace/functions/q ### Description Retrieves a list of functions within the OpenMesh namespace that start with the letter 'q'. This includes functions for input/output filters and geometry quadrics. ### Method GET ### Endpoint /openmesh/namespace/functions/q ### Parameters None ### Request Example None ### Response #### Success Response (200) - **functions** (array) - A list of function names and their respective namespaces. #### Response Example ```json { "functions": [ "OpenMesh::IO::_IOManager_::qt_read_filters()", "OpenMesh::IO::_IOManager_::qt_write_filters()", "OpenMesh::Geometry::QuadricT< Scalar >::QuadricT()" ] } ``` ``` -------------------------------- ### Update decimation tutorial documentation Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a06304 The documentation for the decimation tutorial has been adjusted to correctly explain the initialization of the priority module. This improves clarity and accuracy for users following the tutorial. ```markdown Updated decimation tutorial documentation regarding priority module initialization. ``` -------------------------------- ### OpenMesh IOManager Quick Start Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a06319 This section provides a quick start example for using the OpenMesh IOManager to read and write mesh files. ```APIDOC ## IOManager Quick Start ### Description This example demonstrates how to quickly integrate mesh reading and writing functionality using the OpenMesh IOManager. ### Method Not Applicable (C++ code example) ### Endpoint Not Applicable (C++ code example) ### Parameters None for this specific code snippet, but the functions `read_mesh` and `write_mesh` take mesh objects and filenames as parameters. ### Request Example ```cpp #include MyMesh mesh; if (!OpenMesh::IO::read_mesh(mesh, "some input file")) { std::cerr << "read error\n"; exit(1); } // do something with your mesh ... if (!OpenMesh::IO::write_mesh(mesh, "some output file")) { std::cerr << "write error\n"; exit(1); } ``` ### Response #### Success Response Mesh data is processed and written to the specified file. #### Response Example No direct response, but successful execution implies the mesh was read or written correctly. ``` -------------------------------- ### OpenMesh Navigation with Smart Handles Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a06339 Demonstrates how to iterate over mesh elements and navigate using smart handles for simplified code. ```APIDOC ## OpenMesh Navigation with Smart Handles ### Description This section illustrates advanced mesh navigation techniques in OpenMesh using smart handles and ranges. It shows how to efficiently access adjacent elements (vertices, edges, faces) of a mesh. ### Method N/A (Illustrative code examples) ### Endpoint N/A (C++ Library Documentation) ### Parameters N/A ### Request Example N/A ### Response N/A ## Example 1: Basic Navigation using Halfedge Handles ### Description Iterates over all vertices of a triangle mesh and for each vertex, finds all opposite vertices connected by edges in the vertex's ring. ### Method N/A (C++ Code Example) ### Endpoint N/A ### Parameters N/A ### Request Example ```cpp // iterate over vertices of the mesh for (auto vh : mesh.vertices()) { std::vector opposite_vertices; // iterate over all outgoing halfedges for (auto heh : mesh.voh_range(vh)) { // navigate to the opposite vertex and store it in the vector opposite_vertices.push_back(mesh.to_vertex_handle(mesh.next_halfedge_handle(mesh.opposite_halfedge_handle(mesh.next_halfedge_handle(heh)))))); } } ``` ### Response N/A ## Example 2: Navigation using Smart Handles ### Description Demonstrates the simplified navigation using OpenMesh's smart handles (e.g., `SmartHalfedgeHandle`), which encapsulate mesh context and provide intuitive navigation methods. ### Method N/A (C++ Code Example) ### Endpoint N/A ### Parameters N/A ### Request Example ```cpp // iterate over vertices of the mesh for (auto vh : mesh.vertices()) { // iterate over all outgoing halfedges std::vector opposite_vertices; for (auto heh : vh.outgoing_halfedges()) // Using SmartHalfedgeHandle { // navigate to the opposite vertex and store it in the vector opposite_vertices.push_back(heh.next().opp().next().to()); } } ``` ### Response N/A ## Example 3: Navigation with Ranges and Functors ### Description Shows how to use `to_vector()` method on ranges returned by smart handles, applying a functor for concise element transformation. ### Method N/A (C++ Code Example) ### Endpoint N/A ### Parameters N/A ### Request Example ```cpp // iterate over vertices of the mesh for (auto vh : mesh.vertices()) { // create lambda that returns opposite vertex auto opposite_vertex = [](OpenMesh::SmartHalfedgeHandle heh) { return heh.next().opp().next().to(); }; // create vector containing all opposite vertices auto opposite_vertices = vh.outgoing_halfedges().to_vector(opposite_vertex); } ``` ### Response N/A ``` -------------------------------- ### Get Halfedges of Edge (from HalfedgeHandle) Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02630 Returns a range object for iterating over the halfedges of a given edge, starting from a specific halfedge. ```APIDOC ## eh_range() [2/2] ### Description Returns a range object for iterating over the halfedges of the specified edge, starting iteration at the provided halfedge. ### Method `PolyConnectivity::ConstEdgeHalfedgeRange` ### Parameters #### Path Parameters - `__heh_` (HalfedgeHandle) - The halfedge handle from which to start iteration. ### Returns A range object suitable for C++11 range-based for loops. ``` -------------------------------- ### OpenMesh Testing Framework Usage Example Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a00458_source Demonstrates how to set up and use the OpenMesh Testing Framework. It shows the creation of a custom test class inheriting from `TestingFramework::TestFunc`, implementing the `body()` method for test logic, and registering it with the `TestingFramework` in `main`. ```cpp #include #include <.../TestingFramework.hh> struct test_func : public TestingFramework::TestFunc { typedef test_func Self; // define ctor and copy-ctor test_func( TestingFramework& _th, std::string _n ) : TestingFramework::TestFunc( _th, _n ) { } test_func( Self& _cpy ) : TestingFramework::TestFunc(_cpy) { } // overload body() void body() { // Do the tests // direct call to verify verify( testResult, expectedResult, "additional information" ); // or use the define TH_VERIFY. The test-expression will be used as the message string TH_VERIFY( testResult, expectedResult ); ... } }; int main(...) { TestingFramework testSuite(std::cout); // send output to stdout new test_func(testSuite); // create new test instance. It registers with testSuite. return testSuite.run(); } ``` -------------------------------- ### Get Halfedge Handle for Face in C++ Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a01154_source Retrieves the handle of a halfedge that lies on the boundary of a given face. This is a starting point for iterating through the halfedges of a face. ```cpp HalfedgeHandle halfedge_handle(FaceHandle _fh) const; ``` -------------------------------- ### OpenMesh: Get Outgoing Halfedges Range (HalfedgeHandle) Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02630 Provides a C++ range object for iterating through outgoing halfedges incident to a specified vertex, starting iteration at the given halfedge. ```cpp inline PolyConnectivity::ConstVertexOHalfedgeRange OpenMesh::PolyConnectivity::voh_range(HalfedgeHandle __heh_) const ``` -------------------------------- ### OpenMesh File List Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/dir_8a440bf75a6d313779e8057642fee177 Lists the header files associated with the Tutorial10 example in OpenMesh. These files likely contain declarations for mesh processing functionalities and utilities. ```text fill_props.hh generate_cube.hh int2roman.hh stats.hh ``` -------------------------------- ### BaseDecimaterT Initialization and Setup Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a03370 Provides functions for initializing the decimater, checking its initialization status, and setting up an observer for monitoring the decimation process. ```cpp BaseDecimaterT(Mesh &_mesh) bool initialize() bool is_initialized() const void set_observer(Observer *_o) Observer *observer() ``` -------------------------------- ### OpenMesh: Get Incoming Halfedges Range (HalfedgeHandle) Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02630 Provides a C++ range object for iterating through incoming halfedges incident to a specified vertex, starting iteration at the given halfedge. ```cpp inline PolyConnectivity::ConstVertexIHalfedgeRange OpenMesh::PolyConnectivity::vih_range(HalfedgeHandle __heh_) const ``` -------------------------------- ### OpenMesh Main Page Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02927 Provides an overview of the OpenMesh library, including navigation to different sections like Modules, Namespaces, Classes, and Files. ```APIDOC ## OpenMesh Documentation ### Description Welcome to the official documentation for the OpenMesh library. This site provides comprehensive information about the library's structure, classes, functions, and more. ### Navigation Explore the documentation using the navigation menu on the left: * **Main Page**: Overview of OpenMesh. * **Related Pages**: Links to related documentation. * **Modules**: Groupings of related functionalities. * **Namespaces**: Organization of classes and functions. * Namespace List * Namespace Members (All, Functions, Variables, Typedefs, Enumerations, Enumerator) * **Classes**: Detailed information about each class. * Class List * Class Hierarchy * Class Members (All, Functions, Variables, Typedefs, Enumerations, Enumerator, Related Functions) * **Files**: Information about the library's source files. * File List * File Members (All, Macros) ### Key Features * Efficient mesh data structures. * Support for various mesh operations. * Extensible through modules and concepts. ### Getting Started * How to create your own project inside OpenMesh * Todo List * Deprecated List ``` -------------------------------- ### Get Halfedge Handle from Vertex in C++ Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a01154_source Retrieves the handle of a halfedge originating from a given vertex. This is a fundamental operation for navigating the mesh connectivity starting from a vertex. ```cpp HalfedgeHandle halfedge_handle(VertexHandle _vh) const; ``` -------------------------------- ### OpenMesh Halfedge Iteration and Traversal Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02815 Functions for iterating over and traversing halfedges in OpenMesh. This includes getting iterators for the start and end of halfedge sequences and traversing halfedge loops in different directions. ```c++ halfedges() const halfedges_begin() halfedges_begin() const halfedges_end() halfedges_end() const halfedges_sbegin() halfedges_sbegin() const hl_begin(HalfedgeHandle _heh) hl_ccw_range(HalfedgeHandle _heh) const hl_ccwbegin(HalfedgeHandle _heh) hl_ccwend(HalfedgeHandle _heh) hl_cw_range(HalfedgeHandle _heh) const hl_cwbegin(HalfedgeHandle _heh) hl_cwend(HalfedgeHandle _heh) hl_end(HalfedgeHandle _heh) hl_range(HalfedgeHandle _heh) const ``` -------------------------------- ### Build OpenMesh Project with CMake Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a06341 These commands initiate the CMake build process for the OpenMesh project, including any added custom applications. First, a 'build' directory is created and entered. Then, 'cmake ..' configures the build, and 'make' compiles the project. ```bash mkdir build cd build cmake .. make ``` -------------------------------- ### OpenMesh: Get Outgoing Halfedges CW Range (HalfedgeHandle) Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02630 Provides a C++ range object for iterating through outgoing halfedges incident to a specified vertex in a clockwise direction, starting iteration at the given halfedge. ```cpp inline PolyConnectivity::ConstVertexOHalfedgeCWRange OpenMesh::PolyConnectivity::voh_cw_range(HalfedgeHandle __heh_) const ``` -------------------------------- ### Build OpenMesh and Documentation on MacOS X Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a06305 Commands to build the OpenMesh library and its documentation. 'make' compiles the library, and 'make doc' specifically builds the documentation. ```shell make ## Build OpenMesh make doc ## Build OpenMesh's documentation ``` -------------------------------- ### OpenMesh: Get Outgoing Halfedges CCW Range (HalfedgeHandle) Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02630 Provides a C++ range object for iterating through outgoing halfedges incident to a specified vertex in a counter-clockwise direction, starting iteration at the given halfedge. ```cpp inline PolyConnectivity::ConstVertexOHalfedgeCCWRange OpenMesh::PolyConnectivity::voh_ccw_range(HalfedgeHandle __heh_) const ``` -------------------------------- ### OpenMesh Singleton Pattern Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/functions_i Documentation for the Singleton design pattern implementation. ```APIDOC ## OpenMesh Singleton Pattern ### Description Details the implementation of the Singleton pattern for ensuring a single instance of a class. ### Singleton Class - **`SingletonT< T >`**: Template for the Singleton pattern. - **`Instance()`**: Returns the singleton instance. ``` -------------------------------- ### BaseProperty Constructor and Destructor Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02834 Documentation for the BaseProperty constructor and destructor, including default and copy constructors, and the virtual destructor. ```APIDOC ## BaseProperty Constructor & Destructor ### Default Constructor **BaseProperty** (const std::string &_name="", const std::string &_internal_type_name="") Default constructor. Allows specifying a name and internal type name for the property. If the property is intended for storage in the OM-format, it must be named and its persistent flag enabled using `set_persistent()`. Parameters: - `_name` (const std::string &): Optional textual name for the property. - `_internal_type_name` (const std::string &): Internal type name used when storing data in OM format. ### Copy Constructor **BaseProperty** (const BaseProperty &_rhs) Copy constructor for creating a new BaseProperty object from an existing one. ### Destructor virtual **~BaseProperty** () Virtual destructor for the BaseProperty class. ``` -------------------------------- ### OpenMesh: Get Incoming Halfedges CW Range (HalfedgeHandle) Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02630 Provides a C++ range object for iterating through incoming halfedges incident to a specified vertex in a clockwise direction, starting iteration at the given halfedge. ```cpp inline PolyConnectivity::ConstVertexIHalfedgeCWRange OpenMesh::PolyConnectivity::vih_cw_range(HalfedgeHandle __heh_) const ``` -------------------------------- ### Example Main Function for Mesh I/O (OpenMesh C++) Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a06336 A complete C++ `main` function demonstrating reading a mesh, displaying its properties (including binary format, byte order, and available features like vertex normals), and then writing the mesh with specified options. It includes error handling for both read and write operations. ```C++ #include #include #include #include #include // Define macros for checking and printing options #define CHKROPT( Option ) std::cout << " provides " << #Option << (ropt.check(IO::Options:: Option)?": yes\n":": no\n") #define CHKWOPT( Option ) std::cout << " write " << #Option << (wopt.check(IO::Options:: Option)?": yes\n":": no\n") #define MESHOPT( msg, tf ) std::cout << " " << msg << ": " << ((tf) ? "yes\n" : "no\n") // Typedef for the mesh kernel typedef OpenMesh::TriMesh_ArrayKernelT<> MyMesh; // Forward declarations for helper functions void parse_commandline( int _argc, char **_argv, MyMesh& _mesh, IO::Options &ropt, IO::Options &wopt ); void usage_and_exit(int xcode); int main(int argc, char **argv) { MyMesh mesh; IO::Options ropt, wopt; // Evaluate command line arguments parse_commandline( argc, argv, mesh, ropt, wopt ); // Read the mesh from the specified file if ( ! IO::read_mesh(mesh,argv[optind], ropt) ) { std::cerr << "Error loading mesh from file " << argv[optind] << std::endl; return 1; } // Display read options and mesh properties std::cout << "File " << argv[optind] << std::endl; std::cout << " is binary: " << (ropt.check(IO::Options::Binary) ? " yes\n" : " no\n"); std::cout << " byte order: "; if (ropt.check(IO::Options::Swap)) std::cout << "swapped\n"; else if (ropt.check(IO::Options::LSB)) std::cout << "little endian\n"; else if (ropt.check(IO::Options::MSB)) std::cout << "big endian\n"; else std::cout << "don't care\n"; std::cout << " provides VertexNormal" << (ropt.check(IO::Options::VertexNormal) ? ": yes\n":"no\n"); CHKROPT( VertexColor ); CHKROPT( VertexTexCoord ); CHKROPT( FaceNormal ); CHKROPT( FaceColor ); // Display mesh statistics std::cout << "# Vertices: " << mesh.n_vertices() << std::endl; std::cout << "# Edges : " << mesh.n_edges() << std::endl; // Corrected from n_faces() to n_edges() std::cout << "# Faces : " << mesh.n_faces() << std::endl; // Display selected write options std::cout << "Selected write options:\n"; std::cout << " use binary: " << (wopt.check(IO::Options::Binary) ? " yes\n" : " no\n"); std::cout << " byte order: "; if (wopt.check(IO::Options::Swap)) std::cout << "swapped\n"; else if (wopt.check(IO::Options::LSB)) std::cout << "little endian\n"; else if (wopt.check(IO::Options::MSB)) std::cout << "big endian\n"; else std::cout << "don't care\n"; std::cout << " write VertexNormal" << (wopt.check(IO::Options::VertexNormal) ? ": yes\n":": no\n"); CHKWOPT( VertexColor ); CHKWOPT( VertexTexCoord ); CHKWOPT( FaceNormal ); CHKWOPT( FaceColor ); // Display mesh capabilities std::cout << "Mesh supports\n"; MESHOPT("vertex normals", mesh.has_vertex_normals()); MESHOPT("vertex colors", mesh.has_vertex_colors()); MESHOPT("texcoords", mesh.has_vertex_texcoords2D()); MESHOPT("face normals", mesh.has_face_normals()); MESHOPT("face colors", mesh.has_face_colors()); // Write the mesh to the output file std::cout << "Write mesh to " << argv[optind+1] << ".."; if ( !IO::write_mesh( mesh, argv[optind+1], wopt ) ) { std::cerr << "Error" << std::endl; std::cerr << "Possible reasons:\n"; std::cerr << "1. Chosen format cannot handle an option!\n"; std::cerr << "2. Mesh does not provide necessary information!\n"; std::cerr << "3. Or simply cannot open file for writing!\n"; return 1; } else std::cout << "Ok.\n"; return 0; } ``` -------------------------------- ### Get CCW Incoming Halfedge Range (OpenMesh) Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02630 Returns a range object for incoming halfedges incident to a vertex in counter-clockwise order, starting iteration at a specified halfedge. Suitable for C++11 range-based for loops. ```C++ PolyConnectivity::ConstVertexIHalfedgeCCWRange OpenMesh::PolyConnectivity::vih_ccw_range ( HalfedgeHandle __heh_ ) const ``` -------------------------------- ### Utility Functions Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a01254 Provides documentation for key utility functions such as kbhit, getch, getche, and GLenum_as_string. ```APIDOC ## kbhit() ### Description Checks if characters are pending in standard input. ### Method GET ### Endpoint `/utils/kbhit` ### Parameters #### Query Parameters - **None** ### Request Example ```json { "example": "No request body needed" } ``` ### Response #### Success Response (200) - **int** - Number of characters available to read. #### Response Example ```json { "result": 1 } ``` ## ◆ getch() ### Description Reads a single character from standard input in a blocking manner. ### Method GET ### Endpoint `/utils/getch` ### Parameters #### Query Parameters - **None** ### Request Example ```json { "example": "No request body needed" } ``` ### Response #### Success Response (200) - **int** - The character read, or -1 if an input error occurs. #### Response Example ```json { "result": 97 } ``` ## ◆ getche() ### Description Reads a single character from standard input in a blocking manner with echo. ### Method GET ### Endpoint `/utils/getche` ### Parameters #### Query Parameters - **None** ### Request Example ```json { "example": "No request body needed" } ``` ### Response #### Success Response (200) - **int** - The character read, or -1 if an input error occurs. #### Response Example ```json { "result": 97 } ``` ## ◆ GLenum_as_string() ### Description Converts a GLenum value to its string representation. ### Method GET ### Endpoint `/utils/glenum_as_string` ### Parameters #### Query Parameters - **_m** (GLenum) - The GLenum value to convert. ### Request Example ```json { "example": "No request body needed" } ``` ### Response #### Success Response (200) - **const char*** - The string representation of the GLenum. #### Response Example ```json { "result": "GL_TRIANGLES" } ``` ``` -------------------------------- ### OpenMesh MyMeshSmootherExampleTraits VertexT Example Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a03358 This snippet demonstrates the usage of the VertexT struct within the MyMeshSmootherExampleTraits namespace in OpenMesh. It includes public member functions for getting and setting the centroid (cog) of a vertex. ```C++ const Point & **cog** () const void **set_cog** (const Point &_p) ``` -------------------------------- ### OpenMesh Documentation Links Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02702 Provides access to specific documentation pages and general information about OpenMesh. ```APIDOC ## GET /docs/openmesh ### Description Retrieves information and links related to the main OpenMesh documentation. ### Method GET ### Endpoint /docs/openmesh ### Parameters None ### Request Example None ### Response #### Success Response (200) - **title** (string) - The title of the OpenMesh documentation page. - **description** (string) - A brief description of the OpenMesh documentation. - **links** (object) - Contains links to related pages like 'main_page', 'modules', 'classes', 'files'. #### Response Example { "title": "OpenMesh Documentation", "description": "Main entry point for OpenMesh documentation.", "links": { "main_page": "/docs/openmesh/main", "modules": "/docs/openmesh/modules", "classes": "/docs/openmesh/classes", "files": "/docs/openmesh/files" } } ## GET /docs/openmesh/todo ### Description Retrieves the 'Todo List' for OpenMesh development. ### Method GET ### Endpoint /docs/openmesh/todo ### Parameters None ### Request Example None ### Response #### Success Response (200) - **todo_list** (array) - A list of tasks or items in the OpenMesh todo list. #### Response Example [ "Implement new meshing algorithm", "Refactor property handling" ] ## GET /docs/openmesh/deprecated ### Description Retrieves the 'Deprecated List' for OpenMesh features. ### Method GET ### Endpoint /docs/openmesh/deprecated ### Parameters None ### Request Example None ### Response #### Success Response (200) - **deprecated_list** (array) - A list of deprecated features or functions in OpenMesh. #### Response Example [ "OldMeshGenerator API", "LegacyIOStream" ] ``` -------------------------------- ### OpenMesh Documentation Structure Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a00827_source Overview of the OpenMesh documentation structure, including navigation for main pages, modules, namespaces, classes, and files. ```APIDOC ## OpenMesh Documentation Overview ### Description Provides a hierarchical view of the OpenMesh C++ library's documentation. ### Method N/A (Informational) ### Endpoint N/A (Informational) ### Parameters N/A ### Request Example N/A ### Response N/A ## OpenMesh File Structure ### Description Details the file organization within the OpenMesh library, specifically focusing on the 'Core' module. ### Method N/A (Informational) ### Endpoint N/A (Informational) ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### OpenMesh Class Member Constants (l) Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/functions_l Lists constants starting with 'l' within OpenMesh classes, specifying their associated classes. Examples include enumerations related to collapse legality and endianness. ```cpp LEGAL_COLLAPSE : OpenMesh::Decimater::ModBaseT< MeshT > LSB : OpenMesh::Endian, OpenMesh::IO::Options ``` -------------------------------- ### Mesh Traversal and Element Access (OpenMesh) Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a01154_source Functions related to traversing mesh elements and accessing related handles. This includes getting the next halfedge handle and retrieving the starting vertex of a halfedge. ```cpp HalfedgeHandle next_halfedge_handle(HalfedgeHandle _heh) const // Get the next halfedge handle. ``` ```cpp VertexHandle from_vertex_handle(HalfedgeHandle _heh) const // Get the vertex the halfedge starts from (implemented as to-handle of the opposite halfedge,... ``` -------------------------------- ### OpenMesh Smart Pointers and Taggers Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/functions_i Documentation for smart handle and tagger functionalities. ```APIDOC ## OpenMesh Smart Pointers and Taggers ### Description Covers smart handles and tagging mechanisms for mesh elements. ### Smart Handles and Taggers - **`SmartVertexHandle`**: Smart handle for vertices. - **`SmartHandleBoundaryPredicate< HandleType >`**: Predicate for checking boundary status of smart handles. - **`SmartTaggerT< Mesh, EHandle, EPHandle >`**: Template for smart taggers. ``` -------------------------------- ### OpenMesh Core Utils - System Helpers Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a00914_source Documentation for system helper utilities, including non-copyable objects and random number generation. ```APIDOC ## GET /openmesh/core/utils/system-helpers ### Description Details on system helper utilities like non-copyable objects and random number generators. ### Method GET ### Endpoint /openmesh/core/utils/system-helpers ### Parameters None ### Request Example None ### Response #### Success Response (200) - **system_helpers** (array) - A list of system helper utilities. #### Response Example { "system_helpers": [ { "name": "Noncopyable.hh", "description": "Base class to prevent copying of objects." }, { "name": "RandomNumberGenerator.hh", "description": "Provides random number generation facilities." }, { "name": "Endian.hh", "description": "Utilities for handling byte order (endianness)." } ] } ``` -------------------------------- ### OpenMesh Class Member Functions (l) Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/functions_l Lists functions starting with 'l' within OpenMesh classes, including their return types and associated classes. Examples include norm calculations, hierarchy navigation, and handle operations. ```cpp l1_norm() : OpenMesh::VectorT< Scalar, DIM >, VectorT< Scalar, N > l8_norm() : OpenMesh::VectorT< Scalar, DIM >, VectorT< Scalar, N > lchild_handle() : OpenMesh::VDPM::VHierarchyNode length() : OpenMesh::VectorT< Scalar, DIM >, VectorT< Scalar, N > less() : OpenMesh::Utils::HeapInterfaceT< HeapEntry > local() : OpenMesh::Endian locked() : OpenMesh::Attributes::StatusInfo, OpenMesh::SmartHandleStatusPredicates< HandleType > loop() : OpenMesh::SmartHalfedgeHandle loop_ccw() : OpenMesh::SmartHalfedgeHandle loop_cw() : OpenMesh::SmartHalfedgeHandle ``` -------------------------------- ### OpenMesh::SmartVertexHandle Methods Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02739 Methods for navigating and querying SmartVertexHandle objects. ```APIDOC ## OpenMesh::SmartVertexHandle Methods ### Description Provides methods to access vertex information and connectivity. ### Methods - `out()`: Returns an output stream. - `outgoing_halfedges()`: Returns all outgoing halfedges. - `outgoing_halfedges(HalfedgeHandle _heh)`: Returns outgoing halfedges starting from a specific halfedge. - `outgoing_halfedges_ccw()`: Returns outgoing halfedges in counter-clockwise order. - `outgoing_halfedges_ccw(HalfedgeHandle _heh)`: Returns outgoing halfedges in CCW order from a specific halfedge. - `outgoing_halfedges_cw()`: Returns outgoing halfedges in clockwise order. - `outgoing_halfedges_cw(HalfedgeHandle _heh)`: Returns outgoing halfedges in CW order from a specific halfedge. - `vertices()`: Returns adjacent vertices. - `vertices_ccw()`: Returns adjacent vertices in counter-clockwise order. - `vertices_cw()`: Returns adjacent vertices in clockwise order. - `valence()`: Returns the valence of the vertex. ### Endpoint N/A (Internal class methods) ### Parameters - **_heh** (HalfedgeHandle) - A specific halfedge handle (for methods accepting it). ### Request Example N/A ### Response - **HalfedgeHandle/VertexHandle/int** - Depending on the method called. ``` -------------------------------- ### Get Named Property Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a03326 Obtains a handle to a named property. This function requires the property to exist on the mesh. If the property is not found or has a different type, it throws a std::runtime_error. An example demonstrates its usage within a try-catch block. ```cpp template PropertyManager< typename HandleToPropHandle< ElementT, T >::type > getProperty(PolyConnectivity & _mesh_, const char * _propname_) ``` ```cpp PolyMesh m; { try { auto is_quad = getProperty(m, "is_quad"); // Use is_quad here. } catch (const std::runtime_error& e) { // There is no is_quad face property on the mesh. } } ``` -------------------------------- ### OpenMesh Introduction Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a06328 Overview of OpenMesh library features and basic usage, including defining mesh types and adding vertices. ```APIDOC ## OpenMesh Library Overview ### Description This section provides a high-level introduction to the OpenMesh library, detailing its capabilities in handling various mesh types (triangle, polygonal) and different mesh kernels. It illustrates the fundamental steps for declaring a mesh type, such as `MyMesh`, and adding vertices with their coordinates. ### Key Concepts * **Mesh Types**: Supports `TriMesh` (triangle meshes) and `PolyMesh` (polygonal meshes). * **Mesh Kernels**: Different internal storage mechanisms for mesh data, requiring an array-like interface. `ArrayKernelT` is commonly used. * **Vertex Addition**: Uses the `add_vertex` method, which takes coordinates and returns a handle to the new vertex. ### Example Snippet ```cpp #include typedef OpenMesh::PolyMesh_ArrayKernelT<> MyMesh; MyMesh mesh; // Add vertices MyMesh::VertexHandle vhandle[8]; vhandle[0] = mesh.add_vertex(MyMesh::Point(-1, -1, 1)); vhandle[1] = mesh.add_vertex(MyMesh::Point( 1, -1, 1)); // ... other vertices ... ``` ``` -------------------------------- ### Get 'to' and 'from' vertex handles from a halfedge Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a06322 Retrieve the vertex handles at the start ('from') and end ('to') of a given halfedge. This functionality is crucial for navigating mesh structures and understanding connectivity. The methods rely on the directional property of halfedges. ```c++ OpenMesh::Concepts::KernelT::to_vertex_handle(); OpenMesh::Concepts::KernelT::from_vertex_handle(); ``` ```c++ VertexHandle from_vertex_handle(HalfedgeHandle _heh) const // Get the vertex the halfedge starts from (implemented as to-handle of the opposite halfedge,... ``` ```c++ VertexHandle to_vertex_handle(HalfedgeHandle _heh) const // Get the vertex the halfedge points to. ``` -------------------------------- ### OpenMesh Mesh Reading and Processing Example Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a06340 Demonstrates reading a mesh file using OpenMesh::IO::read_mesh and then processing it, including counting boundary vertices. This serves as a basic setup for mesh operations in OpenMesh. Requires OpenMesh IO and Mesh headers. ```cpp #include #include #include #include #include #include using MyMesh = OpenMesh::TriMesh; bool is_divisible_by_3(OpenMesh::FaceHandle vh) { return vh.idx() % 3 == 0; } int main(int argc, char** argv) { using namespace OpenMesh::Predicates; MyMesh mesh; if (argc != 2) { std::cerr << "Usage: " << argv[0] << " " << std::endl; return 1; } const std::string infile = argv[1]; if (!OpenMesh::IO::read_mesh(mesh, infile)) { std::cerr << "Error: Cannot read mesh from " << infile << std::endl; return 1; } std::cout << "Mesh contains " << mesh.vertices().count_if(Boundary()) << " boundary vertices"; return 0; } ``` -------------------------------- ### OpenMesh Timer Class Dependencies Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a00488 This snippet shows the header files required to use the OpenMesh::Utils::Timer class. It highlights the essential include files for system configuration, output streams, string manipulation, and assertions. ```cpp #include #include #include #include ``` -------------------------------- ### OpenMesh Timer Utility Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/functions_i Documentation for the timer utility. ```APIDOC ## OpenMesh Timer Utility ### Description Details the timer utility for performance measurement. ### Timer Class - **`Utils::Timer`**: Timer class. - **`is_valid()`**: Checks the validity of the timer. ``` -------------------------------- ### Get Subdivision Rule Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a03674 Gets the subdivision rule. Inherited from RuleInterfaceT. ```C++ Self * subdiv_rule() const ``` -------------------------------- ### HeapT Constructors and Destructor Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a00470_source Details the available constructors for creating a HeapT instance and its destructor. ```APIDOC ## HeapT Constructors and Destructor ### HeapT::HeapT (Constructor 1) ### Description Constructs a HeapT with a given HeapInterface. ### Method HeapT ### Parameters - **_interface** (const HeapInterface &) - The HeapInterface to use for heap operations. ### Definition HeapT.hh:155 ### HeapT::HeapT (Constructor 2) ### Description Default constructor for HeapT. ### Method HeapT ### Definition HeapT.hh:146 ### HeapT::~HeapT (Destructor) ### Description Destructor for the HeapT class. ### Method ~HeapT ### Definition HeapT.hh:161 ``` -------------------------------- ### Get Previous Rule Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a03674 Gets the previous rule in a sequence. Inherited from RuleInterfaceT. ```C++ Self * prev_rule() ``` -------------------------------- ### Get Number of Rules Source: https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a03674 Gets the total number of rules in a sequence. Inherited from RuleInterfaceT. ```C++ int n_rules() const ```