Giter Site home page Giter Site logo

ddg-exercises's Introduction

ddg-exercises

This repo contains C++ skeleton code for course assignments from Discrete Differential Geometry (15-458/858).

For the JavaScript version, see https://github.com/cmu-geometry/ddg-exercises-js.

This code framework uses Geometry Central for geometry processing utilities and Polyscope for visualization, which were developed by Nick Sharp and others in the Geometry Collective. Extensive documentation for these libraries ---and how to build them on various platforms--- can be found at the preceding links. If you're having trouble building, please make sure to take a look before bugging the TAs! :-) (We are of course still very happy to help if you're still having trouble.)

Documentation for Geometry Central can be found here.

Documentation for Polyscope can be found here here.

Getting started

  1. Clone the repository and its submodules.
git clone --recursive https://github.com/GeometryCollective/ddg-exercises
cd ddg-exercises/projects

Each project in ddg-exercises/projects builds its own executable when compiled. To run a particular project <project>, go to the projects/<project> directory. The basic process for compiling is as follows. First, make a build directory and compile using

mkdir build
cd build
cmake ..
make -j4

This builds an executable main which can then be run using

bin/main <optional_path_to_a_mesh>
  1. If you would like to add your own remote repository,
git remote add origin <url_of_remote_repository>

or change the url of an existing remote repo named 'origin' via

git remote set-url origin <new_url>

Then you should be able to push your commits to your remote repo. (For more extensive documentation to fit your needs, see git-remote documentation.)

