Git Product home page Git Product logo

geometry-processing-introduction's Introduction

Geometry Processing – Introduction

To get started: Clone (do not fork publicly) this repository

git clone --recursive http://github.com/alecjacobson/geometry-processing-introduction.git

Welcome to Geometry Processing! The purpose of this assignment will be to get you up and running with the two C++ libraries we will be using: Eigen for dense and sparse linear algebra routines and libigl for geometry processing routines. We will make use of the OpenGL-based viewer used by the libigl tutorial. This viewer also depends on glfw, a library for managing windows on Linux, Mac OS X and windows.

Prerequisite installation

On all platforms, we will assume you have installed cmake and a modern c++ compiler on Mac OS X¹, Linux², or Windows³.

We also assume that you have cloned this repository using the --recursive flag (if not then issue git submodule update --init --recursive).

Layout

All assignments will have a similar directory and file layout:

README.md
CMakeLists.txt
main.cpp
include/
  function1.h
  function2.h
  ...
src/
  function1.cpp
  function2.cpp
  ...
shared/
  libigl/
    include/
      igl/
        ...
  ...

The README.md file will describe the background, contents and tasks of the assignment.

The CMakeLists.txt file setups up the cmake build routine for this assignment.

The main.cpp file will include the headers in the include/ directory and link to the functions compiled in the src/ directory. This file contains the main function that is executed when the program is run from the command line.

The include/ directory contains one file for each function that you will implement as part of the assignment. Do not change these files.

The src/ directory contains empty implementations of the functions specified in the include/ directory. This is where you will implement the parts of the assignment.

The shared/ directory will contain shared resources: cmake files, dependences (e.g., libigl) and data. Feel free to poke around in here, but you shouldn't change any of these files.

Compilation

This and all following assignments will follow a typical cmake/make build routine. Starting in this directory, issue:

mkdir build
cd build
cmake ..
make 

Why don't you try this right now?

Execution

Once built, you can execute the assignment from inside the build/ using

./introduction

After compiling according to the instructions above, if you try executing right now, then you'll see a bunny:

Screenshot of viewer displaying a bunny

You can click and drag to change the view.

Optionally, this program can input a path to a triangle mesh file (other than the bunny):

./introduction [path to input file]

Background

Every assignment, including this one, will start with a Background section. This will review the math and algorithms behind the task in the assignment. Students following the lectures should already be familiar with this material and may opt to skip this section.

Let's get familiar with the explicit mesh representation of a discrete surface immersed in $\mathbb{R}^3$. Throughout the course, we will store the set of mesh vertices $V$ and the set of triangles (a.k.a. faces) $F$ as two matrices: V and F.

The matrix V is $|V|$ by 3 in size, where the ith row of this matrix contains the x-, y- and z-coordinates of the ith vertex of the mesh.

The matrix F is $|F|$ by 3 in size, where the jth row of this matrix contains the indices into the rows of V of the first, second and third corners of the jth triangle as a non-negative number (remember in C++ arrays and matrices start with index 0).

The information in V alone is purely positional and encodes the geometry of the surface.

The information in F alone is purely combinatoric and encodes the topology of the surface.

By convention, the indices in each row of F are ordered counter-clockwise around the triangle. Using the right-hand rule, we can define the normal of each triangle as the vector that points most away from the surface.

The right-hand rule and the counterclockwise ordering convention defines the normal of a triangle.

Each oriented triangle also defines three directed edges between its three vertices. Other triangles in the mesh may contain edges with the same incident vertices, possibly in the opposite direction. A manifold mesh will have at most two triangles incident on the same (undirected) edge, therefor we'll refer to each triangle's directed edge as a half-edge.

Two neighboring triangles may share the same (unoriented) edge (thick black). In a consistently oriented mesh, these triangles' corresponding half-edges (orange) will have opposite orientation.

The number of vertices $|V|$ and number of faces $|F|$ and number of unique (undirected) edges $|E|$ are intimately related. Adding a new triangle to a mesh may mean increasing the number of vertices and edges, too. The algebraic relationship between the number of vertices, edges and faces reveals the topological genus of the surface via the Euler Characteristic

$$ χ = 2c - 2h - b, $$

where $c$ is the number of connected components, $h$ is number of holes (as in donut), and $b$ is the number of connected components of the boundary of the surface.

