{"id":13700217,"url":"https://github.com/alecjacobson/geometry-processing-introduction","last_synced_at":"2025-04-09T23:16:08.390Z","repository":{"id":59336272,"uuid":"78591333","full_name":"alecjacobson/geometry-processing-introduction","owner":"alecjacobson","description":"Introductory assignment for Geometry Processing course","archived":false,"fork":false,"pushed_at":"2022-10-22T19:08:36.000Z","size":1208,"stargazers_count":123,"open_issues_count":15,"forks_count":133,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-09T23:16:02.914Z","etag":null,"topics":["geometry-processing","libigl"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alecjacobson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-11T01:36:18.000Z","updated_at":"2025-03-04T02:08:40.000Z","dependencies_parsed_at":"2023-01-20T08:25:28.336Z","dependency_job_id":null,"html_url":"https://github.com/alecjacobson/geometry-processing-introduction","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecjacobson%2Fgeometry-processing-introduction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecjacobson%2Fgeometry-processing-introduction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecjacobson%2Fgeometry-processing-introduction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecjacobson%2Fgeometry-processing-introduction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alecjacobson","download_url":"https://codeload.github.com/alecjacobson/geometry-processing-introduction/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125591,"owners_count":21051770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geometry-processing","libigl"],"created_at":"2024-08-02T20:00:50.631Z","updated_at":"2025-04-09T23:16:08.353Z","avatar_url":"https://github.com/alecjacobson.png","language":"C++","funding_links":[],"categories":["CMake"],"sub_categories":[],"readme":"# Geometry Processing – Introduction\n\n\u003e **To get started:** Clone (**do not fork publicly**) this repository\n\u003e \n\u003e     git clone --recursive http://github.com/alecjacobson/geometry-processing-introduction.git\n\u003e\n\nWelcome to Geometry Processing! The purpose of this assignment will be to get\nyou up and running with the two C++ libraries we will be using:\n[Eigen](http://eigen.tuxfamily.org) for dense and sparse linear algebra\nroutines and [libigl](https://github.com/libigl/libigl) for geometry processing\nroutines. We will make use of the OpenGL-based viewer used by the [libigl\ntutorial](http://libigl.github.io/libigl/tutorial/tutorial.html). This viewer\nalso depends on [glfw](http://www.glfw.org/download.html), a library for\nmanaging windows on Linux, Mac OS X and windows.\n\n## Prerequisite installation\n\nOn all platforms, we will assume you have installed cmake and a modern c++\ncompiler on Mac OS X[¹](#¹macusers), Linux[²](#²linuxusers), or\nWindows[³](#³windowsusers).\n\nWe also assume that you have cloned this repository using the `--recursive`\nflag (if not then issue `git submodule update --init --recursive`). \n\n## Layout\n\nAll assignments will have a similar directory and file layout:\n\n    README.md\n    CMakeLists.txt\n    main.cpp\n    include/\n      function1.h\n      function2.h\n      ...\n    src/\n      function1.cpp\n      function2.cpp\n      ...\n    shared/\n      libigl/\n        include/\n          igl/\n            ...\n      ...\n\nThe `README.md` file will describe the background, contents and tasks of the\nassignment.\n\nThe `CMakeLists.txt` file setups up the cmake build routine for this\nassignment.\n\nThe `main.cpp` file will include the headers in the `include/` directory and\nlink to the functions compiled in the `src/` directory. This file contains the\n`main` function that is executed when the program is run from the command line.\n\nThe `include/` directory contains one file for each function that you will\nimplement as part of the assignment. **_Do not change_** these files.\n\nThe `src/` directory contains _empty implementations_ of the functions\nspecified in the `include/` directory. This is where you will implement the\nparts of the assignment.\n\nThe `shared/` directory will contain shared resources: cmake files, dependences\n(e.g., libigl) and data. Feel free to poke around in here, but you shouldn't\nchange any of these files.\n\n## Compilation\n\nThis and all following assignments will follow a typical cmake/make build\nroutine. Starting in this directory, issue:\n\n    mkdir build\n    cd build\n    cmake ..\n    make \n\nWhy don't you try this right now?\n\n## Execution\n\nOnce built, you can execute the assignment from inside the `build/` using \n\n    ./introduction\n\nAfter [compiling according to the instructions above](#compilation), if you try\nexecuting right now, then you'll see a bunny:\n\n![Screenshot of viewer displaying a bunny](images/bunny-screenshot.jpg)\n\nYou can click and drag to change the view.\n\nOptionally, this program can input a path to a triangle mesh file (other than\nthe bunny):\n\n    ./introduction [path to input file]\n\n## Background\n\n\u003e Every assignment, including this one, will start with a **Background**\n\u003e section. This will review the math and algorithms behind the task in the\n\u003e assignment. Students following the lectures should already be familiar with\n\u003e this material and may opt to skip this section.\n\nLet's get familiar with the _explicit_ mesh representation of a discrete\nsurface immersed in $\\mathbb{R}^3$. Throughout the course, we will store the set of\nmesh vertices $V$[⁴](#⁴latex) and the set of triangles (a.k.a.\nfaces) $F$ as two matrices: `V` and `F`.\n\nThe matrix `V` is $|V|$ by 3 in size, where the ith row of this matrix contains\nthe x-, y- and z-coordinates of the ith vertex of the mesh. \n\nThe matrix `F` is $|F|$ by 3 in size, where the jth row of this matrix contains\nthe indices into the rows of `V` of the first, second and third corners of the\njth triangle as a non-negative number (remember in C++ arrays and matrices\nstart with index `0`). \n\nThe information in `V` alone is purely positional and encodes the\n_geometry_ of the surface.\n\nThe information in `F` alone is purely combinatoric and encodes the _topology_\nof the surface. \n\nBy convention, the indices in each row of `F` are _ordered_ counter-clockwise\naround the triangle. Using the right-hand rule, we can define the normal of\neach triangle as the vector that points _most away_ from the surface.\n\n![The right-hand rule and the counterclockwise ordering convention defines the\nnormal of a triangle.](images/right-hand-rule.jpg)\n\nEach oriented triangle also defines three _directed edges_ between its three\nvertices. Other triangles in the mesh may contain edges with the same incident\nvertices, possibly in the opposite direction. A manifold mesh will have at most\ntwo triangles incident on the same (undirected) _edge_, therefor we'll refer to\neach triangle's directed edge as a _half-edge_.\n\n![Two neighboring triangles may share the same (unoriented) edge (thick black).\nIn a consistently oriented mesh, these triangles' corresponding half-edges\n(orange) will have opposite orientation.](images/half-edges.jpg)\n\nThe number of vertices $|V|$ and number of faces $|F|$ and number of unique\n(undirected) edges $|E|$ are _intimately_ related. Adding a new triangle to a\nmesh may mean increasing the number of vertices and edges, too. The algebraic\nrelationship between the number of vertices, edges and faces reveals the\ntopological _genus_ of the surface via the _Euler Characteristic_ \n\n$$\nχ = 2c - 2h - b,\n$$\n\nwhere $c$ is the number of connected components, $h$ is number of\nholes (as in donut), and $b$ is the number of connected components of the\nboundary of the surface.\n\nFor meshes representing polyhedral surfaces, the Euler Characteristic can be\ncomputed very simply:\n\n```\nChi = |V| - |E| + |F|.\n```\n\nAssuming no _unreferenced_ vertices in `V`, each of the quantities in the\nright-hand side can be determined from `F` alone. This indicates that its a\npurely topological property. Changing the geometric positions (i.e., changing\nthe vertex positions in `V`) will not affect the Euler Characteristic. Due to\nthis, we say that the Euler Characteristic is a _topological invariant_.\n\n## Tasks\n\nEvery assignment, including this one, will contain a **Tasks** section. This\nwill enumerate all of the tasks a student will need to complete for this\nassignment. These tasks will match the header/implementation pairs in the\n`include/`/`src/` directories.\n\n### Groundrules\n\nLibigl has implemented many of the tasks you'll find in this course. As a\nresult, for some assignments, including this one, you'll see a **Groundrules**\nsection that lists which functions you can and should use from libigl and/or\nfunctions you may not use (and should avoid copying your answers from).\n\n#### Blacklist libigl functions\n\nFor this assignment you may not use\n\n - `igl::all_edges`\n - `igl::edge_flaps`\n - `igl::edge_topology`\n - `igl::edges`\n - `igl::euler_characteristic`\n - `igl::exterior_edges`\n - `igl::is_boundary_edge`\n - `igl::unique_edge_map`\n - or any other libigl function that returns a list of edges.\n\n### `src/edges.cpp`\n\nFrom a list of triangles `F`, construct a $|E|$ by 2 matrix `E`, where the kth\nrow of this matrix contains the indices into the rows of `V` of the start and\nend point of the kth edge in the mesh. `E` should contain every _undirected\nedge_ exactly once. \n\n### `src/euler_characteristic.cpp`\n\nFrom the list of triangles `F`, return the Euler Characteristic `X` of the\ntriangle mesh. You may and should use your `edges` function from the previous\ntask.\n\n### Submission\n\nSubmit your `src/` files on [MarkUs](https://markus.teach.cs.toronto.edu/2022-09/courses/19/)\n\n### Questions? \n\nDirect your questions to the [Issues page of this\nrepository](https://github.com/alecjacobson/geometry-processing-introduction/issues).\n\n### Answers?\n\nHelp your fellow students by answering questions or positions helpful tips on\nthe [Issues page of this\nrepository](https://github.com/alecjacobson/geometry-processing-introduction/issues).\n\n-----------------------------------------------------------------------------\n\n\u003e #### ¹ Mac Users\n\u003e\n\u003e You will need to install Xcode if you haven't already. \n\u003e\n\u003e #### ² Linux Users\n\u003e\n\u003e Many linux distributions do not include gcc and the basic development tools\n\u003e in their default installation. On Ubuntu, you need to install the following\n\u003e packages:\n\u003e\n\u003e     sudo apt-get install git\n\u003e     sudo apt-get install build-essential\n\u003e     sudo apt-get install cmake\n\u003e     sudo apt-get install libx11-dev\n\u003e     sudo apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev\n\u003e     sudo apt-get install libxrandr-dev\n\u003e     sudo apt-get install libxi-dev\n\u003e     sudo apt-get install libxmu-dev\n\u003e     sudo apt-get install libblas-dev\n\u003e\n\u003e\n\u003e #### ³ Windows Users\n\u003e\n\u003e libigl only supports the Microsoft Visual Studio\n\u003e 2015 compiler in 64bit mode. It will not work with a 32bit build and it will\n\u003e not work with older versions of visual studio.\n\u003e\n\u003e #### ⁴ LaTeX\n\u003e\n\u003e This markdown document, and those for all other assignments, contains\n\u003e $\\LaTeX$ math. GitHub just shows the un-evaluated LaTeX code, but other\n\u003e markdown browsers will show the typeset math. You can also generate\n\u003e `README.html` using\n\u003e [multimarkdown](http://fletcherpenney.net/multimarkdown/):\n\u003e\n\u003e     cat shared/markdown/header.md README.md | multimarkdown --process-html -o README.html\n\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecjacobson%2Fgeometry-processing-introduction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falecjacobson%2Fgeometry-processing-introduction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecjacobson%2Fgeometry-processing-introduction/lists"}