Please make your repo(s) private to protect academic integrity! As mentioned by the course grading policy, "Duplicate work turned in by two different students will be considered cheating by both students" -- meaning if another student copies your code off your public repo, you will both get zeros for the course :((.

"Release" vs "Debug" mode

By default, the projects will compile in "Release" mode. While implementing these exercises, you may find it helpful to compile in "Debug" mode, which will enable more sanity checks in the code and print out more descriptive error messages, at the cost of somewhat less efficient performance. You can compile in Debug mode by using

cmake -DCMAKE_BUILD_TYPE=Debug ..

You can explicitly tell CMake to compile in Release mode by using

cmake -DCMAKE_BUILD_TYPE=Release ..

Dependencies (all included)

  1. Geometry processing and linear algebra - Geometry Central, which in turn has dependencies on Eigen and/or Suitesparse.

  2. Visualization - Polyscope

  3. Unit tests - Google Test

Author

Nicole Feng

Email: [email protected]

Rohan Sawhney (original JavaScript version)

Email: [email protected]

This code is directly based off Rohan's original JavaScript framework, ddg-exercises-js.

License

MIT

ddg-exercises's People

Contributors

geometrycollective avatar greenlightning avatar marekmarchlewicz avatar markgillespie avatar nzfeng 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

ddg-exercises's Issues

minor polyscope display issue

On line

ImGui::EndCombo(); // dropdown menu only works if EndCombo() is outside if; I'm not sure why.

it puts the "ImGui::EndCombo" outside the if. I previously had a problem calling polyscope::show() as it gave error BeginPopup/EndPopup Mismatch and the program shuts down. After I put this line inside the if statement it worked well.
Maybe someone with the same issue could do the same.

Polyscope OpenGL Error

Hi, all,

I've built the project simplicial-complex-operators without error. However, when I run the main executable to display the mesh file. Error message such as Polyscope OpenGL Error! Type: Invalid enum appears. Any hints to solve this issue? THX!

root@milton-PC:/data/code14/ddg-exercises/projects/simplicial-complex-operators/build# ./bin/main ../../../input/disk.obj 
[polyscope] Backend: openGL3_glfw -- Loaded openGL version: 3.3 (Core Profile) Mesa 18.0.5
[polyscope] Polyscope OpenGL Error!  Type: Invalid enum
GLError() after shader compilation! Program text:

      
// tag ${ GLSL_VERSION }$
// from rule: GLSL_VERSION
#version 330 core

      in vec3 a_position;
      out vec2 tCoord;

      void main()
      {
          tCoord = (a_position.xy+vec2(1.0,1.0))/2.0;
          gl_Position = vec4(a_position,1.);
      }

terminate called after throwing an instance of 'std::runtime_error'
  what():  OpenGl error occurred. Text: Invalid enum
Aborted (core dumped)

P.S. My system is ubuntu 16.04.7. gcc/g++ already upgraded to 7.5 version.

RandR

I had an issue with my Linux Ubuntu 20 machine during configuration with cmake.

I did sudo apt-get install xorg-dev libglu1-mesa-dev and I was able to make it work perfectly.

Polyscope will not show mesh, but detect it

I'm trying to do simplicial-complex-operators in Windows 11. Just so I can use the mentioned command (cmake, make, bin/main etc) I used Ubuntu as Windows Subsystem for Linux. Then to connect the graphics I installed Vcxsrv, allowing me to use things like xeyes in in my Ubuntu cmd

I managed to download all the required package to generate the executable main. I did have to do the cmake -DCMAKE_BUILD_TYPE=Debug ..) trick mentioned on here. The problem is when I tried to run "bin/main", while Polyscope run it will not show the mesh. Pictures when I run "bin/main ../../../input/bunny.obj"
image

it seems Polyscope notice the mesh since it mentions number of vertices and faces. However it will not show the mesh, only plain white.

The weirdest thing is it was working fine in my exact same machine (DELL XPS) when I still had Windows 10. Now I change to Windows 11 this issue appears. I would be extremely grateful for any guidance/thoughts. Happy to cooperate in any way.

Displays but doesn't respond to mouse or keyboard - Windows/Mesa

Trying to do the first coding exercise in Windows 10 Pro 21H2 using wsl2 Ubuntu with VcXsrv.
I've installed all dependencies and have a completely clean compile, not in debug mode.
It launches and the Polyscope window displays the sample mesh, or if I provide an OBJ it displays that correctly. The frame rate updates, it's definitely running. But it won't interact, the controls don't receive mouse clicks or keypresses. With one exception: the mousewheel works to zoom the mesh in and out. Driving me nuts because SO CLOSE to working.
xeyes, xcalc, glxgears run normally and receive mouse and keyboard inputs as they should.

I tried default, kisak and oibaf Mesa, all give the same results.
[polyscope] Backend: openGL3_glfw -- Loaded openGL version: 3.3 (Core Profile) Mesa 21.2.6
[polyscope] Backend: openGL3_glfw -- Loaded openGL version: 3.3 (Core Profile) Mesa 22.0.0 - kisak-mesa PPA
[polyscope] Backend: openGL3_glfw -- Loaded openGL version: 4.2 (Core Profile) Mesa 22.1.0-devel (git-b7fbaf9 2022-03-16 focal-oibaf-ppa)
I can't switch to pure Nvidia because Windows only allows this in its bleediest-edge update channel right now, and I do actually need this machine to work.

At cmu-geometry/ddg-exercises-js#1 it's suggested this problem may be due to compiler over-optimization. I tried adding -O0 to the compiler flags without improvement, and that's as much as I can figure out. Help?

Thanks, Bathsheba

$ glxinfo -B
name of display: 172.17.32.1:0
display: 172.17.32.1:0 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Microsoft Corporation (0xffffffff)
Device: D3D12 (NVIDIA GeForce GTX 1070) (0xffffffff)
Version: 22.1.0
Accelerated: yes
Video memory: 24436MB
Unified memory: no
Preferred profile: core (0x1)
Max core profile version: 4.2
Max compat profile version: 4.2
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.1
OpenGL vendor string: Microsoft Corporation
OpenGL renderer string: D3D12 (NVIDIA GeForce GTX 1070)
OpenGL core profile version string: 4.2 (Core Profile) Mesa 22.1.0-devel (git-b7fbaf9 2022-03-16 focal-oibaf-ppa)
OpenGL core profile shading language version string: 4.20
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.2 (Compatibility Profile) Mesa 22.1.0-devel (git-b7fbaf9 2022-03-16 focal-oibaf-ppa)
OpenGL shading language version string: 4.20
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.1 Mesa 22.1.0-devel (git-b7fbaf9 2022-03-16 focal-oibaf-ppa)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10

Eigen, NDEBUG, and matrix shapes

A student posted this on Piazza. Maintainers, please take a look :D

This might be done on purpose, but it did take me quite some time to figure out what is going on.
In the CmakeLists.txt that lives in ddg-exercises/projects/simplicial-complex-operators/CMakeLists.txt, line 41 (pasted below), the flag -DNDEBUG is passed. This disables the Eigen shape-checking for matrix multiplication. This allows wrongly shaped matrices to be multiplied silently. Once I took out this flag debugging became much easier :).

  # https://gitlab.kitware.com/cmake/cmake/-/issues/22484
  include(CheckCXXCompilerFlag)
  unset(COMPILER_SUPPORTS_MARCH_NATIVE CACHE)
  CHECK_CXX_COMPILER_FLAG(-march=native COMPILER_SUPPORTS_MARCH_NATIVE)
  if(COMPILER_SUPPORTS_MARCH_NATIVE)
    SET(CMAKE_CXX_FLAGS_RELEASE        "-O3 -march=native -DNDEBUG")
  else()
    SET(CMAKE_CXX_FLAGS_RELEASE        "-O3 -mcpu=apple-m1 -DNDEBUG") # Apple M1
  endif()

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.