Ver Fonte

update bbw demo to use libigl

Former-commit-id: 9e617b854d0d6f12bf69c8af2f2a6d357d6afd22
Alec Jacobson (jalec há 12 anos atrás
pai
commit
2e3e563ed2

+ 8 - 11
examples/bbw/Makefile

@@ -2,10 +2,11 @@ include ../../Makefile.conf
 
 CXX=g++
 
-IGL=../../
-IGL_INC=-I${IGL}/include
-IGL_LIB=-L${IGL}/lib -ligl
+LIBIGL=../../
+LIBIGL_INC=-I${LIBIGL}/include
+LIBIGL_LIB=-L${LIBIGL}/lib -ligl
 
+# Adjust your mosek paths etc. accordingly
 ifndef MOSEKPLATFORM
   MOSEKPLATFORM=osx64x86
 endif
@@ -15,22 +16,20 @@ MOSEK_LIB=-L$(MOSEK)/6/tools/platform/$(MOSEKPLATFORM)/bin -lmosek64 -liglmosek
 
 EIGEN3_INC=-I$(DEFAULT_PREFIX)/include/eigen3 -I$(DEFAULT_PREFIX)/include/eigen3/unsupported
 
-TETGEN=$(IGL)/external/tetgen
+# By default I'm using the libigl version. Adjust accordingly
+TETGEN=$(LIBIGL)/external/tetgen
 TETGEN_LIB=-L$(TETGEN) -ligltetgen -ltet 
 TETGEN_INC=-I$(TETGEN)
 
-INC=-I. ${EIGEN3_INC} ${IGL_INC} ${TETGEN_INC} ${MOSEK_INC} 
-LIB=${TETGEN_LIB} ${MOSEK_LIB} ${OPENGL_LIB} ${GLUT_LIB} ${IGL_LIB} 
+INC=-I. ${EIGEN3_INC} ${LIBIGL_INC} ${TETGEN_INC} ${MOSEK_INC} 
+LIB=${TETGEN_LIB} ${MOSEK_LIB} ${OPENGL_LIB} ${GLUT_LIB} ${LIBIGL_LIB} 
 
 # Make file for bbw_demo
 .PHONY: all
 all: bbw_demo
 
 CPP_FILES=$(wildcard ./*.cpp)
-#C_FILES=$(wildcard ./*.c)
 OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o))) 
-#$(addprefix obj/,$(notdir $(C_FILES:.c=.o)))
-CFLAGS+=-DSHADER_DIR="\"./GLSL\""
 
 bbw_demo: obj $(OBJ_FILES)
 	$(CXX) -o bbw_demo $(CFLAGS) $(OBJ_FILES) $(LIB)
@@ -38,8 +37,6 @@ bbw_demo: obj $(OBJ_FILES)
 obj:
 	mkdir -p obj
 
-#obj/%.o: %.c %.h
-#	gcc $(CFLAGS) -o $@ -c $< $(INC)
 obj/%.o: %.cpp %.h
 	$(CXX) $(CFLAGS) -o $@ -c $< $(INC)
 obj/%.o: %.cpp

+ 56 - 33
examples/bbw/README

@@ -4,17 +4,64 @@ supports point handles and skeleton trees (bones). Cages are not supported.
 This program only computes and outputs the weight function values. You should
 be able to load them into matlab or maya or whatever.
 
+This demo (main.cpp) is really just a skeleton of function calls that load the
+input and writes the output. The real "meat" of the bbw demo is conducted in
+the bbw function of libigl. If you only want to look at that implementation,
+then download libigl and jump to libigl/include/igl/mosek/bbw.h and
+libigl/include/igl/mosek/bbw.cpp
+
+= Dependencies =
+
+The dependencies are:
+  libigl
+    eigen3
+    tetgen
+    mosek
+    libigl_tetgen
+    libigl_mosek
+
+  = libigl =
+  libigl is our groups internal library. The library functions as an inlined
+  header library and simultaneously a static library.
+  http://igl.ethz.ch/projects/libigl/
+
+  This demo depends on the libigl_tetgen and libigl_mosek extras that come with
+  libigl. You will have to edit your libigl Makefile.conf accordingly: set
+  IGL_WITH_TETGEN=1 and IGL_WITH_MOSEK=1 and then build the main libigl library
+  and the extras with:
+  
+  make lib
+  make extras
+  
+    = Eigen3 =
+    The libigl dependencies rely on a depracted version of the Sparse Matrix
+    suite in eigen 3. Thus you need the correct version of eigen. It's not
+    clear how much longer this will work with the current version of Eigen.
+  
+    = Mosek =
+    Mosek is free for academics and has its own installation instructions.
+    Adjust the makefile accordingly.
+  
+    = Tetgen =
+    Tetgen is also free and easy to install. Be sure to compile the library
+    version, i.e.: 
+      make tetlib
+  
+    To make life a little easier, libigl include a working version of tetgen in
+    libigl/external/tetgen/. You can go there and compile libtet.a or download
+    the tetgen source and do that on your own. Whatever.
+
 = COMPILE =
 
-First install the dependencies (e.g. mosek).  If your on a mac, and why
-wouldn't you be, then you *should* with any luck and by the grace of God be
-able to compile with:
+First install the dependencies (eigen, tetgen, mosek, libigl).  If your on a
+mac, and why wouldn't you be, then you *should* with any luck and by the grace
+of God be able to compile with:
 
   make
 
 = RUN =
 
-Then run an example with (e.g.):
+Then run an example with:
 
   ./bbw_demo examples/brick.obj examples/brick.tgf
 
@@ -25,38 +72,14 @@ This will produce at least 2 files:
 
 = File Formats =
 
-See file-formats/index.html
-
-The dependencies are:
-  igl_lib
-    eigen3
-    tetgen
-    mosek
-
-= Igl lib =
-IGL_lib is our groups internal library. It will someday be publically
-available, but not yet. Thus I only include here a bare minimum to get this
-demo to work. The library functions as an inlined header library. All the
-source is located in ./igl_lib/include/igl
-
-  = Eigen3 =
-  The igl dependencies rely on a depracted version of the Sparse Matrix suite
-  in eigen 3. Thus you need the correct version of eigen. To make this easier I
-  have included the necessary version of eigen here: ./eigen3
-
-  = Mosek =
-  Mosek is free for academics and has its own installation instructions. Adjust
-  your makefile accordingly.
+See libigl/file-formats/index.html
 
-  = Tetgen =
-  Tetgen is also free and easy to install. Be sure to compile the library
-  version, i.e.: 
-    make tetlib
+= Zip =
+Package up this demo using:
 
-  To make life a little easier I include a working version of tetgen in
-  ./igl_lib/external/tetgen/. You can go there and compile libtet.a or download
-  the tetgen source and do that on your own. Whatever.
+zip -9 -r -x=*/.hg/* -x=*un~  bbw_demo_3d.zip ../bbw
 
+= Contact =
 
 You can try to email Alec Jacobson (alecjacobson@gmail.com) with questions.
 Especially regarding the algorithm described in "Bounded biharmonic weights for

+ 4 - 5
examples/bbw/main.cpp

@@ -18,7 +18,7 @@
 #include <string>
 
 // Whether medit program is install
-const bool WITH_MEDIT = true;
+//#define WITH_MEDIT
 
 const char * USAGE=
 "Usage:\n"
@@ -228,12 +228,11 @@ int main(int argc, char * argv[])
   {
     return 1;
   }
+#ifdef WITH_MEDIT
   // If you have medit installed then it's convenient to visualize the tet mesh
   // at this point
-  if(WITH_MEDIT)
-  {
-    launch_medit(VV,TT,FF,false);
-  }
+  launch_medit(VV,TT,FF,false);
+#endif
   // Compute boundary conditions (aka fixed value constraints)
   // List of boundary indices (aka fixed value indices into VV)
   VectorXi b;

+ 34 - 0
file-formats/rbr.html

@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+  <head>
+    <link rel='stylesheet' type='text/css' href='../style.css' >
+    <title>libigl file formats | .rbr</title>
+  </head>
+  <body class=article_body>
+  <div class=article>
+    <a href=..><img src=../libigl-logo.jpg alt="igl logo" class=center></a>
+    <h1>.rbr - ReAntTweakbar state file</h1>
+    <hr>
+    <p>
+An .rbr file contains the saved values of the ReAntTweakBar class. It is used
+to load and save variables (and states specified via callbacks) stored in an
+AntTweakBar GUI.
+    </p>
+    <p>
+Each line contains the name of the AntTweakBar item, the type of item and the
+value as a string:
+    </p>
+    <pre><code>[name]: [type] [value]</code></pre>
+    <p>
+As per AntTweakBar's own advice, names should not contain spaces. Names should
+also not contain colons (':'). An example of a line looks like:
+    </p>
+    <pre><code>my_rotation: TW_TYPE_QUAT4 0.0111272 -0.00101157 0.00648534 -0.999917</code></pre>
+    <p>Not all AntTweakBar types are currently supported. See
+    <code>igl/ReAntTweakbar.h</code> for an up-to-date list of supported
+    types.</p>
+    <p>See also: <a href=.>file formats</a></p>
+  </div>
+  </body>
+</html>
+

+ 1 - 1
include/igl/tetgen/mesh_with_skeleton.cpp

@@ -40,7 +40,7 @@ bool igl::mesh_with_skeleton(
   //   * has no 0-volume pieces
   // Default settings pq100 tell tetgen to mesh interior of triangle mesh and
   // to produce a graded tet mesh
-  writeOFF("mesh_with_skeleton.off",VS,F);
+  //writeOFF("mesh_with_skeleton.off",VS,F);
   cerr<<"tetgen begin()"<<endl;
   int status = tetrahedralize( VS,F,"pq100Y",VV,TT,FF);
   cerr<<"tetgen end()"<<endl;