diff --git a/examples/camera/example.cpp b/examples/camera/example.cpp index 6ece00202..85af002b5 100644 --- a/examples/camera/example.cpp +++ b/examples/camera/example.cpp @@ -230,7 +230,7 @@ void draw_scene(const igl::Camera & v_camera, glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); - if(v_camera.m_angle > Camera::MIN_ANGLE) + if(v_camera.m_angle > IGL_CAMERA_MIN_ANGLE) { gluPerspective(v_camera.m_angle,v_camera.m_aspect,v_camera.m_near,v_camera.m_far); }else diff --git a/include/igl/avg_edge_length.cpp b/include/igl/avg_edge_length.cpp index 154d94f9c..ae6772223 100644 --- a/include/igl/avg_edge_length.cpp +++ b/include/igl/avg_edge_length.cpp @@ -10,7 +10,7 @@ #include template -double igl::avg_edge_length( +IGL_INLINE double igl::avg_edge_length( const Eigen::PlainObjectBase& V, const Eigen::PlainObjectBase& F) { diff --git a/include/igl/boost/manifold_patches.cpp b/include/igl/boost/manifold_patches.cpp index 45e219a24..95716ee31 100644 --- a/include/igl/boost/manifold_patches.cpp +++ b/include/igl/boost/manifold_patches.cpp @@ -14,7 +14,7 @@ #include template -void igl::manifold_patches( +IGL_INLINE void igl::manifold_patches( const Eigen::PlainObjectBase & F, Eigen::PlainObjectBase & C, Eigen::SparseMatrix & A) diff --git a/include/igl/cotangent.h b/include/igl/cotangent.h index c29d6a5ba..bbbb34dd9 100644 --- a/include/igl/cotangent.h +++ b/include/igl/cotangent.h @@ -13,22 +13,16 @@ namespace igl { // COTANGENT compute the cotangents of each angle in mesh (V,F) // - // Templates: - // MatV vertex position matrix, e.g. Eigen::MatrixXd - // MatF face index matrix, e.g. Eigen::MatrixXd - // MatC cotangent weights matrix, e.g. Eigen::MatrixXd // Inputs: // V #V by dim list of rest domain positions // F #F by {3|4} list of {triangle|tetrahedra} indices into V // Outputs: - // C #F by {3|6} list of cotangents corresponding angles - // for triangles, columns correspond to edges [1,2],[2,0],[0,1] - // for tets, columns correspond to edges - // [1,2],[2,0],[0,1],[3,0],[3,1],[3,2] **times corresponding edge - // lengths** + // C #F by 3 list of 1/2*cotangents corresponding angles + // for triangles, columns correspond to edges [1,2],[2,0],[0,1] + // OR + // C #F by 6 list of 1/6*cotangents of dihedral angles*edge lengths + // for tets, columns along edges [1,2],[2,0],[0,1],[3,0],[3,1],[3,2] // - // Known bug: - // This computes 0.5*cotangent template IGL_INLINE void cotangent( const Eigen::PlainObjectBase& V, diff --git a/include/igl/embree/project_mesh.h b/include/igl/embree/project_mesh.h index 46f0ee874..bfcaec9df 100644 --- a/include/igl/embree/project_mesh.h +++ b/include/igl/embree/project_mesh.h @@ -35,11 +35,11 @@ namespace igl template IGL_INLINE ScalarMatrix project_mesh ( - const ScalarMatrix & V_source, - const IndexMatrix & F_source, + const ScalarMatrix & V_source, + const IndexMatrix & F_source, const ScalarMatrix & V_target, const IndexMatrix & F_target - ); + ); // Project the point cloud V_source onto the triangle mesh // V_target,F_target. diff --git a/include/igl/fit_plane.cpp b/include/igl/fit_plane.cpp index 47f6bf337..0dba5b31c 100644 --- a/include/igl/fit_plane.cpp +++ b/include/igl/fit_plane.cpp @@ -9,7 +9,7 @@ #include "fit_plane.h" #include -void igl::fit_plane( +IGL_INLINE void igl::fit_plane( const Eigen::MatrixXd & V, Eigen::RowVector3d & N, Eigen::RowVector3d & C) diff --git a/include/igl/matlab/mexStream.cpp b/include/igl/matlab/mexStream.cpp index 1862a92ee..f8a299d1c 100644 --- a/include/igl/matlab/mexStream.cpp +++ b/include/igl/matlab/mexStream.cpp @@ -8,14 +8,16 @@ #include "mexStream.h" #include "mex.h" -std::streamsize igl::mexStream::xsputn(const char *s, std::streamsize n) +inline std::streamsize igl::mexStream::xsputn( + const char *s, + std::streamsize n) { mexPrintf("%.*s",n,s); mexEvalString("drawnow;"); // to dump string. return n; } -int igl::mexStream::overflow(int c) +inline int igl::mexStream::overflow(int c) { if (c != EOF) { mexPrintf("%.1s",&c); diff --git a/include/igl/matlab/mexStream.h b/include/igl/matlab/mexStream.h index 334be8473..64efc6024 100644 --- a/include/igl/matlab/mexStream.h +++ b/include/igl/matlab/mexStream.h @@ -26,8 +26,8 @@ namespace igl { public: protected: - virtual std::streamsize xsputn(const char *s, std::streamsize n); - virtual int overflow(int c = EOF); + inline virtual std::streamsize xsputn(const char *s, std::streamsize n); + inline virtual int overflow(int c = EOF); }; } #ifdef IGL_HEADER_ONLY diff --git a/include/igl/polar_svd.cpp b/include/igl/polar_svd.cpp index eabaa445c..fe3adb075 100644 --- a/include/igl/polar_svd.cpp +++ b/include/igl/polar_svd.cpp @@ -45,6 +45,7 @@ IGL_INLINE void igl::polar_svd( U = svd.matrixU(); V = svd.matrixV(); S = svd.singularValues(); + // TODO: Check for sign and switch here. R = U*V.transpose(); T = V*S.asDiagonal()*V.adjoint(); } diff --git a/include/igl/tga.cpp b/include/igl/tga.cpp index a314c17ff..b0ecebd46 100644 --- a/include/igl/tga.cpp +++ b/include/igl/tga.cpp @@ -59,7 +59,7 @@ typedef struct { int laststate; } RLEstate; -static int +IGL_INLINE static int std_fread(RLEstate *rleInfo, unsigned char *buf, size_t datasize, size_t nelems, FILE *fp) { if (_verbose > 1) { @@ -75,7 +75,7 @@ std_fread(RLEstate *rleInfo, unsigned char *buf, size_t datasize, size_t nelems, #define RLE_PACKETSIZE 0x80 /* Decode a bufferful of file. */ -static int +IGL_INLINE static int rle_fread(RLEstate *rleInfo, unsigned char *vbuf, size_t datasize, size_t nelems, FILE *fp) { @@ -184,7 +184,7 @@ rle_fread(RLEstate *rleInfo, unsigned char *vbuf, size_t datasize, size_t nelems return nelems; } -igl::gliGenericImage * +IGL_INLINE igl::gliGenericImage * igl::gliReadTGA(FILE *fp, char *name, int hflip, int vflip) { igl::TgaHeader tgaHeader; @@ -468,7 +468,7 @@ igl::gliReadTGA(FILE *fp, char *name, int hflip, int vflip) return genericImage; } -int igl::gli_verbose(int new_verbose) +IGL_INLINE int igl::gli_verbose(int new_verbose) { _verbose = new_verbose; return _verbose; @@ -507,14 +507,14 @@ unsigned char TGAHeaderBW[12] = // this makes sure that // image size is written in correct format // and byte order (least first) -void write16bit(int n, FILE* fp) { +IGL_INLINE void write16bit(int n, FILE* fp) { unsigned char bytes[] = { static_cast(n % 256), static_cast(n / 256) }; fwrite(bytes, 2, sizeof(unsigned char),fp); } -void igl::writeTGA( igl::gliGenericImage* image, FILE *fp) { +IGL_INLINE void igl::writeTGA( igl::gliGenericImage* image, FILE *fp) { assert(!image->cmap); // we do not deal with color map images diff --git a/include/igl/tga.h b/include/igl/tga.h index a66b9fbde..405047336 100644 --- a/include/igl/tga.h +++ b/include/igl/tga.h @@ -1,6 +1,7 @@ #ifndef IGL_TGA_H #define IGL_TGA_H #ifndef IGL_NO_OPENGL +#include "igl_inline.h" // See license in tga.cpp /* tga.h - interface for TrueVision (TGA) image file loader */ @@ -82,11 +83,11 @@ typedef struct { char null; } TgaFooter; -extern gliGenericImage *gliReadTGA(FILE *fp, char *name, int hflip, int vflip); -int gli_verbose(int new_verbose); -extern int gliVerbose(int newVerbose); +IGL_INLINE extern gliGenericImage *gliReadTGA(FILE *fp, char *name, int hflip, int vflip); +IGL_INLINE int gli_verbose(int new_verbose); +IGL_INLINE extern int gliVerbose(int newVerbose); -void writeTGA( gliGenericImage* image, FILE *fp); +IGL_INLINE void writeTGA( gliGenericImage* image, FILE *fp);