For meshes representing polyhedral surfaces, the Euler Characteristic can be computed very simply:

Chi = |V| - |E| + |F|.

Assuming no unreferenced vertices in V, each of the quantities in the right-hand side can be determined from F alone. This indicates that its a purely topological property. Changing the geometric positions (i.e., changing the vertex positions in V) will not affect the Euler Characteristic. Due to this, we say that the Euler Characteristic is a topological invariant.

Tasks

Every assignment, including this one, will contain a Tasks section. This will enumerate all of the tasks a student will need to complete for this assignment. These tasks will match the header/implementation pairs in the include//src/ directories.

Groundrules

Libigl has implemented many of the tasks you'll find in this course. As a result, for some assignments, including this one, you'll see a Groundrules section that lists which functions you can and should use from libigl and/or functions you may not use (and should avoid copying your answers from).

Blacklist libigl functions

For this assignment you may not use

  • igl::all_edges
  • igl::edge_flaps
  • igl::edge_topology
  • igl::edges
  • igl::euler_characteristic
  • igl::exterior_edges
  • igl::is_boundary_edge
  • igl::unique_edge_map
  • or any other libigl function that returns a list of edges.

src/edges.cpp

From a list of triangles F, construct a $|E|$ by 2 matrix E, where the kth row of this matrix contains the indices into the rows of V of the start and end point of the kth edge in the mesh. E should contain every undirected edge exactly once.

src/euler_characteristic.cpp

From the list of triangles F, return the Euler Characteristic X of the triangle mesh. You may and should use your edges function from the previous task.

Submission

Submit your src/ files on MarkUs

Questions?

Direct your questions to the Issues page of this repository.

Answers?

Help your fellow students by answering questions or positions helpful tips on the Issues page of this repository.


¹ Mac Users

You will need to install Xcode if you haven't already.

² Linux Users

Many linux distributions do not include gcc and the basic development tools in their default installation. On Ubuntu, you need to install the following packages:

sudo apt-get install git
sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install libx11-dev
sudo apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev
sudo apt-get install libxrandr-dev
sudo apt-get install libxi-dev
sudo apt-get install libxmu-dev
sudo apt-get install libblas-dev

³ Windows Users

libigl only supports the Microsoft Visual Studio 2015 compiler in 64bit mode. It will not work with a 32bit build and it will not work with older versions of visual studio.

⁴ LaTeX

This markdown document, and those for all other assignments, contains $\LaTeX$ math. GitHub just shows the un-evaluated LaTeX code, but other markdown browsers will show the typeset math. You can also generate README.html using multimarkdown:

cat shared/markdown/header.md README.md | multimarkdown --process-html -o README.html

geometry-processing-introduction's People

Contributors

alecjacobson avatar samarendra109 avatar soso-song avatar texify[bot] avatar xd-liu avatar xingxinhe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geometry-processing-introduction's Issues

make error after running cmake

The steps for setting up assignment 0 state to run cmake .. then make. I've managed to get cmake to run but make gives me an error. Having never used these tools before I assume there's something simple I'm missing.
capture

Question

Hi
I only want to calculate E F G e f g for a mesh. I did it with thousands methods (discrete or using surface fitting) but the results aren't good.
I am using Windows. could you please help me how I can use your code?
Thanks

Questions about igl adjacency matrix.

image

I am wondering what the notation V(i, : ) means. For max(F), I guess it is the greater of the width and height of F. If would be great if someone could confirm this for me. Thank you.

Blank Screen

My code for assignment 0 compiles and runs, but I don't see the rabbit.
capture

Assignment 1 Unique Faces

When computing Chi, can we assume the faces in matrix F are unique? (i.e. no rows are (exact) duplicates)

Testing on beetle.off

Is our code expected to work correctly on beetle.off? Some of the responses to previous issues imply assumptions about the input mesh that exclude it, though its inclusion in the project files suggests otherwise.

doublearea.cpp failed

Hi, i try to follow the instructions and play with the bunny, but ./introduction failed in doublearea.cpp.
"""
Assertion failed: F.cols() == 3, file F:\geometry-processing-introduction\libigl\include\igl\doublearea.cpp, line 27
"""
Here is the code that failed for reference
"""
// Only support triangles
assert(F.cols() == 3);
"""

Slow edges implementation

