diff --git a/examples/ambient-occlusion/example.cpp b/examples/ambient-occlusion/example.cpp index 263da3bb4..0416dc31b 100644 --- a/examples/ambient-occlusion/example.cpp +++ b/examples/ambient-occlusion/example.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -297,7 +297,7 @@ void key(unsigned char key, int mouse_x, int mouse_y) cout<<"Unknown key command: "< #include #include -#include +#include #include #include #include @@ -109,7 +109,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData) using namespace igl; const RotationType old_rotation_type = rotation_type; rotation_type = *(const RotationType *)(value); - if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && + if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP) { push_undo(); @@ -262,7 +262,7 @@ bool update_arap() //Quaterniond q(AngleAxisd(PI/1.5,Vector3d(0,1.0,0.1).normalized())); //const Vector3d a = bc.row(bi); //bc.row(bi) = (q*(a-t) + t) + Vector3d(1.5,0.1,0.9); - + break; } @@ -573,7 +573,7 @@ void mouse_drag(int mouse_x, int mouse_y) } case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP: { - // Rotate according to two axis valuator with fixed up vector + // Rotate according to two axis valuator with fixed up vector two_axis_valuator_fixed_up( width, height, 2.0, @@ -625,7 +625,7 @@ void key(unsigned char key, int mouse_x, int mouse_y) cout<<"Unknown key command: "< #include #include -#include +#include #include #include #include @@ -96,7 +96,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData) using namespace igl; const RotationType old_rotation_type = rotation_type; rotation_type = *(const RotationType *)(value); - if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && + if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP) { push_undo(); @@ -406,7 +406,7 @@ void mouse_drag(int mouse_x, int mouse_y) } case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP: { - // Rotate according to two axis valuator with fixed up vector + // Rotate according to two axis valuator with fixed up vector two_axis_valuator_fixed_up( width, height, 2.0, @@ -468,7 +468,7 @@ void key(unsigned char key, int mouse_x, int mouse_y) cout<<"Unknown key command: "< #include #include -#include +#include #include #include #include @@ -103,7 +103,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData) using namespace igl; const RotationType old_rotation_type = rotation_type; rotation_type = *(const RotationType *)(value); - if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && + if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP) { push_undo(); @@ -227,7 +227,7 @@ void draw_eyes() LED_METHOD_TEXTURE_FLARE = 2 } method = LED_METHOD_TEXTURE_FLARE; - + for(int l = 0;l #include #include -#include +#include #include #include #include @@ -615,7 +615,7 @@ int main(int argc, char * argv[]) { return false; } - triangulate(vF,F); + polygon_mesh_to_triangle_mesh(vF,F); } // Compute normals, centroid, colors, bounding box diagonal per_face_normals(V,F,N); diff --git a/examples/patches/example.cpp b/examples/patches/example.cpp index ce41a036e..6e028c1da 100644 --- a/examples/patches/example.cpp +++ b/examples/patches/example.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -766,7 +766,7 @@ int main(int argc, char * argv[]) { return 1; } - triangulate(vF,F); + polygon_mesh_to_triangle_mesh(vF,F); } MatrixXi F_unique; unique_simplices(F, F_unique); diff --git a/examples/randomly-sample-mesh/example.cpp b/examples/randomly-sample-mesh/example.cpp index 0be62456e..8e0a9b8d2 100644 --- a/examples/randomly-sample-mesh/example.cpp +++ b/examples/randomly-sample-mesh/example.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -93,7 +93,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData) using namespace igl; const RotationType old_rotation_type = rotation_type; rotation_type = *(const RotationType *)(value); - if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && + if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP) { push_undo(); @@ -223,7 +223,7 @@ void display() glMaterialfv(GL_BACK, GL_SPECULAR, SILVER_SPECULAR); glMaterialf (GL_BACK, GL_SHININESS, 128); - + draw_mesh(V,F,N); glPointSize(3.); @@ -381,7 +381,7 @@ void mouse_drag(int mouse_x, int mouse_y) } case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP: { - // Rotate according to two axis valuator with fixed up vector + // Rotate according to two axis valuator with fixed up vector two_axis_valuator_fixed_up( width, height, 2.0, @@ -482,7 +482,7 @@ void key(unsigned char key, int mouse_x, int mouse_y) cout<<"Unknown key command: "< #include #include -#include +#include #include #include #include @@ -99,7 +99,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData) using namespace igl; const RotationType old_rotation_type = rotation_type; rotation_type = *(const RotationType *)(value); - if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && + if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP) { push_undo(); @@ -417,7 +417,7 @@ void mouse_drag(int mouse_x, int mouse_y) } case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP: { - // Rotate according to two axis valuator with fixed up vector + // Rotate according to two axis valuator with fixed up vector two_axis_valuator_fixed_up( width, height, 2.0, @@ -509,7 +509,7 @@ void key(unsigned char key, int mouse_x, int mouse_y) cout<<"Unknown key command: "< #include #include -#include +#include #include #include #include @@ -107,7 +107,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData) using namespace igl; const RotationType old_rotation_type = rotation_type; rotation_type = *(const RotationType *)(value); - if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && + if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP) { push_undo(); @@ -246,7 +246,7 @@ void display() glMaterialfv(GL_BACK, GL_SPECULAR, SILVER_SPECULAR); glMaterialf (GL_BACK, GL_SHININESS, 128); - + draw_mesh(V,F,N); pop_object(); @@ -306,7 +306,7 @@ void mouse_wheel(int wheel, int direction, int mouse_x, int mouse_y) break; default: case CENTER_TYPE_FPS: - // Move `eye` and `at` + // Move `eye` and `at` camera.dolly((wheel==0?Vector3d(0,0,1):Vector3d(-1,0,0))*0.1*direction); break; } @@ -408,13 +408,13 @@ void mouse_drag(int mouse_x, int mouse_y) down_camera.m_rotation_conj.coeffs().data()+4, down_quaternion); float new_quaternion[4]; - + const float center_x = ((float)width)/2.0; const float center_y = ((float)height)/2.0; const double speed = 2.0f; const float half_width = ((float)width)/speed; const float half_height = ((float)height)/speed; - + ::trackball(new_quaternion, (float)(center_x-down_x)/half_width, (float)(down_y-center_y)/half_height, @@ -435,7 +435,7 @@ void mouse_drag(int mouse_x, int mouse_y) const double speed = 2.0; if(axis.norm() != 0) { - q = + q = Quaterniond( AngleAxisd( M_PI*axis.norm()/(double)width*speed/2.0, @@ -446,7 +446,7 @@ void mouse_drag(int mouse_x, int mouse_y) } case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP: { - // Rotate according to two axis valuator with fixed up vector + // Rotate according to two axis valuator with fixed up vector two_axis_valuator_fixed_up( width, height, 2.0, @@ -565,7 +565,7 @@ void key(unsigned char key, int mouse_x, int mouse_y) cout<<"Unknown key command: "< #include #include -#include +#include #include #include #include @@ -89,9 +89,9 @@ bool initialize_shadows( glGenTextures(1, &shadowMapTexture); glBindTexture(GL_TEXTURE_2D, shadowMapTexture); glTexImage2D( - GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, + GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, factor*windowWidth, - factor*windowHeight, + factor*windowHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); @@ -103,16 +103,16 @@ bool initialize_shadows( glGenFramebuffersEXT(1, &fbo); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); glFramebufferTexture2DEXT( - GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, + GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, shadowMapTexture,0); // Attach color render buffer glGenRenderbuffersEXT(1,&cfbo); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,cfbo); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8, + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8, factor*windowWidth, factor*windowHeight); //------------------------- //Attach color buffer to FBO - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, cfbo); //------------------------- //Does the GPU support current FBO configuration? @@ -140,7 +140,7 @@ struct Mesh Eigen::MatrixXi F; Eigen::Affine3d a,da; Mesh():V(),N(),F(),a(Eigen::Affine3d::Identity()),da(Eigen::Affine3d::Identity()) - { + { using namespace Eigen; Quaterniond r(Eigen::Vector4d::Random()); Quaterniond i(1,0,0,0); @@ -368,7 +368,7 @@ void draw_objects() draw_mesh(mesh.V,mesh.F,mesh.N); glPopMatrix(); } - + // Draw a nice floor glPushMatrix(); { @@ -451,7 +451,7 @@ void display() is_animating = false; } Quaterniond q; - q.coeffs() = + q.coeffs() = animation_to_quat.coeffs()*t + animation_from_quat.coeffs()*(1.-t); q.normalize(); copy(q.coeffs().data(),q.coeffs().data()+4,s.camera.rotation); @@ -496,7 +496,7 @@ void mouse_wheel(int wheel, int direction, int mouse_x, int mouse_y) const double a_diff = 1.0; s.camera.angle += double(direction)*a_diff; const double min_angle = 15.0; - s.camera.angle = + s.camera.angle = min(90.0,max(min_angle,s.camera.angle)); } } @@ -596,7 +596,7 @@ void mouse_drag(int mouse_x, int mouse_y) Vector3d axis(0,1,0); const double speed = 2.0; Quaterniond q; - q = down_q * + q = down_q * Quaterniond( AngleAxisd( M_PI*((double)(mouse_x-down_x))/(double)width*speed/2.0, @@ -607,7 +607,7 @@ void mouse_drag(int mouse_x, int mouse_y) const double speed = 2.0; if(axis.norm() != 0) { - q = + q = Quaterniond( AngleAxisd( M_PI*(mouse_y-down_y)/(double)width*speed/2.0, @@ -708,7 +708,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData) using namespace igl; const RotationType old_rotation_type = rotation_type; rotation_type = *(const RotationType *)(value); - if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && + if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP) { push_undo(); @@ -808,7 +808,7 @@ int main(int argc, char * argv[]) { return 1; } - triangulate(vF,mesh.F); + polygon_mesh_to_triangle_mesh(vF,mesh.F); } init_mesh(mesh); } diff --git a/examples/skeleton/example.cpp b/examples/skeleton/example.cpp index 276e6504b..7ca9a8980 100644 --- a/examples/skeleton/example.cpp +++ b/examples/skeleton/example.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include @@ -112,7 +112,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData) using namespace igl; const RotationType old_rotation_type = rotation_type; rotation_type = *(const RotationType *)(value); - if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && + if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP) { push_undo(); @@ -273,7 +273,7 @@ void display() T.block(e*(dim+1),0,dim+1,dim) = a.matrix().transpose().block(0,0,dim+1,dim); } - + if(wireframe) { glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); @@ -434,7 +434,7 @@ void mouse_drag(int mouse_x, int mouse_y) } case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP: { - // Rotate according to two axis valuator with fixed up vector + // Rotate according to two axis valuator with fixed up vector two_axis_valuator_fixed_up( width, height, 2.0, @@ -524,7 +524,7 @@ void key(unsigned char key, int mouse_x, int mouse_y) cout<<"Unknown key command: "< #include #include -#include +#include #include #include #include @@ -101,7 +101,7 @@ void TW_CALL set_rotation_type(const void * value, void * clientData) using namespace igl; const RotationType old_rotation_type = rotation_type; rotation_type = *(const RotationType *)(value); - if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && + if(rotation_type == ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP && old_rotation_type != ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP) { push_undo(); @@ -457,7 +457,7 @@ void mouse_drag(int mouse_x, int mouse_y) } case ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP: { - // Rotate according to two axis valuator with fixed up vector + // Rotate according to two axis valuator with fixed up vector two_axis_valuator_fixed_up( width, height, 2.0, @@ -494,7 +494,7 @@ void key(unsigned char key, int mouse_x, int mouse_y) cout<<"Unknown key command: "< 0) { @@ -577,7 +577,7 @@ int main(int argc, char * argv[]) } // Create a tweak bar rebar.TwNewBar("TweakBar"); - rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D, + rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D, s.camera.m_rotation_conj.coeffs().data(), "open readonly=true"); s.camera.push_away(3); s.camera.dolly_zoom(25-s.camera.m_angle); diff --git a/examples/upright/example.cpp b/examples/upright/example.cpp index 62afbb41b..7cc1722bb 100644 --- a/examples/upright/example.cpp +++ b/examples/upright/example.cpp @@ -4,7 +4,7 @@ // Demonstrates trackball mouse camera control and undo/redo stack with // immutable state object (i.e. not with reverse operations). // -// Reads (V,F) from .obj,.off,.wrl files and saves (V,F) to .obj,.off. Any +// Reads (V,F) from .obj,.off,.wrl files and saves (V,F) to .obj,.off. Any // normals, texture coordinates, etc. in the input file will be ignored and // lost in the output file. // @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include @@ -184,7 +184,7 @@ void display() glMaterialfv(GL_BACK, GL_SPECULAR, SILVER_SPECULAR); glMaterialf (GL_BACK, GL_SHININESS, 128); - + draw_mesh(s.V,s.F,s.N); glDisable(GL_LIGHTING); @@ -281,7 +281,7 @@ void bake() s.V.col(0).array() -= s.Vmid(0); s.V.col(1).array() -= s.Vmid(1); s.V.col(2).array() -= s.Vmid(2); - s.V *= 2./s.bbd; + s.V *= 2./s.bbd; s.V = (s.V * s.rot.matrix().transpose()).eval(); } @@ -433,7 +433,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 +// +// Copyright (C) 2014 Daniele Panozzo +// +// 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 "triangulate.h" +#include "polygon_mesh_to_triangle_mesh.h" template -IGL_INLINE void igl::triangulate( +IGL_INLINE void igl::polygon_mesh_to_triangle_mesh( const std::vector > & vF, Eigen::PlainObjectBase& F) { @@ -56,5 +56,5 @@ IGL_INLINE void igl::triangulate( #ifndef IGL_HEADER_ONLY // Explicit template instanciation -template void igl::triangulate >(std::vector >, std::allocator > > > const&, Eigen::PlainObjectBase >&); +template void igl::polygon_mesh_to_triangle_mesh >(std::vector >, std::allocator > > > const&, Eigen::PlainObjectBase >&); #endif diff --git a/include/igl/triangulate.h b/include/igl/polygon_mesh_to_triangle_mesh.h similarity index 79% rename from include/igl/triangulate.h rename to include/igl/polygon_mesh_to_triangle_mesh.h index f29cec0b6..7539b769f 100644 --- a/include/igl/triangulate.h +++ b/include/igl/polygon_mesh_to_triangle_mesh.h @@ -1,12 +1,12 @@ // This file is part of libigl, a simple c++ geometry processing library. // -// Copyright (C) 2013 Alec Jacobson +// Copyright (C) 2013 Daniele Panozzo // // 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 +#ifndef IGL_POLYGON_MESH_TO_TRIANGLE_MESH_H +#define IGL_POLYGON_MESH_TO_TRIANGLE_MESH_H #include "igl_inline.h" #ifndef IGL_NO_EIGEN @@ -32,13 +32,13 @@ namespace igl // list_to_matrix(vV,V); // triangulate(vF,F); template - IGL_INLINE void triangulate( + IGL_INLINE void polygon_mesh_to_triangle_mesh( const std::vector > & vF, Eigen::PlainObjectBase& F); } #ifdef IGL_HEADER_ONLY -# include "triangulate.cpp" +# include "polygon_mesh_to_triangle_mesh.cpp" #endif #endif