├── .gitignore ├── LICENSE ├── Makefile ├── Makefile.conf ├── MatlabWorkspace ├── Makefile ├── README ├── example.cpp └── example.dmat ├── README.md ├── ReAntTweakBar ├── Makefile ├── README └── example.cpp ├── affine ├── Makefile ├── README └── example.cpp ├── ambient-occlusion ├── CMakeLists.txt └── example.cpp ├── arap ├── Makefile └── example.cpp ├── bbw ├── Makefile ├── README ├── example.cpp └── examples │ ├── armadillo.bf │ ├── armadillo.obj │ ├── armadillo.tgf │ ├── brick.obj │ ├── brick.tgf │ ├── gargoyle-skeleton-4-points.tgf │ ├── gargoyle.obj │ └── toy.tgf ├── beach-balls ├── BeachBall.cpp ├── BeachBall.h ├── Makefile └── example.cpp ├── camera ├── Makefile └── example.cpp ├── cmake ├── FindANTTWEAKBAR.cmake ├── FindCGAL.cmake ├── FindCORK.cmake ├── FindEIGEN.cmake ├── FindEMBREE.cmake ├── FindEMBREEH.cmake ├── FindGLEW.cmake ├── FindGLFW.cmake ├── FindGLFWH.cmake ├── FindLIBCOMISO.cmake ├── FindLIBCOMISOH.cmake ├── FindLIBIGL.cmake ├── FindLIM.cmake ├── FindMATLAB.cmake ├── FindMOSEK.cmake ├── FindNANOGUI.cmake ├── FindNANOGUIH.cmake ├── FindPNG.cmake ├── FindTETGEN.cmake ├── FindTINYXML2.cmake ├── FindTRIANGLE.cmake └── FindYIMG.cmake ├── colored-mesh ├── Makefile └── example.cpp ├── components ├── Makefile └── example.cpp ├── convertmesh ├── CMakeLists.txt ├── Makefile └── convertmesh.cpp ├── dmat ├── Makefile ├── README ├── example.cpp └── example.dmat ├── eigen-gotchas ├── Makefile └── example.cpp ├── embree ├── Makefile └── example.cpp ├── file_contents_as_string ├── Makefile ├── README └── example.cpp ├── flare-eyes ├── Makefile └── example.cpp ├── get_seconds ├── Makefile ├── README └── example.cpp ├── glslversion ├── Makefile ├── README └── example.cpp ├── glut_speed_test ├── Makefile └── example.cpp ├── harwell_boeing ├── Makefile ├── README └── example.cpp ├── intersections ├── Makefile ├── README.md └── example.cpp ├── is_dir ├── Makefile ├── README └── example.cpp ├── meshio ├── Makefile ├── README ├── cube.obj ├── example.cpp └── torus.obj ├── mode ├── Makefile ├── README └── example.cpp ├── multi-viewport ├── Makefile └── example.cpp ├── patches ├── Makefile ├── example.cpp ├── example.sln ├── example.vcxproj └── example.vcxproj.filters ├── path_tests ├── Makefile ├── README ├── example.cpp └── example.php ├── pathinfo ├── Makefile ├── README ├── example.cpp ├── example.php └── input.txt ├── randomly-sample-mesh ├── Makefile └── example.cpp ├── render_to_png ├── Makefile ├── README └── example.cpp ├── rotate-widget ├── Makefile └── example.cpp ├── scene-rotation ├── Makefile ├── README ├── example.cpp ├── trackball.cpp └── trackball.h ├── shadow-mapping ├── Makefile └── example.cpp ├── shared ├── TinyTorus.obj ├── animal.obj ├── animal.png ├── beast-xyz.dmat ├── beast.obj ├── cheburashka.off ├── cheburashka.tgf ├── cube.obj ├── decimated-knight-selection.dmat ├── decimated-knight.obj └── truck.obj ├── skeleton-builder ├── CMakeLists.txt ├── Makefile └── example.cpp ├── skeleton-poser ├── CMakeLists.txt ├── Makefile ├── clean.cpp ├── clean.h ├── example.cpp ├── robust_bbw.cpp └── robust_bbw.h ├── skeleton ├── Makefile └── example.cpp ├── slice ├── Makefile ├── README └── example.cpp ├── sort ├── Makefile ├── README └── example.cpp ├── sortrows ├── IC.dmat ├── Makefile ├── README ├── X.dmat ├── Y.dmat └── example.cpp ├── stdin_to_temp ├── Makefile ├── README └── example.cpp ├── textured-mesh ├── Makefile └── example.cpp ├── trackball ├── Makefile ├── README └── example.cpp ├── transparency ├── Makefile ├── example.cpp └── project.m ├── transpose_blocks ├── Makefile ├── README └── example.cpp └── upright ├── Makefile └── example.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | # use glob syntax. 2 | syntax: glob 3 | *.so 4 | *.so.[0123456789] 5 | *.so.[0123456789].[0123456789] 6 | *.o 7 | *.o-* 8 | *.a 9 | *.dylib 10 | *~ 11 | *CMakeFiles* 12 | example 13 | bbw/bbw_demo_selfcontained/* 14 | bbw/bbw_demo_selfcontained.zip 15 | quicklook-mesh/Mesh.qlgenerator/* 16 | */*.mexmaci64 17 | */*.rbr 18 | *.swp 19 | *.swo 20 | bbw/bbw_demo 21 | external/medit/rebar.rbr 22 | bbw/examples/*-volume.dmat 23 | bbw/examples/*-volume.mesh 24 | convertmesh/convertmesh 25 | upright/upright 26 | principal_curvature/curvature 27 | skeleton-builder/skeleton_builder 28 | skeleton-poser/skeleton-poser 29 | *.pyc 30 | */build/* 31 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | .NOTPARALLEL: all 3 | 4 | SUBDIRS= \ 5 | MatlabWorkspace ReAntTweakBar \ 6 | affine ambient-occlusion arap bbw beach-balls camera colored-mesh \ 7 | components convertmesh dmat eigen-gotchas embree file_contents_as_string \ 8 | flare-eyes get_seconds glslversion glut_speed_test harwell_boeing \ 9 | intersections is_dir meshio mode multi-viewport patches path_tests pathinfo \ 10 | randomly-sample-mesh render_to_png rotate-widget scene-rotation \ 11 | shadow-mapping skeleton skeleton-builder skeleton-poser slice sort \ 12 | sortrows stdin_to_temp textured-mesh trackball transparency \ 13 | transpose_blocks upright \ 14 | 15 | # http://stackoverflow.com/a/2463804/148668 16 | .PHONY: all check clean 17 | all check clean: $(SUBDIRS) 18 | 19 | all: TARGET=all 20 | check: TARGET=check 21 | clean: TARGET=clean 22 | # No, you can't do TARG=$@, or at least I don't know how to. 23 | 24 | $(SUBDIRS): force 25 | @ $(MAKE) -C $@ $(TARGET) 26 | 27 | .PHONY: force 28 | force :; 29 | -------------------------------------------------------------------------------- /Makefile.conf: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | # FLAGS 3 | ############################################################################# 4 | UNAME := $(shell uname) 5 | 6 | THIS_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) 7 | 8 | GG=g++ 9 | #GG=clang++ 10 | #GG=/usr/bin/g++ 17s 11 | #GG=/usr/bin/clang++ 14s 12 | #GG=g++-mp-4.3 15.5s 13 | #GG=g++-mp-4.7 19.9s 14 | 15 | CFLAGS += -Wall 16 | CFLAGS += -std=c++11 17 | 18 | ifeq ($(UNAME), Linux) 19 | DEFAULT_PREFIX=/usr/local/ 20 | else 21 | DEFAULT_PREFIX=/usr/local/ 22 | # I guess arch only works in Mac OSX 23 | AFLAGS+=-arch x86_64 -m64 -march=corei7-avx 24 | endif 25 | 26 | # Default parameters for the IGL group members based on there computer's 27 | # username 28 | ifndef IGL_USERNAME 29 | #IGL_USERNAME := $(shell whoami) 30 | IGL_USERNAME := ajx 31 | endif 32 | 33 | ifeq ($(IGL_USERNAME),whitinge) 34 | DEFAULT_PREFIX=/usr/local/ 35 | MOSEKPLATFORM=osx64x86 36 | MOSEKVERSION=7 37 | IGL_WITH_TETGEN=1 38 | IGL_WITH_MOSEK=1 39 | IGL_WITH_BBW=1 40 | IGL_WITH_SVD3X3=1 41 | IGL_WITH_PNG=1 42 | # I don't use llvm 43 | #AFLAGS = -m64 -march="corei7-avx" 44 | # msse4.2 is necessary for me to get embree to compile correctly 45 | AFLAGS=-m64 -msse4.2 46 | OPENMP=-fopenmp 47 | EIGEN3_INC=-I$(DEFAULT_PREFIX)/include/eigen3 -I$(DEFAULT_PREFIX)/include/eigen3/unsupported 48 | endif 49 | 50 | ifeq ($(IGL_USERNAME),ajx) 51 | LIBIGL_USE_STATIC_LIBRARY=1 52 | MOSEKPLATFORM=osx64x86 53 | MOSEKVERSION=7 54 | IGL_WITH_VIEWER=1 55 | IGL_WITH_TETGEN=1 56 | IGL_WITH_BOOLEAN=1 57 | IGL_WITH_EMBREE=1 58 | IGL_WITH_MATLAB=1 59 | IGL_WITH_MOSEK=1 60 | IGL_WITH_CGAL=1 61 | IGL_WITH_BBW=1 62 | IGL_WITH_SVD3X3=1 63 | IGL_WITH_PNG=1 64 | IGL_WITH_XML=1 65 | IGL_WITH_BOOST=1 66 | # I don't use llvm 67 | #AFLAGS = -m64 -march="corei7-avx" 68 | # msse4.2 is necessary for me to get embree to compile correctly 69 | AFLAGS=-m64 -msse4.2 70 | #OPENMP=-fopenmp 71 | EIGEN3_INC=-I$(DEFAULT_PREFIX)/include/eigen3 -I$(DEFAULT_PREFIX)/include/eigen3/unsupported 72 | #EIGEN3_INC=-I/Users/ajx/Documents/eigen -I/Users/ajx/Documents/eigen/unsupported 73 | endif 74 | 75 | ifeq ($(IGL_USERNAME),alecjaco) 76 | DEFAULT_PREFIX=/home1/alecjaco/ 77 | #MOSEKPLATFORM=linux64x86 78 | IGL_WITH_TETGEN=1 79 | IGL_WITH_MATLAB=0 80 | #IGL_WITH_MOSEK=1 81 | OPENGL_INC=-I$(DEFAULT_PREFIX)/include 82 | OPENGL_LIB=-lGL -lGLU 83 | # Glut is needed only for examples 84 | GLUT_LIB=-lglut 85 | ANTTWEAKBAR_LIB=-lAntTweakBar 86 | OPENMP=-fopenmp 87 | endif 88 | 89 | ifeq ($(IGL_USERNAME),jacobson) 90 | CFLAGS+= 91 | endif 92 | 93 | ifeq ($(IGL_USERNAME),sorkineo) 94 | MOSEKPLATFORM=osx64x86 95 | IGL_WITH_TETGEN=1 96 | IGL_WITH_MATLAB=0 97 | IGL_WITH_MOSEK=1 98 | IGL_WITH_PNG=0 99 | endif 100 | 101 | ifeq ($(IGL_USERNAME),jalec_linux) 102 | MOSEKPLATFORM=linux64x86 103 | IGL_WITH_TETGEN=1 104 | IGL_WITH_MATLAB=0 105 | IGL_WITH_MOSEK=1 106 | OPENGL_LIB=-lGL -lGLU 107 | # Glut is needed only for examples 108 | GLUT_LIB=-lglut 109 | ANTTWEAKBAR_LIB=-lAntTweakBar 110 | IGL_WITH_PNG=1 111 | OPENMP=-fopenmp 112 | endif 113 | 114 | ifeq ($(IGL_USERNAME),daniele) 115 | IGL_WITH_MATLAB=0 116 | IGL_WITH_XML=1 117 | AFLAGS=-m64 118 | GG=g++-4.8 -Wfatal-errors 119 | EIGEN3_INC=-I/usr/local/include/eigen3 120 | endif 121 | 122 | ifeq ($(IGL_USERNAME),olkido) 123 | IGL_WITH_MATLAB=1 124 | IGL_WITH_COMISO=1 125 | IGL_WITH_XML=1 126 | COMISO=/Users/olkido/Documents/igl/MIQ/src/CoMISo 127 | IGL_WITH_XML=1 128 | AFLAGS= -m64 129 | IGL_WITH_EMBREE=1 130 | IGL_WITH_PNG=1 131 | IGL_WITH_VIEWER=1 132 | MATLAB=/Applications/MATLAB_R2014b.app/ 133 | endif 134 | 135 | ifeq ($(IGL_USERNAME),chrsch) 136 | ifeq ($(UNAME), Linux) 137 | DEFAULT_PREFIX=/usr 138 | IGL_WITH_XML=1 139 | IGL_WITH_TETGEN=0 140 | IGL_WITH_MATLAB=0 141 | IGL_WITH_PNG=0 142 | IGL_WITH_MOSEK=0 143 | #MOSEKPLATFORM=linux64x86 144 | OPENGL_LIB=-lGL -lGLU 145 | # Glut is needed only for examples 146 | GLUT_LIB=-lglut 147 | ANTTWEAKBAR_LIB=-lAntTweakBar 148 | OPENMP=-fopenmp 149 | AFLAGS = -Wfatal-errors 150 | else 151 | IGL_WITH_XML=1 152 | IGL_WITH_TETGEN=0 153 | IGL_WITH_MATLAB=0 154 | IGL_WITH_PNG=0 155 | IGL_WITH_MOSEK=0 156 | OPENGL_INC=-I$(DEFAULT_PREFIX)/include 157 | OPENGL_LIB=-lGL -lGLU 158 | # Glut is needed only for examples 159 | GLUT_LIB=-lglut 160 | ANTTWEAKBAR_LIB=-lAntTweakBar 161 | OPENMP=-fopenmp 162 | AFLAGS=-m64 163 | endif 164 | endif 165 | 166 | ifeq ($(IGL_USERNAME),stefanmessmer) 167 | GG=clang++ 168 | IGL_WITH_TETGEN=0 169 | IGL_WITH_EMBREE=0 170 | IGL_WITH_MATLAB=0 171 | IGL_WITH_MOSEK=0 172 | IGL_WITH_BBW=1 173 | IGL_WITH_PNG=0 174 | IGL_WITH_XML=0 175 | IGL_WITH_BOOST=0 176 | IGL_WITH_SVD3X3=1 177 | #OPENGL_INC=-I$(DEFAULT_PREFIX)/include 178 | #OPENGL_LIB=-lGL -lGLU 179 | # Glut is needed only for examples 180 | #GLUT_LIB=-lglut 181 | #ANTTWEAKBAR_LIB=-lAntTweakBar 182 | OPENPMP = -openmp 183 | AFLAGS = -DIGL_NO_MOSEK -DIGL_NO_ANTTWEAKBAR -DIGL_NO_OPENGL -arch armv7s -arch armv7 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk 184 | AFLAGS_SIMULATOR = -DIGL_NO_MOSEK -DIGL_NO_ANTTWEAKBAR -DIGL_NO_OPENG -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk 185 | endif 186 | 187 | ifeq ($(IGL_USERNAME),wenzel) 188 | IGL_WITH_TETGEN=0 189 | IGL_WITH_MATLAB=0 190 | IGL_WITH_MOSEK=0 191 | OPENGL_LIB=-lGL -lGLU 192 | GLUT_LIB=-lglut 193 | ANTTWEAKBAR_LIB=-lAntTweakBar 194 | IGL_WITH_PNG=1 195 | OPENMP=-fopenmp 196 | CFLAGS += -msse4 -D__SSE4__ -DIGL_NO_MOSEK 197 | endif 198 | 199 | ############################################################################# 200 | # DEFAULTS (USUALLY TO SOMETHING THAT WORKS FOR SURE ON MAC OS X 201 | ############################################################################# 202 | 203 | ifndef OPENGL_LIB 204 | OPENGL_LIB=-framework OpenGL 205 | endif 206 | ifndef GLUT_LIB 207 | GLUT_LIB=-framework GLUT 208 | endif 209 | # Eigen dependency 210 | ifndef EIGEN3_INC 211 | EIGEN3_INC=-I$(DEFAULT_PREFIX)/include/eigen3 -I$(DEFAULT_PREFIX)/include/eigen3/unsupported 212 | endif 213 | 214 | LIBIGL=$(THIS_DIR)/../libigl/ 215 | LIBIGL_INC=-I$(LIBIGL)/include 216 | 217 | ifndef ANTTWEAKBAR_INC 218 | ANTTWEAKBAR_INC=-I$(LIBIGL)/external/AntTweakBar/include 219 | endif 220 | ifndef ANTTWEAKBAR_LIB 221 | # AntTweakBar needs AppKit on mac os x 222 | ANTTWEAKBAR_LIB=-L$(LIBIGL)/external/AntTweakBar/lib -lAntTweakBar -framework AppKit -liglanttweakbar 223 | endif 224 | 225 | ifndef SINGULAR_VALUE_DECOMPOSITION_INC 226 | SINGULAR_VALUE_DECOMPOSITION_INC=\ 227 | -I$(LIBIGL)/external/Singular_Value_Decomposition/ 228 | endif 229 | 230 | ifndef TETGEN 231 | # By default I'm using the libigl version. Adjust accordingly 232 | TETGEN=$(LIBIGL)/external/tetgen 233 | TETGEN_LIB=-L$(TETGEN) -ligltetgen -ltet 234 | TETGEN_INC=-I$(TETGEN) 235 | endif 236 | 237 | ifndef EMBREE 238 | EMBREE=$(LIBIGL)/external/embree 239 | EMBREE_INC=-I$(EMBREE)/ -I$(EMBREE)/include 240 | EMBREE_LIB=-L$(EMBREE)/build -lembree -lsys 241 | endif 242 | ifndef YIMG 243 | YIMG=$(LIBIGL)/external/yimg 244 | YIMG_LIB=-L$(YIMG) -lyimg -lz -L/usr/X11/lib -L$(DEFAULT_PREFIX)/lib -lpng -bind_at_load 245 | YIMG_INC=-I/usr/X11/include -I$(YIMG) 246 | endif 247 | 248 | ifdef LIBIGL_USE_STATIC_LIBRARY 249 | CFLAGS += -DIGL_STATIC_LIBRARY 250 | LIBIGL_LIB=-L$(LIBIGL)/lib -ligl -liglopengl2 -liglopengl 251 | endif 252 | 253 | OPTFLAGS+=-O3 -DNDEBUG $(OPENMP) 254 | -------------------------------------------------------------------------------- /MatlabWorkspace/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | LIBIGL_LIB+=-liglmatlab 6 | 7 | MATLAB_INC=-I$(MATLAB)/extern/include/ 8 | MATLAB_LIB=-L$(MATLAB)/bin/maci64 -lmx -lmat 9 | 10 | LIB+=$(LIBIGL_LIB) $(MATLAB_LIB) 11 | INC+=$(LIBIGL_INC) $(EIGEN3_INC) $(MATLAB_INC) 12 | 13 | CFLAGS += -g 14 | 15 | ifeq ($(IGL_WITH_MATLAB),1) 16 | EXAMPLE=example 17 | endif 18 | 19 | all: $(EXAMPLE) 20 | 21 | example: example.o 22 | g++ -o example example.o $(LIB) 23 | 24 | example.o: example.cpp 25 | g++ $(CFLAGS) -o $@ -c $< $(INC) 26 | 27 | clean: 28 | rm -f example.o 29 | rm -f example 30 | -------------------------------------------------------------------------------- /MatlabWorkspace/README: -------------------------------------------------------------------------------- 1 | This is a simple example program that shows how to use the MatlabWorkspace 2 | class of the igl library 3 | 4 | 5 | To Build: 6 | make 7 | 8 | To Run: 9 | ./example [input.dmat] [output.mat] 10 | 11 | Example Run #1: 12 | Issuing: 13 | ./example example.dmat output.mat 14 | -------------------------------------------------------------------------------- /MatlabWorkspace/example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | #ifdef IGL_STATIC_LIBRARY 7 | # define IGL_HEADER_ONLY 8 | # define IGL_HEADER_ONLY_WAS_NOT_DEFINED 9 | #endif 10 | #include 11 | #include 12 | #ifndef IGL_STATIC_LIBRARY_WAS_NOT_DEFINED 13 | # undef IGL_HEADER_ONLY 14 | #endif 15 | 16 | int main(int argc, char * argv[]) 17 | { 18 | using namespace igl; 19 | using namespace Eigen; 20 | if(argc <= 2) 21 | { 22 | printf("USAGE:\n ./example [input.dmat] [output.mat]\n"); 23 | return 1; 24 | } 25 | MatrixXd M; 26 | readDMAT(argv[1],M); 27 | igl::matlab::MatlabWorkspace mat; 28 | mat.save(M,"M"); 29 | mat.write(argv[2]); 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /MatlabWorkspace/example.dmat: -------------------------------------------------------------------------------- 1 | 3 2 2 | 1 3 | 4 4 | 2 5 | 5 6 | 3 7 | 6 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > # ⚠️⚠️⚠️⚠️⚠️ ARCHIVED ⚠️⚠️⚠️⚠️⚠️ 2 | > This repository has been archived and will not be maintained. You may be interested in: 3 | > - https://libigl.github.io/tutorial/ 4 | > - https://github.com/libigl/libigl-example-project 5 | > - https://github.com/alecjacobson/gp-cli 6 | > 7 | 8 | 9 | # libigl-examples 10 | 11 | This repository contains examples applications that use 12 | [libigl](libigl.github.io/libigl/). They've been tested on Mac OS X. Most are 13 | too involved or special purpose to be part of the [libigl 14 | tutorial](libigl.github.io/libigl/tutorial/tutorial.html). 15 | 16 | ## Dependencies 17 | 18 | #### All: 19 | 20 | - libigl 21 | - std 22 | - Eigen 23 | - C++11 24 | 25 | #### Most: 26 | 27 | - OpenGL v2 28 | - GLUT 29 | - AntTweakBar 30 | 31 | #### Some: 32 | 33 | - embree 34 | - ispc 35 | - tbb 36 | - mosek (optional) 37 | - tetgen 38 | - matlab 39 | - cgal 40 | 41 | ### GLUT 42 | 43 | Nearly all of these examples depend on GLUT. On Mac OS X, glut is deprecated 44 | but still included. However, I'd recommend replacing it with a [modified 45 | glut](https://github.com/alecjacobson/glut) that supports scroll wheel and the 46 | command ⌘ key. 47 | 48 | ### AntTweakBar 49 | 50 | I'd recommend installing AntTweakBar as a static library. You can do this from 51 | with then `libigl/external/AntTweakBar` directory using: 52 | 53 | make -C [libigl]/external/AntTweakBar/src -f Makefile.osx.igl 54 | 55 | ### Embree 56 | 57 | I'd recommend installing Embree via the `libigl/external/embree` submodule. 58 | Travel there and follow the usual cmake build: 59 | 60 | cd [libigl]/external/embree 61 | mkdir build 62 | cd build 63 | cmake .. 64 | make 65 | 66 | ## Compilation 67 | 68 | ### Make 69 | 70 | > This is hopefully subject to change as I update examples to be built with 71 | > cmake. 72 | 73 | Each example directory is independent and be compiled using: 74 | 75 | make -C [example-dir] 76 | 77 | You can also try to compile all examples by simply issuing: 78 | 79 | make 80 | 81 | ### Cmake 82 | 83 | Some examples now use cmake to build. Compile the dependencies above and then 84 | issue: 85 | 86 | cd [example] 87 | mkdir build 88 | cd build 89 | cmake .. 90 | make 91 | -------------------------------------------------------------------------------- /ReAntTweakBar/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: example 7 | 8 | .PHONY: example 9 | 10 | inc=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) 11 | lib=$(LIBIGL_LIB) $(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) 12 | CFLAGS+=-g 13 | 14 | example: example.o 15 | g++ $(CFLAGS) -o example example.o $(lib) 16 | 17 | example.o: example.cpp 18 | g++ $(CFLAGS) -c example.cpp -o example.o $(inc) 19 | clean: 20 | rm -f example.o 21 | rm -f example 22 | -------------------------------------------------------------------------------- /ReAntTweakBar/README: -------------------------------------------------------------------------------- 1 | ReAntTweakBar is a minimal wrapper for the AntTweakBar library that allows 2 | "bars" to be saved and load from disk. Changing your existing app that users 3 | AntTweakBar to use ReAntTweakBar is trivial. 4 | 5 | This directory should contain: 6 | README 7 | example.cpp 8 | example (option example binary) 9 | temp.rbr (optional example ReAntTweakBar output) 10 | 11 | Many (but not all) variable types are supported. I'll try to keep track them 12 | here: 13 | TW_TYPE_BOOLCPP 14 | TW_TYPE_QUAT4F 15 | TW_TYPE_COLOR4F 16 | TW_TYPE_COLOR3F 17 | TW_TYPE_DIR3F 18 | TW_TYPE_BOOL32 19 | TW_TYPE_INT32 20 | TW_TYPE_FLOAT 21 | TW_TYPE_DOUBLE 22 | and 23 | custom TwTypes made with TwDefineEnum 24 | 25 | I'm working on adding the rest on an as-needed basis. Adding a new type only 26 | requires changes in a few places... 27 | 28 | Look in example.cpp for an example of how to compile with ReAntTweakBar and use 29 | it. 30 | -------------------------------------------------------------------------------- /affine/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | all: example 4 | 5 | # Shared flags etc. 6 | include ../Makefile.conf 7 | 8 | .PHONY: example 9 | 10 | CFLAGS+=-g 11 | inc=$(LIBIGL_INC) $(EIGEN3_INC) 12 | lib=$(LIBIGL_LIB) 13 | 14 | example: example.o 15 | g++ $(CFLAGS) -o example example.o $(lib) 16 | 17 | example.o: example.cpp 18 | g++ $(CFLAGS) -c example.cpp -o example.o $(inc) 19 | clean: 20 | rm -f example.o 21 | rm -f example 22 | -------------------------------------------------------------------------------- /affine/README: -------------------------------------------------------------------------------- 1 | A small program showing how .translate and .rotate affect eigen's Affine matrix class 2 | 3 | 4 | Compile with: 5 | make 6 | 7 | Run with: 8 | ./example 9 | -------------------------------------------------------------------------------- /affine/example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | typedef Eigen::Transform Tform3; 6 | typedef Eigen::Vector3d Vec3; 7 | typedef Eigen::Quaterniond Quat; 8 | 9 | int main(int argc, char * argv[]) 10 | { 11 | Tform3 T; 12 | T =Tform3::Identity(); 13 | cout<<"T =Tform3::Identity();"< 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | BeachBall::BeachBall(): 20 | radius(1), 21 | is_hover(false), 22 | is_down(false), 23 | trackball_on(false), 24 | down_x(-1), 25 | down_y(-1) 26 | { 27 | r[0]=r[1]=r[2]=0;r[3]=1; 28 | t[0]=t[1]=t[2]=0;t[3]=0; 29 | } 30 | 31 | void BeachBall::pushmv() const 32 | { 33 | glPushMatrix(); 34 | glLoadIdentity(); 35 | glMultMatrixd(mv); 36 | } 37 | void BeachBall::popmv() const 38 | { 39 | glPopMatrix(); 40 | } 41 | 42 | void BeachBall::push() const 43 | { 44 | using namespace igl; 45 | glPushMatrix(); 46 | // Translate to relative origin 47 | glTranslated(t[0],t[1],t[2]); 48 | // Rotate to relative orientation 49 | double mat[4*4]; quat_to_mat(r,mat); glMultMatrixd(mat); 50 | } 51 | void BeachBall::pop() const 52 | { 53 | glPopMatrix(); 54 | } 55 | 56 | void BeachBall::draw() 57 | { 58 | using namespace std; 59 | using namespace igl; 60 | // Keep track of relative identity (modelview) matrix at draw call 61 | glGetDoublev(GL_MODELVIEW_MATRIX,mv); 62 | push(); 63 | // Dim if hovered over 64 | float ld[4]; 65 | glGetLightfv(GL_LIGHT0,GL_DIFFUSE,ld); 66 | if(is_hover) 67 | { 68 | float ld_hover[4]; 69 | ld_hover[0] = 0.5*ld[0]; 70 | ld_hover[1] = 0.5*ld[1]; 71 | ld_hover[2] = 0.5*ld[2]; 72 | ld_hover[3] = 0.5*ld[3]; 73 | glLightfv(GL_LIGHT0,GL_DIFFUSE,ld_hover); 74 | } 75 | // Adjust scale only after setting origin 76 | glPushMatrix(); 77 | glScaled(radius,radius,radius); 78 | // draw oriented glyph 79 | igl::opengl2::draw_beach_ball(); 80 | // Pop scale 81 | glPopMatrix(); 82 | // Reset lighting 83 | glLightfv(GL_LIGHT0,GL_DIFFUSE,ld); 84 | // Reset relative identity 85 | pop(); 86 | } 87 | 88 | bool BeachBall::in(const int x,const int y) const 89 | { 90 | using namespace igl; 91 | using namespace std; 92 | pushmv(); 93 | push(); 94 | // Now origin is center of object 95 | double obj[3]; 96 | // Check if igl::opengl2::unprojected screen point is nearby 97 | igl::opengl2::unproject_to_zero_plane(x,y, &obj[0], &obj[1], &obj[2]); 98 | bool near = (obj[0]*obj[0] + obj[1]*obj[1] + obj[2]*obj[2])( 146 | VP[2], 147 | VP[3], 148 | 2, 149 | (down_x-origin[0]+VP[2]/2), 150 | VP[3]-(down_y-origin[1]+VP[3]/2), 151 | ( x-origin[0]+VP[2]/2), 152 | VP[3]-( y-origin[1]+VP[3]/2), 153 | rot); 154 | { 155 | // We've computed change in rotation according to this view: 156 | // R = mv * r, R' = rot * (mv * r) 157 | // But we only want new value for r: 158 | // R' = mv * r' 159 | // mv * r' = rot * (mv * r) 160 | // r' = mv* * rot * sr * r 161 | // Convert modelview matrix to quaternion 162 | double sr_conj[4],scene_rot[4],t1[4],t2[4]; 163 | mat4_to_quat(mv,scene_rot); 164 | //cout<<"::sr: "<< 165 | // BeachBall::scene_rot[0]<<" "<< 166 | // BeachBall::scene_rot[1]<<" "<< 167 | // BeachBall::scene_rot[2]<<" "<< 168 | // BeachBall::scene_rot[3]<<" "<< 169 | // endl; 170 | //cout<<" sr: "<< 171 | // scene_rot[0]<<" "<< 172 | // scene_rot[1]<<" "<< 173 | // scene_rot[2]<<" "<< 174 | // scene_rot[3]<<" "<< 175 | // endl; 176 | // Normalize to unit quaternion (rotation only) 177 | double len = 178 | sqrt(scene_rot[0]*scene_rot[0]+ 179 | scene_rot[1]*scene_rot[1]+ 180 | scene_rot[2]*scene_rot[2]+ 181 | scene_rot[3]*scene_rot[3]); 182 | for(int j = 0;j<4;j++) 183 | { 184 | scene_rot[j] /= len; 185 | } 186 | // TODO: Just use Eigen::Quaterniond 187 | quat_conjugate(scene_rot,sr_conj); 188 | quat_mult(sr_conj,rot,t1); 189 | quat_mult(t1,scene_rot,t2); 190 | quat_mult(t2,down_r,r); 191 | 192 | } 193 | }else 194 | { 195 | // We want that origin follows mouse move. First define plane we 196 | // igl::opengl2::projecteing screen mouse movement to as perpendicular plan passing 197 | // through this origin. 198 | pushmv(); 199 | // down_t igl::opengl2::projected to screen to get depth value 200 | double p[3]; 201 | igl::opengl2::project(down_t[0],down_t[1],down_t[2],&p[0],&p[1],&p[2]); 202 | // igl::opengl2::unprojected down_x,down_y with down_t depth 203 | double du[3]; 204 | igl::opengl2::unproject(down_x,down_y,p[2],&du[0],&du[1],&du[2]); 205 | // igl::opengl2::unprojected x,y with down_t depth 206 | double u[3]; 207 | igl::opengl2::unproject(x,y,p[2],&u[0], &u[1], &u[2]); 208 | popmv(); 209 | // Then move this origin according to igl::opengl2::project mouse displacment 210 | t[0] = down_t[0] + (u[0]-du[0]); 211 | t[1] = down_t[1] + (u[1]-du[1]); 212 | t[2] = down_t[2] + (u[2]-du[2]); 213 | } 214 | return is_down; 215 | } 216 | 217 | bool BeachBall::right_down(const int x,const int y) 218 | { 219 | using namespace std; 220 | using namespace igl; 221 | is_down = in(x,y); 222 | if(is_down) 223 | { 224 | copy(r,r+4,down_r); 225 | copy(t,t+4,down_t); 226 | down_x = x; 227 | down_y = y; 228 | } 229 | return is_down; 230 | } 231 | 232 | bool BeachBall::up(const int /*x*/,const int /*y*/) 233 | { 234 | trackball_on = false; 235 | return is_down = false; 236 | } 237 | -------------------------------------------------------------------------------- /beach-balls/BeachBall.h: -------------------------------------------------------------------------------- 1 | #ifndef BEACHBALL_H 2 | #define BEACHBALL_H 3 | class BeachBall 4 | { 5 | public: 6 | static double * scene_rot; 7 | public: 8 | // Rigid transformation: rotation as quaternion 9 | double r[4]; 10 | // Rigid transformation: translation as quaternion 11 | double t[4]; 12 | double radius; 13 | protected: 14 | bool is_hover; 15 | bool is_down; 16 | // trackball 17 | bool trackball_on; 18 | // Rigid transformation at down 19 | double down_r[4]; 20 | double down_t[4]; 21 | // query position at down 22 | int down_x; 23 | int down_y; 24 | // modelview matrix at draw 25 | double mv[16]; 26 | public: 27 | BeachBall(); 28 | // Push the latest modelview matrix seen at draw time onto the stack 29 | void pushmv() const; 30 | // Pop the stack 31 | void popmv() const; 32 | // Push rigid transformation onto the stack 33 | void push() const; 34 | // Pop the stack 35 | void pop() const; 36 | // Draw and cache the modelview matrix 37 | void draw(); 38 | // Return whether (x,y) in screenspace is "inside" (hitting) 39 | bool in(const int x,const int y) const; 40 | // Called on passive mouse move to (x,y) 41 | // 42 | // Return whether (x,y) is hovering over, set is_hover accordingly 43 | bool hover(const int x,const int y); 44 | // Called on mouse down at (x,y) 45 | // 46 | // Return whether (x,y) is down, set is_down accordingly 47 | bool down(const int x,const int y); 48 | // Called on mouse drag to (x,y) 49 | // 50 | // Returns whether still is_down 51 | bool drag(const int x,const int y); 52 | // Called on right mouse down at (x,y) 53 | // 54 | // Return whether (x,y) is down, set is_down accordingly 55 | bool right_down(const int x,const int y); 56 | // Called on mouse up at (x,y) 57 | // 58 | // Returns whether still is_down 59 | bool up(const int x,const int y); 60 | }; 61 | #endif 62 | -------------------------------------------------------------------------------- /beach-balls/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: obj example 7 | 8 | .PHONY: example 9 | 10 | CFLAGS+=-g -std=c++11 11 | 12 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) $(GLUT_INC) 13 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) 14 | 15 | CPP_FILES=$(wildcard ./*.cpp) 16 | OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o))) 17 | 18 | example: obj $(OBJ_FILES) 19 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -o example $(OBJ_FILES) $(LIB) 20 | 21 | obj: 22 | mkdir -p obj 23 | 24 | obj/%.o: %.cpp 25 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 26 | 27 | obj/%.o: %.cpp %.h 28 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 29 | 30 | clean: 31 | rm -f $(OBJ_FILES) 32 | rm -f example 33 | -------------------------------------------------------------------------------- /beach-balls/example.cpp: -------------------------------------------------------------------------------- 1 | #include "BeachBall.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | double back[3] = {85.0/255.0,85.0/255.0,85.0/255.0}; 17 | double width,height; 18 | double scene_rot[4] = {0,0,0,1}; 19 | double * BeachBall::scene_rot = NULL; 20 | double down_scene_rot[4] = {0,0,0,1}; 21 | int down_mouse_x=-1,down_mouse_y=-1; 22 | bool trackball_on = false; 23 | const float light_pos[4] = {-0.2, -0.1, 1,0}; 24 | 25 | std::vector balls; 26 | float plane[4] = {0,0,1,1.5}; 27 | 28 | int display_count = 0; 29 | 30 | void push_scene() 31 | { 32 | using namespace igl; 33 | glMatrixMode(GL_PROJECTION); 34 | glLoadIdentity(); 35 | //gluOrtho2D(0,width,0,height); 36 | gluPerspective(15,(double)width/(double)height,1e-2,300); 37 | glMatrixMode(GL_MODELVIEW); 38 | glLoadIdentity(); 39 | glPushMatrix(); 40 | gluLookAt(0,0,20,0,0,0,0,1,0); 41 | double mat[4*4]; 42 | quat_to_mat(scene_rot,mat); 43 | glMultMatrixd(mat); 44 | } 45 | 46 | void lights() 47 | { 48 | using namespace std; 49 | using namespace igl; 50 | 51 | glEnable(GL_LIGHTING); 52 | float ones[4] = {1.0,1.0,1.0,1.0}; 53 | glLightfv(GL_LIGHT0,GL_AMBIENT,ones); 54 | glLightfv(GL_LIGHT0,GL_DIFFUSE,ones); 55 | glLightfv(GL_LIGHT0,GL_SPECULAR,ones); 56 | glLightfv(GL_LIGHT0,GL_POSITION,light_pos); 57 | glEnable(GL_LIGHT0); 58 | } 59 | 60 | void pop_scene() 61 | { 62 | glPopMatrix(); 63 | } 64 | 65 | void display() 66 | { 67 | using namespace std; 68 | using namespace igl; 69 | 70 | glEnable(GL_BLEND); 71 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 72 | 73 | if(true || display_count==0 || display_count==200) 74 | { 75 | glClearColor(back[0],back[1],back[2],0); 76 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 77 | glEnable(GL_DEPTH_TEST); 78 | 79 | lights(); 80 | push_scene(); 81 | 82 | //// Normal list 83 | //for(int i = 0;i<(int)balls.size();i++) 84 | //{ 85 | // balls[i].draw(); 86 | //} 87 | 88 | // single root 89 | balls[0].draw(); 90 | balls[0].push(); 91 | for(int i = 1;i<(int)balls.size();i++) 92 | { 93 | balls[i].radius = 0.5; 94 | balls[i].draw(); 95 | } 96 | balls[0].pop(); 97 | 98 | // Draw floor 99 | glEnable(GL_COLOR_MATERIAL); 100 | glEnable(GL_POLYGON_OFFSET_FILL); 101 | glPolygonOffset(10.0,1); 102 | float size = 10; 103 | glBegin(GL_QUADS); 104 | glNormal3f(0,0,1); 105 | glColor4f(0,0.2,0.8,0.5); 106 | glVertex4f(-size,-size,-plane[3],1); 107 | glColor4f(0,0,1,0.5); 108 | glVertex4f( size,-size,-plane[3],1); 109 | glColor4f(0.0,0.1,0.5,0.5); 110 | glVertex4f( size, size,-plane[3],1); 111 | //glColor4f(back[0],back[1],back[2],1); 112 | glColor4f(0.0,0.1,0.5,0.5); 113 | glVertex4f(-size, size,-plane[3],1); 114 | glEnd(); 115 | glDisable(GL_POLYGON_OFFSET_FILL); 116 | pop_scene(); 117 | } 118 | 119 | 120 | //// Animation 121 | //for(int i = 0;i<(int)balls.size();i++) 122 | //{ 123 | // balls[i].r[0] += cos(double(i*display_count)/1000.0) + sin(double(display_count)/1000.0); 124 | // balls[i].r[1] += sin(double(2*i*display_count)/1000.0) + cos(double(2*display_count)/1000.0); 125 | // balls[i].r[2] += cos(double(3*i*display_count)/1000.0) + sin(double(3*display_count)/1000.0); 126 | // balls[i].r[3] += sin(double(4*i*display_count)/1000.0) + cos(double(4*display_count)/1000.0); 127 | // double len = 128 | // sqrt(balls[i].r[0]*balls[i].r[0]+ 129 | // balls[i].r[1]*balls[i].r[1]+ 130 | // balls[i].r[2]*balls[i].r[2]+ 131 | // balls[i].r[3]*balls[i].r[3]); 132 | // for(int j = 0;j<4;j++) 133 | // { 134 | // balls[i].r[j] /= len; 135 | // } 136 | //} 137 | 138 | igl::opengl::report_gl_error(); 139 | glutSwapBuffers(); 140 | glutPostRedisplay(); 141 | 142 | display_count++; 143 | } 144 | 145 | void reshape(int width, int height) 146 | { 147 | using namespace std; 148 | ::width = width; 149 | ::height = height; 150 | glMatrixMode(GL_PROJECTION); 151 | glLoadIdentity(); 152 | glViewport(0,0,width,height); 153 | } 154 | 155 | void key(unsigned char key, int /*mouse_x*/, int /*mouse_y*/) 156 | { 157 | using namespace std; 158 | 159 | switch(key) 160 | { 161 | case char(27): 162 | exit(0); 163 | default: 164 | cout<<"Unknown key command: "<( 211 | width, 212 | height, 213 | 2, 214 | down_scene_rot, 215 | down_mouse_x, 216 | height-down_mouse_y, 217 | mouse_x, 218 | height-mouse_y, 219 | scene_rot); 220 | } 221 | push_scene(); 222 | for(int i = 0;i<(int)balls.size();i++) 223 | { 224 | balls[i].drag(mouse_x,mouse_y); 225 | } 226 | pop_scene(); 227 | 228 | } 229 | 230 | void mouse_move(int mouse_x, int mouse_y) 231 | { 232 | mouse_y = height-mouse_y; 233 | push_scene(); 234 | bool any = false; 235 | for(int i = 0;!any && i<(int)balls.size();i++) 236 | { 237 | any |= balls[i].hover(mouse_x,mouse_y); 238 | } 239 | pop_scene(); 240 | } 241 | 242 | 243 | int main(int argc,char * argv[]) 244 | { 245 | using namespace igl; 246 | using namespace std; 247 | glutInit(&argc,argv); 248 | glutInitDisplayString( "rgba depth double samples>=8 "); 249 | glutInitWindowSize(glutGet(GLUT_SCREEN_WIDTH),glutGet(GLUT_SCREEN_HEIGHT)/2); 250 | glutCreateWindow(__FILE__); 251 | glutDisplayFunc(display); 252 | glutReshapeFunc(reshape); 253 | glutKeyboardFunc(key); 254 | glutMouseFunc(mouse); 255 | glutMotionFunc(mouse_drag); 256 | glutPassiveMotionFunc(mouse_move); 257 | 258 | //copy(XZ_PLANE_QUAT_D,XZ_PLANE_QUAT_D+4,scene_rot); 259 | 260 | balls.push_back(BeachBall()); 261 | const int children = 10; 262 | for(int i = 1;i<=children;i++) 263 | { 264 | balls.push_back(BeachBall()); 265 | balls[i].t[0] = 2.5*sin(double(i)*2.0*PI/double(children)); 266 | balls[i].t[1] = 2.5*cos(double(i)*2.0*PI/double(children)); 267 | } 268 | BeachBall::scene_rot = scene_rot; 269 | 270 | glutMainLoop(); 271 | return 0; 272 | } 273 | -------------------------------------------------------------------------------- /camera/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: obj example 7 | 8 | .PHONY: example 9 | 10 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) $(GLUT_INC) 11 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) 12 | 13 | CPP_FILES=$(wildcard ./*.cpp) 14 | OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o))) 15 | 16 | CFLAGS+=-std=c++11 -g -O0 17 | 18 | example: obj $(OBJ_FILES) 19 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -o example $(OBJ_FILES) $(LIB) 20 | 21 | obj: 22 | mkdir -p obj 23 | 24 | obj/%.o: %.cpp 25 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 26 | 27 | obj/%.o: %.cpp %.h 28 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 29 | 30 | clean: 31 | rm -f $(OBJ_FILES) 32 | rm -f example 33 | -------------------------------------------------------------------------------- /cmake/FindANTTWEAKBAR.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find AntTweakBar library and include path. 3 | # Once done this will define 4 | # 5 | # ANT_TWEAK_BAR_FOUND 6 | # ANT_TWEAK_BAR_INCLUDE_DIR 7 | # ANT_TWEAK_BAR_LIBRARY 8 | # 9 | 10 | IF (WIN32) 11 | IF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) 12 | SET( BITS "64" ) 13 | ELSE( CMAKE_SIZEOF_VOID_P EQUAL 8 ) 14 | SET( BITS "" ) 15 | ENDIF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) 16 | 17 | FIND_PATH( ANT_TWEAK_BAR_INCLUDE_DIR AntTweakBar.h 18 | PATHS 19 | ${PROJECT_SOURCE_DIR}/../../external/AntTweakBar/include 20 | ${PROJECT_SOURCE_DIR}/../external/AntTweakBar/include 21 | ${PROJECT_SOURCE_DIR}/external/AntTweakBar/include 22 | $ENV{ANT_TWEAK_BAR_ROOT}/include 23 | DOC "The directory where AntTweakBar.h resides") 24 | 25 | FIND_LIBRARY( ANT_TWEAK_BAR_LIBRARY AntTweakBar${BITS} 26 | PATHS 27 | ${PROJECT_SOURCE_DIR}/../../external/AntTweakBar/lib 28 | ${PROJECT_SOURCE_DIR}/../external/AntTweakBar/lib 29 | ${PROJECT_SOURCE_DIR}/external/AntTweakBar/lib 30 | $ENV{ANT_TWEAK_BAR_ROOT}/lib 31 | DOC "The AntTweakBar library") 32 | ELSE (WIN32) 33 | 34 | FIND_PATH(ANT_TWEAK_BAR_INCLUDE_DIR AntTweakBar.h 35 | PATHS 36 | ${LIBIGL_INCLUDE_DIR}/../external/AntTweakBar/include/ 37 | ${PROJECT_SOURCE_DIR}/../../external/AntTweakBar/include/ 38 | ${PROJECT_SOURCE_DIR}/../external/AntTweakBar/include/ 39 | ${PROJECT_SOURCE_DIR}/external/AntTweakBar/include/ 40 | /usr/local/include 41 | /usr/X11/include 42 | /usr/include 43 | NO_DEFAULT_PATH) 44 | 45 | FIND_LIBRARY( ANT_TWEAK_BAR_LIBRARY AntTweakBar 46 | PATHS 47 | ${LIBIGL_INCLUDE_DIR}/../external/AntTweakBar/lib 48 | ${PROJECT_SOURCE_DIR}/../../external/AntTweakBar/lib 49 | ${PROJECT_SOURCE_DIR}/../external/AntTweakBar/lib 50 | ${PROJECT_SOURCE_DIR}/external/AntTweakBar/lib 51 | /usr/local 52 | /usr/X11 53 | /usr 54 | PATH_SUFFIXES 55 | a 56 | lib64 57 | lib 58 | dylib 59 | NO_DEFAULT_PATH 60 | ) 61 | 62 | ENDIF (WIN32) 63 | 64 | 65 | SET(ANTTWEAKBAR_FOUND "NO") 66 | IF (ANT_TWEAK_BAR_INCLUDE_DIR AND ANT_TWEAK_BAR_LIBRARY) 67 | SET(ANTTWEAKBAR_FOUND "YES") 68 | ENDIF (ANT_TWEAK_BAR_INCLUDE_DIR AND ANT_TWEAK_BAR_LIBRARY) 69 | 70 | set(ANT_TWEAK_BAR_INCLUDE_DIR ${ANT_TWEAK_BAR_INCLUDE_DIR} ${ANT_TWEAK_BAR_INCLUDE_DIR}/../src/) 71 | 72 | # message(FATAL_ERROR ${ANT_TWEAK_BAR_LIBRARY}) 73 | 74 | if(ANT_TWEAK_BAR_INCLUDE_DIR AND ANT_TWEAK_BAR_LIBRARY) 75 | message(STATUS "Found ANTTWEAKBAR: ${ANT_TWEAK_BAR_INCLUDE_DIR}") 76 | else(ANT_TWEAK_BAR_INCLUDE_DIR AND ANT_TWEAK_BAR_LIBRARY) 77 | if (NOT ANTTWEAKBAR_FIND_QUIETLY) 78 | message(FATAL_ERROR "could NOT find ANTTWEAKBAR") 79 | endif (NOT ANTTWEAKBAR_FIND_QUIETLY) 80 | 81 | 82 | endif(ANT_TWEAK_BAR_INCLUDE_DIR AND ANT_TWEAK_BAR_LIBRARY) 83 | 84 | FILE(GLOB 85 | ANT_TWEAK_BAR_SOURCES 86 | ${ANT_TWEAK_BAR_INCLUDE_DIR}/../src/*.c 87 | ${ANT_TWEAK_BAR_INCLUDE_DIR}/../src/*.cpp) 88 | -------------------------------------------------------------------------------- /cmake/FindCGAL.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # The following module is based on FindVTK.cmake 3 | # 4 | 5 | # - Find a CGAL installation or binary tree. 6 | # The following variables are set if CGAL is found. If CGAL is not 7 | # found, CGAL_FOUND is set to false. 8 | # 9 | # CGAL_FOUND - Set to true when CGAL is found. 10 | # CGAL_USE_FILE - CMake file to use CGAL. 11 | # 12 | 13 | # Construct consitent error messages for use below. 14 | set(CGAL_DIR_DESCRIPTION "directory containing CGALConfig.cmake. This is either the binary directory where CGAL was configured or PREFIX/lib/CGAL for an installation.") 15 | set(CGAL_DIR_MESSAGE "CGAL not found. Set the CGAL_DIR cmake variable or environment variable to the ${CGAL_DIR_DESCRIPTION}") 16 | 17 | set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) 18 | 19 | if ( NOT CGAL_DIR ) 20 | 21 | # Get the system search path as a list. 22 | if(UNIX) 23 | string(REGEX MATCHALL "[^:]+" CGAL_DIR_SEARCH1 "$ENV{PATH}") 24 | else() 25 | string(REGEX REPLACE "\\\\" "/" CGAL_DIR_SEARCH1 "$ENV{PATH}") 26 | endif() 27 | 28 | string(REGEX REPLACE "/;" ";" CGAL_DIR_SEARCH2 "${CGAL_DIR_SEARCH1}") 29 | 30 | # Construct a set of paths relative to the system search path. 31 | set(CGAL_DIR_SEARCH "") 32 | 33 | foreach(dir ${CGAL_DIR_SEARCH2}) 34 | 35 | set(CGAL_DIR_SEARCH ${CGAL_DIR_SEARCH} ${dir}/../lib/CGAL ) 36 | 37 | endforeach() 38 | 39 | 40 | # 41 | # Look for an installation or build tree. 42 | # 43 | find_path(CGAL_DIR CGALConfig.cmake 44 | 45 | # Look for an environment variable CGAL_DIR. 46 | $ENV{CGAL_DIR} 47 | 48 | # Look in places relative to the system executable search path. 49 | ${CGAL_DIR_SEARCH} 50 | 51 | # Look in standard UNIX install locations. 52 | /opt/local/share/CGAL/cmake 53 | /usr/local/lib/CGAL 54 | /usr/lib/CGAL 55 | 56 | # Read from the CMakeSetup registry entries. It is likely that 57 | # CGAL will have been recently built. 58 | [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1] 59 | [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2] 60 | [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3] 61 | [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4] 62 | [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5] 63 | [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6] 64 | [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7] 65 | [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8] 66 | [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9] 67 | [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10] 68 | 69 | # Help the user find it if we cannot. 70 | DOC "The ${CGAL_DIR_DESCRIPTION}" 71 | ) 72 | 73 | endif() 74 | 75 | if ( CGAL_DIR ) 76 | 77 | if ( EXISTS "${CGAL_DIR}/CGALConfig.cmake" ) 78 | include( "${CGAL_DIR}/CGALConfig.cmake" ) 79 | set( CGAL_FOUND TRUE ) 80 | endif() 81 | 82 | endif() 83 | 84 | if(CGAL_FOUND) 85 | MESSAGE(STATUS "Found CGAL: ${CGAL_DIR}") 86 | else() 87 | if(CGAL_FIND_REQUIRED) 88 | MESSAGE(FATAL_ERROR ${CGAL_DIR_MESSAGE}) 89 | else() 90 | if(NOT CGAL_FIND_QUIETLY) 91 | MESSAGE(STATUS ${CGAL_DIR_MESSAGE}) 92 | endif() 93 | endif() 94 | endif() 95 | -------------------------------------------------------------------------------- /cmake/FindCORK.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find CORK library and include path. 3 | # Once done this will define 4 | # 5 | # CORK_FOUND 6 | # CORK_INCLUDE_DIR 7 | # CORK_LIBRARIES 8 | # 9 | 10 | if(NOT CORK_FOUND) 11 | 12 | FIND_PATH(CORK_INCLUDE_DIR cork.h 13 | PATHS 14 | ${PROJECT_SOURCE_DIR}/../../external/cork/include 15 | ${PROJECT_SOURCE_DIR}/../external/cork/include 16 | ${PROJECT_SOURCE_DIR}/external/cork/include 17 | /usr/local/include 18 | /usr/X11/include 19 | /usr/include 20 | /opt/local/include 21 | NO_DEFAULT_PATH 22 | ) 23 | 24 | FIND_LIBRARY( CORK_LIBRARIES NAMES cork 25 | PATHS 26 | ${PROJECT_SOURCE_DIR}/../../external/cork/lib/ 27 | ${PROJECT_SOURCE_DIR}/../external/cork/lib/ 28 | ${PROJECT_SOURCE_DIR}/external/cork/lib/ 29 | /usr/local 30 | /usr/X11 31 | /usr 32 | PATH_SUFFIXES 33 | a 34 | lib64 35 | lib 36 | NO_DEFAULT_PATH 37 | ) 38 | 39 | SET(CORK_FOUND "NO") 40 | IF (CORK_INCLUDE_DIR AND CORK_LIBRARIES) 41 | SET(CORK_FOUND "YES") 42 | ENDIF (CORK_INCLUDE_DIR AND CORK_LIBRARIES) 43 | 44 | if(CORK_FOUND) 45 | message(STATUS "Found CORK: ${CORK_INCLUDE_DIR}") 46 | else(CORK_FOUND) 47 | if (NOT CORK_FIND_QUIETLY) 48 | message(FATAL_ERROR "could NOT find CORK") 49 | endif (NOT CORK_FIND_QUIETLY) 50 | endif(CORK_FOUND) 51 | 52 | endif(NOT CORK_FOUND) 53 | -------------------------------------------------------------------------------- /cmake/FindEIGEN.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find Eigen3 lib 2 | # 3 | # This module supports requiring a minimum version, e.g. you can do 4 | # find_package(Eigen3 3.1.2) 5 | # to require version 3.1.2 or newer of Eigen3. 6 | # 7 | # Once done this will define 8 | # 9 | # EIGEN_FOUND - system has eigen lib with correct version 10 | # EIGEN_INCLUDE_DIR - the eigen include directory 11 | # EIGEN_VERSION - eigen version 12 | 13 | # Copyright (c) 2006, 2007 Montel Laurent, 14 | # Copyright (c) 2008, 2009 Gael Guennebaud, 15 | # Copyright (c) 2009 Benoit Jacob 16 | # Redistribution and use is allowed according to the terms of the 2-clause BSD license. 17 | 18 | if(NOT Eigen_FIND_VERSION) 19 | if(NOT Eigen_FIND_VERSION_MAJOR) 20 | set(Eigen_FIND_VERSION_MAJOR 3) 21 | endif(NOT Eigen_FIND_VERSION_MAJOR) 22 | if(NOT Eigen_FIND_VERSION_MINOR) 23 | set(Eigen_FIND_VERSION_MINOR 2) 24 | endif(NOT Eigen_FIND_VERSION_MINOR) 25 | if(NOT Eigen_FIND_VERSION_PATCH) 26 | set(Eigen_FIND_VERSION_PATCH 0) 27 | endif(NOT Eigen_FIND_VERSION_PATCH) 28 | 29 | set(Eigen_FIND_VERSION "${Eigen_FIND_VERSION_MAJOR}.${Eigen_FIND_VERSION_MINOR}.${Eigen_FIND_VERSION_PATCH}") 30 | endif(NOT Eigen_FIND_VERSION) 31 | 32 | macro(_eigen3_check_version) 33 | file(READ "${EIGEN_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header) 34 | 35 | string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}") 36 | set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}") 37 | string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}") 38 | set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}") 39 | string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}") 40 | set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}") 41 | 42 | set(EIGEN_VERSION ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}) 43 | if(${EIGEN_VERSION} VERSION_LESS ${Eigen_FIND_VERSION}) 44 | set(EIGEN_VERSION_OK FALSE) 45 | else(${EIGEN_VERSION} VERSION_LESS ${Eigen_FIND_VERSION}) 46 | set(EIGEN_VERSION_OK TRUE) 47 | endif(${EIGEN_VERSION} VERSION_LESS ${Eigen_FIND_VERSION}) 48 | 49 | if(NOT EIGEN_VERSION_OK) 50 | 51 | message(STATUS "Eigen version ${EIGEN_VERSION} found in ${EIGEN_INCLUDE_DIR}, " 52 | "but at least version ${Eigen_FIND_VERSION} is required") 53 | endif(NOT EIGEN_VERSION_OK) 54 | endmacro(_eigen3_check_version) 55 | 56 | if (EIGEN_INCLUDE_DIRS) 57 | 58 | # in cache already 59 | _eigen3_check_version() 60 | set(EIGEN_FOUND ${EIGEN_VERSION_OK}) 61 | 62 | else () 63 | 64 | find_path(EIGEN_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library 65 | PATHS 66 | ${CMAKE_INSTALL_PREFIX}/include 67 | ${KDE4_INCLUDE_DIR} 68 | ${PROJECT_SOURCE_DIR}/../../../Eigen 69 | ${PROJECT_SOURCE_DIR}/../../../external/nanogui/ext/eigen/ 70 | ${PROJECT_SOURCE_DIR}/../../external/nanogui/ext/eigen/ 71 | ${PROJECT_SOURCE_DIR}/../external/nanogui/ext/eigen/ 72 | ${PROJECT_SOURCE_DIR}/../libigl/external/nanogui/ext/eigen/ 73 | ${PROJECT_SOURCE_DIR}/../../libigl/external/nanogui/ext/eigen/ 74 | ${PROJECT_SOURCE_DIR}/../../../libigl/external/nanogui/ext/eigen/ 75 | $ENV{DevLibraries}/Eigen 76 | PATH_SUFFIXES eigen3 eigen 77 | ) 78 | 79 | if(EIGEN_INCLUDE_DIR) 80 | _eigen3_check_version() 81 | endif(EIGEN_INCLUDE_DIR) 82 | 83 | include(FindPackageHandleStandardArgs) 84 | find_package_handle_standard_args(Eigen DEFAULT_MSG EIGEN_INCLUDE_DIR EIGEN_VERSION_OK) 85 | 86 | mark_as_advanced(EIGEN_INCLUDE_DIR) 87 | SET(EIGEN_INCLUDE_DIRS ${EIGEN_INCLUDE_DIR} CACHE PATH "The Eigen include path.") 88 | 89 | endif() 90 | -------------------------------------------------------------------------------- /cmake/FindEMBREE.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find EMBREE 3 | # Once done this will define 4 | # 5 | # EMBREE_FOUND - system has EMBREE 6 | # EMBREE_INCLUDE_DIRS - the EMBREE include directories 7 | # EMBREE_LIBRARIES - Link these to use EMBREE 8 | # 9 | 10 | FIND_PATH(EMBREE_INCLUDE_DIR embree2/rtcore.h 11 | PATHS 12 | ${LIBIGL_INCLUDE_DIR}/../external/embree/include 13 | ${PROJECT_SOURCE_DIR}/../../external/embree/include 14 | ${PROJECT_SOURCE_DIR}/../external/embree/include 15 | ${PROJECT_SOURCE_DIR}/../libigl/external/embree/include 16 | NO_DEFAULT_PATH 17 | ) 18 | 19 | #message(FATAL_ERROR ${PROJECT_SOURCE_DIR}/../libigl/external/embree) 20 | #message(FATAL_ERROR ${EMBREE_INCLUDE_DIR}) 21 | 22 | SET(SEARCH_PATHS "${EMBREE_INCLUDE_DIR}/../" "${EMBREE_INCLUDE_DIR}/../build" "${EMBREE_INCLUDE_DIR}/../lib") 23 | 24 | FIND_LIBRARY(EMBREE_CORE_LIBRARY NAMES simd PATHS ${SEARCH_PATHS} PATH_SUFFIXES a lib) 25 | FIND_LIBRARY(EMBREE_CORE_LIBRARY3 NAMES embree_sse41 PATHS ${SEARCH_PATHS} PATH_SUFFIXES a lib) 26 | FIND_LIBRARY(EMBREE_CORE_LIBRARY4 NAMES embree_sse42 PATHS ${SEARCH_PATHS} PATH_SUFFIXES a lib) 27 | FIND_LIBRARY(EMBREE_CORE_LIBRARY5 NAMES transport PATHS ${SEARCH_PATHS} PATH_SUFFIXES a lib) 28 | FIND_LIBRARY(EMBREE_CORE_LIBRARY6 NAMES image PATHS ${SEARCH_PATHS} PATH_SUFFIXES a lib) 29 | FIND_LIBRARY(EMBREE_CORE_LIBRARY7 NAMES lexers PATHS ${SEARCH_PATHS} PATH_SUFFIXES a lib) 30 | FIND_LIBRARY(EMBREE_CORE_LIBRARY8 NAMES embree PATHS ${SEARCH_PATHS} PATH_SUFFIXES dylib a lib) 31 | FIND_LIBRARY(EMBREE_CORE_LIBRARY9 NAMES sys PATHS ${SEARCH_PATHS} PATH_SUFFIXES a lib) 32 | 33 | if(EMBREE_CORE_LIBRARY AND EMBREE_INCLUDE_DIR) 34 | set(EMBREE_FOUND TRUE) 35 | endif(EMBREE_CORE_LIBRARY AND EMBREE_INCLUDE_DIR) 36 | 37 | IF (EMBREE_FOUND) 38 | message(STATUS "Found EMBREE: ${EMBREE_INCLUDE_DIR}") 39 | 40 | SET(EMBREE_LIBRARIES 41 | "${EMBREE_CORE_LIBRARY}" 42 | "${EMBREE_CORE_LIBRARY3}" 43 | "${EMBREE_CORE_LIBRARY4}" 44 | "${EMBREE_CORE_LIBRARY5}" 45 | "${EMBREE_CORE_LIBRARY6}" 46 | "${EMBREE_CORE_LIBRARY7}" 47 | "${EMBREE_CORE_LIBRARY8}" 48 | "${EMBREE_CORE_LIBRARY9}" 49 | ) 50 | SET(EMBREE_INCLUDE_DIRS ${EMBREE_INCLUDE_DIR} ${EMBREE_INCLUDE_DIR}/embree) 51 | ELSE (EMBREE_FOUND) 52 | message(STATUS "could NOT find EMBREE") 53 | ENDIF (EMBREE_FOUND) 54 | -------------------------------------------------------------------------------- /cmake/FindEMBREEH.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find EMBREE header files 3 | # Once done this will define 4 | # 5 | # EMBREE_FOUND - system has EMBREE 6 | # EMBREE_INCLUDE_DIRS - the EMBREE include directories 7 | 8 | FIND_PATH(EMBREE_INCLUDE_DIR embree2/rtcore.h 9 | PATHS 10 | ${PROJECT_SOURCE_DIR}/../../external/embree/include 11 | ${PROJECT_SOURCE_DIR}/../external/embree/include 12 | ${PROJECT_SOURCE_DIR}/../libigl/external/embree/include 13 | NO_DEFAULT_PATH 14 | ) 15 | 16 | if(EMBREE_INCLUDE_DIR) 17 | set(EMBREE_FOUND TRUE) 18 | endif(EMBREE_INCLUDE_DIR) 19 | 20 | IF (EMBREE_FOUND) 21 | message(STATUS "Found EMBREE: ${EMBREE_INCLUDE_DIR}") 22 | 23 | SET(EMBREE_INCLUDE_DIRS ${EMBREE_INCLUDE_DIR} ${EMBREE_INCLUDE_DIR}/embree) 24 | ELSE (EMBREE_FOUND) 25 | message(STATUS "could NOT find EMBREE") 26 | ENDIF (EMBREE_FOUND) 27 | -------------------------------------------------------------------------------- /cmake/FindGLEW.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the GLEW library 2 | # Once done this will define 3 | # 4 | # GLEW_FOUND - system has GLEW 5 | # GLEW_INCLUDE_DIR - the GLEW include directory 6 | # GLEW_SOURCES - the GLEW source file list 7 | 8 | FIND_PATH(GLEW_INCLUDE_DIR GL/glew.h 9 | ${PROJECT_SOURCE_DIR}/../../../external/nanogui/ext/glew/include 10 | ${PROJECT_SOURCE_DIR}/../../external/nanogui/ext/glew/include 11 | ${PROJECT_SOURCE_DIR}/../external/nanogui/ext/glew/include 12 | ${PROJECT_SOURCE_DIR}/external/nanogui/ext/glew/include 13 | ${PROJECT_SOURCE_DIR}/../../../libigl/external/nanogui/ext/glew/include 14 | ${PROJECT_SOURCE_DIR}/../../libigl/external/nanogui/ext/glew/include 15 | ${PROJECT_SOURCE_DIR}/../libigl/external/nanogui/ext/glew/include 16 | ${PROJECT_SOURCE_DIR}/libigl/external/nanogui/ext/glew/include 17 | /usr/include 18 | /usr/local/include 19 | $ENV{GLEWROOT}/include 20 | $ENV{GLEW_ROOT}/include 21 | $ENV{GLEW_DIR}/include 22 | $ENV{GLEW_DIR}/inc 23 | [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC]/PlatformSDK/Include 24 | NO_DEFAULT_PATH 25 | ) 26 | 27 | if(GLEW_INCLUDE_DIR) 28 | set(GLEW_FOUND TRUE) 29 | endif(GLEW_INCLUDE_DIR) 30 | 31 | if(GLEW_FOUND) 32 | set(GLEW_SOURCES ${GLEW_INCLUDE_DIR}/../src/glew.c) 33 | message(STATUS "Found GLEW: ${GLEW_INCLUDE_DIR}") 34 | else(GLEW_FOUND) 35 | message(WARNING "could NOT find glew") 36 | endif(GLEW_FOUND) 37 | 38 | MARK_AS_ADVANCED(GLEW_INCLUDE_DIR) 39 | -------------------------------------------------------------------------------- /cmake/FindGLFW.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find GLFW library and include path. 3 | # Once done this will define 4 | # 5 | # GLFW_FOUND 6 | # GLFW_INCLUDE_DIR 7 | # GLFW_LIBRARIES 8 | # 9 | 10 | if(NOT GLFW_FOUND) 11 | 12 | FIND_PATH(GLFW_INCLUDE_DIR GLFW/glfw3.h 13 | PATHS 14 | ${PROJECT_SOURCE_DIR}/../../external/glfw/include 15 | ${PROJECT_SOURCE_DIR}/../external/glfw/include 16 | ${PROJECT_SOURCE_DIR}/external/glfw/include 17 | ${PROJECT_SOURCE_DIR}/../../libigl/external/glfw/include 18 | ${PROJECT_SOURCE_DIR}/../libigl/external/glfw/include 19 | ${PROJECT_SOURCE_DIR}/libigl/external/glfw/include 20 | ${PROJECT_SOURCE_DIR}/../../libigl/external/nanogui/ext/glfw/include 21 | ${PROJECT_SOURCE_DIR}/../libigl/external/nanogui/ext/glfw/include 22 | ${PROJECT_SOURCE_DIR}/libigl/external/nanogui/ext/glfw/include 23 | /usr/local/include 24 | /usr/X11/include 25 | /usr/include 26 | /opt/local/include 27 | NO_DEFAULT_PATH 28 | ) 29 | 30 | FIND_LIBRARY( GLFW_LIBRARIES NAMES glfw glfw3 31 | PATHS 32 | ${PROJECT_SOURCE_DIR}/../../external/glfw/src 33 | ${PROJECT_SOURCE_DIR}/../external/glfw/src 34 | ${PROJECT_SOURCE_DIR}/external/glfw/src 35 | ${PROJECT_SOURCE_DIR}/../../libigl/external/glfw/src 36 | ${PROJECT_SOURCE_DIR}/../libigl/external/glfw/src 37 | ${PROJECT_SOURCE_DIR}/libigl/external/glfw/src 38 | ${PROJECT_SOURCE_DIR}/../../external/glfw/lib/x64 39 | ${PROJECT_SOURCE_DIR}/../external/glfw/lib/x64 40 | ${PROJECT_SOURCE_DIR}/external/glfw/lib/x64 41 | ${PROJECT_SOURCE_DIR}/../../libigl/external/glfw/lib/x64 42 | ${PROJECT_SOURCE_DIR}/../libigl/external/glfw/lib/x64 43 | ${PROJECT_SOURCE_DIR}/libigl/external/glfw/lib/x64 44 | /usr/local 45 | /usr/X11 46 | /usr 47 | PATH_SUFFIXES 48 | a 49 | lib64 50 | lib 51 | NO_DEFAULT_PATH 52 | ) 53 | 54 | SET(GLFW_FOUND "NO") 55 | IF (GLFW_INCLUDE_DIR AND GLFW_LIBRARIES) 56 | SET(GLFW_FOUND "YES") 57 | ENDIF (GLFW_INCLUDE_DIR AND GLFW_LIBRARIES) 58 | 59 | if(GLFW_FOUND) 60 | message(STATUS "Found GLFW: ${GLFW_INCLUDE_DIR}") 61 | else(GLFW_FOUND) 62 | if (NOT GLFW_FIND_QUIETLY) 63 | message(FATAL_ERROR "could NOT find GLFW") 64 | endif (NOT GLFW_FIND_QUIETLY) 65 | endif(GLFW_FOUND) 66 | 67 | endif(NOT GLFW_FOUND) 68 | -------------------------------------------------------------------------------- /cmake/FindGLFWH.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find GLFW library and include path. 3 | # Once done this will define 4 | # 5 | # GLFW_FOUND 6 | # GLFW_INCLUDE_DIR 7 | # GLFW_LIBRARIES 8 | # 9 | 10 | if(NOT GLFW_FOUND) 11 | 12 | FIND_PATH(GLFW_INCLUDE_DIR GLFW/glfw3.h 13 | PATHS 14 | ${PROJECT_SOURCE_DIR}/../../external/glfw/include 15 | ${PROJECT_SOURCE_DIR}/../external/glfw/include 16 | ${PROJECT_SOURCE_DIR}/external/glfw/include 17 | ${PROJECT_SOURCE_DIR}/../../libigl/external/glfw/include 18 | ${PROJECT_SOURCE_DIR}/../libigl/external/glfw/include 19 | ${PROJECT_SOURCE_DIR}/libigl/external/glfw/include 20 | ${PROJECT_SOURCE_DIR}/../../../libigl/external/nanogui/ext/glfw/include 21 | ${PROJECT_SOURCE_DIR}/../../libigl/external/nanogui/ext/glfw/include 22 | ${PROJECT_SOURCE_DIR}/../libigl/external/nanogui/ext/glfw/include 23 | ${PROJECT_SOURCE_DIR}/libigl/external/nanogui/ext/glfw/include 24 | /usr/local/include 25 | /usr/X11/include 26 | /usr/include 27 | /opt/local/include 28 | NO_DEFAULT_PATH 29 | ) 30 | 31 | SET(GLFW_FOUND "NO") 32 | IF (GLFW_INCLUDE_DIR) 33 | SET(GLFW_FOUND "YES") 34 | ENDIF (GLFW_INCLUDE_DIR) 35 | 36 | if(GLFW_FOUND) 37 | message(STATUS "Found GLFW: ${GLFW_INCLUDE_DIR} -- HEADERS ONLY") 38 | else(GLFW_FOUND) 39 | if (NOT GLFW_FIND_QUIETLY) 40 | message(WARNING "could NOT find GLFW") 41 | endif (NOT GLFW_FIND_QUIETLY) 42 | endif(GLFW_FOUND) 43 | 44 | endif(NOT GLFW_FOUND) 45 | -------------------------------------------------------------------------------- /cmake/FindLIBCOMISO.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the LIBCOMISO library 2 | # Once done this will define 3 | # 4 | # LIBCOMISO_FOUND - system has LIBCOMISO 5 | # LIBCOMISO_INCLUDE_DIR - the LIBCOMISO include directory 6 | # LIBCOMISO_LIBRARY - the LIBCOMISO binary lib 7 | 8 | FIND_PATH(LIBCOMISO_INCLUDE_DIR CoMISo/Solver/ConstrainedSolver.hh 9 | /usr/include 10 | /usr/local/include 11 | $ENV{LIBCOMISOROOT}/include 12 | $ENV{LIBCOMISO_ROOT}/include 13 | $ENV{LIBCOMISO_DIR}/include 14 | $ENV{LIBCOMISO_DIR}/inc 15 | ${PROJECT_SOURCE_DIR}/../ 16 | ${PROJECT_SOURCE_DIR}/../../ 17 | ${PROJECT_SOURCE_DIR}/../../../ 18 | ${PROJECT_SOURCE_DIR}/../CoMISo/ 19 | ${PROJECT_SOURCE_DIR}/../CoMISo/include 20 | ${PROJECT_SOURCE_DIR}/../../CoMISo/ 21 | ${PROJECT_SOURCE_DIR}/../../CoMISo/include 22 | /Users/daniele/Dropbox/igl/MIQ/src 23 | /Users/olkido/Documents/igl/MIQ/src 24 | ) 25 | 26 | #message(FATAL_ERROR "${LIBCOMISO_INCLUDE_DIR}") 27 | 28 | FIND_LIBRARY(LIBCOMISO_LIBRARY NAMES CoMISo 29 | PATHS 30 | #/usr/local 31 | /usr/X11 32 | /usr 33 | / 34 | ${PROJECT_SOURCE_DIR}/../CoMISo/ 35 | ${PROJECT_SOURCE_DIR}/../CoMISo/build/Build/lib/CoMISo/ 36 | ${PROJECT_SOURCE_DIR}/../../CoMISo/ 37 | ${PROJECT_SOURCE_DIR}/../../CoMISo/build/Build/lib/CoMISo/ 38 | ${PROJECT_SOURCE_DIR}/../../../CoMISo/ 39 | ${PROJECT_SOURCE_DIR}/../../../CoMISo/build/Build/lib/CoMISo/ 40 | /Users/olkido/Documents/igl/MIQ/src/CoMISo/Build 41 | /usr/local/lib 42 | /usr/local/lib/CoMISo 43 | /usr/lib 44 | /usr/lib/CoMISo 45 | ) 46 | #message(STATUS "${LIBCOMISO_LIBRARY}") 47 | 48 | SET(LIBCOMISO_FOUND "NO") 49 | IF (COMISO_INCLUDE_DIR AND LIBCOMISO_LIBRARY) 50 | SET(LIBCOMISO_FOUND "YES") 51 | ENDIF (COMISO_INCLUDE_DIR AND LIBCOMISO_LIBRARY) 52 | 53 | 54 | 55 | if(LIBCOMISO_INCLUDE_DIR AND LIBCOMISO_LIBRARY) 56 | 57 | #message("${LIBCOMISO_INCLUDE_DIR}") 58 | 59 | set(LIBCOMISO_INCLUDE_DIRS 60 | ${LIBCOMISO_INCLUDE_DIR} 61 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo 62 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo/Solver 63 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo/EigenSolver 64 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo/NSolver 65 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo/Config 66 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo/Utils 67 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo/QtWidgets 68 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo/gmm/include 69 | ) 70 | 71 | #message("${LIBCOMISO_INCLUDE_DIRS}") 72 | 73 | set(LIBCOMISO_INCLUDE_DIR ${LIBCOMISO_INCLUDE_DIR}) 74 | 75 | add_definitions(-DINCLUDE_TEMPLATES) 76 | message(STATUS "Found LIBCOMISO: ${LIBCOMISO_INCLUDE_DIR} ${LIBCOMISO_LIBRARY}") 77 | set(LIBCOMISO_FOUND TRUE) 78 | else(LIBCOMISO_INCLUDE_DIR) 79 | if (NOT LIBCOMISO_FIND_QUIETLY) 80 | message(FATAL_ERROR "could NOT find LIBCOMISO") 81 | endif (NOT LIBCOMISO_FIND_QUIETLY) 82 | 83 | endif(LIBCOMISO_INCLUDE_DIR AND LIBCOMISO_LIBRARY) 84 | -------------------------------------------------------------------------------- /cmake/FindLIBCOMISOH.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the LIBCOMISO library 2 | # Once done this will define 3 | # 4 | # LIBCOMISO_FOUND - system has LIBCOMISO 5 | # LIBCOMISO_INCLUDE_DIR - the LIBCOMISO include directory 6 | # LIBCOMISO_LIBRARY - the LIBCOMISO binary lib 7 | 8 | FIND_PATH(LIBCOMISO_INCLUDE_DIR CoMISo/Solver/ConstrainedSolver.hh 9 | /usr/include 10 | /usr/local/include 11 | $ENV{LIBCOMISOROOT}/include 12 | $ENV{LIBCOMISO_ROOT}/include 13 | $ENV{LIBCOMISO_DIR}/include 14 | $ENV{LIBCOMISO_DIR}/inc 15 | ${PROJECT_SOURCE_DIR}/../ 16 | ${PROJECT_SOURCE_DIR}/../../ 17 | ${PROJECT_SOURCE_DIR}/../../../ 18 | ${PROJECT_SOURCE_DIR}/../CoMISo/ 19 | ${PROJECT_SOURCE_DIR}/../CoMISo/include 20 | ${PROJECT_SOURCE_DIR}/../../CoMISo/ 21 | ${PROJECT_SOURCE_DIR}/../../CoMISo/include 22 | ${PROJECT_SOURCE_DIR}/../external 23 | ${PROJECT_SOURCE_DIR}/../../external 24 | ${PROJECT_SOURCE_DIR}/../../../external 25 | ) 26 | 27 | SET(LIBCOMISO_FOUND "NO") 28 | IF (COMISO_INCLUDE_DIR) 29 | SET(LIBCOMISO_FOUND "YES") 30 | ENDIF (COMISO_INCLUDE_DIR) 31 | 32 | 33 | 34 | if(LIBCOMISO_INCLUDE_DIR) 35 | 36 | #message("${LIBCOMISO_INCLUDE_DIR}") 37 | 38 | set(LIBCOMISO_INCLUDE_DIRS 39 | ${LIBCOMISO_INCLUDE_DIR} 40 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo 41 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo/Solver 42 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo/EigenSolver 43 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo/NSolver 44 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo/Config 45 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo/Utils 46 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo/QtWidgets 47 | ${LIBCOMISO_INCLUDE_DIR}/CoMISo/ext/gmm-4.2/include 48 | ) 49 | 50 | #message("${LIBCOMISO_INCLUDE_DIRS}") 51 | 52 | set(LIBCOMISO_INCLUDE_DIR ${LIBCOMISO_INCLUDE_DIR}) 53 | 54 | add_definitions(-DINCLUDE_TEMPLATES) 55 | message(STATUS "Found LIBCOMISO: ${LIBCOMISO_INCLUDE_DIR}") 56 | set(LIBCOMISO_FOUND TRUE) 57 | else(LIBCOMISO_INCLUDE_DIR) 58 | if (NOT LIBCOMISOH_FIND_QUIETLY) 59 | message(FATAL_ERROR "could NOT find LIBCOMISO") 60 | endif (NOT LIBCOMISOH_FIND_QUIETLY) 61 | 62 | endif(LIBCOMISO_INCLUDE_DIR) 63 | -------------------------------------------------------------------------------- /cmake/FindLIBIGL.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the LIBIGL library 2 | # Once done this will define 3 | # 4 | # LIBIGL_FOUND - system has LIBIGL 5 | # LIBIGL_INCLUDE_DIR - **the** LIBIGL include directory 6 | # LIBIGL_INCLUDE_DIRS - LIBIGL include directories 7 | # LIBIGL_SOURCES - the LIBIGL source files 8 | if(NOT LIBIGL_FOUND) 9 | 10 | FIND_PATH(LIBIGL_INCLUDE_DIR igl/readOBJ.h 11 | ${PROJECT_SOURCE_DIR}/../../include 12 | ${PROJECT_SOURCE_DIR}/../include 13 | ${PROJECT_SOURCE_DIR}/include 14 | ${PROJECT_SOURCE_DIR}/../libigl/include 15 | ${PROJECT_SOURCE_DIR}/../../libigl/include 16 | $ENV{LIBIGL}/include 17 | $ENV{LIBIGLROOT}/include 18 | $ENV{LIBIGL_ROOT}/include 19 | $ENV{LIBIGL_DIR}/include 20 | $ENV{LIBIGL_DIR}/inc 21 | /usr/include 22 | /usr/local/include 23 | /usr/local/igl/libigl/include 24 | ) 25 | 26 | 27 | if(LIBIGL_INCLUDE_DIR) 28 | set(LIBIGL_FOUND TRUE) 29 | set(LIBIGL_INCLUDE_DIRS ${LIBIGL_INCLUDE_DIR} ${LIBIGL_INCLUDE_DIR}/../external/Singular_Value_Decomposition) 30 | #set(LIBIGL_SOURCES 31 | # ${LIBIGL_INCLUDE_DIR}/igl/viewer/Viewer.cpp 32 | #) 33 | endif(LIBIGL_INCLUDE_DIR) 34 | 35 | if(LIBIGL_USE_STATIC_LIBRARY) 36 | add_definitions(-DIGL_STATIC_LIBRARY) 37 | set(LIBIGL_LIB_DIRS 38 | ${CMAKE_BINARY_DIR}/ 39 | ${PROJECT_SOURCE_DIR}/../../lib 40 | ${PROJECT_SOURCE_DIR}/../lib 41 | ${PROJECT_SOURCE_DIR}/lib 42 | ${PROJECT_SOURCE_DIR}/../../libigl/lib 43 | ${PROJECT_SOURCE_DIR}/../libigl/lib 44 | $ENV{LIBIGL}/lib 45 | $ENV{LIBIGLROOT}/lib 46 | $ENV{LIBIGL_ROOT}/lib 47 | $ENV{LIBIGL_DIR}/lib 48 | /usr/lib 49 | /usr/local/lib) 50 | FIND_LIBRARY( LIBIGL_LIBRARY NAMES igl PATHS ${LIBIGL_LIB_DIRS}) 51 | 52 | # try to find pre-requisites 53 | find_package(CORK QUIET) 54 | find_package(CGAL QUIET) 55 | find_package(EMBREE QUIET) 56 | find_package(LIBCOMISO QUIET) 57 | find_package(MATLAB QUIET) 58 | find_package(MOSEK QUIET) 59 | find_package(TETGEN QUIET) 60 | find_package(TINYXML2 QUIET) 61 | find_package(TRIANGLE QUIET) 62 | 63 | # Main library must be found 64 | if(NOT LIBIGL_LIBRARY) 65 | set(LIBIGL_FOUND FALSE) 66 | message(FATAL_ERROR "could NOT find libigl") 67 | endif(NOT LIBIGL_LIBRARY) 68 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGL_LIBRARY}) 69 | 70 | FIND_LIBRARY( LIBIGLANTTWEAKBAR_LIBRARY NAMES iglanttweakbar PATHS ${LIBIGL_LIB_DIRS}) 71 | if(NOT LIBIGLANTTWEAKBAR_LIBRARY) 72 | set(LIBIGL_FOUND FALSE) 73 | message(FATAL_ERROR "could NOT find libiglanttweakbar") 74 | endif(NOT LIBIGLANTTWEAKBAR_LIBRARY) 75 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLANTTWEAKBAR_LIBRARY}) 76 | 77 | # libiglbbw will work with/without mosek 78 | FIND_LIBRARY( LIBIGLBBW_LIBRARY NAMES iglbbw PATHS ${LIBIGL_LIB_DIRS}) 79 | if(NOT LIBIGLBBW_LIBRARY) 80 | set(LIBIGL_FOUND FALSE) 81 | message(FATAL_ERROR "could NOT find libiglbbw") 82 | endif(NOT LIBIGLBBW_LIBRARY) 83 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLBBW_LIBRARY}) 84 | 85 | if(LIBCOMISO_FOUND) 86 | FIND_LIBRARY(LIBIGLCOMISO_LIBRARY NAMES iglcomiso PATHS ${LIBIGL_LIB_DIRS}) 87 | if(NOT LIBIGLCOMISO_LIBRARY) 88 | set(LIBIGL_FOUND FALSE) 89 | message(FATAL_ERROR "could NOT find libiglcomiso") 90 | endif(NOT LIBIGLCOMISO_LIBRARY) 91 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLCOMISO_LIBRARY}) 92 | endif(LIBCOMISO_FOUND) 93 | 94 | if(CGAL_FOUND) 95 | 96 | FIND_LIBRARY( LIBIGLCGAL_LIBRARY NAMES iglcgal PATHS ${LIBIGL_LIB_DIRS}) 97 | if(NOT LIBIGLCGAL_LIBRARY) 98 | set(LIBIGL_FOUND FALSE) 99 | message(FATAL_ERROR "could NOT find libiglcgal") 100 | endif(NOT LIBIGLCGAL_LIBRARY) 101 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLCGAL_LIBRARY}) 102 | endif(CGAL_FOUND) 103 | 104 | if(EMBREE_FOUND) 105 | FIND_LIBRARY( LIBIGLEMBREE_LIBRARY NAMES iglembree PATHS ${LIBIGL_LIB_DIRS}) 106 | if(NOT LIBIGLEMBREE_LIBRARY) 107 | set(LIBIGL_FOUND FALSE) 108 | message(FATAL_ERROR "could NOT find libiglembree") 109 | endif(NOT LIBIGLEMBREE_LIBRARY) 110 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLEMBREE_LIBRARY}) 111 | endif(EMBREE_FOUND) 112 | 113 | if(LIM_FOUND) 114 | FIND_LIBRARY( LIBIGLLIM_LIBRARY NAMES igllim PATHS ${LIBIGL_LIB_DIRS}) 115 | if(NOT LIBIGLLIM_LIBRARY) 116 | set(LIBIGL_FOUND FALSE) 117 | message(FATAL_ERROR "could NOT find libigllim") 118 | endif(NOT LIBIGLLIM_LIBRARY) 119 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLLIM_LIBRARY}) 120 | endif(LIM_FOUND) 121 | 122 | if(MATLAB_FOUND) 123 | FIND_LIBRARY( LIBIGLMATLAB_LIBRARY NAMES iglmatlab PATHS ${LIBIGL_LIB_DIRS}) 124 | if(NOT LIBIGLMATLAB_LIBRARY) 125 | set(LIBIGL_FOUND FALSE) 126 | message(FATAL_ERROR "could NOT find libiglmatlab") 127 | endif(NOT LIBIGLMATLAB_LIBRARY) 128 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLMATLAB_LIBRARY}) 129 | endif(MATLAB_FOUND) 130 | 131 | # mosek support should be determined before trying to find bbw 132 | if(MOSEK_FOUND) 133 | FIND_LIBRARY( LIBIGLMOSEK_LIBRARY NAMES iglmosek PATHS ${LIBIGL_LIB_DIRS}) 134 | if(NOT LIBIGLMOSEK_LIBRARY) 135 | set(LIBIGL_FOUND FALSE) 136 | message(FATAL_ERROR "could NOT find libiglmosek") 137 | endif(NOT LIBIGLMOSEK_LIBRARY) 138 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLMOSEK_LIBRARY}) 139 | endif(MOSEK_FOUND) 140 | 141 | FIND_LIBRARY( LIBIGLOPENGL_LIBRARY NAMES iglopengl PATHS ${LIBIGL_LIB_DIRS}) 142 | if(NOT LIBIGLOPENGL_LIBRARY) 143 | set(LIBIGL_FOUND FALSE) 144 | message(FATAL_ERROR "could NOT find libiglopengl") 145 | endif(NOT LIBIGLOPENGL_LIBRARY) 146 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLOPENGL_LIBRARY}) 147 | 148 | FIND_LIBRARY( LIBIGLOPENGL2_LIBRARY NAMES iglopengl2 PATHS ${LIBIGL_LIB_DIRS}) 149 | if(NOT LIBIGLOPENGL2_LIBRARY) 150 | set(LIBIGL_FOUND FALSE) 151 | message(FATAL_ERROR "could NOT find libiglopengl2") 152 | endif(NOT LIBIGLOPENGL2_LIBRARY) 153 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLOPENGL2_LIBRARY}) 154 | 155 | if(TETGEN_FOUND) 156 | FIND_LIBRARY( LIBIGLTETGEN_LIBRARY NAMES igltetgen PATHS ${LIBIGL_LIB_DIRS}) 157 | if(NOT LIBIGLTETGEN_LIBRARY) 158 | set(LIBIGL_FOUND FALSE) 159 | message(FATAL_ERROR "could NOT find libigltetgen") 160 | endif(NOT LIBIGLTETGEN_LIBRARY) 161 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLTETGEN_LIBRARY}) 162 | endif(TETGEN_FOUND) 163 | 164 | if(TINYXML2_FOUND) 165 | FIND_LIBRARY( LIBIGLXML_LIBRARY NAMES iglxml PATHS ${LIBIGL_LIB_DIRS}) 166 | if(NOT LIBIGLXML_LIBRARY) 167 | set(LIBIGL_FOUND FALSE) 168 | message(FATAL_ERROR "could NOT find libiglxml") 169 | endif(NOT LIBIGLXML_LIBRARY) 170 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLXML_LIBRARY}) 171 | endif(TINYXML2_FOUND) 172 | 173 | if(TRIANGLE_FOUND) 174 | FIND_LIBRARY( LIBIGLTRIANGLE_LIBRARY NAMES igltriangle PATHS ${LIBIGL_LIB_DIRS}) 175 | if(NOT LIBIGLTRIANGLE_LIBRARY) 176 | set(LIBIGL_FOUND FALSE) 177 | message(FATAL_ERROR "could NOT find libigltriangle") 178 | endif(NOT LIBIGLTRIANGLE_LIBRARY) 179 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLTRIANGLE_LIBRARY}) 180 | endif(TRIANGLE_FOUND) 181 | 182 | # libiglviewer is required 183 | FIND_LIBRARY( LIBIGLVIEWER_LIBRARY NAMES iglviewer PATHS ${LIBIGL_LIB_DIRS}) 184 | if(NOT LIBIGLVIEWER_LIBRARY) 185 | set(LIBIGL_FOUND FALSE) 186 | message(FATAL_ERROR "could NOT find libiglviewer") 187 | endif(NOT LIBIGLVIEWER_LIBRARY) 188 | set(LIBIGL_LIBRARIES ${LIBIGL_LIBRARIES} ${LIBIGLVIEWER_LIBRARY}) 189 | 190 | find_package(OpenMP) 191 | if (OPENMP_FOUND) 192 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 193 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 194 | endif(OPENMP_FOUND) 195 | 196 | 197 | endif(LIBIGL_USE_STATIC_LIBRARY) 198 | 199 | 200 | 201 | if(LIBIGL_FOUND) 202 | if(NOT LIBIGL_FIND_QUIETLY) 203 | message(STATUS "Found LIBIGL: ${LIBIGL_INCLUDE_DIR}") 204 | endif(NOT LIBIGL_FIND_QUIETLY) 205 | else(LIBIGL_FOUND) 206 | if(LIBIGL_FIND_REQUIRED) 207 | message(FATAL_ERROR "could NOT find LIBIGL") 208 | endif(LIBIGL_FIND_REQUIRED) 209 | endif(LIBIGL_FOUND) 210 | 211 | MARK_AS_ADVANCED(LIBIGL_INCLUDE_DIRS LIBIGL_INCLUDE_DIR LIBIGL_LIBRARIES IGL_VIEWER_SOURCES) 212 | 213 | endif(NOT LIBIGL_FOUND) 214 | -------------------------------------------------------------------------------- /cmake/FindLIM.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the LIM library 2 | # Once done this will define 3 | # 4 | # LIM_FOUND - system has LIM 5 | # LIM_INCLUDE_DIR - the LIM include directory 6 | # LIM_SOURCES - the LIM source files 7 | 8 | FIND_PATH(LIM_INCLUDE_DIR LIMSolverInterface.h 9 | /usr/include 10 | /usr/local/include 11 | ${PROJECT_SOURCE_DIR}/../libigl/external/lim/ 12 | ${PROJECT_SOURCE_DIR}/../../external/lim/ 13 | NO_DEFAULT_PATH 14 | ) 15 | 16 | set( 17 | LIM_SOURCES 18 | ${LIM_INCLUDE_DIR}/NMSolver.cpp 19 | ${LIM_INCLUDE_DIR}/LIMSolver.cpp 20 | ${LIM_INCLUDE_DIR}/LIMSolver2D.cpp 21 | ${LIM_INCLUDE_DIR}/LIMSolver3D.cpp 22 | ${LIM_INCLUDE_DIR}/TriangleMesh.cpp 23 | ${LIM_INCLUDE_DIR}/TetrahedronMesh.cpp 24 | ${LIM_INCLUDE_DIR}/Dirichlet_LIMSolver2D.cpp 25 | ${LIM_INCLUDE_DIR}/Dirichlet_LIMSolver3D.cpp 26 | ${LIM_INCLUDE_DIR}/UniformLaplacian_LIMSolver2D.cpp 27 | ${LIM_INCLUDE_DIR}/UniformLaplacian_LIMSolver3D.cpp 28 | ${LIM_INCLUDE_DIR}/Laplacian_LIMSolver2D.cpp 29 | ${LIM_INCLUDE_DIR}/Laplacian_LIMSolver3D.cpp 30 | ${LIM_INCLUDE_DIR}/LGARAP_LIMSolver2D.cpp 31 | ${LIM_INCLUDE_DIR}/LGARAP_LIMSolver3D.cpp 32 | ${LIM_INCLUDE_DIR}/GreenStrain_LIMSolver2D.cpp 33 | ${LIM_INCLUDE_DIR}/GreenStrain_LIMSolver3D.cpp 34 | ${LIM_INCLUDE_DIR}/LSConformal_LIMSolver2D.cpp 35 | ${LIM_INCLUDE_DIR}/Poisson_LIMSolver2D.cpp 36 | ) 37 | 38 | SET(LIM_FOUND "NO") 39 | IF (LIM_INCLUDE_DIR) 40 | SET(LIM_FOUND "YES") 41 | ENDIF (LIM_INCLUDE_DIR) 42 | 43 | if(LIM_INCLUDE_DIR) 44 | message(STATUS "Found LIM: ${LIM_INCLUDE_DIR}") 45 | else(LIM_INCLUDE_DIR) 46 | if (NOT LIM_FIND_QUIETLY) 47 | message(FATAL_ERROR "could NOT find LIM") 48 | endif(NOT LIM_FIND_QUIETLY) 49 | endif(LIM_INCLUDE_DIR) 50 | 51 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DANSI_DECLARATORS") 52 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DANSI_DECLARATORS") 53 | 54 | MARK_AS_ADVANCED(LIM_INCLUDE_DIR LIM_LIBRARIES LIM_SOURCES) 55 | -------------------------------------------------------------------------------- /cmake/FindMOSEK.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find MOSEK 3 | # Once done this will define 4 | # 5 | # MOSEK_FOUND - system has MOSEK 6 | # MOSEK_INCLUDE_DIRS - the MOSEK include directories 7 | # MOSEK_LIBRARIES - Link these to use MOSEK 8 | # 9 | 10 | FIND_PATH(MOSEK_INCLUDE_DIR mosek.h 11 | PATHS /usr/local/mosek/7/tools/platform/osx64x86/h/ 12 | ) 13 | 14 | SET(SEARCH_PATHS "${MOSEK_INCLUDE_DIR}" "${MOSEK_INCLUDE_DIR}/../bin" "${MOSEK_INCLUDE_DIR}/lib") 15 | 16 | set(MOSEK_LIBRARIES) 17 | FIND_LIBRARY(MOSEK_LIBRARIES NAMES mosek64 PATHS ${SEARCH_PATHS} NO_DEFAULT_PATH DPATH_SUFFIXES a lib dylib) 18 | 19 | if(MOSEK_LIBRARIES AND MOSEK_INCLUDE_DIR) 20 | message(STATUS "Found mosek: ${MOSEK_LIBRARIES}") 21 | set(MOSEK_FOUND TRUE) 22 | endif(MOSEK_LIBRARIES AND MOSEK_INCLUDE_DIR) 23 | 24 | IF (MOSEK_FOUND) 25 | message(STATUS "Found MOSEK: ${MOSEK_INCLUDE_DIR}") 26 | SET(MOSEK_INCLUDE_DIRS ${MOSEK_INCLUDE_DIR} ) 27 | ELSE (MOSEK_FOUND) 28 | #add_definitions(-DIGL_NO_MOSEK) 29 | #message(WARNING "could NOT find MOSEK") 30 | ENDIF (MOSEK_FOUND) 31 | -------------------------------------------------------------------------------- /cmake/FindNANOGUI.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find NANOGUI library and include path. 3 | # Once done this will define 4 | # 5 | # NANOGUI_FOUND 6 | # NANOGUI_INCLUDE_DIR 7 | # NANOGUI_LIBRARY 8 | # 9 | 10 | if(NOT NANOGUI_FOUND) 11 | 12 | FIND_PATH(NANOGUI_INCLUDE_DIR nanogui/nanogui.h 13 | PATHS 14 | ${PROJECT_SOURCE_DIR}/../../external/nanogui/include 15 | ${PROJECT_SOURCE_DIR}/../external/nanogui/include 16 | ${PROJECT_SOURCE_DIR}/external/nanogui/include 17 | ${PROJECT_SOURCE_DIR}/../../libigl/external/nanogui/include 18 | ${PROJECT_SOURCE_DIR}/../libigl/external/nanogui/include 19 | ${PROJECT_SOURCE_DIR}/libigl/external/nanogui/include 20 | /usr/local/include 21 | /usr/X11/include 22 | /usr/include 23 | /opt/local/include 24 | NO_DEFAULT_PATH 25 | ) 26 | 27 | FIND_LIBRARY( NANOGUI_LIBRARY NAMES nanogui 28 | PATHS 29 | ${PROJECT_SOURCE_DIR}/../../external/nanogui/build 30 | ${PROJECT_SOURCE_DIR}/../external/nanogui/build 31 | ${PROJECT_SOURCE_DIR}/external/nanogui/build 32 | ${PROJECT_SOURCE_DIR}/../../libigl/external/nanogui/build 33 | ${PROJECT_SOURCE_DIR}/../libigl/external/nanogui/build 34 | ${PROJECT_SOURCE_DIR}/libigl/external/nanogui/build 35 | ${PROJECT_SOURCE_DIR}/../../external/glfw/lib/x64 36 | ${PROJECT_SOURCE_DIR}/../external/glfw/lib/x64 37 | ${PROJECT_SOURCE_DIR}/external/glfw/lib/x64 38 | ${PROJECT_SOURCE_DIR}/../../libigl/external/glfw/lib/x64 39 | ${PROJECT_SOURCE_DIR}/../libigl/external/glfw/lib/x64 40 | ${PROJECT_SOURCE_DIR}/libigl/external/glfw/lib/x64 41 | /usr/local 42 | /usr/X11 43 | /usr 44 | PATH_SUFFIXES 45 | a 46 | lib64 47 | lib 48 | NO_DEFAULT_PATH 49 | ) 50 | 51 | SET(NANOGUI_FOUND "NO") 52 | IF (NANOGUI_INCLUDE_DIR AND NANOGUI_LIBRARY) 53 | SET(NANOGUI_FOUND "YES") 54 | SET(NANOGUI_INCLUDE_DIRS 55 | ${NANOGUI_INCLUDE_DIR} 56 | ${NANOGUI_INCLUDE_DIR}/../ext/nanovg/src 57 | ${NANOGUI_INCLUDE_DIR}/../ext/glfw/include 58 | ) 59 | 60 | ENDIF (NANOGUI_INCLUDE_DIR AND NANOGUI_LIBRARY) 61 | 62 | if(NANOGUI_FOUND) 63 | message(STATUS "Found NANOGUI: ${NANOGUI_INCLUDE_DIR}") 64 | else(NANOGUI_FOUND) 65 | if (NOT NANOGUI_FIND_QUIETLY) 66 | message(FATAL_ERROR "could NOT find NANOGUI") 67 | endif (NOT NANOGUI_FIND_QUIETLY) 68 | endif(NANOGUI_FOUND) 69 | 70 | endif(NOT NANOGUI_FOUND) 71 | -------------------------------------------------------------------------------- /cmake/FindNANOGUIH.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find NANOGUI library and include path. 3 | # Once done this will define 4 | # 5 | # NANOGUI_FOUND 6 | # NANOGUI_INCLUDE_DIR 7 | # NANOGUI_LIBRARY 8 | # 9 | 10 | if(NOT NANOGUI_FOUND) 11 | 12 | FIND_PATH(NANOGUI_INCLUDE_DIR nanogui/nanogui.h 13 | PATHS 14 | ${PROJECT_SOURCE_DIR}/../../external/nanogui/include 15 | ${PROJECT_SOURCE_DIR}/../external/nanogui/include 16 | ${PROJECT_SOURCE_DIR}/external/nanogui/include 17 | ${PROJECT_SOURCE_DIR}/../../libigl/external/nanogui/include 18 | ${PROJECT_SOURCE_DIR}/../libigl/external/nanogui/include 19 | ${PROJECT_SOURCE_DIR}/libigl/external/nanogui/include 20 | /usr/local/include 21 | /usr/X11/include 22 | /usr/include 23 | /opt/local/include 24 | NO_DEFAULT_PATH 25 | ) 26 | 27 | SET(NANOGUI_FOUND "NO") 28 | IF (NANOGUI_INCLUDE_DIR) 29 | SET(NANOGUI_FOUND "YES") 30 | SET(NANOGUI_INCLUDE_DIRS 31 | ${NANOGUI_INCLUDE_DIR} 32 | ${NANOGUI_INCLUDE_DIR}/../ext/nanovg/src 33 | ${NANOGUI_INCLUDE_DIR}/../ext/glfw/include 34 | ) 35 | 36 | ENDIF (NANOGUI_INCLUDE_DIR) 37 | 38 | if(NANOGUI_FOUND) 39 | message(STATUS "Found NANOGUI: ${NANOGUI_INCLUDE_DIR} -- HEADERS ONLY") 40 | else(NANOGUI_FOUND) 41 | if (NOT NANOGUIH_FIND_QUIETLY) 42 | message(FATAL_ERROR "could NOT find NANOGUI") 43 | endif (NOT NANOGUIH_FIND_QUIETLY) 44 | endif(NANOGUI_FOUND) 45 | 46 | endif(NOT NANOGUI_FOUND) 47 | -------------------------------------------------------------------------------- /cmake/FindPNG.cmake: -------------------------------------------------------------------------------- 1 | # - Find the native PNG includes and library 2 | # 3 | 4 | # This module defines 5 | # PNG_INCLUDE_DIR, where to find png.h, etc. 6 | # PNG_LIBRARIES, the libraries to link against to use PNG. 7 | # PNG_DEFINITIONS - You should ADD_DEFINITONS(${PNG_DEFINITIONS}) before compiling code that includes png library files. 8 | # PNG_FOUND, If false, do not try to use PNG. 9 | # also defined, but not for general use are 10 | # PNG_LIBRARY, where to find the PNG library. 11 | # None of the above will be defined unles zlib can be found. 12 | # PNG depends on Zlib 13 | # 14 | # Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. 15 | # See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. 16 | 17 | 18 | INCLUDE(FindZLIB) 19 | 20 | SET(PNG_FOUND "NO") 21 | 22 | IF(ZLIB_FOUND) 23 | FIND_PATH(PNG_PNG_INCLUDE_DIR png.h 24 | /usr/local/include 25 | /usr/include 26 | /usr/local/include/libpng # OpenBSD 27 | ) 28 | 29 | SET(PNG_NAMES ${PNG_NAMES} png libpng) 30 | FIND_LIBRARY(PNG_LIBRARY 31 | NAMES ${PNG_NAMES} 32 | PATHS /usr/lib64 /usr/lib /usr/local/lib 33 | ) 34 | 35 | IF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR) 36 | # png.h includes zlib.h. Sigh. 37 | SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ) 38 | SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY}) 39 | SET(PNG_FOUND "YES") 40 | SET(HAVE_PNG_H) 41 | IF (CYGWIN) 42 | IF(BUILD_SHARED_LIBS) 43 | # No need to define PNG_USE_DLL here, because it's default for Cygwin. 44 | ELSE(BUILD_SHARED_LIBS) 45 | SET (PNG_DEFINITIONS -DPNG_STATIC) 46 | ENDIF(BUILD_SHARED_LIBS) 47 | ENDIF (CYGWIN) 48 | 49 | ENDIF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR) 50 | 51 | ENDIF(ZLIB_FOUND) 52 | 53 | IF (PNG_FOUND) 54 | IF (NOT PNG_FIND_QUIETLY) 55 | MESSAGE(STATUS "Found PNG: ${PNG_LIBRARY}") 56 | ENDIF (NOT PNG_FIND_QUIETLY) 57 | ELSE (PNG_FOUND) 58 | IF (PNG_FIND_REQUIRED) 59 | MESSAGE(FATAL_ERROR "Could not find PNG library") 60 | ENDIF (PNG_FIND_REQUIRED) 61 | ENDIF (PNG_FOUND) 62 | 63 | MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR PNG_LIBRARY ) 64 | -------------------------------------------------------------------------------- /cmake/FindTETGEN.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the TETGEN library 2 | # Once done this will define 3 | # 4 | # TETGEN_FOUND - system has TETGEN 5 | # TETGEN_INCLUDE_DIR - the TETGEN include directory 6 | # TETGEN_SOURCES - the TETGEN source files 7 | 8 | FIND_PATH(TETGEN_INCLUDE_DIR tetgen.h 9 | ${LIBIGL_INCLUDE_DIR}/../external/tetgen/ 10 | ${PROJECT_SOURCE_DIR}/../libigl/external/tetgen/ 11 | ${PROJECT_SOURCE_DIR}/../../external/tetgen/ 12 | ${PROJECT_SOURCE_DIR}/../external/tetgen/ 13 | /usr/include 14 | /usr/local/include 15 | NO_DEFAULT_PATH 16 | ) 17 | 18 | set(TETGEN_SOURCES ${TETGEN_INCLUDE_DIR}/tetgen.cxx ${TETGEN_INCLUDE_DIR}/predicates.cxx) 19 | 20 | SET(TETGEN_FOUND "NO") 21 | IF (TETGEN_INCLUDE_DIR) 22 | SET(TETGEN_FOUND "YES") 23 | ENDIF (TETGEN_INCLUDE_DIR) 24 | 25 | if(TETGEN_INCLUDE_DIR) 26 | message(STATUS "Found TETGEN: ${TETGEN_INCLUDE_DIR}") 27 | else(TETGEN_INCLUDE_DIR) 28 | if (NOT TETGEN_FIND_QUIETLY) 29 | message(FATAL_ERROR "could NOT find TETGEN") 30 | endif (NOT TETGEN_FIND_QUIETLY) 31 | endif(TETGEN_INCLUDE_DIR) 32 | 33 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTETLIBRARY") 34 | 35 | MARK_AS_ADVANCED(TETGEN_INCLUDE_DIR TETGEN_LIBRARIES TETGEN_SOURCES) 36 | -------------------------------------------------------------------------------- /cmake/FindTINYXML2.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the TINYXML2 library 2 | # Once done this will define 3 | # 4 | # TINYXML2_FOUND - system has TINYXML2 5 | # TINYXML2_INCLUDE_DIR - the TINYXML2 include directory 6 | # TINYXML2_SOURCES - the TINYXML2 source files 7 | 8 | FIND_PATH(TINYXML2_INCLUDE_DIR tinyxml2.h 9 | /usr/include 10 | /usr/local/include 11 | ${LIBIGL_INCLUDE_DIR}/../external/tinyxml2/ 12 | ${PROJECT_SOURCE_DIR}/../libigl/external/tinyxml2/ 13 | ${PROJECT_SOURCE_DIR}/../../external/tinyxml2/ 14 | ${PROJECT_SOURCE_DIR}/../external/tinyxml2/ 15 | ${PROJECT_SOURCE_DIR}/external/tinyxml2/ 16 | ) 17 | 18 | SET(TINYXML2_FOUND "NO") 19 | IF (TINYXML2_INCLUDE_DIR) 20 | SET(TINYXML2_FOUND "YES") 21 | ENDIF (TINYXML2_INCLUDE_DIR) 22 | 23 | set(TINYXML2_SOURCES ${TINYXML2_INCLUDE_DIR}/tinyxml2.cpp) 24 | 25 | if(TINYXML2_INCLUDE_DIR) 26 | message(STATUS "Found TINYXML2: ${TINYXML2_INCLUDE_DIR}") 27 | else(TINYXML2_INCLUDE_DIR) 28 | if (NOT TINYXML2_FIND_QUIETLY) 29 | message(FATAL_ERROR "could NOT find TINYXML2") 30 | endif (NOT TINYXML2_FIND_QUIETLY) 31 | endif(TINYXML2_INCLUDE_DIR) 32 | 33 | MARK_AS_ADVANCED(TINYXML2_INCLUDE_DIR TINYXML2_LIBRARIES TINYXML2_SOURCES) 34 | -------------------------------------------------------------------------------- /cmake/FindTRIANGLE.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the TRIANGLE library 2 | # Once done this will define 3 | # 4 | # TRIANGLE_FOUND - system has TRIANGLE 5 | # TRIANGLE_INCLUDE_DIR - the TRIANGLE include directory 6 | # TRIANGLE_SOURCES - the TRIANGLE source files 7 | 8 | IF (WIN32) 9 | add_definitions(-DNO_TIMER) 10 | ENDIF (WIN32) 11 | 12 | FIND_PATH(TRIANGLE_INCLUDE_DIR triangle.c 13 | /usr/include 14 | /usr/local/include 15 | ${PROJECT_SOURCE_DIR}/../libigl/external/triangle/ 16 | ${PROJECT_SOURCE_DIR}/../../external/triangle/ 17 | ${PROJECT_SOURCE_DIR}/../external/triangle/ 18 | NO_DEFAULT_PATH 19 | ) 20 | 21 | set(TRIANGLE_SOURCES ${TRIANGLE_INCLUDE_DIR}/triangle.c) 22 | 23 | SET(TRIANGLE_FOUND "NO") 24 | IF (TRIANGLE_INCLUDE_DIR) 25 | SET(TRIANGLE_FOUND "YES") 26 | ENDIF (TRIANGLE_INCLUDE_DIR) 27 | 28 | if(TRIANGLE_INCLUDE_DIR) 29 | message(STATUS "Found TRIANGLE: ${TRIANGLE_INCLUDE_DIR}") 30 | else(TRIANGLE_INCLUDE_DIR) 31 | if (NOT TRIANGLE_FIND_QUIETLY) 32 | message(FATAL_ERROR "could NOT find TRIANGLE") 33 | endif(NOT TRIANGLE_FIND_QUIETLY) 34 | endif(TRIANGLE_INCLUDE_DIR) 35 | 36 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTRILIBRARY -DANSI_DECLARATORS") 37 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTRILIBRARY -DANSI_DECLARATORS") 38 | 39 | MARK_AS_ADVANCED(TRIANGLE_INCLUDE_DIR TRIANGLE_LIBRARIES TRIANGLE_SOURCES) 40 | -------------------------------------------------------------------------------- /cmake/FindYIMG.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the YIMG library 2 | # Once done this will define 3 | # 4 | # YIMG_FOUND - system has YIMG 5 | # YIMG_INCLUDE_DIR - the YIMG include directory 6 | # YIMG_SOURCES - the YIMG source files 7 | 8 | FIND_PATH(YIMG_INCLUDE_DIR YImage.hpp 9 | /usr/include 10 | /usr/local/include 11 | /opt/local/include 12 | $ENV{LIBIGL}/external/yimg 13 | ../external/yimg/ 14 | ../../external/yimg/ 15 | ../../external/yimg/ 16 | ../libigl/external/yimg/ 17 | ../../libigl/external/yimg/ 18 | ../../../libigl/external/yimg/ 19 | 20 | ) 21 | 22 | set(YIMG_SOURCES 23 | ${YIMG_INCLUDE_DIR}/YImage.cpp) 24 | 25 | if(YIMG_INCLUDE_DIR) 26 | message(STATUS "Found YIMG: ${YIMG_INCLUDE_DIR}") 27 | set(YIMG_FOUND "YES") 28 | else() 29 | set(YIMG_FOUND "NO") 30 | if (NOT YIMG_FIND_QUIETLY) 31 | message(FATAL_ERROR "could NOT find YIMG") 32 | endif (NOT YIMG_FIND_QUIETLY) 33 | endif() 34 | 35 | MARK_AS_ADVANCED(YIMG_INCLUDE_DIR YIMG_LIBRARIES) 36 | -------------------------------------------------------------------------------- /colored-mesh/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: example 7 | 8 | .PHONY: example 9 | 10 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) $(EMBREE_INC) 11 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) $(EMBREE_LIB) 12 | 13 | example: example.o 14 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) $(LIB) -o example example.o 15 | 16 | example.o: example.cpp 17 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c example.cpp -o example.o $(INC) 18 | clean: 19 | rm -f example.o 20 | rm -f example 21 | -------------------------------------------------------------------------------- /components/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | LIBIGL_LIB+=-liglembree 6 | 7 | all: obj example 8 | 9 | .PHONY: example 10 | 11 | CFLAGS+=-g -std=c++11 12 | 13 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) $(GLUT_INC) $(EMBREE_INC) 14 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) $(EMBREE_LIB) 15 | 16 | CPP_FILES=$(wildcard ./*.cpp) 17 | OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o))) 18 | 19 | example: obj $(OBJ_FILES) 20 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -o example $(OBJ_FILES) $(LIB) 21 | 22 | obj: 23 | mkdir -p obj 24 | 25 | obj/%.o: %.cpp 26 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 27 | 28 | obj/%.o: %.cpp %.h 29 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 30 | 31 | clean: 32 | rm -f $(OBJ_FILES) 33 | rm -f example 34 | -------------------------------------------------------------------------------- /convertmesh/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1) 2 | project(convertmesh) 3 | 4 | SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake) 5 | 6 | # libigl 7 | option(LIBIGL_USE_STATIC_LIBRARY "Use libigl as static library" OFF) 8 | option(LIBIGL_WITH_ANTTWEAKBAR "Use AntTweakBar" OFF) 9 | option(LIBIGL_WITH_CGAL "Use CGAL" OFF) 10 | option(LIBIGL_WITH_COMISO "Use CoMiso" OFF) 11 | option(LIBIGL_WITH_CORK "Use Cork" OFF) 12 | option(LIBIGL_WITH_EMBREE "Use Embree" OFF) 13 | option(LIBIGL_WITH_LIM "Use LIM" OFF) 14 | option(LIBIGL_WITH_MATLAB "Use Matlab" OFF) 15 | option(LIBIGL_WITH_MOSEK "Use MOSEK" OFF) 16 | option(LIBIGL_WITH_OPENGL "Use OpenGL" ON) 17 | option(LIBIGL_WITH_OPENGL_GLFW "Use GLFW" ON) 18 | option(LIBIGL_WITH_OPENGL_GLFW_IMGUI "Use ImGui" OFF) 19 | option(LIBIGL_WITH_PNG "Use PNG" OFF) 20 | option(LIBIGL_WITH_PYTHON "Use Python" OFF) 21 | option(LIBIGL_WITH_TETGEN "Use Tetgen" OFF) 22 | option(LIBIGL_WITH_TRIANGLE "Use Triangle" OFF) 23 | option(LIBIGL_WITH_VIEWER "Use OpenGL viewer" ON) 24 | option(LIBIGL_WITH_XML "Use XML" ON) 25 | 26 | find_package(LIBIGL REQUIRED QUIET) 27 | 28 | # Add your project files 29 | FILE(GLOB SRCFILES *.cpp) 30 | add_executable(${PROJECT_NAME} ${SRCFILES}) 31 | target_link_libraries(${PROJECT_NAME} igl::core igl::xml) 32 | -------------------------------------------------------------------------------- /convertmesh/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: convertmesh 7 | 8 | .PHONY: convertmesh 9 | 10 | INC=$(LIBIGL_INC) $(EIGEN3_INC) 11 | LIB=$(LIBIGL_LIB) 12 | OPTFLAGS+=-O3 -DNDEBUG $(OPENMP) 13 | 14 | convertmesh: convertmesh.o 15 | g++ $(OPTFLAGS) $(AFLAGS) $(CFLAGS) $(LIB) -o convertmesh convertmesh.o 16 | 17 | convertmesh.o: convertmesh.cpp 18 | g++ $(OPTFLAGS) $(AFLAGS) $(CFLAGS) -c convertmesh.cpp -o convertmesh.o $(INC) 19 | clean: 20 | rm -f convertmesh.o 21 | rm -f convertmesh 22 | -------------------------------------------------------------------------------- /convertmesh/convertmesh.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | //#include 3 | // Use igl::xml version to support .dae collada files, too 4 | #include 5 | #include 6 | #include 7 | int main(int argc, char * argv[]) 8 | { 9 | using namespace std; 10 | using namespace Eigen; 11 | using namespace igl; 12 | MatrixXd V; 13 | MatrixXi F; 14 | string in,out; 15 | switch(argc) 16 | { 17 | case 3: 18 | in = argv[1]; 19 | out = argv[2]; 20 | break; 21 | default: 22 | cerr< 2 | #include 3 | #include 4 | using namespace igl; 5 | #include 6 | 7 | int main(int argc, char * argv[]) 8 | { 9 | if(argc <= 2) 10 | { 11 | printf("USAGE:\n ./example [input path] [output path]\n"); 12 | return 1; 13 | } 14 | Eigen::MatrixXd M; 15 | readDMAT(argv[1],M); 16 | writeDMAT(argv[2],M); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /dmat/example.dmat: -------------------------------------------------------------------------------- 1 | 3 2 2 | 1 3 | 4 4 | 2 5 | 5 6 | 3 7 | 6 8 | -------------------------------------------------------------------------------- /eigen-gotchas/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: example 7 | 8 | .PHONY: example 9 | 10 | CFLAGS+=-g 11 | INC=$(LIBIGL_INC) $(EIGEN3_INC) 12 | LIB=$(LIBIGL_LIB) 13 | 14 | example: example.o 15 | g++ $(CFLAGS) -o example example.o $(LIB) 16 | 17 | example.o: example.cpp 18 | g++ $(CFLAGS) -c example.cpp -o example.o $(INC) 19 | clean: 20 | rm -f example.o 21 | rm -f example 22 | -------------------------------------------------------------------------------- /eigen-gotchas/example.cpp: -------------------------------------------------------------------------------- 1 | // Make an effort to verify bugs/gotchas for column and row major 2 | //#define EIGEN_DEFAULT_TO_ROW_MAJOR 3 | 4 | #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET 5 | #define EIGEN_IM_MAD_AS_HELL_AND_IM_NOT_GOING_TO_TAKE_IT_ANYMORE 6 | #include 7 | using namespace Eigen; 8 | 9 | #include 10 | #include 11 | using namespace std; 12 | 13 | #include 14 | using namespace igl; 15 | 16 | #if EIGEN_VERSION_AT_LEAST(3,0,92) 17 | # warning these gotchas have not been verified for your Eigen Version 18 | #else 19 | // Eigen fails to notice at compile time that the inneriterator used to loop 20 | // over the contents of a sparsematrix of type T is a different type 21 | // 22 | // http://www.alecjacobson.com/weblog/?p=2216 23 | void wrong_sparsematrix_inner_iterator_type() 24 | { 25 | // Fill 10 by 10 matrix with 0.5*(1:10) along the diagonal 26 | SparseMatrix A(10,10); 27 | A.reserve(10); 28 | for(int i = 0;i<10;i++) 29 | { 30 | A.insert(i,i) = (double)i/2.0; 31 | } 32 | A.finalize(); 33 | cout<<"AIJV=["<::InnerIterator it(A,k); it; ++it) 43 | { 44 | printf("A(%d,%d) = %d\n",it.row(),it.col(),it.value()); 45 | } 46 | } 47 | } 48 | 49 | // Eigen can't handle .transpose within expression on right hand side of = 50 | // operator 51 | // 52 | // Temporary solution: Never use Something.transpose() in expression. Always 53 | // first compute Something into a matrix: 54 | // SparseMatrix S = Something; 55 | // then compute tranpose 56 | // SparseMatrix ST = Something.transpose(); 57 | // then continue 58 | void sparsematrix_transpose_in_rhs_aliasing() 59 | { 60 | SparseMatrix A(7,2); 61 | A.reserve(4); 62 | A.insert(0,0) = -0.5; 63 | A.insert(2,0) = -0.5; 64 | A.insert(4,1) = -0.5; 65 | A.insert(6,1) = -0.5; 66 | A.finalize(); 67 | cout<<"AIJV=["< B(2,7); 72 | B.reserve(4); 73 | B.insert(0,0) = -0.5; 74 | B.insert(0,2) = -0.5; 75 | B.insert(1,4) = -0.5; 76 | B.insert(1,6) = -0.5; 77 | B.finalize(); 78 | cout<<"BIJV=["< C; 83 | 84 | // Should be empty but isn't 85 | C = A-B.transpose(); 86 | cout<<"C = A - B.transpose();"< BT = B.transpose(); 100 | C = A-BT; 101 | cout<<"C = A - BT;"< > A_LLT(A); 112 | // with: 113 | // SparseLLT > A_LLT(A.template triangularView()); 114 | // 115 | void sparsellt_needs_triangular_view() 116 | { 117 | // Succeeds 118 | SparseMatrix A(2,2); 119 | A.reserve(4); 120 | A.insert(0,0) = 1; 121 | A.insert(0,1) = -0.5; 122 | A.insert(1,0) = -0.5; 123 | A.insert(1,1) = 1; 124 | A.finalize(); 125 | cout<<"AIJV=["< > A_LLT(A.triangularView()); 129 | SparseMatrix A_L = A_LLT.matrixL(); 130 | cout<<"A_LIJV=["< B(2,2); 136 | B.reserve(4); 137 | B.insert(0,0) = 1; 138 | B.insert(0,1) = -0.5; 139 | B.insert(1,0) = -0.5; 140 | B.insert(1,1) = 1; 141 | B.finalize(); 142 | cout<<"BIJV=["< > B_LLT(B); 146 | } 147 | 148 | void sparsematrix_nonzeros_after_expression() 149 | { 150 | SparseMatrix A(2,2); 151 | A.reserve(4); 152 | A.insert(0,0) = 1; 153 | A.insert(0,1) = -0.5; 154 | A.insert(1,0) = -0.5; 155 | A.insert(1,1) = 1; 156 | A.finalize(); 157 | cout<<"AIJV=["< AmA = A-A; 162 | cout<<"(AmA).nonZeros(): "< A(2,2); 178 | A.reserve(4); 179 | A.insert(0,0) = 1; 180 | A.insert(0,1) = -0.5; 181 | A.insert(1,0) = -0.5; 182 | A.insert(1,1) = 1; 183 | A.finalize(); 184 | cout<<"AIJV=["< > A_LLT(A.triangularView()); 188 | cout<<"A_LLT.succeeded(): "<<(A_LLT.succeeded()?"TRUE":"FALSE")< A_L = A_LLT.matrixL(); 190 | // See sparsematrix_nonzeros_after_expression 191 | cout<<"(A_L*0).eval().nonZeros(): "<<(A_L*0).eval().nonZeros()< B(2,2); 199 | B.reserve(4); 200 | B.insert(0,0) = -1; 201 | B.insert(0,1) = 0.5; 202 | B.insert(1,0) = 0.5; 203 | B.insert(1,1) = -1; 204 | B.finalize(); 205 | cout<<"BIJV=["< > B_LLT(B.triangularView()); 209 | cout<<"B_LLT.succeeded(): "<<(B_LLT.succeeded()?"TRUE":"FALSE")< B_L = B_LLT.matrixL(); 211 | // See sparsematrix_nonzeros_after_expression 212 | cout<<"(B_L*0).eval().nonZeros(): "<<(B_L*0).eval().nonZeros()< 2 | using namespace igl; 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | int main(int argc, char * argv[]) 8 | { 9 | if(argc <= 1) 10 | { 11 | printf("USAGE:\n ./example [path_1] [path_2] ... [path_n]\n"); 12 | return 1; 13 | } 14 | // loop over arguments 15 | for(int i = 1; i < argc; i++) 16 | { 17 | string content; 18 | bool success = file_contents_as_string(argv[i],content); 19 | if(!success) 20 | { 21 | return 1; 22 | } 23 | printf("%s",content.c_str()); 24 | } 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /flare-eyes/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: obj example 7 | 8 | .PHONY: example 9 | 10 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) $(MATLAB_INC) $(GLUT_INC) 11 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) $(MATLAB_LIB) $(CARBON_LIB) 12 | 13 | CPP_FILES=$(wildcard ./*.cpp) 14 | OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o))) 15 | 16 | CFLAGS+=-g -std=c++11 17 | 18 | example: obj $(OBJ_FILES) 19 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -o example $(OBJ_FILES) $(LIB) 20 | 21 | obj: 22 | mkdir -p obj 23 | 24 | obj/%.o: %.cpp 25 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 26 | 27 | obj/%.o: %.cpp %.h 28 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 29 | 30 | clean: 31 | rm -f $(OBJ_FILES) 32 | rm -f example 33 | -------------------------------------------------------------------------------- /get_seconds/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: example 7 | 8 | .PHONY: example 9 | 10 | CFLAGS+=-g -Wall 11 | inc=$(LIBIGL_INC) 12 | lib=$(LIBIGL_LIB) 13 | 14 | example: example.o 15 | g++ $(CFLAGS) -o example example.o $(lib) 16 | 17 | example.o: example.cpp 18 | g++ $(CFLAGS) -c example.cpp -o example.o $(inc) 19 | clean: 20 | rm -f example.o 21 | rm -f example 22 | -------------------------------------------------------------------------------- /get_seconds/README: -------------------------------------------------------------------------------- 1 | Simple program showing how to use get_seconds from the igl library 2 | 3 | Compile with: 4 | make 5 | 6 | Run with: 7 | ./example 8 | which should produces something similar to: 9 | start: 0.001414s 10 | 1.00141s - 0.001414s = 1s 11 | 2.00141s - 0.001414s = 2s 12 | 3.00142s - 0.001414s = 3s 13 | 4.00141s - 0.001414s = 4s 14 | 5.00141s - 0.001414s = 5s 15 | 6.00141s - 0.001414s = 6s 16 | 7.00141s - 0.001414s = 7s 17 | 8.00141s - 0.001414s = 8s 18 | 9.00141s - 0.001414s = 9s 19 | 10.0014s - 0.001414s = 10s 20 | end: 10.0014s 21 | -------------------------------------------------------------------------------- /get_seconds/example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char * argv[]) 6 | { 7 | using namespace igl; 8 | using namespace std; 9 | double start = get_seconds(); 10 | printf("start: %lgs\n",start); 11 | double lap = start; 12 | double now; 13 | do 14 | { 15 | now = get_seconds(); 16 | if((now-lap)>=1.0) 17 | { 18 | printf("%lgs - %lgs = %lgs\n",now,start,now-start); 19 | lap = now-((now-start)-floor(now-start)); 20 | } 21 | }while((now - start)<10.0); 22 | printf("end: %lgs\n",now); 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /glslversion/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: example 7 | 8 | .PHONY: example 9 | 10 | igl_lib=../../ 11 | 12 | CFLAGS+=-g 13 | inc=$(LIBIGL_INC) 14 | lib=$(OPENGL_LIB) $(GLUT_LIB) $(LIBIGL_LIB) 15 | 16 | example: example.o 17 | g++ $(CFLAGS) -o example example.o $(lib) 18 | 19 | example.o: example.cpp 20 | g++ $(CFLAGS) -c example.cpp -o example.o $(inc) 21 | clean: 22 | rm -f example.o 23 | rm -f example 24 | -------------------------------------------------------------------------------- /glslversion/README: -------------------------------------------------------------------------------- 1 | This is a simple example program that creates a dummy GLUT window to get a 2 | valid opengl context then print the glsl version string 3 | 4 | 5 | To Build: 6 | make 7 | 8 | To Run: 9 | ./example 10 | 11 | Example Run #1: 12 | Issuing: 13 | ./example 14 | should produce something like: 15 | GL_SHADING_LANGUAGE_VERSION: 1.20 16 | -------------------------------------------------------------------------------- /glslversion/example.cpp: -------------------------------------------------------------------------------- 1 | #ifdef __APPLE__ 2 | # include 3 | #else 4 | # include 5 | #endif 6 | #include 7 | 8 | int main(int argc,char * argv[]) 9 | { 10 | // Make GLUT window just to get a valid OpenGL context 11 | glutInit(&argc,argv); 12 | glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); 13 | glutInitWindowSize(640, 480); 14 | glutCreateWindow("Dummy"); 15 | glutCreateMenu(NULL); 16 | 17 | printf("GL_VERSION: %s\n", 18 | glGetString(GL_VERSION)); 19 | printf("GL_SHADING_LANGUAGE_VERSION: %s\n", 20 | glGetString(GL_SHADING_LANGUAGE_VERSION)); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /glut_speed_test/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | all: example 4 | 5 | # Shared flags etc. 6 | include ../Makefile.conf 7 | 8 | .PHONY: example 9 | 10 | igl_lib=../../ 11 | 12 | CFLAGS+=-g -Wall 13 | INC=$(LIBIGL_INC) 14 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(LIBIGL_LIB) 15 | 16 | example: example.o 17 | g++ $(CFLAGS) -o example example.o $(LIB) 18 | 19 | example.o: example.cpp 20 | g++ $(CFLAGS) $(deps) -c example.cpp -o example.o $(INC) 21 | 22 | clean: 23 | rm -f example.o 24 | rm -f example 25 | -------------------------------------------------------------------------------- /glut_speed_test/example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace igl; 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | #if defined(__APPLE__) 8 | # include 9 | #else 10 | # include 11 | #endif 12 | 13 | const int width = 1088; 14 | const int height = 612; 15 | int frame_counter = 0; 16 | double start_time; 17 | // number of frames before computing fps 18 | const int frames_per_lap = 1000; 19 | 20 | void Display(void) 21 | { 22 | // Clear the screen with current background color 23 | glClearColor( 24 | fabs(sin(get_seconds())), 25 | fabs(sin(get_seconds()/3)), 26 | fabs(sin(get_seconds()/7)), 27 | 0.0); 28 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 29 | // Present frame buffer 30 | glutSwapBuffers(); 31 | // Recall Display at next frame 32 | glutPostRedisplay(); 33 | 34 | frame_counter++; 35 | if(frame_counter == frames_per_lap) 36 | { 37 | double elapsed_time = get_seconds()-start_time; 38 | printf("%g fps: %d frames in %g seconds\n", 39 | (double)frame_counter/elapsed_time,frame_counter,elapsed_time); 40 | // reset frame counter and timer 41 | start_time = get_seconds(); 42 | frame_counter = 0; 43 | } 44 | } 45 | 46 | int main(int argc,char * argv[]) 47 | { 48 | // Initialize GLUT 49 | glutInit(&argc, argv); 50 | glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); 51 | glutInitWindowSize(width, height); 52 | // Center window 53 | glutInitWindowPosition( 54 | glutGet(GLUT_SCREEN_WIDTH)/2-glutGet(GLUT_INIT_WINDOW_WIDTH)/2, 55 | glutGet(GLUT_SCREEN_HEIGHT)/2-glutGet(GLUT_INIT_WINDOW_HEIGHT)/2); 56 | glutCreateWindow(""); 57 | glutCreateMenu(NULL); 58 | // Set GLUT callbacks 59 | glutDisplayFunc(Display); 60 | //glutReshapeFunc(Reshape); 61 | 62 | // initialize timer 63 | start_time = get_seconds(); 64 | // Call the GLUT main loop 65 | glutMainLoop(); 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /harwell_boeing/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: example 7 | 8 | .PHONY: example 9 | 10 | CFLAGS+=-g 11 | INC=$(LIBIGL_INC) $(EIGEN3_INC) 12 | LIB=$(LIBIGL_LIB) 13 | 14 | example: example.o 15 | g++ $(CFLAGS) -o example example.o $(LIB) 16 | 17 | example.o: example.cpp 18 | g++ $(CFLAGS) -c example.cpp -o example.o $(INC) 19 | clean: 20 | rm -f example.o 21 | rm -f example 22 | -------------------------------------------------------------------------------- /harwell_boeing/README: -------------------------------------------------------------------------------- 1 | Demonstrates how to use igl/harwell_boeing which computes indices and values of compressed column storage: 2 | http://eigen.tuxfamily.org/api/classEigen_1_1SparseMatrix.html 3 | -------------------------------------------------------------------------------- /harwell_boeing/example.cpp: -------------------------------------------------------------------------------- 1 | #define IGL_HEADER_ONLY 2 | #include 3 | #include 4 | 5 | template 6 | void print(T & v) 7 | { 8 | std::cout< 12 | #include 13 | #include 14 | int main(int argc,char * argv[]) 15 | { 16 | using namespace Eigen; 17 | using namespace std; 18 | using namespace igl; 19 | SparseMatrix A(5,5); 20 | A.insert(0,1) = 3; 21 | A.insert(1,0) = 22; 22 | A.insert(1,4) = 17; 23 | A.insert(2,0) = 7; 24 | A.insert(2,1) = 5; 25 | A.insert(2,3) = 1; 26 | A.insert(4,2) = 14; 27 | A.insert(4,4) = 8; 28 | 29 | vector V; 30 | vector R,C; 31 | 32 | int nr; 33 | harwell_boeing(A,nr,V,R,C); 34 | cout<<"V=["; 35 | for_each(V.begin(),V.end(),&print); 36 | cout<<"];"<); 39 | cout<<"];"<); 42 | cout<<"];"< TRUE 16 | is_dir(..) --> TRUE 17 | is_dir(example.cpp) --> FALSE 18 | is_dir(non-existant-file) --> FALSE 19 | -------------------------------------------------------------------------------- /is_dir/example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace igl; 3 | #include 4 | 5 | int main(int argc, char * argv[]) 6 | { 7 | if(argc <= 1) 8 | { 9 | printf("USAGE:\n ./example [path_1] [path_2] ... [path_n]\n"); 10 | return 1; 11 | } 12 | // loop over arguments 13 | for(int i = 1; i < argc; i++) 14 | { 15 | printf("is_dir(%s) --> %s\n",argv[i],(is_dir(argv[i])?"TRUE":"FALSE")); 16 | } 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /meshio/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: example 7 | 8 | .PHONY: example 9 | 10 | CFLAGS+=-g 11 | inc=$(LIBIGL_INC) $(EIGEN3_INC) 12 | lib=$(LIBIGL_LIB) 13 | 14 | example: example.o 15 | g++ $(CFLAGS) -o example example.o $(lib) 16 | 17 | example.o: example.cpp 18 | g++ $(CFLAGS) -c example.cpp -o example.o $(inc) 19 | clean: 20 | rm -f example.o 21 | rm -f example 22 | -------------------------------------------------------------------------------- /meshio/README: -------------------------------------------------------------------------------- 1 | This is a simple example program that shows how to use the mesh IO functions of 2 | readOBJ.h etc. in the igl library. 3 | 4 | 5 | To Build: 6 | make 7 | 8 | To Run: 9 | ./example [path_1] [path_2] ... [path_n] 10 | -------------------------------------------------------------------------------- /meshio/cube.obj: -------------------------------------------------------------------------------- 1 | # cube.obj 2 | # 3 | 4 | g cube 5 | 6 | v 0.0 0.0 0.0 7 | v 0.0 0.0 1.0 8 | v 0.0 1.0 0.0 9 | v 0.0 1.0 1.0 10 | v 1.0 0.0 0.0 11 | v 1.0 0.0 1.0 12 | v 1.0 1.0 0.0 13 | v 1.0 1.0 1.0 14 | 15 | vn 0.0 0.0 1.0 16 | vn 0.0 0.0 -1.0 17 | vn 0.0 1.0 0.0 18 | vn 0.0 -1.0 0.0 19 | vn 1.0 0.0 0.0 20 | vn -1.0 0.0 0.0 21 | 22 | f 1//2 7//2 5//2 23 | f 1//2 3//2 7//2 24 | f 1//6 4//6 3//6 25 | f 1//6 2//6 4//6 26 | f 3//3 8//3 7//3 27 | f 3//3 4//3 8//3 28 | f 5//5 7//5 8//5 29 | f 5//5 8//5 6//5 30 | f 1//4 5//4 6//4 31 | f 1//4 6//4 2//4 32 | f 2//1 6//1 8//1 33 | f 2//1 8//1 4//1 34 | -------------------------------------------------------------------------------- /meshio/example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | using namespace igl; 12 | using namespace std; 13 | using namespace Eigen; 14 | 15 | // Template: 16 | // T type that can be safely cast to float 17 | // Inputs: 18 | // vv vector of vectors of type T 19 | template 20 | void print_vector_of_vectors_as_floats(const std::vector > & vv) 21 | { 22 | for(int i = 0;i > V,TC,N; 40 | vector > F,FTC,FN; 41 | // loop over arguments 42 | for(int i = 1; i < argc; i++) 43 | { 44 | if(i != 1) 45 | { 46 | printf("-----------------------------------------------------------\n"); 47 | } 48 | readOBJ(argv[i],V,TC,N,F,FTC,FN); 49 | cout<<"V=["; print_vector_of_vectors_as_floats(V); cout<<"];"< 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | using namespace igl; 8 | using namespace Eigen; 9 | 10 | 11 | template 12 | void matlab_print(const string name, const T & X) 13 | { 14 | cout< M1; 28 | mode(X,1,M1); 29 | matlab_print("M1",M1); 30 | 31 | Eigen::Matrix M2; 32 | mode(X,2,M2); 33 | matlab_print("M2",M2); 34 | } 35 | -------------------------------------------------------------------------------- /multi-viewport/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | 5 | all: example 6 | 7 | .PHONY: example 8 | 9 | include ../Makefile.conf 10 | 11 | CFLAGS+=-std=c++11 -g -Wno-deprecated-declarations 12 | 13 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) 14 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) 15 | 16 | example: example.o 17 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -o example example.o $(LIB) 18 | 19 | example.o: example.cpp 20 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c example.cpp -o example.o $(INC) 21 | clean: 22 | rm -f example.o 23 | rm -f example 24 | -------------------------------------------------------------------------------- /patches/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | ifdef LIBIGL_USE_STATIC_LIBRARY 6 | LIBIGL_LIB+=-liglembree 7 | endif 8 | 9 | all: obj example 10 | 11 | .PHONY: example 12 | 13 | CFLAGS+=-g -std=c++11 14 | 15 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) $(GLUT_INC) $(EMBREE_INC) 16 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) $(EMBREE_LIB) 17 | 18 | CPP_FILES=$(wildcard ./*.cpp) 19 | OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o))) 20 | 21 | example: obj $(OBJ_FILES) 22 | g++ $(OPTFLAGS) $(OPENMP) $(AFLAGS) $(CFLAGS) -o example $(OBJ_FILES) $(LIB) 23 | 24 | obj: 25 | mkdir -p obj 26 | 27 | obj/%.o: %.cpp 28 | g++ $(OPTFLAGS) $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 29 | 30 | obj/%.o: %.cpp %.h 31 | g++ $(OPTFLAGS) $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 32 | 33 | clean: 34 | rm -f $(OBJ_FILES) 35 | rm -f example 36 | -------------------------------------------------------------------------------- /patches/example.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example.vcxproj", "{7F5B7683-7531-481C-8997-6221D7170894}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {7F5B7683-7531-481C-8997-6221D7170894}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {7F5B7683-7531-481C-8997-6221D7170894}.Debug|Win32.Build.0 = Debug|Win32 14 | {7F5B7683-7531-481C-8997-6221D7170894}.Release|Win32.ActiveCfg = Release|Win32 15 | {7F5B7683-7531-481C-8997-6221D7170894}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /patches/example.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | embree 7 | 8 | 9 | embree 10 | 11 | 12 | embree 13 | 14 | 15 | embree 16 | 17 | 18 | embree 19 | 20 | 21 | embree 22 | 23 | 24 | embree 25 | 26 | 27 | embree 28 | 29 | 30 | embree 31 | 32 | 33 | embree 34 | 35 | 36 | embree 37 | 38 | 39 | embree 40 | 41 | 42 | embree 43 | 44 | 45 | embree 46 | 47 | 48 | embree 49 | 50 | 51 | embree 52 | 53 | 54 | embree 55 | 56 | 57 | embree 58 | 59 | 60 | embree 61 | 62 | 63 | embree 64 | 65 | 66 | embree 67 | 68 | 69 | embree 70 | 71 | 72 | embree 73 | 74 | 75 | embree 76 | 77 | 78 | embree 79 | 80 | 81 | embree 82 | 83 | 84 | embree 85 | 86 | 87 | embree 88 | 89 | 90 | embree 91 | 92 | 93 | embree 94 | 95 | 96 | embree 97 | 98 | 99 | embree 100 | 101 | 102 | embree 103 | 104 | 105 | embree 106 | 107 | 108 | embree 109 | 110 | 111 | embree 112 | 113 | 114 | embree 115 | 116 | 117 | embree 118 | 119 | 120 | embree 121 | 122 | 123 | embree 124 | 125 | 126 | embree 127 | 128 | 129 | embree 130 | 131 | 132 | embree 133 | 134 | 135 | embree 136 | 137 | 138 | embree 139 | 140 | 141 | embree 142 | 143 | 144 | embree 145 | 146 | 147 | 148 | 149 | {53eff656-6473-409c-9ad5-cac1983d91e1} 150 | 151 | 152 | {6a04be79-a793-4c4a-a5c0-5d40f1f2ca7f} 153 | 154 | 155 | 156 | 157 | 158 | -------------------------------------------------------------------------------- /path_tests/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: example 7 | 8 | .PHONY: example 9 | 10 | CFLAGS+=-g -Wall 11 | inc=$(LIBIGL_INC) 12 | lib=$(LIBIGL_LIB) 13 | 14 | example: example.o 15 | g++ $(CFLAGS) -o example example.o $(lib) 16 | 17 | example.o: example.cpp 18 | g++ $(CFLAGS) -c example.cpp -o example.o $(inc) 19 | clean: 20 | rm -f example.o 21 | rm -f example 22 | -------------------------------------------------------------------------------- /path_tests/README: -------------------------------------------------------------------------------- 1 | This is a simple example program that shows how to use the is_dir, is_file, 2 | file_exists, is_readable, is_writable, functions of the igl library 3 | 4 | 5 | To Build: 6 | make 7 | 8 | To Run: 9 | ./example [path_1] [path_2] ... [path_n] 10 | 11 | Example Run #1: 12 | Issuing: 13 | touch not-writable 14 | touch not-readable 15 | chmod u-r not-readable 16 | chmod u-w not-writable 17 | ./example / . .. example.cpp non-existant-file not-readable not-writable > output 18 | php example.php / . .. example.cpp non-existant-file not-readable not-writable > php-output 19 | diff php-output output 20 | should produce no differences 21 | -------------------------------------------------------------------------------- /path_tests/example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | using namespace igl; 7 | #include 8 | 9 | int main(int argc, char * argv[]) 10 | { 11 | if(argc <= 1) 12 | { 13 | printf("USAGE:\n ./example [path_1] [path_2] ... [path_n]\n"); 14 | return 1; 15 | } 16 | // loop over arguments 17 | for(int i = 1; i < argc; i++) 18 | { 19 | printf("file_exists(%s) --> %s\n",argv[i],(file_exists(argv[i])?"TRUE":"FALSE")); 20 | printf("is_dir(%s) --> %s\n",argv[i],(is_dir(argv[i])?"TRUE":"FALSE")); 21 | printf("is_file(%s) --> %s\n",argv[i],(is_file(argv[i])?"TRUE":"FALSE")); 22 | printf("is_readable(%s) --> %s\n",argv[i],(is_readable(argv[i])?"TRUE":"FALSE")); 23 | printf("is_writable(%s) --> %s\n",argv[i],(is_writable(argv[i])?"TRUE":"FALSE")); 24 | } 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /path_tests/example.php: -------------------------------------------------------------------------------- 1 | %s\n",$argv[$i],(file_exists($argv[$i])?"TRUE":"FALSE")); 10 | printf("is_dir(%s) --> %s\n",$argv[$i],(is_dir($argv[$i])?"TRUE":"FALSE")); 11 | printf("is_file(%s) --> %s\n",$argv[$i],(is_file($argv[$i])?"TRUE":"FALSE")); 12 | printf("is_readable(%s) --> %s\n",$argv[$i],(is_readable($argv[$i])?"TRUE":"FALSE")); 13 | printf("is_writable(%s) --> %s\n",$argv[$i],(is_writable($argv[$i])?"TRUE":"FALSE")); 14 | } 15 | ?> 16 | -------------------------------------------------------------------------------- /pathinfo/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | all: example 4 | 5 | # Shared flags etc. 6 | include ../Makefile.conf 7 | 8 | .PHONY: example 9 | 10 | CFLAGS+=-g -Wall 11 | inc=$(LIBIGL_INC) 12 | lib=$(LIBIGL_LIB) 13 | 14 | example: example.o 15 | g++ $(CFLAGS) -o example example.o $(lib) 16 | 17 | example.o: example.cpp 18 | g++ $(CFLAGS) $(deps) -c example.cpp -o example.o $(inc) 19 | clean: 20 | rm -f example.o 21 | rm -f example 22 | -------------------------------------------------------------------------------- /pathinfo/README: -------------------------------------------------------------------------------- 1 | This pair of .cpp and .php programs demonstrate the use of pathinfo. 2 | 3 | To compile: 4 | make 5 | 6 | To run C++ 7 | ./example 8 | 9 | To run php: 10 | php example.php 11 | 12 | To run test: 13 | ./example > c++_output.txt 14 | php example.php > php_output.txt 15 | # should find 0 differences 16 | diff c++_output.txt php_output.txt 17 | -------------------------------------------------------------------------------- /pathinfo/example.cpp: -------------------------------------------------------------------------------- 1 | #define VERBOSE 2 | #include 3 | #include 4 | using namespace igl; 5 | #include 6 | #include 7 | #include 8 | #include 9 | using namespace std; 10 | 11 | int main(int argc, char * argv[]) 12 | { 13 | ifstream fin("input.txt"); 14 | if (fin.is_open() == false) 15 | { 16 | // error 17 | return 1; 18 | } 19 | 20 | const char * format = "%-25s | %-10s %-10s %-10s %-10s\n"; 21 | printf(format, 22 | "input", 23 | "dirname", 24 | "basename", 25 | "extension", 26 | "filename"); 27 | string line; 28 | while( getline(fin, line) ) 29 | { 30 | string dirname,basename,extension,filename; 31 | pathinfo(line,dirname,basename,extension,filename); 32 | printf(format, 33 | C_STR("\""< ". 10 | $p['dirname'].",". 11 | $p['basename'].",". 12 | $p['extension'].",". 13 | $p['filename']."\n"; 14 | } 15 | } 16 | fclose($file_handle); 17 | ?> 18 | -------------------------------------------------------------------------------- /pathinfo/input.txt: -------------------------------------------------------------------------------- 1 | / 2 | // 3 | /foo 4 | /foo/ 5 | /foo// 6 | /foo/./ 7 | /foo/bar 8 | /foo/bar. 9 | /foo/bar.txt 10 | /foo/bar.txt.zip 11 | /foo/bar.dir/ 12 | /foo/bar.dir/file 13 | /foo/bar.dir/file.txt 14 | 15 | foo 16 | foo/ 17 | foo/bar 18 | foo/bar.txt 19 | foo/bar.txt.zip 20 | foo/bar.dir/ 21 | foo/bar.dir/file 22 | foo/bar.dir/file.txt 23 | .bar 24 | foo. 25 | ./foo 26 | ./foo/ 27 | ./foo/bar 28 | ./foo/bar.txt 29 | ./foo/bar.txt.zip 30 | ./foo/bar.dir/ 31 | ./foo/bar.dir/file 32 | ./foo/bar.dir/file.txt 33 | ./.bar 34 | ~/foo. 35 | ~/foo 36 | ~/foo/ 37 | ~/foo/bar 38 | ~/foo/bar.txt 39 | ~/foo/bar.txt.zip 40 | ~/foo/bar.dir/ 41 | ~/foo/bar.dir/file 42 | ~/foo/bar.dir/file.txt 43 | ~/.bar 44 | ~/foo. 45 | . 46 | .. 47 | -------------------------------------------------------------------------------- /randomly-sample-mesh/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: obj example 7 | 8 | .PHONY: example 9 | 10 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) $(GLUT_INC) 11 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) 12 | 13 | CPP_FILES=$(wildcard ./*.cpp) 14 | OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o))) 15 | 16 | CFLAGS+=-std=c++11 17 | 18 | example: obj $(OBJ_FILES) 19 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -o example $(OBJ_FILES) $(LIB) 20 | 21 | obj: 22 | mkdir -p obj 23 | 24 | obj/%.o: %.cpp 25 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 26 | 27 | obj/%.o: %.cpp %.h 28 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 29 | 30 | clean: 31 | rm -f $(OBJ_FILES) 32 | rm -f example 33 | -------------------------------------------------------------------------------- /render_to_png/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | LIBIGL_LIB+=-liglpng 6 | 7 | # YIMG dependency 8 | 9 | all: example 10 | 11 | .PHONY: example 12 | 13 | IGL=../../ 14 | 15 | inc=$(LIBIGL_INC) $(YIMG_INC) $(EIGEN3_INC) 16 | lib=$(LIBIGL_LIB) $(OPENGL_LIB) $(GLUT_LIB) $(YIMG_LIB) 17 | 18 | example: example.o 19 | g++ $(CFLAGS) -o example example.o $(lib) 20 | 21 | example.o: example.cpp 22 | g++ $(CFLAGS) -c example.cpp -o example.o $(inc) 23 | clean: 24 | rm -f example.o 25 | rm -f example 26 | -------------------------------------------------------------------------------- /render_to_png/README: -------------------------------------------------------------------------------- 1 | Small example to show how to use render_to_png inside a glut application. 2 | 3 | Compile with: 4 | 5 | make 6 | 7 | Run with: 8 | 9 | ./example 10 | 11 | Then hit [space] to take a screen shot. Hit 's' to change the shape. 12 | 13 | Produces files in the working directory named: 14 | render_to_png-example-example-0000.png, 15 | render_to_png-example-example-0001.png, 16 | and so on 17 | -------------------------------------------------------------------------------- /render_to_png/example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #ifdef __APPLE__ 6 | # include 7 | #else 8 | # include 9 | #endif 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | // This example displays one of the following shapes 20 | typedef enum { SHAPE_TEAPOT=1, SHAPE_TORUS=2, SHAPE_CONE=3, SHAPE_SPHERE=4 } Shape; 21 | #define NUM_SHAPES 4 22 | Shape g_CurrentShape = SHAPE_TEAPOT; 23 | int width,height; 24 | double alpha = 0.8; 25 | int capture_count = 0; 26 | bool capture_on_next = false; 27 | 28 | const float light_pos[4] = {-0.1,-0.1,1.0,0.0}; 29 | 30 | // Callback function called by GLUT to render screen 31 | void Display(void) 32 | { 33 | using namespace igl; 34 | using namespace std; 35 | float v[4]; // will be used to set light paramters 36 | 37 | // Clear frame buffer 38 | glClearColor(1, 1, 1, 0); 39 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 40 | 41 | glEnable(GL_DEPTH_TEST); 42 | glDisable(GL_CULL_FACE); 43 | glEnable(GL_NORMALIZE); 44 | glEnable(GL_LIGHTING); 45 | glLightModelf(GL_LIGHT_MODEL_TWO_SIDE,GL_TRUE); 46 | 47 | // Set light 48 | glEnable(GL_LIGHTING); 49 | glEnable(GL_LIGHT0); 50 | v[0] = v[1] = v[2] = 0.4f; v[3] = 1.0f; 51 | glLightfv(GL_LIGHT0, GL_AMBIENT, v); 52 | v[0] = v[1] = v[2] = 0.8f; v[3] = 1.0f; 53 | glLightfv(GL_LIGHT0, GL_DIFFUSE, v); 54 | glLightfv(GL_LIGHT0, GL_POSITION, light_pos); 55 | 56 | // Set material 57 | glDisable(GL_COLOR_MATERIAL); 58 | float mat_ambient[4], mat_diffuse[4], mat_specular[4], mat_shininess=128; 59 | copy(CYAN_AMBIENT,CYAN_AMBIENT+4,mat_ambient); 60 | copy(CYAN_DIFFUSE,CYAN_DIFFUSE+4,mat_diffuse); 61 | copy(CYAN_SPECULAR,CYAN_SPECULAR+4,mat_specular); 62 | mat_ambient[3] = alpha; 63 | mat_diffuse[3] = alpha; 64 | mat_specular[3] = alpha; 65 | glMaterialfv(GL_BACK, GL_AMBIENT, mat_ambient); 66 | glMaterialfv(GL_BACK, GL_DIFFUSE, mat_diffuse); 67 | glMaterialfv(GL_BACK, GL_SPECULAR, mat_specular); 68 | glMaterialf( GL_BACK, GL_SHININESS, mat_shininess); 69 | 70 | copy(GOLD_AMBIENT,GOLD_AMBIENT+4,mat_ambient); 71 | copy(GOLD_DIFFUSE,GOLD_DIFFUSE+4,mat_diffuse); 72 | copy(GOLD_SPECULAR,GOLD_SPECULAR+4,mat_specular); 73 | glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); 74 | glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); 75 | glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); 76 | glMaterialf( GL_FRONT, GL_SHININESS, mat_shininess); 77 | 78 | if(g_CurrentShape==SHAPE_TEAPOT) 79 | { 80 | glFrontFace(GL_CW); 81 | }else 82 | { 83 | glFrontFace(GL_CCW); 84 | } 85 | // Rotate and draw shape 86 | glPushMatrix(); 87 | glRotated(30,1,0,0); 88 | glRotated(360*(fmod(get_seconds(),10.0)/10.0),0,1,0); 89 | glScaled(1.5,1.5,1.5); 90 | glCallList(g_CurrentShape); 91 | glPopMatrix(); 92 | 93 | if(capture_on_next) 94 | { 95 | stringstream padnum; 96 | padnum << "render_to_png-example-" << setw(4) << setfill('0') << capture_count++ << ".png"; 97 | igl::png::render_to_png(padnum.str(),width,height); 98 | capture_on_next = false; 99 | } 100 | 101 | // Present frame buffer 102 | glutSwapBuffers(); 103 | 104 | // Recall Display at next frame 105 | glutPostRedisplay(); 106 | } 107 | 108 | 109 | // Callback function called by GLUT when window size changes 110 | void Reshape(int width, int height) 111 | { 112 | // Set OpenGL viewport and camera 113 | glViewport(0, 0, width, height); 114 | ::width = width; 115 | ::height = height; 116 | glMatrixMode(GL_PROJECTION); 117 | glLoadIdentity(); 118 | gluPerspective(40, (double)width/height, 1, 10); 119 | glMatrixMode(GL_MODELVIEW); 120 | glLoadIdentity(); 121 | gluLookAt(0,0,5, 0,0,0, 0,1,0); 122 | glTranslatef(0, 0.6f, -1); 123 | } 124 | 125 | 126 | 127 | void key(unsigned char key, int mouse_x, int mouse_y) 128 | { 129 | using namespace std; 130 | switch(key) 131 | { 132 | case 's': 133 | g_CurrentShape = (Shape)((g_CurrentShape)%NUM_SHAPES+1); 134 | cout<<"g_CurrentShape: "<=8 "); 152 | glutInitWindowSize(640, 480); 153 | glutCreateWindow("render_to_png example (press space to render)"); 154 | glutCreateMenu(NULL); 155 | 156 | // Set GLUT callbacks 157 | glutDisplayFunc(Display); 158 | glutReshapeFunc(Reshape); 159 | 160 | glutKeyboardFunc(key); 161 | 162 | // Create some 3D objects (stored in display lists) 163 | glNewList(SHAPE_TEAPOT, GL_COMPILE); 164 | glutSolidTeapot(1.0); 165 | glEndList(); 166 | glNewList(SHAPE_TORUS, GL_COMPILE); 167 | glutSolidTorus(0.3, 1.0, 16, 32); 168 | glEndList(); 169 | glNewList(SHAPE_CONE, GL_COMPILE); 170 | glutSolidCone(1.0, 1.5, 64, 4); 171 | glEndList(); 172 | glNewList(SHAPE_SPHERE, GL_COMPILE); 173 | glutSolidSphere(1.0, 50, 40); 174 | glEndList(); 175 | 176 | // Call the GLUT main loop 177 | glutMainLoop(); 178 | 179 | return 0; 180 | } 181 | 182 | -------------------------------------------------------------------------------- /rotate-widget/Makefile: -------------------------------------------------------------------------------- 1 | 2 | .PHONY: all 3 | 4 | # Shared flags etc. 5 | include ../Makefile.conf 6 | 7 | all: obj example 8 | 9 | .PHONY: example 10 | 11 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) $(GLUT_INC) 12 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) 13 | 14 | CPP_FILES=$(wildcard ./*.cpp) 15 | OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o))) 16 | 17 | CFLAGS+=-std=c++11 18 | 19 | example: obj $(OBJ_FILES) 20 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -o example $(OBJ_FILES) $(LIB) 21 | 22 | obj: 23 | mkdir -p obj 24 | 25 | obj/%.o: %.cpp 26 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 27 | 28 | obj/%.o: %.cpp %.h 29 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 30 | 31 | clean: 32 | rm -f $(OBJ_FILES) 33 | rm -f example 34 | -------------------------------------------------------------------------------- /scene-rotation/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: obj example 7 | 8 | .PHONY: example 9 | 10 | 11 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) $(GLUT_INC) 12 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) 13 | 14 | CPP_FILES=$(wildcard ./*.cpp) 15 | OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o))) 16 | 17 | CFLAGS+=-std=c++11 18 | 19 | example: obj $(OBJ_FILES) 20 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -o example $(OBJ_FILES) $(LIB) 21 | 22 | obj: 23 | mkdir -p obj 24 | 25 | obj/%.o: %.cpp 26 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 27 | 28 | obj/%.o: %.cpp %.h 29 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 30 | 31 | clean: 32 | rm -f $(OBJ_FILES) 33 | rm -f example 34 | -------------------------------------------------------------------------------- /scene-rotation/README: -------------------------------------------------------------------------------- 1 | This is a small program that demonstrates various 2D mouse input interfaces for 2 | control a 3D world-in-hand rotation. 3 | 4 | So far this implements: 5 | ROTATION_TYPE_IGL_TRACKBALL Continuous, "wrap-around" trackball, as seen in 6 | AntTweakBar. 7 | ROTATION_TYPE_BELL_TRACKBALL De facto "Standard" trackball, limited to 180° 8 | rotations. 9 | ROTATION_TYPE_TWO_AXIS_VALUATOR Rotate around drag vector by amount 10 | proportional to drag length. 11 | ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP Rotate around fixed up-vector by x 12 | drag length and around y drag vector by y drag length. As seen in Maya, 3D 13 | Studio Max, etc. 14 | 15 | More trackball variantes could be snatched from here: 16 | http://opentissue.org/svn/OpenTissue/archieve/grid3d/OpenTissue/trackball/ 17 | -------------------------------------------------------------------------------- /scene-rotation/trackball.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (c) Copyright 1993, 1994, Silicon Graphics, Inc. 3 | * ALL RIGHTS RESERVED 4 | * Permission to use, copy, modify, and distribute this software for 5 | * any purpose and without fee is hereby granted, provided that the above 6 | * copyright notice appear in all copies and that both the copyright notice 7 | * and this permission notice appear in supporting documentation, and that 8 | * the name of Silicon Graphics, Inc. not be used in advertising 9 | * or publicity pertaining to distribution of the software without specific, 10 | * written prior permission. 11 | * 12 | * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" 13 | * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, 14 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR 15 | * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON 16 | * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, 17 | * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY 18 | * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, 19 | * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF 20 | * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN 21 | * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON 22 | * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE 23 | * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. 24 | * 25 | * US Government Users Restricted Rights 26 | * Use, duplication, or disclosure by the Government is subject to 27 | * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph 28 | * (c)(1)(ii) of the Rights in Technical Data and Computer Software 29 | * clause at DFARS 252.227-7013 and/or in similar or successor 30 | * clauses in the FAR or the DOD or NASA FAR Supplement. 31 | * Unpublished-- rights reserved under the copyright laws of the 32 | * United States. Contractor/manufacturer is Silicon Graphics, 33 | * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. 34 | * 35 | * OpenGL(TM) is a trademark of Silicon Graphics, Inc. 36 | */ 37 | /* 38 | * trackball.h 39 | * A virtual trackball implementation 40 | * Written by Gavin Bell for Silicon Graphics, November 1988. 41 | */ 42 | 43 | /* 44 | * Pass the x and y coordinates of the last and current positions of 45 | * the mouse, scaled so they are from (-1.0 ... 1.0). 46 | * 47 | * The resulting rotation is returned as a quaternion rotation in the 48 | * first paramater. 49 | */ 50 | void 51 | trackball(float q[4], float p1x, float p1y, float p2x, float p2y); 52 | 53 | /* 54 | * Given two quaternions, add them together to get a third quaternion. 55 | * Adding quaternions to get a compound rotation is analagous to adding 56 | * translations to get a compound translation. When incrementally 57 | * adding rotations, the first argument here should be the new 58 | * rotation, the second and third the total rotation (which will be 59 | * over-written with the resulting new total rotation). 60 | */ 61 | void 62 | add_quats(float *q1, float *q2, float *dest); 63 | 64 | /* 65 | * A useful function, builds a rotation matrix in Matrix based on 66 | * given quaternion. 67 | */ 68 | void 69 | build_rotmatrix(float m[4][4], float q[4]); 70 | 71 | void 72 | build_rotmatrix_v2(float m[16], float q[4]); 73 | 74 | /* 75 | * This function computes a quaternion based on an axis (defined by 76 | * the given vector) and an angle about which to rotate. The angle is 77 | * expressed in radians. The result is put into the third argument. 78 | */ 79 | void 80 | axis_to_quat(float a[3], float phi, float q[4]); 81 | 82 | ////Olga//// 83 | void quat_to_axis(float q[4], float axis[3], float &phi); 84 | void add_quats_no_renorm(float q1[4], float q2[4], float dest[4]); 85 | void quat_rotate_point(float q[4], const float p1[3], float p2[3]); 86 | ////Olga//// 87 | -------------------------------------------------------------------------------- /shadow-mapping/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: obj example 7 | 8 | .PHONY: example 9 | 10 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) $(GLUT_INC) 11 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) 12 | 13 | CPP_FILES=$(wildcard ./*.cpp) 14 | OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o))) 15 | 16 | CFLAGS+=-std=c++11 17 | 18 | example: obj $(OBJ_FILES) 19 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -o example $(OBJ_FILES) $(LIB) 20 | 21 | obj: 22 | mkdir -p obj 23 | 24 | obj/%.o: %.cpp 25 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 26 | 27 | obj/%.o: %.cpp %.h 28 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 29 | 30 | clean: 31 | rm -f $(OBJ_FILES) 32 | rm -f example 33 | -------------------------------------------------------------------------------- /shared/TinyTorus.obj: -------------------------------------------------------------------------------- 1 | #### 2 | # 3 | # OBJ File Generated by Meshlab 4 | # 5 | #### 6 | # Object TinyTorus.obj 7 | # 8 | # Vertices: 24 9 | # Faces: 48 10 | # 11 | #### 12 | v -2.000000 0.000000 0.000000 13 | v -3.000000 0.000000 -1.000000 14 | v -4.000000 0.000000 -0.000001 15 | v -3.000000 0.000000 1.000000 16 | v -1.000000 -1.732050 0.000000 17 | v -1.500000 -2.598080 -1.000000 18 | v -2.000000 -3.464100 -0.000001 19 | v -1.500000 -2.598080 1.000000 20 | v 1.000000 -1.732050 0.000000 21 | v 1.500000 -2.598080 -1.000000 22 | v 2.000000 -3.464100 -0.000001 23 | v 1.500000 -2.598080 1.000000 24 | v 2.000000 0.000000 0.000000 25 | v 3.000000 0.000000 -1.000000 26 | v 4.000000 0.000000 -0.000001 27 | v 3.000000 0.000000 1.000000 28 | v 1.000000 1.732050 0.000000 29 | v 1.500000 2.598080 -1.000000 30 | v 2.000000 3.464100 -0.000001 31 | v 1.500000 2.598080 1.000000 32 | v -1.000000 1.732050 0.000000 33 | v -1.500000 2.598080 -1.000000 34 | v -2.000000 3.464100 -0.000001 35 | v -1.500000 2.598080 1.000000 36 | # 24 vertices, 0 vertices normals 37 | 38 | f 2 1 6 39 | f 5 6 1 40 | f 3 2 7 41 | f 6 7 2 42 | f 4 3 8 43 | f 7 8 3 44 | f 1 4 5 45 | f 8 5 4 46 | f 6 5 10 47 | f 9 10 5 48 | f 7 6 11 49 | f 10 11 6 50 | f 8 7 12 51 | f 11 12 7 52 | f 5 8 9 53 | f 12 9 8 54 | f 10 9 14 55 | f 13 14 9 56 | f 11 10 15 57 | f 14 15 10 58 | f 12 11 16 59 | f 15 16 11 60 | f 9 12 13 61 | f 16 13 12 62 | f 14 13 18 63 | f 17 18 13 64 | f 15 14 19 65 | f 18 19 14 66 | f 16 15 20 67 | f 19 20 15 68 | f 13 16 17 69 | f 20 17 16 70 | f 18 17 22 71 | f 21 22 17 72 | f 19 18 23 73 | f 22 23 18 74 | f 20 19 24 75 | f 23 24 19 76 | f 17 20 21 77 | f 24 21 20 78 | f 22 21 2 79 | f 1 2 21 80 | f 23 22 3 81 | f 2 3 22 82 | f 24 23 4 83 | f 3 4 23 84 | f 21 24 1 85 | f 4 1 24 86 | # 48 faces, 0 coords texture 87 | 88 | # End of File 89 | -------------------------------------------------------------------------------- /shared/animal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libigl/libigl-examples/642903fbe82f9f233a1980b379c67e66d73da1f9/shared/animal.png -------------------------------------------------------------------------------- /shared/cheburashka.tgf: -------------------------------------------------------------------------------- 1 | 1 0.49052238 0.54181994 0.46019698 2 | 2 0.48948838 0.80711737 0.47165516 3 | 3 0.49582425 0.37950696 0.45160151 4 | 4 0.49749146 0.18976581 0.44246072 5 | 5 0.41355982 0.12624592 0.4239086 6 | 6 0.41442489 0.12624592 0.56887869 7 | 7 0.57743597 0.13365921 0.44246072 8 | 8 0.58047998 0.13365921 0.56973562 9 | 9 0.35123043 0.43319543 0.46019698 10 | 10 0.2614806 0.32338386 0.46019698 11 | 11 0.63209461 0.43636307 0.46019698 12 | 12 0.70178272 0.30437801 0.46019698 13 | # 14 | 1 2 15 | 9 10 16 | 7 8 17 | 11 12 18 | 5 6 19 | 1 9 20 | 1 11 21 | 1 3 22 | 3 4 23 | 4 7 24 | 4 5 25 | # 26 | -------------------------------------------------------------------------------- /shared/cube.obj: -------------------------------------------------------------------------------- 1 | # cube.obj 2 | # 3 | 4 | g cube 5 | 6 | v 0.0 0.0 0.0 7 | v 0.0 0.0 1.0 8 | v 0.0 1.0 0.0 9 | v 0.0 1.0 1.0 10 | v 1.0 0.0 0.0 11 | v 1.0 0.0 1.0 12 | v 1.0 1.0 0.0 13 | v 1.0 1.0 1.0 14 | 15 | vn 0.0 0.0 1.0 16 | vn 0.0 0.0 -1.0 17 | vn 0.0 1.0 0.0 18 | vn 0.0 -1.0 0.0 19 | vn 1.0 0.0 0.0 20 | vn -1.0 0.0 0.0 21 | 22 | f 1//2 7//2 5//2 23 | f 1//2 3//2 7//2 24 | f 1//6 4//6 3//6 25 | f 1//6 2//6 4//6 26 | f 3//3 8//3 7//3 27 | f 3//3 4//3 8//3 28 | f 5//5 7//5 8//5 29 | f 5//5 8//5 6//5 30 | f 1//4 5//4 6//4 31 | f 1//4 6//4 2//4 32 | f 2//1 6//1 8//1 33 | f 2//1 8//1 4//1 34 | -------------------------------------------------------------------------------- /shared/decimated-knight-selection.dmat: -------------------------------------------------------------------------------- 1 | 1 502 2 | -1 3 | -1 4 | -1 5 | -1 6 | -1 7 | -1 8 | -1 9 | -1 10 | 1 11 | -1 12 | -1 13 | -1 14 | -1 15 | -1 16 | -1 17 | -1 18 | -1 19 | 1 20 | -1 21 | -1 22 | -1 23 | -1 24 | -1 25 | 2 26 | -1 27 | -1 28 | 2 29 | -1 30 | -1 31 | 1 32 | -1 33 | -1 34 | -1 35 | -1 36 | -1 37 | -1 38 | -1 39 | -1 40 | -1 41 | -1 42 | 1 43 | -1 44 | -1 45 | -1 46 | -1 47 | -1 48 | -1 49 | -1 50 | -1 51 | -1 52 | -1 53 | -1 54 | -1 55 | -1 56 | -1 57 | 0 58 | 2 59 | 1 60 | -1 61 | -1 62 | -1 63 | 1 64 | -1 65 | -1 66 | -1 67 | -1 68 | -1 69 | -1 70 | -1 71 | -1 72 | -1 73 | -1 74 | -1 75 | 0 76 | -1 77 | -1 78 | -1 79 | -1 80 | -1 81 | 2 82 | -1 83 | -1 84 | 1 85 | -1 86 | -1 87 | -1 88 | -1 89 | -1 90 | -1 91 | -1 92 | 1 93 | -1 94 | -1 95 | -1 96 | -1 97 | -1 98 | -1 99 | -1 100 | -1 101 | -1 102 | -1 103 | -1 104 | 0 105 | -1 106 | 1 107 | 1 108 | -1 109 | -1 110 | 2 111 | -1 112 | -1 113 | 0 114 | 1 115 | -1 116 | -1 117 | -1 118 | 2 119 | -1 120 | -1 121 | -1 122 | -1 123 | -1 124 | -1 125 | -1 126 | 2 127 | -1 128 | 2 129 | -1 130 | 2 131 | -1 132 | 1 133 | -1 134 | -1 135 | -1 136 | -1 137 | -1 138 | -1 139 | -1 140 | -1 141 | -1 142 | -1 143 | -1 144 | -1 145 | -1 146 | -1 147 | -1 148 | -1 149 | -1 150 | 1 151 | -1 152 | -1 153 | -1 154 | -1 155 | -1 156 | -1 157 | 1 158 | -1 159 | -1 160 | -1 161 | -1 162 | -1 163 | -1 164 | -1 165 | -1 166 | -1 167 | -1 168 | -1 169 | -1 170 | -1 171 | -1 172 | -1 173 | -1 174 | -1 175 | -1 176 | 2 177 | 2 178 | 0 179 | 0 180 | -1 181 | 1 182 | 2 183 | 2 184 | -1 185 | -1 186 | -1 187 | -1 188 | -1 189 | -1 190 | -1 191 | -1 192 | 2 193 | -1 194 | 2 195 | -1 196 | -1 197 | -1 198 | -1 199 | 1 200 | 2 201 | 0 202 | -1 203 | -1 204 | -1 205 | -1 206 | -1 207 | -1 208 | -1 209 | -1 210 | -1 211 | 2 212 | -1 213 | -1 214 | -1 215 | -1 216 | -1 217 | -1 218 | -1 219 | -1 220 | 2 221 | -1 222 | -1 223 | -1 224 | -1 225 | -1 226 | 2 227 | -1 228 | -1 229 | -1 230 | -1 231 | -1 232 | -1 233 | -1 234 | -1 235 | -1 236 | -1 237 | -1 238 | -1 239 | -1 240 | -1 241 | -1 242 | -1 243 | -1 244 | -1 245 | -1 246 | -1 247 | 1 248 | -1 249 | 1 250 | -1 251 | -1 252 | -1 253 | -1 254 | -1 255 | -1 256 | -1 257 | -1 258 | -1 259 | -1 260 | -1 261 | -1 262 | 0 263 | -1 264 | 0 265 | -1 266 | 0 267 | -1 268 | -1 269 | -1 270 | -1 271 | -1 272 | -1 273 | -1 274 | 1 275 | -1 276 | -1 277 | -1 278 | 0 279 | 1 280 | -1 281 | -1 282 | -1 283 | -1 284 | -1 285 | -1 286 | -1 287 | -1 288 | -1 289 | -1 290 | -1 291 | -1 292 | -1 293 | -1 294 | -1 295 | -1 296 | -1 297 | -1 298 | -1 299 | -1 300 | -1 301 | -1 302 | -1 303 | -1 304 | -1 305 | 2 306 | -1 307 | -1 308 | -1 309 | -1 310 | -1 311 | -1 312 | -1 313 | -1 314 | -1 315 | -1 316 | -1 317 | -1 318 | -1 319 | -1 320 | -1 321 | 0 322 | -1 323 | -1 324 | -1 325 | -1 326 | -1 327 | -1 328 | -1 329 | -1 330 | -1 331 | -1 332 | -1 333 | -1 334 | -1 335 | -1 336 | 2 337 | -1 338 | -1 339 | -1 340 | -1 341 | 0 342 | -1 343 | -1 344 | 0 345 | -1 346 | -1 347 | -1 348 | -1 349 | -1 350 | -1 351 | -1 352 | -1 353 | -1 354 | -1 355 | -1 356 | 1 357 | 0 358 | -1 359 | -1 360 | -1 361 | -1 362 | -1 363 | -1 364 | -1 365 | -1 366 | -1 367 | -1 368 | -1 369 | -1 370 | -1 371 | 0 372 | -1 373 | -1 374 | 1 375 | -1 376 | 0 377 | -1 378 | -1 379 | -1 380 | -1 381 | -1 382 | -1 383 | -1 384 | -1 385 | -1 386 | -1 387 | -1 388 | -1 389 | -1 390 | -1 391 | -1 392 | 1 393 | 2 394 | -1 395 | -1 396 | 0 397 | -1 398 | -1 399 | -1 400 | -1 401 | -1 402 | -1 403 | -1 404 | -1 405 | -1 406 | -1 407 | -1 408 | -1 409 | 2 410 | -1 411 | -1 412 | -1 413 | -1 414 | -1 415 | -1 416 | -1 417 | -1 418 | -1 419 | 2 420 | -1 421 | -1 422 | -1 423 | 0 424 | -1 425 | -1 426 | -1 427 | -1 428 | -1 429 | -1 430 | -1 431 | -1 432 | -1 433 | -1 434 | -1 435 | -1 436 | -1 437 | 2 438 | -1 439 | -1 440 | -1 441 | -1 442 | -1 443 | -1 444 | -1 445 | -1 446 | -1 447 | -1 448 | -1 449 | -1 450 | -1 451 | -1 452 | -1 453 | -1 454 | -1 455 | -1 456 | -1 457 | -1 458 | -1 459 | -1 460 | -1 461 | -1 462 | -1 463 | -1 464 | -1 465 | -1 466 | -1 467 | -1 468 | -1 469 | 0 470 | -1 471 | -1 472 | -1 473 | -1 474 | -1 475 | 1 476 | 1 477 | 1 478 | -1 479 | -1 480 | 0 481 | -1 482 | -1 483 | -1 484 | -1 485 | -1 486 | -1 487 | -1 488 | -1 489 | -1 490 | -1 491 | -1 492 | -1 493 | -1 494 | -1 495 | -1 496 | -1 497 | -1 498 | -1 499 | -1 500 | -1 501 | -1 502 | 1 503 | -1 504 | -------------------------------------------------------------------------------- /skeleton-builder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.6) 2 | 3 | SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake) 4 | 5 | # We need C++11. Put this directive after CGAL's include. 6 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -Wall -Wextra -Wno-reorder -Wno-unknown-pragmas -Wno-deprecated-declarations") 7 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") 9 | endif() 10 | 11 | find_package(EIGEN REQUIRED) 12 | include_directories( "${EIGEN_INCLUDE_DIR}" ) 13 | # Must be found before trying to find libraries in libigl/external 14 | find_package(LIBIGL REQUIRED) 15 | include_directories( "${LIBIGL_INCLUDE_DIR}" ) 16 | find_package(OpenGL REQUIRED) 17 | find_package(GLUT REQUIRED) 18 | 19 | link_directories( 20 | /usr/local/lib 21 | /opt/local/lib 22 | ${EIGEN_DIRS} 23 | ) 24 | 25 | list(APPEND LIBS 26 | ${LIBIGL_LIBRARIES} 27 | ${OPENGL_LIBRARIES} 28 | ${GLUT_LIBRARIES} 29 | ) 30 | 31 | FILE(GLOB SRCFILES *.cpp) 32 | add_executable(skeleton_builder ${SRCFILES}) 33 | target_link_libraries(skeleton_builder ${LIBS}) 34 | -------------------------------------------------------------------------------- /skeleton-builder/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | LIBIGL_LIB+=-liglembree 6 | 7 | all: obj skeleton_builder 8 | 9 | .PHONY: skeleton_builder 10 | 11 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) $(GLUT_INC) ${TETGEN_INC} $(MOSEK_INC) $(EMBREE_INC) 12 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) $(TETGEN_LIB) $(MOSEK_LIB) $(EMBREE_LIB) 13 | 14 | CPP_FILES=$(wildcard ./*.cpp) 15 | OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o))) 16 | 17 | CFLAGS+=-std=c++11 -g 18 | 19 | skeleton_builder: obj $(OBJ_FILES) 20 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -o skeleton_builder $(LIB) $(OBJ_FILES) 21 | 22 | obj: 23 | mkdir -p obj 24 | 25 | obj/%.o: %.cpp 26 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 27 | 28 | obj/%.o: %.cpp %.h 29 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 30 | 31 | clean: 32 | rm -f $(OBJ_FILES) 33 | rm -f skeleton_builder 34 | -------------------------------------------------------------------------------- /skeleton-poser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.6) 2 | 3 | SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake) 4 | 5 | # We need C++11. Put this directive after CGAL's include. 6 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -Wall -Wextra -Wno-reorder -Wno-unknown-pragmas -msse4.2 -Wno-deprecated-declarations -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -DNO_2D" ) 7 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") 9 | endif() 10 | 11 | option(WITH_MATLAB "WITH_MATLAB" OFF) 12 | 13 | 14 | find_package(EIGEN REQUIRED) 15 | include_directories( "${EIGEN_INCLUDE_DIR}" ) 16 | # Must be found before trying to find libraries in libigl/external 17 | find_package(LIBIGL REQUIRED) 18 | include_directories( "${LIBIGL_INCLUDE_DIR}" ) 19 | find_package(ANTTWEAKBAR REQUIRED) 20 | include_directories( ${ANT_TWEAK_BAR_INCLUDE_DIR} ) 21 | find_package(OpenGL REQUIRED) 22 | find_package(GLUT REQUIRED) 23 | 24 | find_package(CGAL REQUIRED) 25 | set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS TRUE CACHE BOOL "Force CGAL to maintain CMAKE flags") 26 | include(${CGAL_USE_FILE}) 27 | # CGAL's monkeying with all of the flags. Rather than change the CGAL_USE_FILE 28 | # just get ride of this flag. 29 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") 30 | remove_cxx_flag("-stdlib=libc++") 31 | endif() 32 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -Wall -Wextra -Wno-reorder -Wno-unknown-pragmas -msse4.2 -Wno-deprecated-declarations -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -DNO_2D" ) 33 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 34 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") 35 | endif() 36 | 37 | find_package(MOSEK QUIET) 38 | if(MOSEK_FOUND) 39 | include_directories( ${MOSEK_INCLUDE_DIR} ) 40 | else(MOSEK_FOUND) 41 | add_definitions(-DIGL_NO_MOSEK) 42 | if(LIBIGL_USE_STATIC_LIBRARY) 43 | set(LIBIGLMOSEK_LIBRARY "") 44 | endif(LIBIGL_USE_STATIC_LIBRARY) 45 | set(MOSEK_LIBRARIES "") 46 | endif(MOSEK_FOUND) 47 | 48 | if(WITH_MATLAB) 49 | find_package(MATLAB REQUIRED) 50 | include_directories( ${MATLAB_INCLUDE_DIR} ) 51 | add_definitions(-DWITH_MATLAB) 52 | endif() 53 | 54 | find_package(TETGEN REQUIRED) 55 | include_directories( ${TETGEN_INCLUDE_DIR}) 56 | 57 | link_directories( 58 | /usr/local/lib 59 | /opt/local/lib 60 | ${ANT_TWEAK_BAR_DIRS} 61 | ${EIGEN_DIRS} 62 | ) 63 | 64 | set(LIBS 65 | ${LIBIGL_LIBRARIES} 66 | ${OPENGL_LIBRARIES} 67 | ${MOSEK_LIBRARIES} 68 | ${MATLAB_LIBRARIES} 69 | ${GLUT_LIBRARIES} 70 | ${ANT_TWEAK_BAR_LIBRARY} 71 | ) 72 | 73 | FILE(GLOB SRCFILES *.cpp) 74 | add_executable(skeleton_poser ${SRCFILES} ${TETGEN_SOURCES}) 75 | target_link_libraries(skeleton_poser ${LIBS}) 76 | -------------------------------------------------------------------------------- /skeleton-poser/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | LIBIGL_LIB+=-liglbbw -liglcgal 6 | 7 | all: obj skeleton-poser 8 | 9 | .PHONY: skeleton-poser 10 | 11 | ifdef IGL_NO_MOSEK 12 | CFLAGS+=-DIGL_NO_MOSEK 13 | else 14 | # Adjust your mosek paths etc. accordingly 15 | ifndef MOSEKPLATFORM 16 | MOSEKPLATFORM=osx64x86 17 | endif 18 | ifndef MOSEKVERSION 19 | MOSEKVERSION=7 20 | endif 21 | MOSEK=/usr/local/mosek 22 | MOSEK_INC=-I$(MOSEK)/$(MOSEKVERSION)/tools/platform/$(MOSEKPLATFORM)/h 23 | MOSEK_LIB=-L$(MOSEK)/$(MOSEKVERSION)/tools/platform/$(MOSEKPLATFORM)/bin -lmosek64 24 | LIBIGL_LIB+=-liglmosek 25 | endif 26 | 27 | CGAL=/opt/local/ 28 | CGAL_LIB=-L$(CGAL)/lib -lCGAL -lCGAL_Core -lgmp -lmpfr -lboost_thread-mt -lboost_system-mt 29 | CGAL_INC=-I$(CGAL)/include -I/usr/include/ 30 | # This is absolutely necessary for Exact Construction 31 | CGAL_FLAGS=-frounding-math -fsignaling-nans 32 | CFLAGS+=$(CGAL_FLAGS) 33 | 34 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) $(GLUT_INC) ${CGAL_INC} ${TETGEN_INC} $(MOSEK_INC) $(EMBREE_INC) 35 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) ${CGAL_LIB} $(TETGEN_LIB) $(MOSEK_LIB) $(EMBREE_LIB) 36 | 37 | CPP_FILES=$(wildcard ./*.cpp) 38 | OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o))) 39 | 40 | CFLAGS+=-std=c++11 -g 41 | 42 | skeleton-poser: obj $(OBJ_FILES) 43 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -o skeleton-poser $(LIB) $(OBJ_FILES) 44 | 45 | obj: 46 | mkdir -p obj 47 | 48 | obj/%.o: %.cpp 49 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 50 | 51 | obj/%.o: %.cpp %.h 52 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 53 | 54 | clean: 55 | rm -f $(OBJ_FILES) 56 | rm -f skeleton-poser 57 | -------------------------------------------------------------------------------- /skeleton-poser/clean.cpp: -------------------------------------------------------------------------------- 1 | #include "clean.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | bool clean( 16 | const Eigen::MatrixXd & V, 17 | const Eigen::MatrixXi & F, 18 | Eigen::MatrixXd & CV, 19 | Eigen::MatrixXi & CF, 20 | Eigen::VectorXi & IM) 21 | { 22 | using namespace igl; 23 | using namespace igl::copyleft::tetgen; 24 | using namespace igl::copyleft::cgal; 25 | using namespace Eigen; 26 | using namespace std; 27 | //writeOBJ("VF.obj",V,F); 28 | const auto & validate_IM = []( 29 | const Eigen::MatrixXd & V, 30 | const Eigen::MatrixXd & CV, 31 | const Eigen::VectorXi & IM) 32 | { 33 | assert(IM.size() >= CV.rows()); 34 | for(int i = 0;i= 0) 37 | { 38 | double diff = (V.row(IM(i))-CV.row(i)).norm(); 39 | if(diff>1e-6) 40 | { 41 | cout<=0?nIM(a):a;}); 64 | //validate_IM(V,CV,IM); 65 | } 66 | MatrixXd TV; 67 | MatrixXi TT; 68 | { 69 | MatrixXi _1; 70 | // c convex hull 71 | // Y no boundary steiners 72 | // p polygon input 73 | // T1e-16 sometimes helps tetgen 74 | cout<<"clean: tetrahedralize"<thresh).cast().sum(); 95 | MatrixXi CT(count,TT.cols()); 96 | int c = 0; 97 | for(int t = 0;tthresh) 100 | { 101 | CT.row(c++) = TT.row(t); 102 | } 103 | } 104 | assert(c==count); 105 | boundary_facets(CT,CF); 106 | //writeMESH("CVCTCF.mesh",TV,CT,CF); 107 | cout<<"clean: remove_unreferenced"<=0?nIM(a):a;}); 121 | cout<<"clean: IM.minCoeff(): "< 4 | // Given a mesh (V,F), fix self-intersections and open boundaries 5 | // 6 | // Inputs: 7 | // V #V by 3 list of mesh vertex positions 8 | // F #F by 3 list of mesh face indices into V 9 | // Outputs: 10 | // CV #CV by 3 list of mesh vertex positions 11 | // CF #CF by 3 list of mesh face indices into CF 12 | // IM >=#CV list of indices into V, so that (CV,IM(F)) produces the same 13 | // mesh as (V,F) 14 | // Returns true iff success. 15 | // 16 | bool clean( 17 | const Eigen::MatrixXd & V, 18 | const Eigen::MatrixXi & F, 19 | Eigen::MatrixXd & CV, 20 | Eigen::MatrixXi & CF, 21 | Eigen::VectorXi & IM); 22 | #endif 23 | -------------------------------------------------------------------------------- /skeleton-poser/robust_bbw.cpp: -------------------------------------------------------------------------------- 1 | #include "robust_bbw.h" 2 | #include "clean.h" 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #ifdef WITH_MATLAB 14 | #include 15 | #endif 16 | #include 17 | 18 | bool robust_bbw( 19 | const Eigen::MatrixXd & V, 20 | const Eigen::MatrixXi & F, 21 | const Eigen::MatrixXd & C, 22 | const Eigen::MatrixXi & BE, 23 | Eigen::MatrixXd & W) 24 | { 25 | using namespace igl; 26 | using namespace igl::copyleft::tetgen; 27 | using namespace Eigen; 28 | using namespace std; 29 | // clean mesh 30 | MatrixXd CV; 31 | MatrixXi CF; 32 | VectorXi IM; 33 | if(!clean(V,F,CV,CF,IM)) 34 | { 35 | return false; 36 | } 37 | 38 | #ifdef WITH_MATLAB 39 | igl::matlab::MatlabWorkspace mw; 40 | mw.save(V,"V"); 41 | mw.save_index(F,"F"); 42 | mw.save(CV,"CV"); 43 | mw.save_index(CF,"CF"); 44 | mw.save_index(IM,"IM"); 45 | #endif 46 | 47 | MatrixXd TV; 48 | MatrixXi TT; 49 | // compute tet-mesh 50 | { 51 | MatrixXi _1; 52 | #ifdef VERBOSE 53 | cerr<<"mesh_with_skeleton"<thresh).cast().sum(); 74 | TT.resize(count,oldTT.cols()); 75 | int c = 0; 76 | for(int t = 0;tthresh) 79 | { 80 | TT.row(c++) = oldTT.row(t); 81 | } 82 | } 83 | } 84 | 85 | // compute weights 86 | VectorXi b; 87 | MatrixXd bc; 88 | if(!boundary_conditions(TV,TT,C,{},BE,{},b,bc)) 89 | { 90 | cout< 4 | // Given a possibly artifact-ridden mesh (V,F) and a skeleton (C,BE), compute 5 | // bounded biharmonic weights for each bone. The mesh will be cleaned, 6 | // weights computed on the clean mesh and then mapped back to the original 7 | // messy mesh. 8 | // 9 | // Inputs: 10 | // V #V by 3 list of mesh vertex positions 11 | // F #F by 3 list of mesh face indices into V 12 | // C #C by 3 list of join positions 13 | // BE #BE by 2 list of bone indices into C 14 | // Output: 15 | // W #V by #BE list of bone weights 16 | // Returns true iff success 17 | // 18 | bool robust_bbw( 19 | const Eigen::MatrixXd & V, 20 | const Eigen::MatrixXi & F, 21 | const Eigen::MatrixXd & C, 22 | const Eigen::MatrixXi & BE, 23 | Eigen::MatrixXd & W); 24 | #endif 25 | -------------------------------------------------------------------------------- /skeleton/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | LIBIGL_LIB+=-liglbbw -liglmosek 6 | 7 | all: obj example 8 | 9 | .PHONY: example 10 | 11 | ifdef IGL_NO_MOSEK 12 | CFLAGS+=-DIGL_NO_MOSEK 13 | else 14 | # Adjust your mosek paths etc. accordingly 15 | ifndef MOSEKPLATFORM 16 | MOSEKPLATFORM=osx64x86 17 | endif 18 | ifndef MOSEKVERSION 19 | MOSEKVERSION=7 20 | endif 21 | IGLMOSEK=../mosek/ 22 | IGLMOSEK_INC=-I$(IGLMOSEK)/ 23 | MOSEK=/usr/local/mosek 24 | MOSEK_INC=-I$(MOSEK)/$(MOSEKVERSION)/tools/platform/$(MOSEKPLATFORM)/h 25 | MOSEK_LIB=-L$(MOSEK)/$(MOSEKVERSION)/tools/platform/$(MOSEKPLATFORM)/bin -lmosek64 26 | endif 27 | 28 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) $(GLUT_INC) ${TETGEN_INC} $(MOSEK_INC) 29 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) $(TETGEN_LIB) $(MOSEK_LIB) 30 | 31 | CPP_FILES=$(wildcard ./*.cpp) 32 | OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o))) 33 | 34 | CFLAGS+=-std=c++11 -g 35 | 36 | example: obj $(OBJ_FILES) 37 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -o example $(OBJ_FILES) $(LIB) 38 | 39 | obj: 40 | mkdir -p obj 41 | 42 | obj/%.o: %.cpp 43 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 44 | 45 | obj/%.o: %.cpp %.h 46 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c $< -o $@ $(INC) 47 | 48 | clean: 49 | rm -f $(OBJ_FILES) 50 | rm -f example 51 | -------------------------------------------------------------------------------- /slice/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: example 7 | 8 | .PHONY: example 9 | 10 | #CFLAGS+=-g 11 | CFLAGS+=-Os -DNDEBUG 12 | inc=$(LIBIGL_INC) $(EIGEN3_INC) 13 | lib=$(LIBIGL_LIB) 14 | 15 | example: example.o 16 | g++ $(CFLAGS) -o example example.o $(lib) 17 | 18 | example.o: example.cpp 19 | g++ $(CFLAGS) -c example.cpp -o example.o $(inc) 20 | clean: 21 | rm -f example.o 22 | rm -f example 23 | -------------------------------------------------------------------------------- /slice/README: -------------------------------------------------------------------------------- 1 | Small example showing how to use the slice.h function in the igl lib which is 2 | like the slice operator in matlab. 3 | 4 | Compile: 5 | make 6 | 7 | Run: 8 | ./example 9 | -------------------------------------------------------------------------------- /slice/example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET 3 | #define EIGEN_IM_MAD_AS_HELL_AND_IM_NOT_GOING_TO_TAKE_IT_ANYMORE 4 | #include 5 | using namespace Eigen; 6 | 7 | #include 8 | #include 9 | using namespace std; 10 | 11 | #include 12 | #include 13 | #include 14 | using namespace igl; 15 | 16 | int main(int argc, char * argv[]) 17 | { 18 | // Dense 19 | MatrixXd A = MatrixXd::Identity(5,5); 20 | cout<<"A=["< spA; 37 | speye(5,5,spA); 38 | cout<<"spA_IJV=["< spB; 41 | cout<<"spB=spA(R,C);"< 3 | #include 4 | using namespace std; 5 | #include 6 | using namespace igl; 7 | 8 | #include 9 | 10 | template 11 | void matlab_print(const string name, const T & X) 12 | { 13 | cout<("Y",Y); 32 | matlab_print("IX",IX); 33 | 34 | // Verify that IX really does sort X into Y 35 | int num_outer = (dim == 1 ? X.cols() : X.rows() ); 36 | // get number of rows (or columns) 37 | int num_inner = (dim == 1 ? X.rows() : X.cols() ); 38 | bool verified = true; 39 | for(int i = 0;i 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | using namespace Eigen; 16 | using namespace std; 17 | using namespace igl; 18 | //MatrixXd X; 19 | //if(!readDMAT("X.dmat",X)) 20 | //{ 21 | // X = MatrixXd::Random(766443,2); 22 | // for(int x = 0;xfile2 10 | cat file1 | ./stdin_to_temp_demo dummy1 dummy2 | cat >file2 11 | ./stdin_to_temp_demo file2 12 | ./stdin_to_temp_demo file2 13 | -------------------------------------------------------------------------------- /stdin_to_temp/example.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Simple example showing how to use stdin_to_temp 3 | * 4 | * Compile with: 5 | * g++ -O3 -o stdin_to_temp_demo stdin_to_temp_demo.cpp 6 | * 7 | * Run examples: 8 | * cat file1 | ./stdin_to_temp_demo 9 | * cat file1 | ./stdin_to_temp_demo | cat >file2 10 | * cat file1 | ./stdin_to_temp_demo dummy1 dummy2 | cat >file2 11 | * ./stdin_to_temp_demo file2 12 | * ./stdin_to_temp_demo file2 13 | * 14 | */ 15 | 16 | #include 17 | using namespace igl; 18 | 19 | #include 20 | using namespace std; 21 | 22 | int main(int argc,char * argv[]) 23 | { 24 | // Process arguements and print to stderr 25 | for(int i = 1;i 11 | #include 12 | #include 13 | #include 14 | using namespace igl; 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | using namespace std; 21 | 22 | #if defined(_WIN32) || defined(_WIN64) 23 | // MiniGLUT.h is provided to avoid the need of having GLUT installed to 24 | // recompile this example. Do not use it in your own programs, better 25 | // install and use the actual GLUT library SDK. 26 | # define USE_MINI_GLUT 27 | #endif 28 | 29 | #if defined(USE_MINI_GLUT) 30 | # include "../src/MiniGLUT.h" 31 | #elif defined(__APPLE__) 32 | # include 33 | #else 34 | # include 35 | #endif 36 | 37 | // This example displays one of the following shapes 38 | typedef enum { SHAPE_TEAPOT=1, SHAPE_TORUS, SHAPE_CONE } Shape; 39 | #define NUM_SHAPES 3 40 | Shape g_CurrentShape = SHAPE_TEAPOT; 41 | // Shape orientation (stored as a quaternion) 42 | float rotation[] = { 0.0f, 0.0f, 0.0f, 1.0f }; 43 | float down_rotation[4]; 44 | // Shapes material 45 | const float g_MatAmbient[] = { 0.5f, 0.0f, 0.0f, 1.0f }; 46 | const float g_MatDiffuse[] = { 1.0f, 1.0f, 0.0f, 1.0f }; 47 | // Light parameter 48 | const double g_LightMultiplier = 1.0f; 49 | const float g_LightDirection[] = { -0.57735f, -0.57735f, -0.57735f }; 50 | // Keep track of mouse down 51 | int down_mouse_x, down_mouse_y; 52 | // keep track of size 53 | int width, height; 54 | float speed_factor = 1; 55 | 56 | void mouse(int glutButton, int glutState, int mouse_x, int mouse_y) 57 | { 58 | down_mouse_x = mouse_x; 59 | down_mouse_y = mouse_y; 60 | copy(rotation,rotation+4,down_rotation); 61 | } 62 | 63 | void mouse_move(int mouse_x, int mouse_y) 64 | { 65 | trackball( 66 | width, 67 | height, 68 | speed_factor, 69 | down_rotation, 70 | down_mouse_x, 71 | down_mouse_y, 72 | mouse_x, 73 | mouse_y, 74 | rotation); 75 | glutPostRedisplay(); 76 | } 77 | 78 | void key(unsigned char key, int mouse_x, int mouse_y) 79 | { 80 | if(key == ' ') 81 | { 82 | g_CurrentShape = (Shape)((g_CurrentShape)%NUM_SHAPES+1); 83 | } 84 | glutPostRedisplay(); 85 | } 86 | 87 | // Callback function called by GLUT to render screen 88 | void Display(void) 89 | { 90 | 91 | // Clear frame buffer 92 | glClearColor(0, 0, 0, 1); 93 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 94 | 95 | glEnable(GL_DEPTH_TEST); 96 | glDisable(GL_CULL_FACE); 97 | glEnable(GL_NORMALIZE); 98 | 99 | float v[4]; // will be used to set light paramters 100 | // Set light 101 | glEnable(GL_LIGHTING); 102 | glEnable(GL_LIGHT0); 103 | v[0] = v[1] = v[2] = g_LightMultiplier*0.4f; v[3] = 1.0f; 104 | glLightfv(GL_LIGHT0, GL_AMBIENT, v); 105 | v[0] = v[1] = v[2] = g_LightMultiplier*0.8f; v[3] = 1.0f; 106 | glLightfv(GL_LIGHT0, GL_DIFFUSE, v); 107 | v[0] = -g_LightDirection[0]; v[1] = -g_LightDirection[1]; v[2] = -g_LightDirection[2]; v[3] = 0.0f; 108 | glLightfv(GL_LIGHT0, GL_POSITION, v); 109 | 110 | // Set material 111 | glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, g_MatAmbient); 112 | glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, g_MatDiffuse); 113 | 114 | // Rotate and draw shape 115 | glPushMatrix(); 116 | float mat[4*4]; // rotation matrix 117 | quat_to_mat(rotation,mat); 118 | glMultMatrixf(mat); 119 | glCallList(g_CurrentShape); 120 | glPopMatrix(); 121 | 122 | // Present frame buffer 123 | glutSwapBuffers(); 124 | 125 | //// Recall Display at next frame 126 | //glutPostRedisplay(); 127 | } 128 | 129 | 130 | // Callback function called by GLUT when window size changes 131 | void Reshape(int width, int height) 132 | { 133 | // keep track of size 134 | ::width = width; 135 | ::height = height; 136 | // Set OpenGL viewport and camera 137 | glViewport(0, 0, width, height); 138 | glMatrixMode(GL_PROJECTION); 139 | glLoadIdentity(); 140 | gluPerspective(40, (double)width/height, 1, 10); 141 | glMatrixMode(GL_MODELVIEW); 142 | glLoadIdentity(); 143 | gluLookAt(0,0,5, 0,0,0, 0,1,0); 144 | } 145 | 146 | 147 | // Function called at exit 148 | void Terminate(void) 149 | { 150 | glDeleteLists(SHAPE_TEAPOT, NUM_SHAPES); 151 | } 152 | 153 | // Main 154 | int main(int argc, char *argv[]) 155 | { 156 | bool help_and_quit = false; 157 | if(argc > 1) 158 | { 159 | if( 160 | argv[1][0] == '-' && 161 | argv[1][1] == 'h') 162 | { 163 | help_and_quit = true; 164 | }else 165 | { 166 | int count = sscanf(argv[1],"%g",&speed_factor); 167 | if(count != 1) 168 | { 169 | printf("Error: %s is not a valid speed factor.", 170 | argv[1]); 171 | help_and_quit = true; 172 | } 173 | } 174 | } 175 | if(help_and_quit) 176 | { 177 | printf( 178 | "Usage:\n ./example\nor\n ./example [positive speed factor]\n\n" 179 | "Interaction:\n Drag on screen to use trackball\n" 180 | " Press SPACE to change shape\n"); 181 | return 1; 182 | } 183 | 184 | // Initialize GLUT 185 | glutInit(&argc, argv); 186 | glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); 187 | glutInitWindowSize(640, 480); 188 | glutCreateWindow("Simple GLUT example with trackball"); 189 | glutCreateMenu(NULL); 190 | 191 | // Set GLUT callbacks 192 | glutDisplayFunc(Display); 193 | glutReshapeFunc(Reshape); 194 | atexit(Terminate); // Called after glutMainLoop ends 195 | 196 | // Set GLUT event callbacks 197 | // Directly redirect GLUT mouse button events to trackball example 198 | glutMouseFunc(mouse); 199 | // Directly redirect GLUT mouse motion events to trackball example 200 | glutMotionFunc(mouse_move); 201 | //glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT); 202 | // Catch keyboard action 203 | glutKeyboardFunc(key); 204 | //glutSpecialFunc((GLUTspecialfun)TwEventSpecialGLUT); 205 | //TwGLUTModifiersFunc(glutGetModifiers); 206 | 207 | // Create some 3D objects (stored in display lists) 208 | glNewList(SHAPE_TEAPOT, GL_COMPILE); 209 | glutSolidTeapot(1.0); 210 | glEndList(); 211 | glNewList(SHAPE_TORUS, GL_COMPILE); 212 | glutSolidTorus(0.3, 1.0, 16, 32); 213 | glEndList(); 214 | glNewList(SHAPE_CONE, GL_COMPILE); 215 | glutSolidCone(1.0, 1.5, 64, 4); 216 | glEndList(); 217 | 218 | // Init rotation 219 | float axis[] = { 0.7f, 0.7f, 0.0f }; 220 | float angle = 0.8f; 221 | axis_angle_to_quat(axis,angle,rotation); 222 | 223 | // Call the GLUT main loop 224 | glutMainLoop(); 225 | 226 | return 0; 227 | } 228 | 229 | -------------------------------------------------------------------------------- /transparency/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: example 7 | 8 | .PHONY: example 9 | 10 | CFLAGS+=-O3 11 | 12 | INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) 13 | LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) 14 | 15 | example: example.o 16 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -o example example.o $(LIB) 17 | 18 | example.o: example.cpp 19 | g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c example.cpp -o example.o $(INC) 20 | clean: 21 | rm -f example.o 22 | rm -f example 23 | -------------------------------------------------------------------------------- /transparency/project.m: -------------------------------------------------------------------------------- 1 | function W = project(V,MV,P,VP) 2 | V = V * MV' * P'; 3 | % WTF! Perspective division is not in the documentation for gluProject: 4 | % http://www.opengl.org/sdk/docs/man2/xhtml/gluProject.xml 5 | V = bsxfun(@rdivide,V,V(:,4)); 6 | W = [ ... 7 | VP(1) + (VP(3) * (V(:,1)+1))/2, ... 8 | VP(2) + (VP(4) * (V(:,2)+1))/2, ... 9 | (V(:,3)+1)/2]; 10 | end 11 | -------------------------------------------------------------------------------- /transpose_blocks/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | # Shared flags etc. 4 | include ../Makefile.conf 5 | 6 | all: example 7 | 8 | .PHONY: example 9 | 10 | CFLAGS+=-g 11 | inc=$(LIBIGL_INC) $(EIGEN3_INC) 12 | lib=$(LIBIGL_LIB) 13 | 14 | example: example.o 15 | g++ $(CFLAGS) -o example example.o $(lib) 16 | 17 | example.o: example.cpp 18 | g++ $(CFLAGS) -c example.cpp -o example.o $(inc) 19 | clean: 20 | rm -f example.o 21 | rm -f example 22 | -------------------------------------------------------------------------------- /transpose_blocks/README: -------------------------------------------------------------------------------- 1 | This is a simple example program that shows how to use the transpose_blocks 2 | function of the igl library 3 | 4 | 5 | To Build: 6 | make 7 | 8 | To Run: 9 | ./example 10 | which should produce 11 | A=[ 12 | 0 1 2 3 13 | 4 5 6 7 14 | 100 101 102 103 15 | 104 105 106 107 16 | 200 201 202 203 17 | 204 205 206 207 18 | ]; 19 | B=[ 20 | 0 4 21 | 1 5 22 | 2 6 23 | 3 7 24 | 100 104 25 | 101 105 26 | 102 106 27 | 103 107 28 | 200 204 29 | 201 205 30 | 202 206 31 | 203 207 32 | ]; 33 | 34 | 35 | -------------------------------------------------------------------------------- /transpose_blocks/example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | #include 5 | using namespace igl; 6 | 7 | int main(int argc,char * argv[]) 8 | { 9 | // hieght of block 10 | int m = 2; 11 | // width of block 12 | int n = 4; 13 | // number of blocks 14 | int k = 3; 15 | // dimension blocks run along 16 | int dim = 1; 17 | 18 | // Input 19 | Eigen::MatrixXd A; 20 | 21 | if(dim == 1) 22 | { 23 | A.resize(m*k,n); 24 | }else{ 25 | A.resize(m,n*k); 26 | } 27 | 28 | // loop over blocks 29 | for(int b = 0;b