Hi. I'm pretty new to this Eigen library and I implemented edges, but it uses nested loops and takes around 30 seconds to complete. I compared it to the igl implementation and that takes less than a second. I heard in tutorial that you won't be marking us on runtime, except if it's too slow.

Is this slow implementation okay or am I in the wrong track? Are there any tips or hints on how to implement this faster? Are matrix operations the way to do it?

Additional Include

For assignment 1 can we add additional #include for using non-banned igl functions and for std classes such as std::set, or including map?

Manifold Mesh Only For A1?

For the scope of this assignment, should we consider the following cases:

  • 2 triangles share an edge while the edge is still directed (eg. CW and CCW occurring on 2 adjacent faces)
  • more than 2 triangles sharing 1 edge
  • unreferenced vertex

Questions about the assignment

What assumptions can we make about the mesh?

Related to computing E:
Will the mesh be a closed mesh (I'm not sure if this is equivalent to calling it a manifold without boundary) or will it be a similar to a manifold with boundary? I assumed the former. Assuming the latter is just slightly more involved, I believe.

Related to computing |V|:
Is the vertex indexing 0-based or 1-based? I assumed 0-based. Technically, does not matter, knowing if it's 0 or 1 based allows for some easier hacks.

Does the assumption of no unreferenced vertices in V mean the following two statements?
The range of F is an onto mapping to the vertex indices.
The indexing of the vertices is consecutive.

Unable to run introduction on teach.cs

I cloned the repo on the teach.cs machine and tried to run it there.
I followed the build instructions which worked fine, but when running introduction, the main.cpp code runs up until the viewer tries to open. No window shows up, and this message appears in the terminal:

GLX: GLX version 1.3 is requiredintroduction: /h/u5/c7/05/leejas45/Desktop/csc419/geometry-processing-introduction/libigl/external/glfw/src/window.c:475: glfwWindowShouldClose: Assertion `window != NULL' failed.

How to submit on MarkUs

Hi! Once I click on the MarkUs link in the README, I'm led to a MarkUs login page asking for a username and password. What should the username and password be? Do I have to make a MarkUs account?

about cmake/make this project

I am trying to use this code, I did camke .., but I cannot do make, it seems some files are missing, could you help me to check what issues happened to me? Thanks very much

image
image

Due Date

Is the homework due on Tuesday at midnight, or Wednesday at midnight?

cmake issue

cmake command fails to run. I got the following message.

CMake Error at libigl/external/glfw/CMakeLists.txt:220 (message):
The Xinerama headers were not found

I am using ubuntu 18.04, and I installed all packages listed in the assignment.
I don't know how to fix this. Can someone help please?

Build issue for "introduction" project

After I ran CMake I can open introduction.sln in visual studio 2015. However not all the projects build correctly. Has anyone else run into this?

------ Rebuild All started: Project: introduction, Configuration: Debug Win32 ------
6> Building Custom Rule C:/UoT-Masters/Geometry-Processing/geometry-processing-introduction/CMakeLists.txt
6> CMake does not need to re-run because C:\UoT-Masters\Geometry-Processing\geometry-processing-introduction\build\CMakeFiles\generate.stamp is up-to-date.
6>cl : Command line error D8021: invalid numeric argument '/Wno-deprecated-declarations'

HW 01

Am I missing something? I don't see any link to HW 01 on the course webpage

Could not run introduction.exe

image
image

I am on Windows 11 and VS 2022. I have not made any implementations and I got this error when running introduction.exe. What should I do?

image
These are the messages I got when running cmake. My machine failed the test for CMAKE_HAVE_LIBC_PTHREAD.

Testing the Code

Hello, just thinking about testing the code, it should be possible to test the code with the other meshes given in the shared/data directory but I was wondering if there a way to create your own triangle mesh files as well? Thanks.

Checks on input?

From personal email:

I would have written extra code to check the mesh to see if it was manifold, find open surfaces (find holes in the mesh by checking adjacent triangle edges - see if any triangles don't share an edge topologically), overlapping vertices (within machine tolerance) and a bunch of other stuff like that, but I didn't because I didn't think that was the intent of the assignment...I should have asked earlier -- but did you want us to do all those checks for the assignment?

Can we use loop for Assignment 1

Just wonder if we are allowed to use for loop in Assignment 1 edge function. Or we have to find some functions in Eigen to complete the task.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.