Explorar o código

missing igl inlines

Former-commit-id: dfc5d943f4970f2d14048e64d1a347d6a5558206
Alec Jacobson %!s(int64=11) %!d(string=hai) anos
pai
achega
05628ba8dc

+ 1 - 1
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

+ 1 - 1
include/igl/avg_edge_length.cpp

@@ -10,7 +10,7 @@
 #include <vector>
 
 template <typename DerivedV, typename DerivedF>
-double igl::avg_edge_length(
+IGL_INLINE double igl::avg_edge_length(
   const Eigen::PlainObjectBase<DerivedV>& V,
   const Eigen::PlainObjectBase<DerivedF>& F)
 {

+ 1 - 1
include/igl/boost/manifold_patches.cpp

@@ -14,7 +14,7 @@
 #include <iostream>
 
 template <typename DerivedF, typename DerivedC, typename AScalar>
-void igl::manifold_patches(
+IGL_INLINE void igl::manifold_patches(
   const Eigen::PlainObjectBase<DerivedF> & F,
   Eigen::PlainObjectBase<DerivedC> & C,
   Eigen::SparseMatrix<AScalar> & A)

+ 5 - 11
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 <typename DerivedV, typename DerivedF, typename DerivedC>
   IGL_INLINE void cotangent(
     const Eigen::PlainObjectBase<DerivedV>& V,

+ 3 - 3
include/igl/embree/project_mesh.h

@@ -35,11 +35,11 @@ namespace igl
   template <typename ScalarMatrix, typename IndexMatrix>
   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. 

+ 1 - 1
include/igl/fit_plane.cpp

@@ -9,7 +9,7 @@
 #include "fit_plane.h"
 #include <iostream>
 
-void igl::fit_plane(
+IGL_INLINE void igl::fit_plane(
     const Eigen::MatrixXd & V,
     Eigen::RowVector3d & N,
     Eigen::RowVector3d & C)

+ 4 - 2
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);

+ 2 - 2
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

+ 1 - 0
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();
 }

+ 6 - 6
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<unsigned char>(n % 256), static_cast<unsigned char>(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
     

+ 5 - 4
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);