diff --git a/examples/ambient-occlusion-mex/mexFunction.cpp b/examples/ambient-occlusion-mex/mexFunction.cpp index 0440fe54d..492ba8ee8 100644 --- a/examples/ambient-occlusion-mex/mexFunction.cpp +++ b/examples/ambient-occlusion-mex/mexFunction.cpp @@ -11,7 +11,7 @@ #include #include -void mexFunction(int nlhs, mxArray *plhs[], +void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { // This is useful for debugging whether Matlab is caching the mex binary @@ -31,7 +31,7 @@ void mexFunction(int nlhs, mxArray *plhs[], // Prepare left-hand side nlhs = 1; - //read("../shared/cheburashka.off",V,F); + //read_triangle_mesh("../shared/cheburashka.off",V,F); //P = V; //per_vertex_normals(V,F,N); ambient_occlusion(V,F,P,N,num_samples,S); diff --git a/examples/basic_topology/example1.cpp b/examples/basic_topology/example1.cpp index acd264cb4..099fe6f37 100644 --- a/examples/basic_topology/example1.cpp +++ b/examples/basic_topology/example1.cpp @@ -1,10 +1,10 @@ // -// IGL Lib - Simple C++ mesh library +// IGL Lib - Simple C++ mesh library // // Copyright 2011, Daniele Panozzo. All rights reserved. // IMPORTANT DO NOT REMOVE OR MOVE -#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET +#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET #include #include @@ -19,7 +19,7 @@ int main (int argc, const char * argv[]) { Eigen::MatrixXd V; Eigen::MatrixXi F; - igl::read("../shared/TinyTorus.obj",V,F); + igl::read_triangle_mesh("../shared/TinyTorus.obj",V,F); std::cout << "Mesh loaded!\n"; cout << "Vertex Array:" << endl; @@ -28,9 +28,9 @@ int main (int argc, const char * argv[]) cout << "Face Array:" << endl; cout << F << endl; cout << "-------------" << endl; - + igl::write("bunny_out.off",V,F); - + // Face Topology cout << "TT Topology:" << endl; Eigen::MatrixXi TT; @@ -43,12 +43,11 @@ int main (int argc, const char * argv[]) Eigen::MatrixXi EV; Eigen::MatrixXi FE; Eigen::MatrixXi EF; - + igl::edgetopology(V,F,EV,FE, EF); cout << EV << endl << FE << endl << EF << endl; cout << "-------------" << endl; - - + + return 0; } - diff --git a/examples/embree/example.cpp b/examples/embree/example.cpp index 291f383bb..4ad0c2454 100644 --- a/examples/embree/example.cpp +++ b/examples/embree/example.cpp @@ -220,9 +220,9 @@ void display() const double w0 = (1.0-hit->u-hit->v); const double w1 = hit->u; const double w2 = hit->v; - VectorXd hitP = - w0 * V.row(F(hit->id,0)) + - w1 * V.row(F(hit->id,1)) + + VectorXd hitP = + w0 * V.row(F(hit->id,0)) + + w1 * V.row(F(hit->id,1)) + w2 * V.row(F(hit->id,2)); glVertex3dv(hitP.data()); } @@ -278,7 +278,7 @@ void display() glDisable(GL_COLOR_MATERIAL); glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(1.0,0.3,0.3,0.6); glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -428,7 +428,7 @@ void key(unsigned char key, int mouse_x, int mouse_y) default: cout<<"Unknown key command: "<= viewports[vp].x && - y >= viewports[vp].y && - x < viewports[vp].x+viewports[vp].width && + x >= viewports[vp].x && + y >= viewports[vp].y && + x < viewports[vp].x+viewports[vp].width && y < viewports[vp].y+viewports[vp].height) { down_vp = vp; @@ -503,7 +503,7 @@ void key(unsigned char key, int mouse_x, int mouse_y) default: cout<<"Unknown key command: "< -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. -#include "read.h" +#include "read_triangle_mesh.h" -#include "readOBJ.h" -#include "readOFF.h" -#include "pathinfo.h" +#include +#include +#include #include #include template -IGL_INLINE bool igl::read( +IGL_INLINE bool igl::read_triangle_mesh( const std::string str, std::vector > & V, std::vector > & F) @@ -45,7 +45,7 @@ IGL_INLINE bool igl::read( #ifndef IGL_NO_EIGN template -IGL_INLINE bool igl::read( +IGL_INLINE bool igl::read_triangle_mesh( const std::string str, Eigen::PlainObjectBase& V, Eigen::PlainObjectBase& F) @@ -55,7 +55,7 @@ IGL_INLINE bool igl::read( ; while (*p != '.') p--; - + if (!strcmp(p, ".obj") || !strcmp(p, ".OBJ")) { return igl::readOBJ(str,V,F); @@ -63,9 +63,9 @@ IGL_INLINE bool igl::read( { return igl::readOFF(str,V,F); } - else + else { - fprintf(stderr,"read() does not recognize extension: %s\n",p); + fprintf(stderr,"read_triangle_mesh() does not recognize extension: %s\n",p); return false; } } @@ -74,7 +74,7 @@ IGL_INLINE bool igl::read( #ifndef IGL_HEADER_ONLY // Explicit template specialization // generated by autoexplicit.sh -template bool igl::read, Eigen::Matrix >(std::basic_string, std::allocator >, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); -template bool igl::read(std::basic_string, std::allocator >, std::vector >, std::allocator > > >&, std::vector >, std::allocator > > >&); -template bool igl::read, Eigen::Matrix >(std::string, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); +template bool igl::read_triangle_mesh, Eigen::Matrix >(std::basic_string, std::allocator >, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); +template bool igl::read_triangle_mesh(std::basic_string, std::allocator >, std::vector >, std::allocator > > >&, std::vector >, std::allocator > > >&); +template bool igl::read_triangle_mesh, Eigen::Matrix >(std::string, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif diff --git a/include/igl/read.h b/include/igl/read_triangle_mesh.h similarity index 81% rename from include/igl/read.h rename to include/igl/read_triangle_mesh.h index 20e582275..aee25dffc 100644 --- a/include/igl/read.h +++ b/include/igl/read_triangle_mesh.h @@ -1,12 +1,12 @@ // This file is part of libigl, a simple c++ geometry processing library. -// +// // Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. -#ifndef IGL_READ_H -#define IGL_READ_H +#ifndef IGL_READ_TRIANGLE_MESH_H +#define IGL_READ_TRIANGLE_MESH_H #include "igl_inline.h" #ifndef IGL_NO_EIGEN @@ -15,9 +15,10 @@ #include #include // History: +// renamed read -> read_triangle_mesh Daniele 24 June 2014 // return type changed from void to bool Alec 18 Sept 2011 -namespace igl +namespace igl { // read mesh from an ascii file with automatic detection of file format. supported: obj, off) // Templates: @@ -31,13 +32,13 @@ namespace igl // V eigen double matrix #V by 3 // F eigen int matrix #F by 3 template - IGL_INLINE bool read( + IGL_INLINE bool read_triangle_mesh( const std::string str, std::vector > & V, std::vector > & F); #ifndef IGL_NO_EIGEN template - IGL_INLINE bool read( + IGL_INLINE bool read_triangle_mesh( const std::string str, Eigen::PlainObjectBase& V, Eigen::PlainObjectBase& F); @@ -45,7 +46,7 @@ namespace igl } #ifdef IGL_HEADER_ONLY -# include "read.cpp" +# include "read_triangle_mesh.cpp" #endif #endif diff --git a/include/igl/triangulate.h b/include/igl/triangulate.h index d7f34372a..f29cec0b6 100644 --- a/include/igl/triangulate.h +++ b/include/igl/triangulate.h @@ -1,9 +1,9 @@ // This file is part of libigl, a simple c++ geometry processing library. -// +// // Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #ifndef IGL_TRIANGULATE_H #define IGL_TRIANGULATE_H @@ -14,7 +14,7 @@ #endif #include -namespace igl +namespace igl { // Triangulate a general polygonal mesh into a triangle mesh. // @@ -26,7 +26,7 @@ namespace igl // Example: // vector > vV; // vector > vF; - // read("poly.obj",vV,vF); + // read_triangle_mesh("poly.obj",vV,vF); // MatrixXd V; // MatrixXi F; // list_to_matrix(vV,V); @@ -42,4 +42,3 @@ namespace igl #endif #endif - diff --git a/tutorial.html b/tutorial.html index 5d2ca1d46..f3a748079 100644 --- a/tutorial.html +++ b/tutorial.html @@ -13,13 +13,13 @@
  • Benefits and drawbacks
  • -
  • +
  • Statically linked library (libigl.a)
  • -
  • +
  • Compressed igl.h/igl.cpp pair
    • Benefits and drawbacks
    • @@ -30,7 +30,7 @@
    • Conversion from matlab
        - +
        @@ -97,7 +97,7 @@
        This practice is not recommended outside of debugging purposes.
        - +

        Benefits of headers-only library

          @@ -214,7 +214,7 @@ cd /to/your/project make 2>$LIBIGL/make.err cd $LIBIGL cat make.err | ./autoexplicit.sh -make clean +make clean make @@ -241,11 +241,11 @@ make

          Calling the script:

          scripts/compress.sh igl.h igl.cpp

          will create a single header - igl.h and a single cpp file igl.cpp. + igl.h and a single cpp file igl.cpp.

          Alternatively, you can also compress everything into a single header file (analagous to IGL_HEADER_ONLY):

          scripts/compress.sh igl.h
          - +

          Benefits of compressed .h/.cpp pair

          • Easy incorporation: This can be easily incorporated @@ -278,7 +278,7 @@ int main(int argc, char * argv[]) { Eigen::MatrixXd V; Eigen::MatrixXi F; - return (argc>=2 && igl::read(argv[1],V,F)?0:1); + return (argc>=2 && igl::read_triangle_mesh(argv[1],V,F)?0:1); }

            Then compile igl.cpp with: @@ -314,10 +314,10 @@ grep OpenGL `grep -L IGL_NO_OPENGL include/igl/*` optional. All OpenGL-dependent functions may be disabled by defining the IGL_NO_OPENGL preprocessor macro.

            -

            Likewise, +

            Likewise, AntTweakBar - is an - assumed dependency, similarly diabled by defining + is an + assumed dependency, similarly diabled by defining the IGL_NO_ANTTWEAKBAR preprocessor macro.

            Each IGL_NO_XXX should just be replaced by a libiglXXX.a extra

            @@ -350,7 +350,7 @@ grep OpenGL `grep -L IGL_NO_OPENGL include/igl/*` translation table). We have implemented a few additional matlab-esque functions to make the translation even easier. Our own translation table shows a list - of common matlab functions and their igl-eigen equivalents. + of common matlab functions and their igl-eigen equivalents.

            Including OpenGL