Ver Fonte

floor

Former-commit-id: 7c7139d7f596bdfc00906741c2d74e0e078fdf50
Alec Jacobson (jalec há 11 anos atrás
pai
commit
a1e1deb226

+ 3 - 1
Makefile

@@ -70,7 +70,9 @@ INC+=-Iinclude/
 INC+=$(OPENGL_INC)
 
 # Eigen dependency
-EIGEN3_INC=-I$(DEFAULT_PREFIX)/include/eigen3 -I$(DEFAULT_PREFIX)/include/eigen3/unsupported
+ifndef EIGEN3_INC
+	EIGEN3_INC=-I$(DEFAULT_PREFIX)/include/eigen3 -I$(DEFAULT_PREFIX)/include/eigen3/unsupported
+endif
 INC+=$(EIGEN3_INC)
 
 # AntTweakBar dependency

+ 2 - 0
Makefile.conf

@@ -33,6 +33,8 @@ ifeq ($(IGL_USERNAME),ajx)
 	# msse4.2 is necessary for me to get embree to compile correctly
 	AFLAGS = -m64 -msse4.2
 	OPENMP=-fopenmp
+	#EIGEN3_INC=-I$(DEFAULT_PREFIX)/include/eigen3 -I$(DEFAULT_PREFIX)/include/eigen3/unsupported
+	EIGEN3_INC=-I/Users/ajx/Documents/eigen -I/Users/ajx/Documents/eigen/unsupported
 endif
 
 ifeq ($(IGL_USERNAME),alecjaco) 

+ 62 - 0
include/igl/draw_floor.cpp

@@ -0,0 +1,62 @@
+#include "draw_floor.h"
+#ifndef IGL_NO_OPENGL
+
+#include "OpenGL_convenience.h"
+
+IGL_INLINE void igl::draw_floor(const float * colorA, const float * colorB)
+{
+  glDisable(GL_LIGHTING);
+  glColorMaterial( GL_FRONT, GL_EMISSION);
+  glEnable(GL_COLOR_MATERIAL);
+  glColorMaterial( GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
+  // Set material
+  const float black[] = {0.,0.,0.,1.};
+  glMaterialfv(GL_FRONT, GL_AMBIENT, black);
+  glMaterialfv(GL_FRONT, GL_DIFFUSE, black);
+  glMaterialfv(GL_FRONT, GL_SPECULAR, black);
+  glMaterialfv(GL_FRONT, GL_EMISSION, black);
+  glMaterialf(GL_FRONT, GL_SHININESS,0);
+  const bool use_lighting = false;
+  if(use_lighting)
+  {
+    glEnable(GL_LIGHTING);
+  }else
+  {
+    glDisable(GL_LIGHTING);
+  }
+
+  int GridSizeX = 100;
+  int GridSizeY = 100;
+  float SizeX = 0.5f;
+  float SizeY = 0.5f;
+
+  glBegin(GL_QUADS);
+  glNormal3f(0,1,0);
+  for (int x =-GridSizeX/2;x<GridSizeX/2;++x)
+  {
+    for (int y =-GridSizeY/2;y<GridSizeY/2;++y)
+    {
+      if ((x+y)&0x00000001) //modulo 2
+      {
+        glColor4fv(colorA);
+      }else
+      {
+        glColor4fv(colorB);
+      }
+      glVertex3f(    x*SizeX,0,    y*SizeY);
+      glVertex3f((x+1)*SizeX,0,    y*SizeY);
+      glVertex3f((x+1)*SizeX,0,(y+1)*SizeY);
+      glVertex3f(    x*SizeX,0,(y+1)*SizeY);
+    }
+  }
+  glEnd();
+  glDisable(GL_COLOR_MATERIAL);
+} 
+
+IGL_INLINE void igl::draw_floor()
+{
+  const float grey[] = {0.80,0.80,0.80,1.};
+  const float white[] = {0.95,0.95,0.95,1.};
+  igl::draw_floor(grey,white);
+}
+#endif

+ 23 - 0
include/igl/draw_floor.h

@@ -0,0 +1,23 @@
+#ifndef IGL_DRAW_FLOOR_H
+#define IGL_DRAW_FLOOR_H
+#ifndef IGL_NO_OPENGL
+#include "igl_inline.h"
+namespace igl
+{
+  // Draw a checkerboard floor aligned with current (X,Z) plane using OpenGL
+  // calls.
+  //
+  // Use glPushMatrix(), glScaled(), glTranslated() to arrange the floor.
+  // 
+  // Inputs:
+  //   colorA  float4 color
+  //   colorB  float4 color
+  IGL_INLINE void draw_floor(const float * colorA, const float * colorB);
+  // Wrapper with default colors
+  IGL_INLINE void draw_floor();
+}
+#ifdef IGL_HEADER_ONLY
+#  include "draw_floor.cpp"
+#endif
+#endif
+#endif

+ 1 - 0
include/igl/draw_point.cpp

@@ -19,6 +19,7 @@ IGL_INLINE void igl::draw_point(
   //glGetBooleanv(GL_DEPTH_TEST,&old_depth_test);
   GLboolean old_lighting;
   glGetBooleanv(GL_LIGHTING,&old_lighting);
+  glEnable( GL_POINT_SMOOTH );
 
   float f;
   glGetFloatv(GL_POINT_SIZE_MAX,&f);

+ 12 - 0
include/igl/min_quad_with_fixed.cpp

@@ -117,6 +117,7 @@ IGL_INLINE bool igl::min_quad_with_fixed_precompute(
     assert(data.Aequ.rows() == neq);
     assert(data.Aequ.cols() == data.unknown.size());
     data.AeqTQR.compute(data.Aequ.transpose().eval());
+    cout<<endl<<matlab_format(SparseMatrix<T>(data.Aequ.transpose().eval()),"AeqT")<<endl<<endl;
     switch(data.AeqTQR.info())
     {
       case Eigen::Success:
@@ -272,11 +273,19 @@ IGL_INLINE bool igl::min_quad_with_fixed_precompute(
     // THIS IS ESSENTIALLY DENSE AND THIS IS BY FAR THE BOTTLENECK
     // http://forum.kde.org/viewtopic.php?f=74&t=117500
     AeqTQ = data.AeqTQR.matrixQ();
+#ifdef MIN_QUAD_WITH_FIXED_CPP_DEBUG
+    cout<<"    prune"<<endl;
+    cout<<"      nnz: "<<AeqTQ.nonZeros()<<endl;
+#endif
     // This shouldn't be necessary
     AeqTQ.prune(0.0);
     //cout<<"AeqTQ: "<<AeqTQ.rows()<<" "<<AeqTQ.cols()<<endl;
     //cout<<matlab_format(AeqTQ,"AeqTQ")<<endl;
     //cout<<"    perms"<<endl;
+#ifdef MIN_QUAD_WITH_FIXED_CPP_DEBUG
+    cout<<"      nnz: "<<AeqTQ.nonZeros()<<endl;
+    cout<<"    perm"<<endl;
+#endif
     SparseMatrix<double> I(neq,neq);
     I.setIdentity();
     data.AeqTE = data.AeqTQR.colsPermutation() * I;
@@ -286,6 +295,9 @@ IGL_INLINE bool igl::min_quad_with_fixed_precompute(
     assert(AeqTQ.cols() == nu);
     assert(AeqTR.cols() == neq);
     //cout<<"    slice"<<endl;
+#ifdef MIN_QUAD_WITH_FIXED_CPP_DEBUG
+    cout<<"    slice"<<endl;
+#endif
     data.AeqTQ1 = AeqTQ.topLeftCorner(nu,nc);
     data.AeqTQ1T = data.AeqTQ1.transpose().eval();
     // ALREADY TRIM (Not 100% sure about this)